meta/sql: only update necessary columns for several interface#6158
meta/sql: only update necessary columns for several interface#6158jiefenghuang merged 1 commit intojuicedata:mainfrom
Conversation
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.
Indx will be ingored if it is zero
There was a problem hiding this comment.
So we'd better keep the Where as origin, and add Cols only? 🤔
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;