Skip to content

Commit

Permalink
removed old upgrade code
Browse files Browse the repository at this point in the history
removed code
  • Loading branch information
dannyzaken authored and nimrod-becker committed Jul 24, 2019
1 parent 9d978ed commit 1975c03
Show file tree
Hide file tree
Showing 30 changed files with 23 additions and 4,246 deletions.
94 changes: 0 additions & 94 deletions src/agent/block_store_services/block_store_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const fs_utils = require('../../util/fs_utils');
const os_utils = require('../../util/os_utils');
const config = require('../../../config.js');
const string_utils = require('../../util/string_utils');
const promise_utils = require('../../util/promise_utils');
const BlockStoreBase = require('./block_store_base').BlockStoreBase;
const { RpcError } = require('../../rpc');

Expand Down Expand Up @@ -42,7 +41,6 @@ class BlockStoreFs extends BlockStoreBase {
return P.map(dir_list, dir => fs_utils.create_path(dir), {
concurrency: 10
})
.then(() => this._upgrade_to_blocks_tree())
.then(() => fs.statAsync(this.usage_path)
.catch(ignore_not_found)
)
Expand Down Expand Up @@ -263,98 +261,6 @@ class BlockStoreFs extends BlockStoreBase {
return path.join(this.blocks_path_root, block_dir, file);
}

_upgrade_to_blocks_tree() {
return fs.statAsync(this.old_blocks_path)
.catch(err => {
// when it doesn't exist it means we don't need to upgrade
// on any other error, we ignore as we don't really expect
// any error we have anything to do about it
if (err.code !== 'ENOENT') {
dbg.log0('_upgrade_to_blocks_tree:',
'Old blocks dir failed to stat, ignoring',
this.old_blocks_path, err);
}
})
.then(stat => {
if (!stat) return;
if (stat.size > 64 * 1024 * 1024) {
dbg.warn('_upgrade_to_blocks_tree:',
'Old blocks dir is huge and might crash the process',
'spawning upgrade_agent_to_blocks_tree.py to the rescue',
this.old_blocks_path, stat);
// spawning the python script to iterativly move
// the large blocks to blocks tree.
// the output of the script will be redirected to our stdout
// though this will not be logged through our debug module,
// but still collected in diagnostics.
return promise_utils.spawn('python', [
'src/agent/upgrade_agent_to_blocks_tree.py',
'--wet',
this.root_path
]);
}
if (stat.size > 8 * 1024 * 1024) {
dbg.warn('_upgrade_to_blocks_tree:',
'Old blocks dir is pretty big and might take longer to read',
this.old_blocks_path, stat);
}
return this._move_to_blocks_tree();
});
}

_move_to_blocks_tree() {
let num_move_errors = 0;
dbg.log0('_upgrade_to_blocks_tree: reading', this.old_blocks_path);
return fs.readdirAsync(this.old_blocks_path)
.then(files => {
dbg.log2('found', files.length, 'files to move. files:', files);
return P.map(files, file => {
let file_split = file.split('.');
let new_path = this._get_block_other_path(file);
if (file_split.length === 2) {
let block_id = file_split[0];
let suffix = file_split[1];
if (suffix === 'data') {
new_path = this._get_block_data_path(block_id);
} else if (suffix === 'meta') {
new_path = this._get_block_meta_path(block_id);
}
}
let old_path = path.join(this.old_blocks_path, file);
return fs.renameAsync(old_path, new_path)
.catch(err => {
// we log the error here and count, but do not throw
// to try and move all the rest of the files.
num_move_errors += 1;
dbg.error('_upgrade_to_blocks_tree:',
'failed moving', old_path, '->', new_path, err);
});
}, {
// limit the number of promises to use for moving blocks
// - set arbitrarily for now
concurrency: 10
});
})
.then(() => fs.rmdirAsync(this.old_blocks_path))
.then(() => {
// since we also successfuly deleted the old blocks dir
// it must mean there are no leftovers in anycase.
// so even if we counted num_move_errors, it might have been
// due to parallel operations with another process,
// so we ignore it.
if (num_move_errors) {
dbg.log0('_upgrade_to_blocks_tree: finished', this.old_blocks_path,
'eventhough we had num_move_errors', num_move_errors);
}
dbg.log0('_upgrade_to_blocks_tree: done', this.old_blocks_path);
})
.catch(err => {
dbg.error('_upgrade_to_blocks_tree: failed',
this.old_blocks_path, 'num_move_errors', num_move_errors,
err.stack || err);
});
}

}

function ignore_not_found(err) {
Expand Down
96 changes: 0 additions & 96 deletions src/agent/upgrade_agent_to_blocks_tree.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ api_schema.register_api(require('./tiering_policy_api'));
api_schema.register_api(require('./pool_api'));
api_schema.register_api(require('./cluster_server_api'));
api_schema.register_api(require('./cluster_internal_api'));
api_schema.register_api(require('./upgrade_api'));
api_schema.register_api(require('./server_inter_process_api'));
api_schema.register_api(require('./hosted_agents_api'));
api_schema.register_api(require('./frontend_notifications_api'));
Expand Down Expand Up @@ -64,7 +63,6 @@ class APIClient {
this.pool = undefined;
this.cluster_server = undefined;
this.cluster_internal = undefined;
this.upgrade = undefined;
this.server_inter_process = undefined;
this.hosted_agents = undefined;
this.frontend_notifications = undefined;
Expand Down
9 changes: 0 additions & 9 deletions src/api/cluster_internal_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,6 @@ module.exports = {
}
},

// used for backward compatability with basic_server_ops upgrade during tests
// TODO: remove after we don't use versions with upgrade in cluster_server
upgrade_cluster: {
method: 'POST',
auth: {
system: 'admin',
}
},

},

definitions: {
Expand Down
108 changes: 0 additions & 108 deletions src/api/upgrade_api.js

This file was deleted.

45 changes: 0 additions & 45 deletions src/deploy/NVA_build/mongo_setup_users.js

This file was deleted.

Loading

0 comments on commit 1975c03

Please sign in to comment.