thanos-io/thanos · error

sync blockDir

Error message

sync blockDir

What it means

Wraps w.syncDir in streamedBlockWriter.Close while finalizing a downsampled block: fsync-ing the finished block's directory failed, so the completed files may not be durable. The finalization of the streamed downsample result is reported as failed.

Solutions

  1. Check the underlying syncDir error (filesystem support, I/O errors in system logs).
  2. Verify the filesystem supports fdatasync on directories.
  3. Retry the block production; treat the block as incomplete.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pkg/compact/downsample/streamed_block_writer.go:169 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/4bef7a65f808c78a. Report an issue: GitHub.

Appendix: source

Thrown at pkg/compact/downsample/streamed_block_writer.go:169

		// Close open file descriptors anyway.
		for _, cl := range w.closers {
			merr.Add(cl.Close())
		}
		return merr.Err()
	}

	// Finalize saves prepared index and metadata to corresponding files.

	for _, cl := range w.closers {
		merr.Add(cl.Close())
	}

	if err := w.writeMetaFile(); err != nil {
		return errors.Wrap(err, "write meta meta")
	}

	if err := w.syncDir(); err != nil {
		return errors.Wrap(err, "sync blockDir")
	}

	if err := merr.Err(); err != nil {
		return errors.Wrap(err, "finalize")
	}

	// No error, claim success.

	level.Info(w.logger).Log(
		"msg", "finalized downsampled block",
		"mint", w.meta.MinTime,
		"maxt", w.meta.MaxTime,
		"ulid", w.meta.ULID,
		"resolution", w.meta.Thanos.Downsample.Resolution,
	)
	return nil
}

View on GitHub (pinned to 35b8b99117)