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

Modify dimension slice catalog update API #6838

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

antekresic
Copy link
Contributor

@antekresic antekresic commented Apr 18, 2024

Use the same logic as PR 6773 while updating dimension slice catalog tuples. PR 6773 addresses chunk catalog updates. We first lock the tuple and then modify the values and update the locked tuple. Replace ts_dimension_slice_update_by_id with field specific APIs and use dimension_slice_update_catalog_tuple calls consistently.

Disable-check: force-changelog-file

Copy link

codecov bot commented Apr 18, 2024

Codecov Report

Attention: Patch coverage is 83.13253% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 81.71%. Comparing base (59f50f2) to head (a994510).
Report is 185 commits behind head on main.

Files Patch % Lines
src/dimension_slice.c 82.92% 4 Missing and 10 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6838      +/-   ##
==========================================
+ Coverage   80.06%   81.71%   +1.64%     
==========================================
  Files         190      199       +9     
  Lines       37181    36932     -249     
  Branches     9450     9647     +197     
==========================================
+ Hits        29770    30178     +408     
+ Misses       2997     2866     -131     
+ Partials     4414     3888     -526     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@antekresic antekresic force-pushed the slice-update branch 3 times, most recently from 3e41345 to 12e7400 Compare May 14, 2024 12:27
@antekresic antekresic marked this pull request as ready for review May 14, 2024 12:29
src/dimension_slice.h Outdated Show resolved Hide resolved
src/dimension_slice.c Show resolved Hide resolved
* call dimension_slice_delete_catalog_tuple to complete the delete.
* This ensures correct tuple locking and tuple deletes in the presence of
* concurrent transactions. Failure to follow this results in catalog corruption
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a check for this sequence e.g. with coccinelle?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure tbh. There is clearly more places in the codebase which don't update/delete catalog tuples this way so it might be premature at this point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to check this sequence via coccinelle. Not blocking this PR, but as a follow up safety check. I believe we have fixed all the known places that violate this sequence with this PR.

Use the same logic as PR 6773 while updating dimension slice catalog
tuples. PR 6773 addresses chunk catalog updates. We first lock the
tuple and then modify the values and update the locked tuple. Replace
ts_dimension_slice_update_by_id with field specific APIs and use
dimension_slice_update_catalog_tuple calls consistently.
Copy link
Contributor

@gayyappan gayyappan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good.
1 open question

* call dimension_slice_delete_catalog_tuple to complete the delete.
* This ensures correct tuple locking and tuple deletes in the presence of
* concurrent transactions. Failure to follow this results in catalog corruption
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to check this sequence via coccinelle. Not blocking this PR, but as a follow up safety check. I believe we have fixed all the known places that violate this sequence with this PR.

@@ -638,23 +799,14 @@ ts_dimension_slice_delete_by_dimension_id(int32 dimension_id, bool delete_constr
int
ts_dimension_slice_delete_by_id(int32 dimension_slice_id, bool delete_constraints)
{
ScanKeyData scankey[1];
FormData_dimension_slice form;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we also have to modify ts_dimension_slice_delete_by_dimension_id function (line 777) to follow the same pattern?

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

Successfully merging this pull request may close these issues.

None yet

3 participants