-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds bytes and entries to chunk metadata in tsdb #5414
Conversation
pkg/storage/tsdb/index/chunk.go
Outdated
@@ -4,7 +4,15 @@ package index | |||
type ChunkMeta struct { | |||
Checksum uint32 | |||
|
|||
// Time range the data covers. | |||
// When MaxTime == math.MaxInt64 the chunk is still open and being appended to. | |||
// Nanosecond precision |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Milliseconds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm intending to store nanoseconds here, but the code we have so far doesn't yet use time.Time
anywhere to populate this field -- it's just an int64 so I added the comment to give more clarity.
// should have little effect as long as there is enough memory available | ||
Bytes uint64 | ||
|
||
Entries uint32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: I assume this is number of log entries that are part of the particular chunk correct?. I'm trying to understand why uint32
here and how it correlates with max size of each chunk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, exactly. I used uint64
for bytes (rationale in the comment) but uint32
for the entries count for space reduction purposes. That make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ref #5428 |
This naively adds the number of bytes and entries for each chunk as part of it's metadata in tsdb. We may store more optimized (smaller) forms in the future, such as
KB
instead ofbytes
and/or useuint32
instead ofuint64
to store them, but I decided to take the naive path first.