mirror of
https://github.com/prometheus/prometheus.git
synced 2026-02-18 18:25:24 -05:00
tsdb/index: export sentinel error for symbol table size exceeded
Signed-off-by: Patryk Prus <p@trykpr.us>
This commit is contained in:
parent
90166d3ddb
commit
d8c24c6bde
1 changed files with 4 additions and 1 deletions
|
|
@ -101,6 +101,9 @@ var ErrPostingsOffsetTableTooLarge = errors.New("length size exceeds 4 bytes")
|
|||
// ErrIndexExceeds64GiB is returned when the index file would exceed the 64GiB limit.
|
||||
var ErrIndexExceeds64GiB = errors.New("exceeding max size of 64GiB")
|
||||
|
||||
// ErrSymbolTableTooLarge is returned when the symbol table size exceeds 4 bytes (4GiB limit).
|
||||
var ErrSymbolTableTooLarge = fmt.Errorf("symbol table size exceeds %d bytes", uint32(math.MaxUint32))
|
||||
|
||||
// The table gets initialized with sync.Once but may still cause a race
|
||||
// with any other use of the crc32 package anywhere. Thus we initialize it
|
||||
// before.
|
||||
|
|
@ -550,7 +553,7 @@ func (w *Writer) finishSymbols() error {
|
|||
symbolTableSize := w.f.pos - w.toc.Symbols - 4
|
||||
// The symbol table's <len> part is 4 bytes. So the total symbol table size must be less than or equal to 2^32-1
|
||||
if symbolTableSize > math.MaxUint32 {
|
||||
return fmt.Errorf("symbol table size exceeds %d bytes: %d", uint32(math.MaxUint32), symbolTableSize)
|
||||
return fmt.Errorf("%w: %d", ErrSymbolTableTooLarge, symbolTableSize)
|
||||
}
|
||||
|
||||
// Write out the length and symbol count.
|
||||
|
|
|
|||
Loading…
Reference in a new issue