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

HIVE-26023: Non blocking REPLACE, RENAME COLUMNS implementation #3089

Merged
merged 2 commits into from
May 5, 2022

Conversation

deniskuzZ
Copy link
Member

@deniskuzZ deniskuzZ commented Mar 9, 2022

What changes were proposed in this pull request?

Why are the changes needed?

Modify the REPLACE/RENAME COLUMNS operation to not acquire EXCLUSIVE lock limiting the system concurrency.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Unit tests

driver.getFetchTask().fetch(res);
swapTxnManager(txnMgr2);

FieldSetter.setField(txnMgr2, txnMgr2.getClass().getDeclaredField("numStatements"), 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this set needed?

Copy link
Member Author

@deniskuzZ deniskuzZ May 2, 2022

Choose a reason for hiding this comment

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

txnMgr.acquireLocks increments the number of statements and that prevents us from calling it again - so doing a hard reset here.

Comment on lines +3669 to +4217
checkLock(blocking ? LockType.EXCLUSIVE : LockType.EXCL_WRITE,
LockState.ACQUIRED, "default", "tab_acid", null, locks);
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be changed to sth like
checkLock(blocking ? LockType.EXCLUSIVE : LockType.EXCL_WRITE, blocking ? LockState.WAITING : LockState.ACQUIRED, "default", "tab_acid", null, locks);
In this case the code block inside if (blocking) would not be necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

in case of blocking flow, 1st step was to check if we'll be blocked/waiting on prev txn, then commit blocking txn and proceed with the current one. At that step, we should have a lock.

Copy link
Contributor

@asinkovits asinkovits left a comment

Choose a reason for hiding this comment

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

LGTM, +1

@deniskuzZ deniskuzZ merged commit e213351 into apache:master May 5, 2022
@deniskuzZ deniskuzZ deleted the HIVE-26023 branch May 5, 2022 18:20
DongWei-4 pushed a commit to DongWei-4/hive that referenced this pull request Oct 28, 2022
dengzhhu653 pushed a commit to dengzhhu653/hive that referenced this pull request Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants