Skip to content

Phoenix 6653 Add upgrade tests based on HBase snapshots#1480

Closed
richardantal wants to merge 2 commits intoapache:masterfrom
richardantal:PHOENIX-6653
Closed

Phoenix 6653 Add upgrade tests based on HBase snapshots#1480
richardantal wants to merge 2 commits intoapache:masterfrom
richardantal:PHOENIX-6653

Conversation

@richardantal
Copy link
Copy Markdown
Contributor

@richardantal richardantal commented Aug 8, 2022

Work is still in progress

@richardantal
Copy link
Copy Markdown
Contributor Author

There is a separate PR for pre 4.10 upgrade #1474
But I'd like to trigger a test run here with these 2. I will rebase Phoenix 6653 to the master.

Copy link
Copy Markdown
Contributor

@stoty stoty left a comment

Choose a reason for hiding this comment

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

You should either duplicate the template class, and put the test there, or rename it.
Also, I think that instead of committing the snapshot directories directly, storing them as a single zip file, or in a zip file per snapshot, and extracting in the test would be better.
The individial files are not human reabable anyway.

@richardantal richardantal force-pushed the PHOENIX-6653 branch 2 times, most recently from ed33be3 to 183dd8c Compare August 10, 2022 16:03
@stoty
Copy link
Copy Markdown
Contributor

stoty commented Aug 11, 2022

(We've had offline discussions about this with Richard, so some context may not be immediately apparent from the patch)

You have uncovered two different additional problems here.

One is that moveChildLinkConnection doesn't handle namespace mapping.
Your current solution here is incorrect, because it manipulates the pre-upgrade default namespace system tables, even though by this point it has already been moved to the NS (and upgraded).
The correct solution would be to replace both TableName.valueOf(SYSTEM_CATALOG_NAME) and TableName.valueOf(SYSTEM_CHILD_LINK_NAME) with the right namespace aware method from SchmaUtil which preforms the '.' -> ':' replacement as needed. (it is also much simpler)

This bugfix may even be split into a separate dependent ticket, if you prefer.
We should also check if we have other similar bugs in the upgrade code.

The other problem is that moveChildLinkConnection creates a the HBase Connection from a vanilla Configuration object (reading from hbase-site.xml), which doesn't get necessary Config changes that were set by BaseTest/minicluster.

Simply copying the ZK quorum from the CQSI connection may get the test to pass, but is not the right way.
We should clone the Configuration object from CQSI, apply the necessary the changes to the clone, and use that for creating the HBaseConnection.


Configuration conf = HBaseConfiguration.create();

Configuration oldconf = HBaseConfiguration.create(config);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Simply use
Configuration conf = HBaseConfiguration.create(config);
and you'll automatically get all properties, including ZK.

* @throws SQLException
*/

public static void moveOrCopyChildLinks(PhoenixConnection oldMetaConnection, Map<String, String> options) throws IOException {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the wrong workaround.

TableName sysCat = SchemaUtil.getPhysicalTableName(SYSTEM_CATALOG_NAME, readOnlyProps);
TableName sysChildLink = SchemaUtil.getPhysicalTableName(SYSTEM_CHILD_LINK_NAME, readOnlyProps);

LOGGER.info(String.format("SYSTEM CATALOG tabled use for copying child links: %s", sysCat.toString()));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Once the testing is done, you may want remove this, or change it to DEBUG level.

Copy link
Copy Markdown
Contributor

@stoty stoty left a comment

Choose a reason for hiding this comment

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

Please also mention the addParentToChildLinks namespace fix in the commit message.

//Now we can start Phoenix
setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet()
.iterator()));
assertTrue(true);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this assertion enough ?
Will the driver throw an exception if there is an upgrade problem ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think, yes
If you see the tests results in my other PR, without the PHOENIX-6754 fix, that fails with
org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): Undefined column. columnName=SYSTEM.CATALOG.COLUMN_QUALIFIER
Test run on this one is successful.

Will update this and the other PR, based on the things you suggested but it would be better to merge PHOENIX-6754 before

Copy link
Copy Markdown
Contributor

@stoty stoty Aug 15, 2022

Choose a reason for hiding this comment

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

That's fine, ping me when the PHOENIX-6754 changes are finished.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

PHOENIX-6754 is finished, but we wanted to run these tests on the change
#1474

@richardantal
Copy link
Copy Markdown
Contributor Author

Thank you @stoty for the review and the suggestions, I've updated the log msgs, and added more detail to the commit message.

<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
</dependency>
<dependency>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be test scope.

  Corrected the HBase table names based on namespace mapping in
  moveOrCopyChildLinks during upgrade
Copy link
Copy Markdown
Contributor

@stoty stoty left a comment

Choose a reason for hiding this comment

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

+1 LGTM
but wait for the tests.

@richardantal
Copy link
Copy Markdown
Contributor Author

Thank you @stoty for the reviews,
I close this PR and merge the other 2 separately.

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.

2 participants