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

PS-7657 crash seen with update query on a partition table having comp… #4284

Merged
merged 1 commit into from
May 17, 2021

Conversation

nitendra-bhosle
Copy link
Contributor

@nitendra-bhosle nitendra-bhosle commented May 3, 2021

…ressed column

PS-7657 crash seen with update query on a partition table having compressed column

https://jira.percona.com/browse/PS-7657

Analysis :
Update statements execution flow on tables with partitions by key and having compressed column:

1.First it searches for the row and positions the cursor (the blob is decompressed and stored in blob_heap and record is returned to server)
2. Builds new row and then calls update(old_row, new_row). Since the blob field doesn't change, the blob from old row is stored in the new row (mysql record)
3. Parition hanlder detects that the updated row should be in different partition
4. Insert the new row in new parition. During insertion, we empty the blob heap. This releases the blocks used by blob and corrupts the blob data in new row
5. So we end up inserting garbage to the new partition after the update

Fix :
Avoided prebuilt->compress_heap from being empty
till it's required

@nitendra-bhosle nitendra-bhosle force-pushed the 5.7-PS-7657 branch 2 times, most recently from 82d93e1 to 7f596d8 Compare May 7, 2021 11:00
Copy link
Contributor

@satya-bodapati satya-bodapati left a comment

Choose a reason for hiding this comment

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

LGTM! minor suggestions

Copy link
Contributor

@satya-bodapati satya-bodapati left a comment

Choose a reason for hiding this comment

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

  1. Please fix GitHub description
  2. Please add Jenkins link as a comment

@nitendra-bhosle
Copy link
Contributor Author

nitendra-bhosle commented May 10, 2021

…ressed column

https://jira.percona.com/browse/PS-7657

Analysis :
Update statements execution flow on tables with partitions by key and having compressed column:

1.First it searches for the row and positions the cursor (the blob is decompressed and stored in blob_heap and record is returned to server)
2. Builds new row and then calls update(old_row, new_row). Since the blob field doesn't change, the blob from old row is stored in the new row (mysql record)
3. Parition hanlder detects that the updated row should be in different partition
4. Insert the new row in new parition. During insertion, we empty the blob heap. This releases the blocks used by blob and corrupts the blob data in new row
5. So we end up inserting garbage to the new partition after the update

Fix :
Avoided prebuilt->compress_heap from being empty
till it's required
Copy link
Contributor

@venkatesh-prasad-v venkatesh-prasad-v left a comment

Choose a reason for hiding this comment

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

Thank you for addressing the review comments. The patch looks good and is approved from my side. But please wait for @satya-bodapati for the final approval.

@nitendra-bhosle nitendra-bhosle deleted the 5.7-PS-7657 branch May 17, 2021 05:54
@nitendra-bhosle nitendra-bhosle restored the 5.7-PS-7657 branch May 17, 2021 07:02
@nitendra-bhosle nitendra-bhosle merged commit a943a8f into percona:5.7 May 17, 2021
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

Successfully merging this pull request may close these issues.

4 participants