-
Notifications
You must be signed in to change notification settings - Fork 139
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
Events notification system for Nessie - VersionStore changes #6647
Events notification system for Nessie - VersionStore changes #6647
Conversation
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 a full review (and not done yet), but went though a bunch of files.
Adding all the *Result
objects to the VersionStore
functions is fine.
Not so much a fan of the new "top-leve" LazyPut
(commented).
I suspect, with some of the suggestions applied, the size of the PR will reduce a bit.
versioned/spi/src/main/java/org/projectnessie/versioned/LazyPut.java
Outdated
Show resolved
Hide resolved
versioned/spi/src/main/java/org/projectnessie/versioned/CommitResult.java
Show resolved
Hide resolved
versioned/spi/src/main/java/org/projectnessie/versioned/VersionStore.java
Outdated
Show resolved
Hide resolved
...e/store/src/main/java/org/projectnessie/versioned/storage/versionstore/BaseCommitHelper.java
Outdated
Show resolved
Hide resolved
...age/store/src/main/java/org/projectnessie/versioned/storage/versionstore/ContentMapping.java
Outdated
Show resolved
Hide resolved
...storage/store/src/main/java/org/projectnessie/versioned/storage/versionstore/CommitImpl.java
Show resolved
Hide resolved
08198cf
to
1b05976
Compare
62ba23e
to
479615d
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.
Thanks!
I'll take a closer look probably next week.
Just a few rather minor comments for now, nothing serious.
...ioned/persist/tx/src/main/java/org/projectnessie/versioned/persist/tx/TxDatabaseAdapter.java
Outdated
Show resolved
Hide resolved
...mon/src/test/java/org/projectnessie/versioned/storage/common/logic/TestIndexesLogicImpl.java
Outdated
Show resolved
Hide resolved
...age/store/src/main/java/org/projectnessie/versioned/storage/versionstore/ContentMapping.java
Outdated
Show resolved
Hide resolved
versioned/spi/src/main/java/org/projectnessie/versioned/Put.java
Outdated
Show resolved
Hide resolved
941b648
to
ba74459
Compare
versioned/tests/src/main/java/org/projectnessie/versioned/tests/AbstractMerge.java
Outdated
Show resolved
Hide resolved
versioned/tests/src/main/java/org/projectnessie/versioned/tests/AbstractTransplant.java
Outdated
Show resolved
Hide resolved
03ef247
to
8336765
Compare
8336765
to
12300f1
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.
Veeeery close :)
Just a few more minor-ish comments and then we can ship it.
...r/src/main/java/org/projectnessie/versioned/persist/adapter/spi/AbstractDatabaseAdapter.java
Outdated
Show resolved
Hide resolved
break; | ||
default: | ||
throw new UnsupportedOperationException("Unknown opVariant " + opVariant); | ||
} | ||
|
||
if (!casSuccess) { | ||
if (opVariant == CasOpVariant.COMMIT) { | ||
if (opVariant == CasOpVariant.COMMIT || opVariant == CasOpVariant.MERGE) { | ||
cleanUpCommitCas(ctx, individualCommits, individualKeyLists); |
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.
Just noting (nothing to change here) - only for posterity why this is not in the new model:
Initially I ported this behavior to the new storage model as well, but (manual, bad "heavy load") tests proved that this can go sideways - up to the point that two concurrent writers produce the exact same commit, one wins and bumps HEAD, the other one "loses" and deletes the commit -> HEAD points to a non-existing commit. It's a rather artificial and will probably never happen in real-live, but still, there's a chance.
versioned/spi/src/main/java/org/projectnessie/versioned/EventsVersionStore.java
Outdated
Show resolved
Hide resolved
versioned/spi/src/main/java/org/projectnessie/versioned/MergeResult.java
Outdated
Show resolved
Hide resolved
versioned/tests/src/main/java/org/projectnessie/versioned/tests/AbstractReferences.java
Outdated
Show resolved
Hide resolved
versioned/tests/src/main/java/org/projectnessie/versioned/tests/AbstractAssign.java
Show resolved
Hide resolved
versioned/tests/src/main/java/org/projectnessie/versioned/tests/AbstractCommits.java
Outdated
Show resolved
Hide resolved
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.
Boom! Ship it! :)
This PR is part of a series of PRs related to the events notification system for Nessie.
See design doc: https://github.com/projectnessie/nessie/blob/main/design/events.md.
This PR focuses on changes required to the existing
VersionStore
API and implementations.Summary of changes:
EventsVersionStore
implementation following the delegate pattern already used for metrics and tracing. Not used for now.VersionStore
now return more detailed results:commit()
returnsCommitResult
assign()
returnsReferenceAssignedResult
create()
returnsReferenceCreatedResult
delete()
returnsReferenceDeletedResult
MergeResult
now has more methods:BranchName getSourceBranch();
List<COMMIT> getAddedCommits();
this is the most tricky additionLazyPut
interface: contrary toPut
, it does not deserialize the content value until it's necessary to do so. (The goal is to avoid deserializing contents on Nessie's write path, if the REST API doesn't need it.)All these additions are meant to be consumed by the events system, not by the REST API which does not change at all, as required by the design doc.