cdb: fix SEGFAULT for gpdb builded with cassert#381
Merged
Conversation
ADB 6.21.1_arenadata36 release
Partition exchanging with different distribution policy may produce `SEGFAULT` at gpdb builded with `--enable-cassert`. If table, that are exhanging, has deleted column and has difference in distribution policy with parent table (ex. parent was created with default policy and new table created with `GpPolicy` `distributed randomly`, or distribution column was dropped at new table) then operation: `alter table parent_tbl exhange partition for ... with exchange_tbl` may produce `SEGFAULT` at function `is_exchangeble`. In case described above, `Assert(newpol->attrs[i] > 0)`, checks that new `GpPolicy` (of new table) has distribution keys, but it doesn't have them (`attrs` is `NULL` and `nattrs`=0), so a NULL pointer dereference occurs. This assertion, seems, should be deleted, because next access to `attrs` is at function `GpPolicyEqual(adjpol, newpol)` (in the code below), but before accessing to `attrs` function validates equality of the GpPolicie's `nattrs`, if them not equal this function returns false and `attrs` won't be accessed.
RekGRpth
previously approved these changes
Aug 25, 2022
Stolb27
approved these changes
Aug 29, 2022
Stolb27
left a comment
Collaborator
There was a problem hiding this comment.
Thank you, @HustonMmmavr. Thank you, @RekGRpth, for review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partition exchanging with different distribution policy may produce
SEGFAULTat gpdb builded with--enable-cassert.If table, that are exhanging, has deleted column and has difference in
distribution policy with parent table (ex. parent was created with
default policy and new table created with
GpPolicydistributed randomly, or distribution column was dropped at new table)then operation:
alter table parent_tbl exhange partition for ... with exchange_tblmay produce
SEGFAULTat functionis_exchangeble.In case described above,
Assert(newpol->attrs[i] > 0), checks thatnew
GpPolicy(of new table) has distribution keys, but it doesn'thave them (
attrsisNULLandnattrs=0), so a NULL pointerdereference occurs.
This assertion, seems, should be deleted, because next access to
attrsis at functionGpPolicyEqual(adjpol, newpol)(in the codebelow), but before accessing to
attrsfunction validates equality ofthe GpPolicie's
nattrs, if them not equal this function returns falseand
attrswon't be accessed.Here are some reminders before you submit the pull request
make installcheck