Skip to content
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

[SPIKE] Determine the cost of adding support for Not-Modified and Created indicators with postgres #4985

Closed
fguimond opened this issue Apr 4, 2023 · 1 comment
Assignees
Milestone

Comments

@fguimond
Copy link
Contributor

fguimond commented Apr 4, 2023

See if features from the Postgres API such as rows affected can be used to implement #4631 without adding complexity. The original issue's milestone should be updated based on the output of this spike.

@fguimond fguimond added this to the 7.0.0 milestone Apr 4, 2023
@echlebek echlebek self-assigned this Apr 24, 2023
@echlebek echlebek changed the title [SPIKE] Determine if Postgres features can be used [SPIKE] Determine the cost of adding support for Not-Modified and Created indicators with postgres Apr 24, 2023
@echlebek
Copy link
Contributor

While no feature can ever be added without also adding complexity, some features need more complexity than others. This feature can be added with fairly minimal complexity.

Knowing if a resource can be created or not is a simple matter of looking at the xmax system column. When xmax = 0, the row was inserted. Otherwise, it will not equal 0.

Knowing if a resource should be updated or not is a matter of computing and storing the entity tag for the resource. We can easily have postgres do this for us with the pgcrypto extension, which is available by default on RDS and most other deployments. The etag can be stored in a new etag column, which will hold the checksum of the resource. If the database detects that the user is attempting to store a resource with the same etag, it can report that the resource wasn't modified by returning the existing etag, and the updated etag, and letting the user compare them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants