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

restore shuffile file on rebuild #40

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion src/er.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ static int er_encode(MPI_Comm comm_world, MPI_Comm comm_store, int num_files, co
}

/* get list of files recording redudancy data */
redset_filelist red_list = redset_filelist_get(redset_path, d);
redset_filelist red_list = redset_filelist_enc_get(redset_path, d);

/* allocate space for a new file list to include both app files and redundancy files */
int red_count = redset_filelist_count(red_list);
Expand Down Expand Up @@ -738,6 +738,44 @@ static int er_rebuild(MPI_Comm comm_world, MPI_Comm comm_store, const char* path
/* rebuild failed, rc is same value across comm_world */
rc = ER_FAILURE;
}

/* rebuild shuffile file in case we are on a new node */

/* if the rebuild succeeds, rebuild the shuffile file */
if (rc == ER_SUCCESS) {
/* get list of app files and files added by redudancy scheme */
redset_filelist app_list = redset_filelist_orig_get(redset_path, d);
redset_filelist red_list = redset_filelist_enc_get(redset_path, d);

/* allocate space for a new file list to include both app files and redundancy files */
int app_count = redset_filelist_count(app_list);
int red_count = redset_filelist_count(red_list);
int count = app_count + red_count;
const char** filenames = (const char**) ER_MALLOC(count * sizeof(char*));

/* fill in list of file names */
int i;
for (i = 0; i < app_count; i++) {
/* application files */
filenames[i] = redset_filelist_file(app_list, i);
}
for (i = 0; i < red_count; i++) {
/* redundancy files */
filenames[app_count + i] = redset_filelist_file(red_list, i);
}

/* associate list of both app files and redundancy files with calling process */
if (shuffile_create(comm_world, comm_store, count, filenames, shuffile_file) != SHUFFILE_SUCCESS) {
/* failed to register files with shuffile */
rc = ER_FAILURE;
}

/* free the new file list */
er_free(&filenames);
redset_filelist_release(&red_list);
redset_filelist_release(&app_list);
}

redset_delete(&d);

/* if successful, update state to ENCODED, otherwise leave as CORRUPT */
Expand Down