Skip to content

Commit

Permalink
Fix Dumps ordering problem when writing
Browse files Browse the repository at this point in the history
  • Loading branch information
gugacavalieri committed Nov 9, 2022
1 parent 92f3cdd commit 82b6a20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions replibyte/src/datastore/local_disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl Datastore for LocalDisk {

let data_size = data.len();
let dump_dir_path = format!("{}/{}", self.dir, self.dump_name);
let dump_file_path = format!("{}/{}.dump", dump_dir_path, file_part);
let dump_file_path = format!("{}/{:02}.dump", dump_dir_path, file_part);

// create the dump directory if needed
DirBuilder::new()
Expand Down Expand Up @@ -317,7 +317,7 @@ mod tests {

// part 1 of dump should exists
assert!(Path::new(&format!(
"{}/{}/1.dump",
"{}/{}/01.dump",
dir.path().to_str().unwrap(),
dump.directory_name
))
Expand Down
4 changes: 2 additions & 2 deletions replibyte/src/datastore/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ fn write_objects<B: Datastore>(
};

let data_size = data.len();
let key = format!("{}/{}.dump", root_key, file_part);
let key = format!("{}/{:02}.dump", root_key, file_part);

info!("upload object '{}' part {} on", key.as_str(), file_part);
info!("upload object '{}' part {:02} on", key.as_str(), file_part);

let _ = create_object(client, bucket, key.as_str(), data)?;

Expand Down

0 comments on commit 82b6a20

Please sign in to comment.