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/05/22 06:26:35 UTC

[hive] branch branch-3.1 updated: HIVE-23044: Make sure Cleaner doesn't delete delta directories for running queries (Zoltan Chovan via Peter Vary)

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

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


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new bfb5556  HIVE-23044: Make sure Cleaner doesn't delete delta directories for running queries (Zoltan Chovan via Peter Vary)
bfb5556 is described below

commit bfb55568bcaa8e91112f4e5b983edcc9dcd2844c
Author: Zoltan Chovan <zc...@cloudera.com>
AuthorDate: Fri May 22 08:16:12 2020 +0200

    HIVE-23044: Make sure Cleaner doesn't delete delta directories for running queries (Zoltan Chovan via Peter Vary)
---
 ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Cleaner.java    | 6 +++---
 .../test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java   | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Cleaner.java b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Cleaner.java
index 3565616..f26920c 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Cleaner.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Cleaner.java
@@ -228,7 +228,7 @@ public class Cleaner extends CompactorThread {
         if ((ci.tableName == null && lock.getTablename() == null) ||
             (ci.tableName != null && ci.tableName.equalsIgnoreCase(lock.getTablename()))) {
           if ((ci.partName == null && lock.getPartname() == null) ||
-              (ci.partName != null && ci.partName.equals(lock.getPartname()))) {
+              (ci.partName != null && ci.partName.equalsIgnoreCase(lock.getPartname()))) {
             relatedLocks.add(lock.getLockid());
           }
         }
@@ -279,8 +279,8 @@ public class Cleaner extends CompactorThread {
        * We only want to clean up to the highestWriteId - otherwise we risk deleting deltas from
        * under an active reader.
        *
-       * Suppose we have deltas D2 D3 for table T, i.e. the last compaction created D3 so now there is a 
-       * clean request for D2.  
+       * Suppose we have deltas D2 D3 for table T, i.e. the last compaction created D3 so now there is a
+       * clean request for D2.
        * Cleaner checks existing locks and finds none.
        * Between that check and removeFiles() a query starts (it will be reading D3) and another compaction
        * completes which creates D4.
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java b/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java
index ce574b4..deff5de 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java
@@ -246,7 +246,7 @@ public class TestCleaner extends CompactorTest {
     burnThroughTransactions("default", "bblp", 25);
 
     CompactionRequest rqst = new CompactionRequest("default", "bblp", CompactionType.MINOR);
-    rqst.setPartitionname("ds=today");
+    rqst.setPartitionname("ds=Today");
     txnHandler.compact(rqst);
     CompactionInfo ci = txnHandler.findNextToCompact("fred");
     txnHandler.markCompacted(ci);
@@ -254,7 +254,7 @@ public class TestCleaner extends CompactorTest {
 
     LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.PARTITION, "default");
     comp.setTablename("bblp");
-    comp.setPartitionname("ds=today");
+    comp.setPartitionname("ds=Today");
     comp.setOperationType(DataOperationType.DELETE);
     List<LockComponent> components = new ArrayList<LockComponent>(1);
     components.add(comp);
@@ -271,7 +271,7 @@ public class TestCleaner extends CompactorTest {
     Assert.assertEquals(1, compacts.size());
     Assert.assertEquals("ready for cleaning", compacts.get(0).getState());
     Assert.assertEquals("bblp", compacts.get(0).getTablename());
-    Assert.assertEquals("ds=today", compacts.get(0).getPartitionname());
+    Assert.assertEquals("ds=Today", compacts.get(0).getPartitionname());
     Assert.assertEquals(CompactionType.MINOR, compacts.get(0).getType());
   }