You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by xu...@apache.org on 2015/07/31 02:43:42 UTC

[42/43] hive git commit: HIVE-11258 - The function drop_database_core() of HiveMetaStore.java may not drop all the tables (Aihua Xu, reviewed by Chao Sun)

HIVE-11258 - The function drop_database_core() of HiveMetaStore.java may not drop all the tables (Aihua Xu, reviewed by Chao Sun)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/7df9d7a9
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/7df9d7a9
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/7df9d7a9

Branch: refs/heads/spark
Commit: 7df9d7a93c7e2dce3fe81213a61fe21d11a7bdb9
Parents: bfe8591
Author: Aihua Xu <ai...@gmail.com>
Authored: Thu Jul 30 09:38:31 2015 -0700
Committer: Chao Sun <su...@apache.org>
Committed: Thu Jul 30 09:38:39 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/metastore/HiveMetaStore.java  | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/7df9d7a9/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index ee2cea0..72a837c 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -1039,14 +1039,9 @@ public class HiveMetaStore extends ThriftHiveMetastore {
             ConfVars.METASTORE_BATCH_RETRIEVE_MAX);
 
         int startIndex = 0;
-        int endIndex = -1;
         // retrieve the tables from the metastore in batches to alleviate memory constraints
-        while (endIndex < allTables.size() - 1) {
-          startIndex = endIndex + 1;
-          endIndex = endIndex + tableBatchSize;
-          if (endIndex >= allTables.size()) {
-            endIndex = allTables.size() - 1;
-          }
+        while (startIndex < allTables.size()) {
+          int endIndex = Math.min(startIndex + tableBatchSize, allTables.size());
 
           List<Table> tables = null;
           try {
@@ -1082,6 +1077,8 @@ public class HiveMetaStore extends ThriftHiveMetastore {
               // Drop the table but not its data
               drop_table(name, table.getTableName(), false);
             }
+
+            startIndex = endIndex;
           }
         }