Skip to content

Commit

Permalink
restore shuffile file on rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
adammoody committed Dec 13, 2023
1 parent 9e88b5b commit c4711e0
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/er.c
Original file line number Diff line number Diff line change
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 orig_list = redset_filelist_orig_get(redset_path, d);
redset_filelist red_list = redset_filelist_get(redset_path, d);

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

/* fill in list of file names */
int i;
for (i = 0; i < orig_count; i++) {
/* application files */
filenames2[i] = redset_filelist_file(orig_list, i);
}
for (i = 0; i < red_count; i++) {
/* redundancy files */
filenames2[orig_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, filenames2, shuffile_file) != SHUFFILE_SUCCESS) {
/* failed to register files with shuffile */
rc = ER_FAILURE;
}

/* free the new file list */
er_free(&filenames2);
redset_filelist_release(&red_list);
redset_filelist_release(&orig_list);
}

redset_delete(&d);

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

0 comments on commit c4711e0

Please sign in to comment.