{"record":{"id":"b6fa261d948ec806","repo":"thanos-io/thanos","slug":"copy-posting-offsets","errorCode":null,"errorMessage":"copy posting offsets","messagePattern":"copy posting offsets","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/indexheader/binary_reader.go","lineNumber":274,"sourceCode":"\t}\n\tdefer runutil.CloseWithErrCapture(&err, rc, \"close symbol reader\")\n\n\tif _, err := io.CopyBuffer(w, rc, buf); err != nil {\n\t\treturn errors.Wrap(err, \"copy symbols\")\n\t}\n\n\treturn nil\n}\n\nfunc (r *chunkedIndexReader) CopyPostingsOffsets(w io.Writer, buf []byte) (err error) {\n\trc, err := r.bkt.GetRange(r.ctx, r.path, int64(r.toc.PostingsTable), int64(r.size-r.toc.PostingsTable))\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"get posting offset table from object storage of %s\", r.path)\n\t}\n\tdefer runutil.CloseWithErrCapture(&err, rc, \"close posting offsets reader\")\n\n\tif _, err := io.CopyBuffer(w, rc, buf); err != nil {\n\t\treturn errors.Wrap(err, \"copy posting offsets\")\n\t}\n\n\treturn nil\n}\n\n// TODO(bwplotka): Add padding for efficient read.\ntype binaryWriter struct {\n\twriter PosWriter\n\n\ttoc BinaryTOC\n\n\t// Reusable memory.\n\tbuf encoding.Encbuf\n\n\tcrc32 hash.Hash\n}\n\nfunc newBinaryWriter(id ulid.ULID, cacheFilename string, buf []byte) (w *binaryWriter, err error) {","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/indexheader/binary_reader.go#L256-L292","documentation":"CopyPostingsOffsets fetched the postings offset table range but io.CopyBuffer failed streaming it to the destination writer, wrapped with 'copy posting offsets'. Like the symbols copy failure, this can originate from the local writer or the remote body.","triggerScenarios":"CopyPostingsOffsets when io.CopyBuffer(w, rc, buf) errors: local disk full or I/O error while writing the index-header file, or the object-storage body read failed mid-stream (connection reset, timeout, context cancellation).","commonSituations":"Index-header cache volume full on store gateways; network blips during large postings tables (high-cardinality blocks have big postings sections); context timeouts during startup fan-out.","solutions":["Inspect the wrapped error: writer-side ENOSPC requires freeing space or growing the cache volume.","Retry on read/network failures; configure the retrying objstore client.","Reduce concurrent header builds or increase buffer sizes to improve reliability of large copies.","Check the context deadline causing cancellation if errors occur at a consistent interval."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if free, _ := diskFree(cacheDir); free < estPostingsSize {\n    return fmt.Errorf(\"not enough space for postings offsets of %s\", path)\n}","typeGuard":null,"tryCatchPattern":"var perr *fs.PathError\nif errors.As(err, &perr) {\n    // disk-full or permission issue on the cache volume\n} else if isRetryableNetErr(err) {\n    retry.WithBackoff(func() error { return copyPostingsOffsets(w, buf) })\n}","preventionTips":["Provision cache volumes with headroom for postings tables of high-cardinality blocks.","Alert on cache disk utilization thresholds.","Use retrying bucket clients to absorb transient body-read failures.","Set copy deadlines proportional to block size; avoid fixed short timeouts."],"tags":["io","disk","object-storage","thanos","postings"],"backgroundTag":"file-write-failed","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"}