You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by pv...@apache.org on 2020/06/10 09:52:55 UTC

[hive] branch master updated: HIVE-23630: stabilize allocateWriteId test in TestTxnHandler by increasing the retry limit (Marton Bod via Peter Vary)

This is an automated email from the ASF dual-hosted git repository.

pvary pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 7cfc6da  HIVE-23630: stabilize allocateWriteId test in TestTxnHandler by increasing the retry limit (Marton Bod via Peter Vary)
7cfc6da is described below

commit 7cfc6daa8648eb50e9389d96df6b9008d7cfe9e1
Author: Marton Bod <ma...@gmail.com>
AuthorDate: Wed Jun 10 11:52:46 2020 +0200

    HIVE-23630: stabilize allocateWriteId test in TestTxnHandler by increasing the retry limit (Marton Bod via Peter Vary)
    
    Closes (#1074)
---
 .../org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java b/ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java
index 3d00bf7..3a38b43 100644
--- a/ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java
+++ b/ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java
@@ -58,6 +58,7 @@ import org.apache.hadoop.hive.metastore.api.TxnOpenException;
 import org.apache.hadoop.hive.metastore.api.TxnState;
 import org.apache.hadoop.hive.metastore.api.UnlockRequest;
 import org.apache.hadoop.hive.metastore.api.TxnToWriteId;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
 import org.apache.hadoop.util.StringUtils;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
@@ -1756,15 +1757,20 @@ public class TestTxnHandler {
   }
 
   @Test
-  @Ignore("unstable HIVE-23630")
   public void allocateNextWriteIdRetriesAfterDetectingConflictingConcurrentInsert() throws Exception {
     String dbName = "abc";
     String tableName = "def";
     int numTxns = 2;
+    int iterations = 20;
+    // use TxnHandler instance w/ increased retry limit
+    long originalLimit = MetastoreConf.getLongVar(conf, MetastoreConf.ConfVars.HMS_HANDLER_ATTEMPTS);
+    MetastoreConf.setLongVar(conf, MetastoreConf.ConfVars.HMS_HANDLER_ATTEMPTS, iterations + 1);
+    TxnStore txnHandler = TxnUtils.getTxnStore(conf);
+
     try (Connection dbConn = ((TxnHandler) txnHandler).getDbConn(Connection.TRANSACTION_READ_COMMITTED);
          Statement stmt = dbConn.createStatement()) {
       // run this multiple times to get write-write conflicts with relatively high chance
-      for (int i = 0; i < 20; ++i) {
+      for (int i = 0; i < iterations; ++i) {
         // make sure these 2 tables have no records of our dbName.tableName
         // this ensures that allocateTableWriteIds() will try to insert into next_write_id (instead of update)
         stmt.executeUpdate("TRUNCATE TABLE \"NEXT_WRITE_ID\"");
@@ -1807,6 +1813,8 @@ public class TestTxnHandler {
         assertEquals(i * numTxns + 2, result.getTxnToWriteIds().get(1).getTxnId());
         assertEquals(2, result.getTxnToWriteIds().get(1).getWriteId());
       }
+      // restore to original retry limit value
+      MetastoreConf.setLongVar(conf, MetastoreConf.ConfVars.HMS_HANDLER_ATTEMPTS, originalLimit);
     }
   }