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-28668: Hive should emit fewer events for truncate table operation #5582

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

saihemanth-cloudera
Copy link
Contributor

What changes were proposed in this pull request?

Currently, we emit twice the number of events for each table/partition for truncate operation. This patch removes this redundant events.

Why are the changes needed?

Having fewer events help external systems that consume these events to catch up with the quantum of events faster.

Does this PR introduce any user-facing change?

No.

Is the change a dependency upgrade?

No.

How was this patch tested?

Added unit test for the patch

}
alterHandler.alterPartition(ms, wh, catName, dbName, tableName, null, partition,
environmentContext, this, validWriteIds);
alterHandler.alterPartitions(ms, wh, catName, dbName, tableName, partitions, environmentContext,
Copy link
Member

Choose a reason for hiding this comment

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

since we know this is a truncation op, can we just call ms.alterPartitions(catName, dbname, name, partValsList, new_parts, writeId, writeIdList) and create the event directly? same for truncating the non-partitioned table.

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'll also call ObjectStore.alterPartitions() where the operation may not be a truncate, for e.g: L#6111 and L#6263

Copy link
Member

Choose a reason for hiding this comment

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

this operation is in a context of truncation, and we have done almost every thing in HMSHandler, like reset the column stats, truncate the table directory, so in my view, we don't need to call alterHandler.alterPartitions to perform other actions, such as fetch the partitions from db again, update the stats, etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have implemented your suggestions, Can you please verify the latest changes?

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