Skip to content

Commit 9ab748b

Browse files
authored
Merge pull request #9149 from naveenpaul1/remove-mongo-code
Mongo | Remove mongo_pool code(1/2)
2 parents 2727e34 + 775b8b6 commit 9ab748b

File tree

17 files changed

+35
-213
lines changed

17 files changed

+35
-213
lines changed

config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ config.EXTERNAL_DB_SERVICE_CERT_PATH = '/etc/external-db-secret';
8484
// TODO take nodes min and free space reserve from system/pool config
8585
config.NODES_MIN_COUNT = 3;
8686
config.NODES_PER_CLOUD_POOL = 1;
87-
config.NODES_PER_MONGO_POOL = 1;
8887
// in kubernetes use reserve of 100MB instead of 10GB
8988
config.NODES_FREE_SPACE_RESERVE = 100 * (1024 ** 2);
9089

@@ -243,7 +242,7 @@ config.POSTGRES_MD_MAX_CLIENTS = (process.env.LOCAL_MD_SERVER === 'true') ? 70 :
243242
// SYSTEM CONFIG //
244243
///////////////////
245244

246-
config.DEFAULT_POOL_TYPE = 'INTERNAL'; // use 'HOSTS' for setting up a pool of FS backingstores instead
245+
config.DEFAULT_POOL_TYPE = 'HOSTS'; // use 'HOSTS' for setting up a pool of FS backingstores instead
247246
config.DEFAULT_POOL_NAME = 'backingstores'; // only used when config.DEFAULT_POOL_TYPE = 'HOSTS'
248247
config.DEFAULT_BUCKET_NAME = 'first.bucket';
249248
config.INTERNAL_STORAGE_POOL_NAME = 'system-internal-storage-pool';

src/agent/agent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,8 @@ class Agent {
480480
dbg.error('This agent appears to be using an old token.',
481481
'cleaning this agent noobaa_storage directory', this.storage_path);
482482
if (this.cloud_info || this.mongo_info) {
483-
dbg.error(`shouldn't be here. node not found for cloud pool or mongo pool!!`);
484-
throw new Error('node not found cloud or mongo node');
483+
dbg.error(`shouldn't be here. node not found for cloud pool pool!!`);
484+
throw new Error('node not found cloud node');
485485
} else {
486486
// We don't exit the process in order to keep the underlaying pod alive until
487487
// the pool statefulset will scale this pod out of existence.

src/api/hosted_agents_api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module.exports = {
5959
},
6060
},
6161

62-
mongo_info: {
62+
mongo_info: {
6363
type: 'object',
6464
additionalProperties: true,
6565
properties: {}

src/api/object_api.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,6 @@ module.exports = {
16651665
mount: { type: 'string' },
16661666
online: { type: 'boolean' },
16671667
in_cloud_pool: { type: 'boolean' },
1668-
in_mongo_pool: { type: 'boolean' },
16691668
}
16701669
}
16711670
}

src/api/pool_api.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -128,23 +128,6 @@ module.exports = {
128128
}
129129
},
130130

