Skip to main content

quarantine_incomplete_files

Function quarantine_incomplete_files 

Source
pub(crate) fn quarantine_incomplete_files(root: &Path) -> Result<Vec<PathBuf>>
Expand description

Renames unfinished writer files under root so they are kept but never read.

A crash or power loss can leave a .parquet.inprogress file without a Parquet footer. Every such file, in any subdirectory, is renamed to <name>.unfinished.quarantined-<unix_ms>-<n>. The original bytes are preserved for diagnosis. The quarantined name still starts with part-<NNNN>, so next_file_index skips that index and later data goes to a new part. The samples themselves come back through JetStream redelivery, because their messages were never acked. Completed .parquet files are not opened or checked.

§Arguments

  • root - Parquet output root. A missing directory is not an error.

§Returns

The new paths of the quarantined files.

§Errors

Returns an error if a directory cannot be read, a file type cannot be determined, or a rename fails. Files renamed before the error stay renamed.