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/01/26 18:48:46 UTC

[GitHub] [hive] zchovan opened a new pull request #1914: [WIP] HIVE-24445: Non blocking DROP table implementation

zchovan opened a new pull request #1914:
URL: https://github.com/apache/hive/pull/1914


   Change-Id: I594a724ccc6c836e6a735e9ef71851150b0f0c9b
   
   <!--
   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.
   -->
   * added nem column to TBLS backend db table
   * updated the related JDO entities
   * added hive.txn.lockless.reads.enabled feature flag
   * added writeId to DropTableOperation/Desc
   
   ### 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 is the first part of a bigger feature "lockless reads" the main goal is to avoid requesting locks for read operations, thus improving acid table performance
   
   
   ### 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.
   -->
   TBD
   


----------------------------------------------------------------
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 #1914: [WIP] HIVE-24445: Non blocking DROP table implementation

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



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -1259,6 +1261,43 @@ public boolean dropTable(String catName, String dbName, String tableName)
     return success;
   }
 
+  private void markTableAsPendingDrop(String catName, String dbName, String tableName) {
+    boolean isLocklessReadsEnabled = MetastoreConf.getBoolVar(getConf(), ConfVars.LOCKLESS_READS_ENABLED);
+
+    if (isLocklessReadsEnabled) {
+      boolean success = false;
+      tableName = normalizeIdentifier(tableName);
+      dbName = normalizeIdentifier(dbName);
+      catName = normalizeIdentifier(catName);
+      Query query = null;
+
+      try {
+        LOG.debug("Executing markTableAsPendingDrop");
+
+        openTransaction();

Review comment:
       Why are you opening new transaction here?




----------------------------------------------------------------
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 #1914: [WIP] HIVE-24445: Non blocking DROP table implementation

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


   


-- 
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] miklosgergely commented on a change in pull request #1914: [WIP] HIVE-24445: Non blocking DROP table implementation

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



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/table/drop/DropTableDesc.java
##########
@@ -29,31 +32,40 @@
  * DDL task description for DROP TABLE commands.
  */
 @Explain(displayName = "Drop Table", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
-public class DropTableDesc implements DDLDesc, Serializable {
+public class DropTableDesc implements DDLDescWithWriteId, Serializable {
   private static final long serialVersionUID = 1L;
 
-  private final String tableName;
+  private final TableName tableName;
   private final boolean ifExists;
   private final boolean purge;
   private final ReplicationSpec replicationSpec;
   private final boolean validationRequired;
+  private final boolean isTransactional;
 
-  public DropTableDesc(String tableName, boolean ifExists, boolean ifPurge, ReplicationSpec replicationSpec) {
-    this(tableName, ifExists, ifPurge, replicationSpec, true);
+  private long writeId = 0;
+
+  public DropTableDesc(TableName tableName, boolean ifExists, boolean ifPurge, ReplicationSpec replicationSpec) {
+    this(tableName, ifExists, ifPurge, replicationSpec, true, null);
   }
 
-  public DropTableDesc(String tableName, boolean ifExists, boolean purge, ReplicationSpec replicationSpec,
+  public DropTableDesc(TableName tableName, boolean ifExists, boolean ifPurge, ReplicationSpec replicationSpec,

Review comment:
       Nit: the variable name should be purge - I know, it was ifPurge before, but it's a great opportunity to fix it :)

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/table/drop/DropTableOperation.java
##########
@@ -104,6 +104,7 @@ public int execute() throws HiveException {
 
     // TODO: API w/catalog name
     context.getDb().dropTable(desc.getTableName(), desc.isPurge());
+//    context.getDb().dropTable(desc.getTableName(), desc.isPurge(), desc.getWriteId());

Review comment:
       I assume that this was not intentionally left commented out.




----------------------------------------------------------------
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 #1914: [WIP] HIVE-24445: Non blocking DROP table implementation

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



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/table/drop/DropTableAnalyzer.java
##########
@@ -54,9 +55,11 @@ public void analyzeInternal(ASTNode root) throws SemanticException {
       outputs.add(new WriteEntity(table, WriteEntity.WriteType.DDL_EXCLUSIVE));
     }
 
+    TableName tName = TableName.fromString(tableName, null, null);
+
     boolean purge = (root.getFirstChildWithType(HiveParser.KW_PURGE) != null);
     ReplicationSpec replicationSpec = new ReplicationSpec(root);
-    DropTableDesc desc = new DropTableDesc(tableName, ifExists, purge, replicationSpec);
+    DropTableDesc desc = new DropTableDesc(tName, ifExists, purge, replicationSpec);

Review comment:
       why is this change? i do not see constructor that accepts TableName. https://github.com/apache/hive/blob/08fd61d70fd172a63ee03e52f8c11db4718ba43c/ql/src/java/org/apache/hadoop/hive/ql/ddl/table/drop/DropTableDesc.java#L41




----------------------------------------------------------------
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 #1914: [WIP] HIVE-24445: Non blocking DROP table implementation

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



##########
File path: standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift
##########
@@ -300,6 +300,17 @@ struct TruncateTableRequest {
   5: optional string validWriteIdList
 }
 
+struct DropTableRequest {
+  1: required string dbName,
+  2: required string tableName,
+  3: required bool deleteDdata,
+  4: optional i64 writeId=-1,
+  5: optional string validWriteIdList

Review comment:
       are you using this list anywhere?




----------------------------------------------------------------
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 #1914: [WIP] HIVE-24445: Non blocking DROP table implementation

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



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -1259,6 +1261,43 @@ public boolean dropTable(String catName, String dbName, String tableName)
     return success;
   }
 
+  private void markTableAsPendingDrop(String catName, String dbName, String tableName) {

Review comment:
       Do you actually need to mark table as dropped or you could simply remove the record?




----------------------------------------------------------------
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 #1914: [WIP] HIVE-24445: Non blocking DROP table implementation

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



##########
File path: standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift
##########
@@ -300,6 +300,17 @@ struct TruncateTableRequest {
   5: optional string validWriteIdList
 }
 
+struct DropTableRequest {
+  1: required string dbName,
+  2: required string tableName,
+  3: required bool deleteDdata,

Review comment:
       what is it used for?




----------------------------------------------------------------
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] zchovan commented on pull request #1914: [WIP] HIVE-24445: Non blocking DROP table implementation

Posted by GitBox <gi...@apache.org>.
zchovan commented on pull request #1914:
URL: https://github.com/apache/hive/pull/1914#issuecomment-767751483


   @deniskuzZ 


----------------------------------------------------------------
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 #1914: [WIP] HIVE-24445: Non blocking DROP table implementation

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


   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