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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 7ed15ee8c9 [Fix](multi-catalog) invalidates the file cache when table 
is non-partitioned. (#17932)
7ed15ee8c9 is described below

commit 7ed15ee8c90661d81950b1e652910c44ebb43120
Author: Xiangyu Wang <[email protected]>
AuthorDate: Wed Mar 22 23:34:18 2023 +0800

    [Fix](multi-catalog) invalidates the file cache when table is 
non-partitioned. (#17932)
    
    Reference to `org.apache.doris.planner.external.HiveSplitter`, the file 
cache of `HiveMetaStoreCache`
    may be created even the table is a non-partitioned table,
    so the `RefreshTableStmt` should consider this scene and handle it.
---
 .../org/apache/doris/datasource/hive/HiveMetaStoreCache.java | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveMetaStoreCache.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveMetaStoreCache.java
index 156f6eba66..bbf873a476 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveMetaStoreCache.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveMetaStoreCache.java
@@ -55,6 +55,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.hive.metastore.api.Partition;
 import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
+import org.apache.hadoop.hive.metastore.api.Table;
 import org.apache.hadoop.mapred.FileInputFormat;
 import org.apache.hadoop.mapred.InputFormat;
 import org.apache.hadoop.mapred.InputSplit;
@@ -382,6 +383,17 @@ public class HiveMetaStoreCache {
             LOG.debug("invalid table cache for {}.{} in catalog {}, cache num: 
{}, cost: {} ms",
                     dbName, tblName, catalog.getName(), 
partitionValues.partitionValuesMap.size(),
                     (System.currentTimeMillis() - start));
+        } else {
+            /**
+             * A file cache entry can be created reference to
+             * {@link 
org.apache.doris.planner.external.HiveSplitter#getSplits},
+             * so we need to invalidate it if this is a non-partitioned table.
+             *
+             * */
+            Table table = catalog.getClient().getTable(dbName, tblName);
+            // we just need to assign the `location` filed because the 
`equals` method of `FileCacheKey`
+            // just compares the value of `location`
+            fileCache.invalidate(new FileCacheKey(table.getSd().getLocation(), 
null));
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to