Skip to content

Commit 5f7ab65

Browse files
authored
[support-bundle] include for large log files (#8771)
@wfchandler noticed an error in a collected support bundle where we failed to copy a large (31GB) log file. We need to turn on [large file support](https://docs.rs/zip/latest/zip/write/struct.FileOptions.html#tymethod.large_file) if we wish to include these files. ``` 03:21:25.519Z ERRO SledAgent: Failed to write service log to zip file: Large file option has not been set file = sled-diagnostics/src/logs.rs:725 log = /pool/ext/1f91451d-a466-4c9a-a6e6-0abd7985595f/crypt/debug/.zfs/snapshot/sled-diagnostics-fJX7Qry22VZX/oxz_crucible_76fe2161-90df-41b5-9c94-067de9c29db1/oxide-crucible-downstairs:downstairs-430d51d9-bad0-4dda-bd3b-548f176a9b51.log.1754362713 service = crucible-downstairs sled_id = 2c33e8ef-ae07-4191-804d-52a1840ce53c ```
1 parent 4449f01 commit 5f7ab65

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

nexus/src/app/background/tasks/support_bundle_collector.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,9 @@ fn recursively_add_directory_to_zipfile(
11581158

11591159
let file_type = entry.file_type()?;
11601160
if file_type.is_file() {
1161-
let opts = FullFileOptions::default();
1161+
let opts = FullFileOptions::default()
1162+
.compression_method(zip::CompressionMethod::Deflated)
1163+
.large_file(true);
11621164
let src = entry.path();
11631165

11641166
zip.start_file_from_path(dst, opts)?;

sled-diagnostics/src/logs.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,13 @@ fn write_log_to_zip<W: Write + Seek>(
720720
zip_path,
721721
FullFileOptions::default()
722722
.compression_method(zip::CompressionMethod::Zstd)
723-
.compression_level(Some(3)),
723+
.compression_level(Some(3))
724+
// NB: From the docs
725+
// If set to false and the file exceeds the
726+
// limit, an I/O error is thrown and the file is aborted. If set to
727+
// true, readers will require ZIP64 support and if the file does not
728+
// exceed the limit, 20 B are wasted.
729+
.large_file(true),
724730
)?;
725731
if let Err(e) = std::io::copy(&mut src, zip) {
726732
// If we fail here the `ZipWriter` is an unknown state and we are forced

0 commit comments

Comments
 (0)