From e0a7eb01ccfe7ff4c1d40eba961025c0946161c4 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Fri, 4 Sep 2015 16:33:40 +0200 Subject: [PATCH 1/3] Use torque renderer config Adds some notes about db pool params in torque --- config/environments/development.js.example | 10 ++++++++++ config/environments/production.js.example | 10 ++++++++++ config/environments/staging.js.example | 10 ++++++++++ config/environments/test.js.example | 10 ++++++++++ lib/cartodb/server_options.js | 1 + 5 files changed, 41 insertions(+) diff --git a/config/environments/development.js.example b/config/environments/development.js.example index c3401aa2..bf98ca23 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -162,6 +162,16 @@ var config = { type: 'fs', // 'fs' and 'url' supported src: __dirname + '/../../assets/default-placeholder.png' } + }, + torque: { + dbPoolParams: { + // maximum number of resources to create at any given time + size: 16, + // max milliseconds a resource can go unused before it should be destroyed + idleTimeout: 3000, + // frequency to check for idle resources + reapInterval: 1000 + } } } ,millstone: { diff --git a/config/environments/production.js.example b/config/environments/production.js.example index d251ac8e..386f4433 100644 --- a/config/environments/production.js.example +++ b/config/environments/production.js.example @@ -156,6 +156,16 @@ var config = { type: 'fs', // 'fs' and 'url' supported src: __dirname + '/../../assets/default-placeholder.png' } + }, + torque: { + dbPoolParams: { + // maximum number of resources to create at any given time + size: 16, + // max milliseconds a resource can go unused before it should be destroyed + idleTimeout: 3000, + // frequency to check for idle resources + reapInterval: 1000 + } } } ,millstone: { diff --git a/config/environments/staging.js.example b/config/environments/staging.js.example index 5fe72c9e..f692d2ba 100644 --- a/config/environments/staging.js.example +++ b/config/environments/staging.js.example @@ -156,6 +156,16 @@ var config = { type: 'fs', // 'fs' and 'url' supported src: __dirname + '/../../assets/default-placeholder.png' } + }, + torque: { + dbPoolParams: { + // maximum number of resources to create at any given time + size: 16, + // max milliseconds a resource can go unused before it should be destroyed + idleTimeout: 3000, + // frequency to check for idle resources + reapInterval: 1000 + } } } ,millstone: { diff --git a/config/environments/test.js.example b/config/environments/test.js.example index f0002aa5..13132e9a 100644 --- a/config/environments/test.js.example +++ b/config/environments/test.js.example @@ -158,6 +158,16 @@ var config = { type: 'fs', // 'fs' and 'url' supported src: __dirname + '/../../assets/default-placeholder.png' } + }, + torque: { + dbPoolParams: { + // maximum number of resources to create at any given time + size: 16, + // max milliseconds a resource can go unused before it should be destroyed + idleTimeout: 3000, + // frequency to check for idle resources + reapInterval: 1000 + } } } ,millstone: { diff --git a/lib/cartodb/server_options.js b/lib/cartodb/server_options.js index 4b2c595d..ac416d30 100644 --- a/lib/cartodb/server_options.js +++ b/lib/cartodb/server_options.js @@ -79,6 +79,7 @@ module.exports = function(redisPool) { }, renderer: { mapnik: rendererConfig.mapnik, + torque: rendererConfig.torque, http: rendererConfig.http }, redis: global.environment.redis, From c409c146bf031ab373d8f33a02dafcdb4d5d2e15 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Mon, 7 Sep 2015 17:17:40 +0200 Subject: [PATCH 2/3] Upgrade CDB_QueryTables to use latest version --- test/support/sql/CDB_QueryTables.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/support/sql/CDB_QueryTables.sql b/test/support/sql/CDB_QueryTables.sql index ac61281d..c7cfa64b 100644 --- a/test/support/sql/CDB_QueryTables.sql +++ b/test/support/sql/CDB_QueryTables.sql @@ -41,11 +41,11 @@ BEGIN xpath('//x:Relation-Name/text()', exp, ARRAY[ARRAY['x', 'http://www.postgresql.org/2009/explain']]) as x, xpath('//x:Relation-Name/../x:Schema/text()', exp, ARRAY[ARRAY['x', 'http://www.postgresql.org/2009/explain']]) as s ) - SELECT unnest(x) as p, unnest(s) as sc from inp + SELECT unnest(x)::text as p, unnest(s)::text as sc from inp LOOP -- RAISE DEBUG 'tab: %', rec2.p; -- RAISE DEBUG 'sc: %', rec2.sc; - tables := array_append(tables, (rec2.sc || '.' || rec2.p)); + tables := array_append(tables, format('%s.%s', quote_ident(rec2.sc), quote_ident(rec2.p))); END LOOP; -- RAISE DEBUG 'Tables: %', tables; From 7ae034d746388f4393bb2132cad63151e38ad449 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Mon, 7 Sep 2015 18:40:20 +0200 Subject: [PATCH 3/3] Remove no longer needed health check params --- lib/cartodb/cartodb_windshaft.js | 2 +- lib/cartodb/monitoring/health_check.js | 2 +- test/acceptance/health_check.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cartodb/cartodb_windshaft.js b/lib/cartodb/cartodb_windshaft.js index 31872ede..950b0649 100644 --- a/lib/cartodb/cartodb_windshaft.js +++ b/lib/cartodb/cartodb_windshaft.js @@ -193,7 +193,7 @@ var CartodbWindshaft = function(serverOptions) { if (!!healthConfig.enabled) { var startTime = Date.now(); - healthCheck.check(healthConfig, function(err) { + healthCheck.check(function(err) { var ok = !err; var response = { enabled: true, diff --git a/lib/cartodb/monitoring/health_check.js b/lib/cartodb/monitoring/health_check.js index dd405149..69425c2e 100644 --- a/lib/cartodb/monitoring/health_check.js +++ b/lib/cartodb/monitoring/health_check.js @@ -8,7 +8,7 @@ function HealthCheck(disableFile) { module.exports = HealthCheck; -HealthCheck.prototype.check = function(config, callback) { +HealthCheck.prototype.check = function(callback) { var self = this; diff --git a/test/acceptance/health_check.js b/test/acceptance/health_check.js index 274e9cfc..4e54393e 100644 --- a/test/acceptance/health_check.js +++ b/test/acceptance/health_check.js @@ -59,7 +59,7 @@ describe('health checks', function () { callback(null, "Maintenance"); }; - healthCheck.check(null, function(err/*, result*/) { + healthCheck.check(function(err) { assert.equal(err.message, "Maintenance"); assert.equal(err.http_status, 503); done();