Skip to content

Commit cd4b2f6

Browse files
committed
system store - load from core - two steps publish - PR notes 2
Signed-off-by: Amit Prinz Setter <[email protected]>
1 parent 203d2b5 commit cd4b2f6

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ config.INTERNAL_STORAGE_POOL_NAME = 'system-internal-storage-pool';
250250
config.ALLOW_BUCKET_CREATE_ON_INTERNAL = true;
251251
config.BUCKET_AUTOCONF_TIER2_ENABLED = false;
252252
config.SYSTEM_STORE_LOAD_CONCURRENCY = parseInt(process.env.SYSTEM_STORE_LOAD_CONCURRENCY, 10) || 5;
253+
// SYSTEM_STORE_SOURCE determines the preffered source for loading system_store data
254+
// This can be either "DB" to load from the DB or "CORE" to load from the system_server in noobaa-core
253255
config.SYSTEM_STORE_SOURCE = process.env.SYSTEM_STORE_SOURCE || "DB";
254256
//////////////////////////
255257
// MD AGGREGATOR CONFIG //

src/server/system_services/system_store.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,9 @@ class SystemStore extends EventEmitter {
504504

505505
//return the latest copy of in-memory data
506506
async recent_db_data() {
507+
if (this.source === SOURCE.CORE) {
508+
throw new RpcError('BAD_REQUEST', 'recent_db_data is not available for CORE source');
509+
}
507510
return this._load_serial.surround(async () => this.old_db_data);
508511
}
509512

src/test/integration_tests/db/test_system_store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ mocha.describe('system_store', function() {
148148
const from_db = await system_store.load();
149149
const from_core = await system_store_from_core.load(undefined, 'ENDPOINT');
150150

151-
assert.deepStrictEqual(from_db, from_core);
151+
assert.deepStrictEqual(from_db.data, from_core.data);
152152

153153
});
154154

0 commit comments

Comments
 (0)