Skip to content

Commit

Permalink
Merge pull request #7737 from romayalon/romy-fix-vaccume
Browse files Browse the repository at this point in the history
NSFS | NC | Avoid vacuumAndAnalyze on nc nsfs without db
  • Loading branch information
romayalon authored Jan 18, 2024
2 parents 313a081 + 703b7d1 commit 0930556
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/cmd/nsfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ const dbg = require('../util/debug_module')(__filename);
if (!dbg.get_process_name()) dbg.set_process_name('nsfs');
dbg.original_console();

// NC nsfs deployments specifying process.env.LOCAL_MD_SERVER=true deployed together with a db
// when a system_store object is initialized VaccumAnalyzer is being called once a day.
// when NC nsfs deployed without db we would like to avoid running VaccumAnalyzer in any flow there is
// because running it will cause a panic.
if (process.env.LOCAL_MD_SERVER !== 'true') {
process.env.NC_NSFS_NO_DB_ENV = 'true';
}
const config = require('../../config');

const os = require('os');
Expand All @@ -19,6 +26,7 @@ const minimist = require('minimist');
if (process.env.LOCAL_MD_SERVER === 'true') {
require('../server/system_services/system_store').get_instance({ standalone: true });
}

//const js_utils = require('../util/js_utils');
const nb_native = require('../util/nb_native');
//const schema_utils = require('../util/schema_utils');
Expand Down
3 changes: 2 additions & 1 deletion src/endpoint/endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ async function main(options = {}) {
await prom_reporting.start_server(metrics_port, false);
dbg.log0('Started metrics server successfully');
}

// TODO: currently NC NSFS deployments don't have internal_rpc_client nor db,
// there for namespace monitor won't be registered
if (internal_rpc_client && config.NAMESPACE_MONITOR_ENABLED) {
endpoint_stats_collector.instance().set_rpc_client(internal_rpc_client);

Expand Down
2 changes: 1 addition & 1 deletion src/util/postgres_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ class PostgresTable {
this.client._ajv.addSchema(schema, name);
}

if (!process.env.CORETEST) {
if (!process.env.CORETEST && !process.env.NC_NSFS_NO_DB_ENV) {
// Run once a day
// TODO: Configure from PostgreSQL
setInterval(this.vacuumAndAnalyze, 86400000, this).unref();
Expand Down

0 comments on commit 0930556

Please sign in to comment.