You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hcatalog-commits@incubator.apache.org by da...@apache.org on 2013/03/21 19:03:11 UTC

svn commit: r1459479 - in /incubator/hcatalog/branches/branch-0.5: CHANGES.txt core/src/main/java/org/apache/hcatalog/mapreduce/FileOutputCommitterContainer.java core/src/test/java/org/apache/hcatalog/mapreduce/TestHCatDynamicPartitioned.java

Author: daijy
Date: Thu Mar 21 19:03:11 2013
New Revision: 1459479

URL: http://svn.apache.org/r1459479
Log:
HCAT-628 Committer deletes the original partition when a duplicate partition fails registration

Modified:
    incubator/hcatalog/branches/branch-0.5/CHANGES.txt
    incubator/hcatalog/branches/branch-0.5/core/src/main/java/org/apache/hcatalog/mapreduce/FileOutputCommitterContainer.java
    incubator/hcatalog/branches/branch-0.5/core/src/test/java/org/apache/hcatalog/mapreduce/TestHCatDynamicPartitioned.java

Modified: incubator/hcatalog/branches/branch-0.5/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.5/CHANGES.txt?rev=1459479&r1=1459478&r2=1459479&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.5/CHANGES.txt (original)
+++ incubator/hcatalog/branches/branch-0.5/CHANGES.txt Thu Mar 21 19:03:11 2013
@@ -28,6 +28,8 @@ IMPROVEMENTS
 OPTIMIZATIONS
 
 BUG FIXES
+  HCAT-628 Committer deletes the original partition when a duplicate partition fails registration (thiruvel via daijy)
+
   HCAT-640 CHANGES.txt still lists 0.5 as unreleased (gates)
 
   HCAT-625 HCatalog 0.5.0 installation document is outdated

Modified: incubator/hcatalog/branches/branch-0.5/core/src/main/java/org/apache/hcatalog/mapreduce/FileOutputCommitterContainer.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.5/core/src/main/java/org/apache/hcatalog/mapreduce/FileOutputCommitterContainer.java?rev=1459479&r1=1459478&r2=1459479&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.5/core/src/main/java/org/apache/hcatalog/mapreduce/FileOutputCommitterContainer.java (original)
+++ incubator/hcatalog/branches/branch-0.5/core/src/main/java/org/apache/hcatalog/mapreduce/FileOutputCommitterContainer.java Thu Mar 21 19:03:11 2013
@@ -681,14 +681,14 @@ class FileOutputCommitterContainer exten
                 // no harProcessor, regular operation
                 updateTableSchema(client, table, jobInfo.getOutputSchema());
                 LOG.info("HAR not is not being used. The table {} has new partitions {}.", table.getTableName(), ptnInfos);
-                partitionsAdded = partitionsToAdd;
-                if (dynamicPartitioningUsed && (partitionsAdded.size()>0)){
+                if (dynamicPartitioningUsed && (partitionsToAdd.size()>0)){
                     Path src = new Path(ptnRootLocation);
                     moveTaskOutputs(fs, src, src, tblPath, true);
                     moveTaskOutputs(fs, src, src, tblPath, false);
                     fs.delete(src, true);
                 }
                 client.add_partitions(partitionsToAdd);
+                partitionsAdded = partitionsToAdd;
             }
         } catch (Exception e) {
             if (partitionsAdded.size() > 0) {

Modified: incubator/hcatalog/branches/branch-0.5/core/src/test/java/org/apache/hcatalog/mapreduce/TestHCatDynamicPartitioned.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.5/core/src/test/java/org/apache/hcatalog/mapreduce/TestHCatDynamicPartitioned.java?rev=1459479&r1=1459478&r2=1459479&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.5/core/src/test/java/org/apache/hcatalog/mapreduce/TestHCatDynamicPartitioned.java (original)
+++ incubator/hcatalog/branches/branch-0.5/core/src/test/java/org/apache/hcatalog/mapreduce/TestHCatDynamicPartitioned.java Thu Mar 21 19:03:11 2013
@@ -181,5 +181,23 @@ public class TestHCatDynamicPartitioned 
             assertTrue(exc == null);
             runMRRead(maxParts + 5);
         }
+
+        query = "show partitions " + tableName;
+        retCode = driver.run(query).getResponseCode();
+        if (retCode != 0) {
+            throw new Exception("Error " + retCode + " running query " + query);
+        }
+        res = new ArrayList<String>();
+        driver.getResults(res);
+        assertEquals(NUM_PARTITIONS, res.size());
+
+        query = "select * from " + tableName;
+        retCode = driver.run(query).getResponseCode();
+        if (retCode != 0) {
+            throw new Exception("Error " + retCode + " running query " + query);
+        }
+        res = new ArrayList<String>();
+        driver.getResults(res);
+        assertEquals(NUM_RECORDS, res.size());
     }
 }