-
Notifications
You must be signed in to change notification settings - Fork 91
[NSFS | NC | GLACIER] Add support for tape reclaim #9241
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,6 +24,7 @@ function get_bin_path(bin_name) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| class TapeCloudUtils { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| static MIGRATE_SCRIPT = 'migrate'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| static RECALL_SCRIPT = 'recall'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| static RECLAIM_SCRIPT = 'reclaim'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| static TASK_SHOW_SCRIPT = 'task_show'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| static PROCESS_EXPIRED_SCRIPT = 'process_expired'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| static LOW_FREE_SPACE_SCRIPT = 'low_free_space'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -182,6 +183,29 @@ class TapeCloudUtils { | |||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * reclaim takes name of a file which contains the list | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * of the files to be reclaimed. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * reclaim doesn't perform any failure handling and expects the | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * underlying scripts to take care of retries. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param {string} file filename | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * @returns {Promise<boolean>} Indicates success if true | ||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| static async reclaim(file) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| dbg.log1("Starting reclaim for file", file); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const out = await exec(`${get_bin_path(TapeCloudUtils.RECLAIM_SCRIPT)} ${file}`, { return_stdout: true }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| dbg.log4("reclaim finished with:", out); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| dbg.log1("Finished reclaim for file", file); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| dbg.error("Failed to run TapeCloudUtils.reclaim for file:", file, "due to error:", error); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+196
to
+207
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Propagate reclaim failures so WAL entries aren’t lost.
static async reclaim(file) {
try {
dbg.log1("Starting reclaim for file", file);
const out = await exec(`${get_bin_path(TapeCloudUtils.RECLAIM_SCRIPT)} ${file}`, { return_stdout: true });
dbg.log4("reclaim finished with:", out);
dbg.log1("Finished reclaim for file", file);
- } catch (error) {
- dbg.error("Failed to run TapeCloudUtils.reclaim for file:", file, "due to error:", error);
+ return true;
+ } catch (error) {
+ dbg.error("Failed to run TapeCloudUtils.reclaim for file:", file, "due to error:", error);
+ return false;
}
-
- return true;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| static async process_expired() { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| dbg.log1("Starting process_expired"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const out = await exec(`${get_bin_path(TapeCloudUtils.PROCESS_EXPIRED_SCRIPT)}`, { return_stdout: true }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -444,6 +468,21 @@ class TapeCloudGlacier extends Glacier { | |||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param {nb.NativeFSContext} fs_context | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param {LogFile} log_file log filename | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param {(entry: string) => Promise<void>} failure_recorder | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * @returns {Promise<boolean>} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| async reclaim(fs_context, log_file, failure_recorder) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return this._reclaim(log_file.log_path); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| dbg.error('unexpected error occured while running tapecloud.reclaim:', error); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
tangledbytes marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+471
to
+484
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing return statement in catch block. The method signature indicates it returns 🐛 Proposed fix async reclaim(fs_context, log_file, failure_recorder) {
try {
return this._reclaim(log_file.log_path);
} catch (error) {
dbg.error('unexpected error occured while running tapecloud.reclaim:', error);
+ return false;
}
}🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| async low_free_space() { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const result = await exec(get_bin_path(TapeCloudUtils.LOW_FREE_SPACE_SCRIPT), { return_stdout: true }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return result.toLowerCase().trim() === 'true'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -511,6 +550,17 @@ class TapeCloudGlacier extends Glacier { | |||||||||||||||||||||||||||||||||||||||||||||||||
| return TapeCloudUtils.process_expired(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * _reclaim should perform object reclaim from tape | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * NOTE: Must be overwritten for tests | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param {string} file | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * @returns {Promise<boolean>} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| async _reclaim(file) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return TapeCloudUtils.reclaim(file); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * finalizes the restore by setting the required EAs | ||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.