{"record":{"id":"485634b5f66ecb02","repo":"thanos-io/thanos","slug":"sync-temporary-blockdir","errorCode":null,"errorMessage":"sync temporary blockDir","messagePattern":"sync temporary blockDir","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compact/downsample/streamed_block_writer.go","lineNumber":198,"sourceCode":"\t\t\"mint\", w.meta.MinTime,\n\t\t\"maxt\", w.meta.MaxTime,\n\t\t\"ulid\", w.meta.ULID,\n\t\t\"resolution\", w.meta.Thanos.Downsample.Resolution,\n\t)\n\treturn nil\n}\n\n// syncDir syncs blockDir on disk.\nfunc (w *streamedBlockWriter) syncDir() (err error) {\n\tdf, err := fileutil.OpenDir(w.blockDir)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"open temporary block blockDir\")\n\t}\n\n\tdefer runutil.CloseWithErrCapture(&err, df, \"close temporary block blockDir\")\n\n\tif err := fileutil.Fdatasync(df); err != nil {\n\t\treturn errors.Wrap(err, \"sync temporary blockDir\")\n\t}\n\n\treturn nil\n}\n\n// writeMetaFile writes meta file.\nfunc (w *streamedBlockWriter) writeMetaFile() error {\n\tw.meta.Version = metadata.TSDBVersion1\n\tw.meta.Thanos.Source = metadata.CompactorSource\n\tw.meta.Thanos.SegmentFiles = block.GetSegmentFiles(w.blockDir)\n\tw.meta.Stats.NumChunks = w.totalChunks\n\tw.meta.Stats.NumSamples = w.totalSamples\n\tw.meta.Stats.NumSeries = uint64(w.seriesRefs)\n\n\treturn w.meta.WriteToDir(w.logger, w.blockDir)\n}\n","sourceCodeStart":180,"sourceCodeEnd":215,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/compact/downsample/streamed_block_writer.go#L180-L215","documentation":"Wraps fileutil.Fdatasync on the temporary block directory in streamedBlockWriter.syncDir: the fsync syscall failed (I/O error, unsupported filesystem), so directory entries for the downsampled block may not survive a crash.","triggerScenarios":"Thrown at pkg/compact/downsample/streamed_block_writer.go:198 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check kernel/filesystem support for directory fdatasync.","Look for I/O errors in system logs.","Retry Close; treat the block as not finalized on repeated failure."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}