Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NC | nsfs.js | Lower fork_utils dependancy down after process.env.NC_NSFS_NO_DB_ENV=true setting #8164

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

romayalon
Copy link
Contributor

Explain the changes

Background:

  1. VaccumAnalyzer issue hit once again after adding const { cluster } = require('../util/fork_utils'); dependency before setting process.env.NC_NSFS_NO_DB_ENV=true on nsfs.js.
  2. The dependency chain causing the issue is as follows -
    nsfs.js -> require forks_utils -> requires prometheus_reporting -> requires stats_aggregator -> many files like system_store, bucket_server etc -> requires db_client -> requires postgres_client that setInterval() for VaccumAnalyzer.
  3. Since process.env.NC_NSFS_NO_DB_ENV is false when requiring forks_utils, we will hit nsfs.js crash after 24 hours.

Changes:

  1. nsfs.js | Lower fork_utils dependancy down to be after process.env.NC_NSFS_NO_DB_ENV=true setting.
  2. config.js | moved vaccum analyzer interval to be a configuration called VACCUM_ANALYZER_INTERVAL instead of a constant.
  3. nc_coretes | Set VACCUM_ANALYZER_INTERVAL = 1 on NC_CORETEST config.json so every time we will have a higher dependency before setting process.env.NC_NSFS_NO_DB_ENV=true we will fail.

Issues: Fixed #xxx / Gap #xxx

Testing Instructions:

Manual no code changes -

  1. Keep nsfs.js running for more than 24 hours.

Manual with setting config/code changes -

  1. Edit config.json/config.js (code) and set VACCUM_ANALYZER_INTERVAL=1;
  2. Start nsfs.js and expect to not fail with -
[32mJun-25 10:43:04.141�[35m [nsfs/24010] �[31m[ERROR]�[39m core.util.postgres_client:: postgres_client: T00000000|Q00000001: failed with error: TypeError: Cannot read properties of undefined (reading 'query')
at _do_query �noobaa-core/src/util/postgres_client.js:254:37)�[
at PostgresTable.single_query �(noobaa-core/�[39msrc/util/postgres_client.js:683:16)
at runNextTicks (node:internal/process/task_queues:60:5)�[
at listOnTimeout (node:internal/timers:540:9)
at process.processTimers (node:internal/timers:514:7)
at async Timeout.vacuumAndAnalyze [as _onTimeout](noobaa-core/�[39msrc/util/postgres_client.js:704:13)

Automatic tests -

  1. Run sudo NC_CORETEST=true node --trace-warnings ./node_modules/mocha/bin/mocha noobaa-core/src/test/unit_tests/test_bucketspace.js
  2. Check error message above does not appear at the run logfile and that all the tests passed successfully.
  • Doc added/updated
  • Tests added

src/test/unit_tests/nc_coretest.js Show resolved Hide resolved
src/util/postgres_client.js Show resolved Hide resolved
@romayalon romayalon merged commit 9f0873f into noobaa:master Jun 27, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants