-
Notifications
You must be signed in to change notification settings - Fork 290
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
Encode xmin in postgres revisions to respect zedtoken order #930
Conversation
d3fe658
to
c038beb
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.
looks good - one real question and a couple of small things, and I still want to run it and test it in the same setting we saw the reversals before just to double check
internal/datastore/memdb/readonly.go
Outdated
@@ -18,7 +19,7 @@ type txFactory func() (*memdb.Txn, error) | |||
type memdbReader struct { | |||
TryLocker | |||
txSource txFactory | |||
revision datastore.Revision | |||
revision decimal.Decimal |
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.
not revision.Decimal
?
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 is actually vestigial, removing it.
@@ -27,12 +30,17 @@ const ( | |||
// %[2] Relationship tuple transaction table | |||
// %[3] Name of timestamp column | |||
// %[4] Quantization period (in nanoseconds) | |||
// %[5] Name of snapshot column |
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.
%[5]
isn't used in the query? did you mean for the column name to be parameterizable?
@@ -27,12 +30,17 @@ const ( | |||
// %[2] Relationship tuple transaction table |
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.
in the query description, might be worth adding some info about the xmin
. It's really detailed right now, but doesn't mention the xmin at all.
internal/datastore/postgres/gc.go
Outdated
// Delete any relationship rows with deleted_transaction <= the transaction ID. | ||
removed.Relationships, err = pgd.batchDelete( | ||
ctx, | ||
tableTuple, | ||
relationTuplePKCols, | ||
sq.LtOrEq{colDeletedXid: transactionFromRevision(txID)}, | ||
sq.LtOrEq{colDeletedXid: revision.tx}, |
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.
do we need to query against the xmins too?
I don't know that an application should be reasoning about liveness at the GC threshold, but I think this means you could send in a revision (close to the GC threshold) twice in a row and get different answers.
Ideally what you'd want is just one answer followed by an "revision out of bounds" error, right?
93ede83
to
585e2cc
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
Tested and didn't see the issues we were seeing before 👍
585e2cc
to
f1bbcfd
Compare
…he datastore revision
f1bbcfd
to
6bf25fd
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
No description provided.