You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/02/25 13:01:55 UTC

[GitHub] [hive] deniskuzZ opened a new pull request #2020: HIVE-24445: Non blocking DROP table implementation

deniskuzZ opened a new pull request #2020:
URL: https://github.com/apache/hive/pull/2020


   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute
     2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
     3. Ensure you have added or run the appropriate tests for your PR: 
     4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX:  Your PR title ...'.
     5. Be sure to keep the PR description updated to reflect all changes.
     6. Please write your PR title to summarize what this PR proposes.
     7. If possible, provide a concise example to reproduce the issue for a faster review.
   
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   This changes the drop table operation to asynchronous. The data files of dropped table will not be removed right away, but they are going to be cleaned up later by the Compactor/Cleaner.
   
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   This along with a few other changes will enable us to implement lockless reads, which provides perf boost to the transactional tables.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducable example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   No
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   Unit tests


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvargacl commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
pvargacl commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r582826481



##########
File path: common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
##########
@@ -2997,6 +2997,9 @@ private static void populateLlapDaemonVarsSet(Set<String> llapDaemonVarsSetLocal
     HIVE_TXN_READONLY_ENABLED("hive.txn.readonly.enabled", false,
       "Enables read-only transaction classification and related optimizations"),
 
+    HIVE_TXN_LOCKLESS_READS_ENABLED("hive.txn.lockless.reads.enabled", false,

Review comment:
       I feel like it would be better to have a different config for non_blocking drop table and partition, they work quit differently, I think there might be cases when you want to turn off the one, but not the other.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] deniskuzZ commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r592392273



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
##########
@@ -1129,14 +1129,17 @@ public void createTable(Table tbl, boolean ifNotExists,
           principalPrivs.setRolePrivileges(grants.getRoleGrants());
           tTbl.setPrivileges(principalPrivs);
         }
+        if (HiveConf.getBoolVar(conf, ConfVars.HIVE_TXN_LOCKLESS_READS_ENABLED) && AcidUtils.isTransactionalTable(tbl)) {

Review comment:
       i don't think it would be a problem, but i'll double check. Thing is that I am indirectly passing HIVE_TXN_LOCKLESS_READS_ENABLED config value to HMS via the txnId attribute. If set - HIVE_TXN_LOCKLESS_READS_ENABLED was enabled.  




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] github-actions[bot] commented on pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #2020:
URL: https://github.com/apache/hive/pull/2020#issuecomment-855489209


   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
   Feel free to reach out on the dev@hive.apache.org list if the patch is in need of reviews.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] github-actions[bot] closed pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #2020:
URL: https://github.com/apache/hive/pull/2020


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] deniskuzZ commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r592393806



