-
Notifications
You must be signed in to change notification settings - Fork 38
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
Fix utility method to check transactional table metadata #950
Fix utility method to check transactional table metadata #950
Conversation
…ng if the after column is present
5ff3842
to
159fc45
Compare
&& !(nonPrimaryKeyColumn.startsWith(Attribute.BEFORE_PREFIX) | ||
&& tableMetadata | ||
.getColumnNames() | ||
.contains(nonPrimaryKeyColumn.substring(Attribute.BEFORE_PREFIX.length())))) { |
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.
nonPrimaryKeyColumn.startsWith(Attribute.BEFORE_PREFIX)
&& tableMetadata
.getColumnNames()
.contains(nonPrimaryKeyColumn.substring(Attribute.BEFORE_PREFIX.length())
were meant to be written inside parentheses since it first verifies that nonPrimaryKeyColumn
starts with Attribute.BEFORE_PREFIX
before it creates the substring nonPrimaryKeyColumn.substring(Attribute.BEFORE_PREFIX.length())
To gives more context, if nonPrimaryKeyColumn
is not an after image column (verified by line 119), then the clause (line 120 to 123) verifies that nonPrimaryKeyColumn
must be a before image column to be a transactional table metadata
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.
Good catch! LGTM! Thank you!
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! Thank you!
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! Thank you!
Context
ConsensusCommitUtils.isTransactionTableMetadata(metadata)
is a utility method that returns true if the given table metadata is transactional.Changes
This method is not working correctly when it verifies that the after column is present for a given before column. This PR fixes this wrong behavior.