-
Notifications
You must be signed in to change notification settings - Fork 180
Open db in Read only mode #588
Open db in Read only mode #588
Conversation
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Also we need to think about our use case. In current design we have only snaphot reader. There is no one syncing blocks if some writer changes it |
Sorry for another PR: #589 |
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
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.
So there was some version that I liked: no reference to db
and purerly read all by DBReadOnly on Block and Querier, However you changed it back to the version with db
. Why? IMO it's wrong as you read only struct has access to wrtie methods in db so it's easy to "write" something by accident.
I closed my PR as I like your idea more to sync in Querier and Block on demand, but with that thing is not longer View
it's rather DBReadOnly name more as you had before. Can we revert the naming?
Also there are lots of side fixes, can those go in separate PR for clarity?
Signed-off-by: Krasi Georgiev <[email protected]>
3fadbf9
to
6fded52
Compare
Signed-off-by: Krasi Georgiev <[email protected]>
6fded52
to
ce25efc
Compare
Signed-off-by: Krasi Georgiev <[email protected]>
…tive Signed-off-by: Krasi Georgiev <[email protected]>
…tive Signed-off-by: Krasi Georgiev <[email protected]>
50ef318
to
cb67884
Compare
Signed-off-by: Krasi Georgiev <[email protected]>
cb67884
to
c2d809b
Compare
Signed-off-by: Krasi Georgiev <[email protected]>
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.
Are we planning to guarantee "read only" here? Because it is still possible to call Delete()
and CleanTombstones()
from a Block
. If we want to assure read-only at all levels, we may need a BlockReadOnly
.
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
c798dbf
to
106d0e9
Compare
ping @bwplotka |
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.
Few comments, didn't have time to look at the tests and wal.go
.
Signed-off-by: Krasi Georgiev <[email protected]>
1405b56
to
2b4ddbc
Compare
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. Just 1 comment.
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
NumSeries in Meta() of Head
Can you hold off one more day? I plan to review this tomorrow but if I don't do anything tomorrow, feel free to merge, I don't forsee any issues :) |
@gouthamve thanks! waiting for the review. |
Reviewing now (: |
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.
Nice one! Looking good, I think it's super close to be done, but I think we can still improve it bit:
- for defers when doing
exitWithError
- I am quite confused with thread safety for DBReadOnly. I think we can improve that part. Let me know if I understood the comment corectly.
Plus some other nits.
Let me know what's your thoughts @krasi-georgiev
Signed-off-by: Krasi Georgiev <[email protected]>
…b into read-only-alternative Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
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.
Thanks!
Further thoughts.
cmd/tsdb/main.go
Outdated
} | ||
printBlocks(db.Blocks(), listCmdHumanReadable) | ||
defer func() { | ||
err = db.Close() |
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.
This will mask actual error, so we need some kind of multierror here or something like Thanos have: https://github.com/improbable-eng/thanos/blob/master/pkg/runutil/runutil.go#L113
I would really either import this runutil
package from Thanos OR move to TSDB (someday Prometheus), so Thanos can import TSDB I guess (:
Also we are extending this package with: thanos-io/thanos#1302
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.
updated
db.mtx.Unlock() | ||
} | ||
|
||
dbWritable := &DB{ |
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.
// TODO(Github-issue): Refactor DB to have writer implementation using pure reader implementation not the opposite.
Potentially with github issue for that.
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
Signed-off-by: Krasi Georgiev <[email protected]>
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 👍 Thanks (:
Cannot see this Meta
comment we were talking about - for special head implementation of BlockReader
behaviour. Otherwise LGTM (:
Can see comment https://github.com/prometheus/tsdb/pull/588/files#diff-0ced3454d447442a96a77b33ebe87300R1131 👍 Thanks |
a better approach than #541 (Thanks to Bartek's review.)
fixes #516
TODO:
Signed-off-by: Krasi Georgiev [email protected]