-
Notifications
You must be signed in to change notification settings - Fork 1.1k
meta/sql: only update necessary columns for several interface #6158
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
Conversation
jiefenghuang
left a comment
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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6158 +/- ##
===========================================
+ Coverage 21.32% 38.11% +16.79%
===========================================
Files 30 165 +135
Lines 19642 49323 +29681
===========================================
+ Hits 4188 18801 +14613
- Misses 14958 28415 +13457
- Partials 496 2107 +1611 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@jiefenghuang Am I breaking something? Unit test errors from something which is not touched. |
This was a unit test issue; fixed in #6159. |
OK. I will rebase after #6159 is merged. |
|
hi @mrdrivingduck , #6159 has merged. |
pkg/meta/sql.go
Outdated
|
|
||
| c2.Slices = append(append(c2.Slices[:skipped*sliceBytes], marshalSlice(pos, id, size, 0, size)...), c2.Slices[len(origin):]...) | ||
| if _, err := s.Where("Inode = ? AND indx = ?", inode, indx).Update(c2); err != nil { | ||
| if _, err := s.Cols("slices").Update(c2, &chunk{Inode: inode, Indx: indx}); err != nil { |
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.
Indx will be ingored if it is zero
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.
So we'd better keep the Where as origin, and add Cols only? 🤔
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.
Yes
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.
Done, PTAL.
Some interface impl accidentally update all columns of metadata. Although it is okay for SQL-based metadata engine, it is not necessary and may cause error on some distributed variant, like Citus for PostgreSQL, because the SQL updates the distributed column, even though the column value is not changed, just like: UPDATE jfs_chunk SET inode = 1 ... WHERE inode = 1;
Some interface impl accidentally update all columns of metadata. Although it is okay for SQL-based metadata engine, it is not necessary and may cause error on some distributed variant, like Citus for PostgreSQL, because the SQL updates the distributed column, even though the column value is not changed, just like:
UPDATE jfs_chunk SET inode = 1 ... WHERE inode = 1;