hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sunc...@apache.org
Subject 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)
Date Thu, 30 Jul 2015 16:41:05 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-1 fb57bd134 -> 399168ccf


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/399168cc
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/399168cc
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/399168cc

Branch: refs/heads/branch-1
Commit: 399168ccfc1e2bad2bfe22d09c4700c59c61af9f
Parents: fb57bd1
Author: Aihua Xu <aihuaxu@gmail.com>
Authored: Thu Jul 30 09:40:31 2015 -0700
Committer: Chao Sun <sunchao@apache.org>
Committed: Thu Jul 30 09:40:34 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/399168cc/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 3403da3..6c5de4e 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -1037,14 +1037,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 {
@@ -1080,6 +1075,8 @@ public class HiveMetaStore extends ThriftHiveMetastore {
               // Drop the table but not its data
               drop_table(name, table.getTableName(), false);
             }
+
+            startIndex = endIndex;
           }
         }
 


Mime
View raw message