Skip to content

Propagate resource revision to/from the backend#32040

Merged
rosstimothy merged 3 commits intomasterfrom
tross/marshal_revision
Sep 26, 2023
Merged

Propagate resource revision to/from the backend#32040
rosstimothy merged 3 commits intomasterfrom
tross/marshal_revision

Conversation

@rosstimothy
Copy link
Copy Markdown
Contributor

@rosstimothy rosstimothy commented Sep 18, 2023

Ensures that the revision is set on all backend items and that the revision is properly unmarshalled from a backend item when retrieving items from the backend.

Contributes to #30416.
Depends on https://github.com/gravitational/teleport.e/pull/2235 and https://github.com/gravitational/teleport.e/pull/2269

@rosstimothy rosstimothy force-pushed the tross/marshal_revision branch 10 times, most recently from 8ce976c to b0a65c4 Compare September 21, 2023 14:15
@rosstimothy rosstimothy marked this pull request as ready for review September 21, 2023 14:15
Adds a new `MarshalOption` that ensures the resource revision is
set when unmarshalling a backend item. The new `WithRevision` option
was also applied everywhere that the legacy `WithResourceID` was
being used.
The revision follows the same semantics as the resource id for
marshalling. This prevents both items from showing up in the value
of the backend item, which can prevent compare and swap operations
from completing succesfully. Each backend is responsible for
persisting the revision in some manner.

The existing PreserveResourceID was reused to prevent having to
make multiple copies of a resource when clearing the id and revision.
The marshal option will be updated in a follow up when the resource
id is removed.
@rosstimothy rosstimothy force-pushed the tross/marshal_revision branch 3 times, most recently from af2a562 to ea51c8b Compare September 22, 2023 20:56
@rosstimothy rosstimothy force-pushed the tross/marshal_revision branch from ea51c8b to 542ea2c Compare September 22, 2023 21:12
@rosstimothy
Copy link
Copy Markdown
Contributor Author

PTAL reviewers

@rosstimothy rosstimothy added this pull request to the merge queue Sep 26, 2023
Merged via the queue into master with commit e035f4d Sep 26, 2023
@rosstimothy rosstimothy deleted the tross/marshal_revision branch September 26, 2023 17:16
rosstimothy added a commit that referenced this pull request Oct 10, 2023
* Set revision on resources retrieved from the backend

Adds a new `MarshalOption` that ensures the resource revision is
set when unmarshalling a backend item. The new `WithRevision` option
was also applied everywhere that the legacy `WithResourceID` was
being used.

* Prevent storing resource revision in the backend item value

The revision follows the same semantics as the resource id for
marshalling. This prevents both items from showing up in the value
of the backend item, which can prevent compare and swap operations
from completing succesfully. Each backend is responsible for
persisting the revision in some manner.

The existing PreserveResourceID was reused to prevent having to
make multiple copies of a resource when clearing the id and revision.
The marshal option will be updated in a follow up when the resource
id is removed.

* Ignore revision in resource comparisons
rosstimothy added a commit that referenced this pull request Oct 17, 2023
* Set revision on resources retrieved from the backend

Adds a new `MarshalOption` that ensures the resource revision is
set when unmarshalling a backend item. The new `WithRevision` option
was also applied everywhere that the legacy `WithResourceID` was
being used.

* Prevent storing resource revision in the backend item value

The revision follows the same semantics as the resource id for
marshalling. This prevents both items from showing up in the value
of the backend item, which can prevent compare and swap operations
from completing succesfully. Each backend is responsible for
persisting the revision in some manner.

The existing PreserveResourceID was reused to prevent having to
make multiple copies of a resource when clearing the id and revision.
The marshal option will be updated in a follow up when the resource
id is removed.

* Prevent backend items with empty revisions

All resource revisions are now being set on a backend.Item before
persisting the item to the backend.

* Ignore revision in resource comparisons
github-merge-queue Bot pushed a commit that referenced this pull request Oct 17, 2023
* Set revision on resources retrieved from the backend

Adds a new `MarshalOption` that ensures the resource revision is
set when unmarshalling a backend item. The new `WithRevision` option
was also applied everywhere that the legacy `WithResourceID` was
being used.

* Prevent storing resource revision in the backend item value

The revision follows the same semantics as the resource id for
marshalling. This prevents both items from showing up in the value
of the backend item, which can prevent compare and swap operations
from completing succesfully. Each backend is responsible for
persisting the revision in some manner.

The existing PreserveResourceID was reused to prevent having to
make multiple copies of a resource when clearing the id and revision.
The marshal option will be updated in a follow up when the resource
id is removed.

* Prevent backend items with empty revisions

All resource revisions are now being set on a backend.Item before
persisting the item to the backend.

* Ignore revision in resource comparisons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants