prometheus/tsdb
George Krajcsovits 7d7b9eacff
Fix int32 overflow issues (#12978)
On a 32 bit architecture the size of int is 32 bits. Thus converting from
int64, uint64 can overflow it and flip the sign.

Try for yourself in playground:
package main

import "fmt"

func main() {
	x := int64(0x1F0000001)
	y := int64(1)
	z := int32(x - y) // numerically this is 0x1F0000000
	fmt.Printf("%v\n", z)
}

Prints -268435456 as if x was smaller.

Followup to #12650

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2023-10-16 16:23:26 +02:00
..
agent tsdb/agent: allow ingestion of OOO samples (#12897) 2023-10-13 16:33:09 +02:00
chunkenc Fix more counterResetInAnyBucket edgecases 2023-09-13 15:18:40 +02:00
chunks
docs Merge branch 'main' into sparsehistogram 2022-08-10 17:54:37 +02:00
encoding Merge 'main' into sparsehistogram 2022-10-05 22:14:49 +02:00
errors
fileutil
goversion
index
record
testdata tsdb: Delete blocks atomically; Remove tmp blocks on start; Added test. (#7772) 2020-08-11 06:56:08 +01:00
tombstones
tsdbutil
wlog Update exp package (#12650) 2023-09-21 22:53:51 +02:00
.gitignore
block.go Add context argument to tsdb.PostingsForMatchers 2023-09-16 18:13:32 +02:00
block_test.go
blockwriter.go
blockwriter_test.go Add a chunk size limit in bytes (#12054) 2023-08-24 15:21:17 +02:00
CHANGELOG.md
compact.go Fix int32 overflow issues (#12978) 2023-10-16 16:23:26 +02:00
compact_test.go
db.go
db_test.go
example_test.go Add context argument to Querier.Select (#12660) 2023-09-12 12:37:38 +02:00
exemplar.go
exemplar_test.go tsdb: in tests use labels.FromStrings 2022-09-09 13:34:49 +02:00
head.go Additionally wrap WBL replay error (#12406) 2023-10-13 14:21:35 +02:00
head_append.go Refactor solution to not repeat code 2023-09-20 15:54:00 +02:00
head_bench_test.go
head_read.go Update exp package (#12650) 2023-09-21 22:53:51 +02:00
head_read_test.go
head_test.go Additionally wrap WBL replay error (#12406) 2023-10-13 14:21:35 +02:00
head_wal.go
isolation.go ci(lint): enable predeclared linter 2023-05-21 07:33:54 +00:00
isolation_test.go
mocks_test.go Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
ooo_head.go Name float values as "floats", not as "values" 2023-04-13 19:25:24 +02:00
ooo_head_read.go Fix int32 overflow issues (#12978) 2023-10-16 16:23:26 +02:00
ooo_head_read_test.go Add context argument to LabelQuerier.LabelValues (#12665) 2023-09-14 16:02:04 +02:00
ooo_head_test.go Name float values as "floats", not as "values" 2023-04-13 19:25:24 +02:00
querier.go Update exp package (#12650) 2023-09-21 22:53:51 +02:00
querier_bench_test.go
querier_test.go Fix exit condition of TestQuerierIndexQueriesRace 2023-09-20 20:22:26 +01:00
README.md Fixed broken link in tsdb README.md 2022-10-07 16:20:20 +00:00
repair.go
repair_test.go
tsdbblockutil.go
wal.go
wal_test.go Add Zstandard compression option for wlog (#11666) 2023-07-11 14:57:57 +02:00

TSDB

GoPkg

This directory contains the Prometheus TSDB (Time Series DataBase) library, which handles storage and querying of all Prometheus v2 data.

Documentation

External resources

A series of blog posts explaining different components of TSDB: