Aihua Xu created HIVE-11258:
-------------------------------

             Summary: The function drop_database_core() of HiveMetaStore.java 
may not drop all the tables
                 Key: HIVE-11258
                 URL: https://issues.apache.org/jira/browse/HIVE-11258
             Project: Hive
          Issue Type: Bug
          Components: Database/Schema
    Affects Versions: 2.0.0
            Reporter: Aihua Xu
            Assignee: Aihua Xu


The following code in that function doesn't work properly.
{noformat}
        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;
          }
{noformat}

e.g.: if we have 5 tables and tableBatchSize is 10, startIndex will be 0 and 
endIndex will be 4. We only drop 4 tables since sublist(startIndex, endIndex) 
is inclusive on startIndex and exclusive on endIndex.

If total tables is larger tableBatchSize, we also have similar issues.

This is discovered when I work on HIVE-11255.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to