##########
File path: common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
##########
@@ -2997,6 +2997,9 @@ private static void populateLlapDaemonVarsSet(Set<String> llapDaemonVarsSetLocal
     HIVE_TXN_READONLY_ENABLED("hive.txn.readonly.enabled", false,
       "Enables read-only transaction classification and related optimizations"),
 
+    HIVE_TXN_LOCKLESS_READS_ENABLED("hive.txn.lockless.reads.enabled", false,

Review comment:
       makes sense. i'll create a separate config for async drop, however HIVE_TXN_LOCKLESS_READS_ENABLED could be still leveraged to enable whole lockless read feature.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] deniskuzZ commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r592384397



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -2863,6 +2862,10 @@ private boolean drop_table_core(final RawStore ms, final String catName, final S
         deletePartitionData(partPaths, ifPurge, ReplChangeManager.shouldEnableCm(db, tbl));
         // Delete the data in the table
         deleteTableData(tblPath, ifPurge, ReplChangeManager.shouldEnableCm(db, tbl));
+      } else if (TxnUtils.isTransactionalTable(tbl)) {
+        CompactionRequest rqst = new CompactionRequest(dbname, name, CompactionType.MAJOR);

Review comment:
       Yeah, that's just a placeholder for marking table as "ready for cleaning". 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvargacl commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
pvargacl commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r582833185



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -2213,9 +2213,9 @@ private void create_table_core(final RawStore ms, final CreateTableRequest req)
       }
 
       if (!TableType.VIRTUAL_VIEW.toString().equals(tbl.getTableType())) {
-        if (tbl.getSd().getLocation() == null
-            || tbl.getSd().getLocation().isEmpty()) {
-          tblPath = wh.getDefaultTablePath(db, tbl);
+        if (tbl.getSd().getLocation() == null || tbl.getSd().getLocation().isEmpty()) {

Review comment:
       I am wondering if there are some loopholes here. What happens if lock free drop is enabled and someone drops and recreated an acid table with manually given location? Shouldn't we only allow lock free drop if the table location is managed by hive (that would mean there won't be lockless reads for tables with manual location)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvargacl commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
pvargacl commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r592499445



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -2213,9 +2213,9 @@ private void create_table_core(final RawStore ms, final CreateTableRequest req)
       }
 
       if (!TableType.VIRTUAL_VIEW.toString().equals(tbl.getTableType())) {
-        if (tbl.getSd().getLocation() == null
-            || tbl.getSd().getLocation().isEmpty()) {
-          tblPath = wh.getDefaultTablePath(db, tbl);
+        if (tbl.getSd().getLocation() == null || tbl.getSd().getLocation().isEmpty()) {

Review comment:
       I think we do, just tried it on a cluster, created a transactional table with a custom location and everything works as expected (insert, read, compaction...)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvargacl commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
pvargacl commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r582826481



##########
File path: common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
##########
@@ -2997,6 +2997,9 @@ private static void populateLlapDaemonVarsSet(Set<String> llapDaemonVarsSetLocal
     HIVE_TXN_READONLY_ENABLED("hive.txn.readonly.enabled", false,
       "Enables read-only transaction classification and related optimizations"),
 
+    HIVE_TXN_LOCKLESS_READS_ENABLED("hive.txn.lockless.reads.enabled", false,

Review comment:
       I feel like it would be better to have a different config for non_blocking drop table and partition, they are work quit differently, I think there might be cases when you want to turn off the one, but not the other.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] deniskuzZ commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r592395791



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -2213,9 +2213,9 @@ private void create_table_core(final RawStore ms, final CreateTableRequest req)
       }
 
       if (!TableType.VIRTUAL_VIEW.toString().equals(tbl.getTableType())) {
-        if (tbl.getSd().getLocation() == null
-            || tbl.getSd().getLocation().isEmpty()) {
-          tblPath = wh.getDefaultTablePath(db, tbl);
+        if (tbl.getSd().getLocation() == null || tbl.getSd().getLocation().isEmpty()) {

Review comment:
       i don't think we support custom location for acid managed tables, do we? 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvargacl commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
pvargacl commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r582835527



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
##########
@@ -1129,14 +1129,17 @@ public void createTable(Table tbl, boolean ifNotExists,
           principalPrivs.setRolePrivileges(grants.getRoleGrants());
           tTbl.setPrivileges(principalPrivs);
         }
+        if (HiveConf.getBoolVar(conf, ConfVars.HIVE_TXN_LOCKLESS_READS_ENABLED) && AcidUtils.isTransactionalTable(tbl)) {

Review comment:
       i would consider do this for every transactional table, regardless of the config. So we would have consistent naming convention everywhere + I think it would help reduce the cases to consider (like what happens if the config is on for some time, then it is turn off, or if somebody turns this off in session level etc.)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvargacl commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
pvargacl commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r582841704



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -2863,6 +2862,10 @@ private boolean drop_table_core(final RawStore ms, final String catName, final S
         deletePartitionData(partPaths, ifPurge, ReplChangeManager.shouldEnableCm(db, tbl));
         // Delete the data in the table
         deleteTableData(tblPath, ifPurge, ReplChangeManager.shouldEnableCm(db, tbl));
+      } else if (TxnUtils.isTransactionalTable(tbl)) {
+        CompactionRequest rqst = new CompactionRequest(dbname, name, CompactionType.MAJOR);

Review comment:
       This is here to prepare for the Cleaner right?
   I think it would be enough to put a record in "ready for cleaning" state
   And you would need to pass to location I guess.
   Plus you don't need to to this if the data was purged.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] kgyrtkirk commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
kgyrtkirk commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r582821814



##########
File path: standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift
##########
@@ -585,8 +585,8 @@ struct Table {
   22: optional byte accessType,
   23: optional list<string> requiredReadCapabilities,
   24: optional list<string> requiredWriteCapabilities
-  25: optional i64 id,                 // id of the table. It will be ignored if set. It's only for
-                                        // read purposed
+  25: optional i64 id,                 // id of the table. It will be ignored if set. It's only for read purposed

Review comment:
       nit: didn't this should be `purposes`?

##########
File path: standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift
##########
@@ -585,8 +585,8 @@ struct Table {
   22: optional byte accessType,
   23: optional list<string> requiredReadCapabilities,
   24: optional list<string> requiredWriteCapabilities
-  25: optional i64 id,                 // id of the table. It will be ignored if set. It's only for
-                                        // read purposed
+  25: optional i64 id,                 // id of the table. It will be ignored if set. It's only for read purposed
+  26: optional i64 txnid,

Review comment:
       this interface seems to follow `camelCase` naming - I think this field should be named `txnId`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvargacl commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
pvargacl commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r582835527



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
##########
@@ -1129,14 +1129,17 @@ public void createTable(Table tbl, boolean ifNotExists,
           principalPrivs.setRolePrivileges(grants.getRoleGrants());
           tTbl.setPrivileges(principalPrivs);
         }
+        if (HiveConf.getBoolVar(conf, ConfVars.HIVE_TXN_LOCKLESS_READS_ENABLED) && AcidUtils.isTransactionalTable(tbl)) {

Review comment:
       i would consider do this for every transactional table, regardless of the config. So we would have consistent naming convention everywhere + it would help I think it would help reduce the cases to consider (like what happens if the config is on for some time, then it is turn off, or if somebody turns this off in session level etc.)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvargacl commented on a change in pull request #2020: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
pvargacl commented on a change in pull request #2020:
URL: https://github.com/apache/hive/pull/2020#discussion_r582835527



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
##########
@@ -1129,14 +1129,17 @@ public void createTable(Table tbl, boolean ifNotExists,
           principalPrivs.setRolePrivileges(grants.getRoleGrants());
           tTbl.setPrivileges(principalPrivs);
         }
+        if (HiveConf.getBoolVar(conf, ConfVars.HIVE_TXN_LOCKLESS_READS_ENABLED) && AcidUtils.isTransactionalTable(tbl)) {

Review comment:
       i would consider do this for every transactional table, regarding of the config. So we would have consistent naming convention everywhere + it would help I think it would help reduce the cases to consider (like what happens if the config is on for some time, then it is turn off, or if somebody turns this off in session level etc.)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org