131-
create_mongo_pool: {
132-
doc: 'Create Mongo Pool',
133-
method: 'POST',
134-
params: {
135-
type: 'object',
136-
required: ['name'],
137-
properties: {
138-
name: {
139-
type: 'string',
140-
}
141-
}
142-
},
143-
auth: {
144-
system: 'admin'
145-
}
146-
},
147-
148131
read_pool: {
149132
doc: 'Read Pool Information',
150133
method: 'GET',

src/hosted_agents/hosted_agents.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class HostedAgents {
6262
reload() {
6363
// start agents for all existing cloud pools
6464
const agents_to_start = system_store.data.pools.filter(pool =>
65-
(!_.isUndefined(pool.cloud_pool_info) || !_.isUndefined(pool.mongo_pool_info))
65+
(!_.isUndefined(pool.cloud_pool_info))
6666
);
6767
dbg.log0(`will start agents for these pools: ${util.inspect(agents_to_start)}`);
6868
return P.map(agents_to_start, pool => this._start_pool_agent(pool));
@@ -114,8 +114,7 @@ class HostedAgents {
114114

115115
const host_id = config.HOSTED_AGENTS_HOST_ID + pool_id;
116116
const storage_path = path.join(process.cwd(), 'noobaa_storage', node_name);
117-
const pool_property_path = pool.resource_type === 'INTERNAL' ?
118-
'mongo_pool_info.agent_info.mongo_path' : 'cloud_pool_info.agent_info.cloud_path';
117+
const pool_property_path = 'cloud_pool_info.agent_info.cloud_path';
119118
const pool_path = _.get(pool, pool_property_path, `noobaa_blocks/${pool_id}`);
120119
const pool_path_property = pool.resource_type === 'INTERNAL' ? 'mongo_path' : 'cloud_path';
121120
const pool_info_property = pool.resource_type === 'INTERNAL' ? 'mongo_info' : 'cloud_info';
@@ -131,12 +130,10 @@ class HostedAgents {
131130
role: 'create_node'
132131
});
133132
const { token_wrapper, create_node_token_wrapper } = _get_pool_token_wrapper(pool);
134-
const info = pool.resource_type === 'INTERNAL' ?
135-
pool.mongo_pool_info : pool.cloud_pool_info;
133+
const info = pool.cloud_pool_info;
136134
if (!info.agent_info || !info.agent_info.create_node_token) {
137135
const existing_token = info.agent_info ? info.agent_info.node_token : null;
138-
const pool_agent_path = pool.resource_type === 'INTERNAL' ?
139-
'mongo_pool_info' : 'cloud_pool_info';
136+
const pool_agent_path = 'cloud_pool_info';
140137
const update = {
141138
pools: [{
142139
_id: pool._id,
@@ -377,8 +374,7 @@ function _get_pool_and_path_for_token(token_pool) {
377374
const sys = system_store.data.systems[0];
378375
const pool = sys.pools_by_name[token_pool.name];
379376
if (!pool) throw new Error(`Pool ${token_pool.name}, ${token_pool._id} does not exist`);
380-
const pool_property_path = pool.resource_type === 'INTERNAL' ?
381-
'mongo_pool_info.agent_info' : 'cloud_pool_info.agent_info';
377+
const pool_property_path = 'cloud_pool_info.agent_info';
382378
return {
383379
pool_property_path,
384380
pool

src/sdk/map_api_types.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ class BlockAPI {
357357
adminfo.mount = node.drive.mount;
358358
adminfo.online = Boolean(node.online);
359359
adminfo.in_cloud_pool = Boolean(node.is_cloud_node);
360-
adminfo.in_mongo_pool = Boolean(node.is_mongo_node);
361360
}
362361
}
363362

src/server/node_services/node_allocator.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,6 @@ function _get_tier_pools_status(pools, required_valid_nodes) {
303303
if (num_nodes !== config.NODES_PER_CLOUD_POOL) {
304304
valid_for_allocation = false;
305305
}
306-
} else if (pool.mongo_pool_info) {
307-
if (num_nodes !== config.NODES_PER_MONGO_POOL) {
308-
valid_for_allocation = false;
309-
}
310306
} else if (num_nodes < required_valid_nodes) {
311307
valid_for_allocation = false;
312308
}

src/server/node_services/nodes_monitor.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ class NodesMonitor extends EventEmitter {
612612
const pool =
613613
agent_config.pool ||
614614
system.pools_by_name[pool_name] ||
615-
_.filter(system.pools_by_name, p => (!_.get(p, 'mongo_pool_info') && (!_.get(p, 'cloud_pool_info'))))[0]; // default - the 1st host pool in the system
615+
_.filter(system.pools_by_name, p => (!_.get(p, 'cloud_pool_info')))[0]; // default - the 1st host pool in the system
616616
// system_store.get_account_by_email(system.owner.email).default_resource; //This should not happen, but if it does, use owner's default
617617

618618
if (!pool) {
@@ -642,9 +642,6 @@ class NodesMonitor extends EventEmitter {
642642
if (pool.cloud_pool_info) {
643643
item.node.is_cloud_node = true;
644644
}
645-
if (pool.mongo_pool_info) {
646-
item.node.is_mongo_node = true;
647-
}
648645

649646
dbg.log0('_add_new_node', item.node);
650647
this._set_need_update.add(item);
@@ -1725,7 +1722,7 @@ class NodesMonitor extends EventEmitter {
17251722

17261723
} catch (err) {
17271724
// We will just wait another cycle and attempt to delete it fully again
1728-
dbg.warn('delete_cloud_or_mongo_pool_node ERROR node', item.node, err);
1725+
dbg.warn('delete_cloud_node ERROR node', item.node, err);
17291726
}
17301727
});
17311728

src/server/object_services/map_db_types.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,6 @@ class BlockDB {
351351
mount: this.node.drive.mount,
352352
online: Boolean(this.node.online),
353353
in_cloud_pool: Boolean(this.node.is_cloud_node),
354-
in_mongo_pool: Boolean(this.node.is_mongo_node),
355354
};
356355
}
357356
return {

0 commit comments

Comments
 (0)