Skip to content

Conversation

hmangla98
Copy link
Contributor

Fix the clean up of open repl created transactions

Copy link
Contributor

@pkumarsinha pkumarsinha left a comment

Choose a reason for hiding this comment

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

One problem I see is that the txns which are aborted outside replication cycle will lead to a state where when a corresponding commit event come as a part of replication, this will be silently ignored.

long loadTaskStartTime = System.currentTimeMillis();
SecurityUtils.reloginExpiringKeytabUser();
//Don't proceed if target db is replication incompatible.
if (work.dbNameToLoadIn != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

When would this be null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can have some situation in which work.dbNameToLoadIn is not set.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know when could that be?

Copy link
Contributor Author

@hmangla98 hmangla98 Jul 13, 2021

Choose a reason for hiding this comment

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

we have test cases to test REPL LOAD * scenarios.

//Don't proceed if target db is replication incompatible.
if (work.dbNameToLoadIn != null) {
Database targetDb = getHive().getDatabase(work.dbNameToLoadIn);
if (targetDb != null && MetaStoreUtils.isDbReplIncompatible(targetDb)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

When would targetDb be null? When a wrong work.dbNameToLoadIn is specified ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for the first load operation (bootstrap load), targetDb would be null.

replica.load("", "`*`");
} catch (SemanticException e) {
assertEquals("REPL LOAD * is not supported", e.getMessage());
assertTrue(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will always fail. Why do you need to have such assertion?

Copy link
Contributor

Choose a reason for hiding this comment

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

assertEquals("REPL LOAD * is not supported", e.getMessage()); -
Do we not throw this error anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This particular error is outdated. Earlier, repl load did not raise any exception and hence catch clause was of no use. In this change, Repl load will throw an exception stating that dbname can't be null.

@pkumarsinha pkumarsinha merged commit a75b868 into apache:master Jul 15, 2021
@hmangla98 hmangla98 deleted the HIVE-25246 branch July 15, 2021 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants