Skip to content

Commit d3bbd5e

Browse files
committed
Add detailed docs for external meta cache engines
1 parent 181250c commit d3bbd5e

File tree

7 files changed

+111
-8
lines changed

7 files changed

+111
-8
lines changed

fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalMetaCacheMgr.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,16 @@ public static Map<String, String> getCacheStats(CacheStats cacheStats, long esti
514514
}
515515

516516
/**
517-
* Default fallback cache: only provides schema entry loading for unknown engines.
517+
* Fallback implementation of {@link AbstractExternalMetaCache} for engines that do not
518+
* provide dedicated cache entries.
519+
*
520+
* <p>Registered entries:
521+
* <ul>
522+
* <li>{@code schema}: schema-only cache keyed by {@link SchemaCacheKey}</li>
523+
* </ul>
524+
*
525+
* <p>This class keeps compatibility for generic external engines and routes only schema
526+
* loading/invalidation. No engine-specific metadata (partitions/files/snapshots) is cached.
518527
*/
519528
private static class DefaultExternalMetaCache extends AbstractExternalMetaCache {
520529
private static final CacheSpec SCHEMA_CACHE_SPEC = CacheSpec.fromTtlValue(

fe/fe-core/src/main/java/org/apache/doris/datasource/doris/DorisExternalMetaCache.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,18 @@
4242
import java.util.stream.Collectors;
4343

4444
/**
45-
* Doris engine implementation of external meta cache.
45+
* Remote Doris engine implementation of {@link AbstractExternalMetaCache}.
46+
*
47+
* <p>Registered entries:
48+
* <ul>
49+
* <li>{@code backends}: remote backend topology keyed by catalog id</li>
50+
* <li>{@code schema}: schema cache keyed by {@link SchemaCacheKey}</li>
51+
* </ul>
52+
*
53+
* <p>The backend cache is intentionally independent from table/db invalidation and can be
54+
* refreshed explicitly via {@link #invalidateBackendCache(long)}.
55+
*
56+
* <p>db/table/partition invalidation only targets schema entries.
4657
*/
4758
public class DorisExternalMetaCache extends AbstractExternalMetaCache {
4859
private static final Logger LOG = LogManager.getLogger(DorisExternalMetaCache.class);

fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveExternalMetaCache.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,27 @@
8383
import java.util.stream.Collectors;
8484

8585
/**
86-
* Hive engine external meta cache implementation.
87-
* It serves both schema cache and hive metastore cache under one engine entry set.
86+
* Hive engine implementation of {@link AbstractExternalMetaCache}.
87+
*
88+
* <p>This cache consolidates schema metadata and Hive Metastore-derived runtime metadata
89+
* under one engine so callers can use a unified invalidation path.
90+
*
91+
* <p>Registered entries:
92+
* <ul>
93+
* <li>{@code schema}: table schema cache keyed by {@link SchemaCacheKey}</li>
94+
* <li>{@code partition_values}: partition value/index structures per table</li>
95+
* <li>{@code partition}: single partition metadata keyed by partition values</li>
96+
* <li>{@code file}: file listing cache for partition/table locations</li>
97+
* </ul>
98+
*
99+
* <p>Invalidation behavior:
100+
* <ul>
101+
* <li>{@link #invalidateDb(long, String)} and {@link #invalidateTable(long, String, String)}
102+
* clear all related entries with table/db granularity.</li>
103+
* <li>{@link #invalidatePartitions(long, String, String, List)} supports partition-level
104+
* invalidation when specific partition names are provided, and falls back to table-level
105+
* invalidation for empty input or unresolved table metadata.</li>
106+
* </ul>
88107
*/
89108
public class HiveExternalMetaCache extends AbstractExternalMetaCache {
90109
private static final Logger LOG = LogManager.getLogger(HiveExternalMetaCache.class);

fe/fe-core/src/main/java/org/apache/doris/datasource/hudi/HudiExternalMetaCache.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,25 @@
5858
import java.util.stream.Collectors;
5959

6060
/**
61-
* Hudi engine implementation of external meta cache.
61+
* Hudi engine implementation of {@link AbstractExternalMetaCache}.
62+
*
63+
* <p>Registered entries:
64+
* <ul>
65+
* <li>{@code partition}: mutable {@link TablePartitionValues} holder keyed by table and
66+
* partition column types</li>
67+
* <li>{@code fs_view}: {@link HoodieTableFileSystemView} for timeline-aware file listing</li>
68+
* <li>{@code meta_client}: {@link HoodieTableMetaClient} for table metadata access</li>
69+
* <li>{@code schema}: Hudi schema cache keyed by table identity + timestamp</li>
70+
* </ul>
71+
*
72+
* <p>Partition cache values are updated in place with read/write locks to avoid rebuilding
73+
* large partition maps on every request.
74+
*
75+
* <p>Invalidation behavior:
76+
* <ul>
77+
* <li>db/table invalidation clears all four entries for matching keys</li>
78+
* <li>partition-level invalidation currently falls back to table-level invalidation</li>
79+
* </ul>
6280
*/
6381
public class HudiExternalMetaCache extends AbstractExternalMetaCache {
6482
private static final Logger LOG = LogManager.getLogger(HudiExternalMetaCache.class);

fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalMetaCache.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,26 @@
5252
import java.util.function.Consumer;
5353

5454
/**
55-
* Iceberg engine implementation of external meta cache.
55+
* Iceberg engine implementation of {@link AbstractExternalMetaCache}.
56+
*
57+
* <p>Registered entries:
58+
* <ul>
59+
* <li>{@code table}: loaded Iceberg {@link Table} instances per Doris table mapping</li>
60+
* <li>{@code view}: loaded Iceberg {@link View} instances</li>
61+
* <li>{@code manifest}: parsed manifest payload ({@link ManifestCacheValue}) keyed by
62+
* manifest path and content type</li>
63+
* <li>{@code schema}: schema cache keyed by table identity + schema id</li>
64+
* </ul>
65+
*
66+
* <p>Manifest entry keys are path-based and intentionally not table-scoped. This allows
67+
* shared manifests to reuse one cache entry across tables in the same catalog.
68+
*
69+
* <p>Invalidation behavior:
70+
* <ul>
71+
* <li>catalog invalidation clears all entries and drops Iceberg {@link ManifestFiles} IO cache</li>
72+
* <li>db/table invalidation clears table/view/schema entries, while keeping manifest entries</li>
73+
* <li>partition-level invalidation falls back to table-level invalidation</li>
74+
* </ul>
5675
*/
5776
public class IcebergExternalMetaCache extends AbstractExternalMetaCache {
5877
private static final Logger LOG = LogManager.getLogger(IcebergExternalMetaCache.class);

fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalMetaCache.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,19 @@
3838
import java.util.function.Function;
3939

4040
/**
41-
* MaxCompute engine implementation of external meta cache.
41+
* MaxCompute engine implementation of {@link AbstractExternalMetaCache}.
42+
*
43+
* <p>Registered entries:
44+
* <ul>
45+
* <li>{@code metadata}: per-catalog {@link MaxComputeMetadataCache} stored under a fixed key</li>
46+
* <li>{@code schema}: schema cache keyed by {@link SchemaCacheKey}</li>
47+
* </ul>
48+
*
49+
* <p>The metadata cache entry is a container for multiple inner caches (partition values,
50+
* table info and related objects). Database/table invalidation first delegates to that
51+
* container, then invalidates schema entries.
52+
*
53+
* <p>Partition-level invalidation currently follows table-level invalidation semantics.
4254
*/
4355
public class MaxComputeExternalMetaCache extends AbstractExternalMetaCache {
4456
public static final String ENGINE = "maxcompute";

fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalMetaCache.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,22 @@
4848
import java.util.concurrent.ExecutorService;
4949

5050
/**
51-
* Paimon engine implementation of external meta cache.
51+
* Paimon engine implementation of {@link AbstractExternalMetaCache}.
52+
*
53+
* <p>Registered entries:
54+
* <ul>
55+
* <li>{@code table}: loaded Paimon table handle per table mapping</li>
56+
* <li>{@code schema}: schema cache keyed by table identity + schema id</li>
57+
* </ul>
58+
*
59+
* <p>Snapshot-related helpers reuse the table/schema entries to derive partition metadata
60+
* and latest snapshot state without introducing extra cache entries.
61+
*
62+
* <p>Invalidation behavior:
63+
* <ul>
64+
* <li>db/table invalidation clears both table and schema entries by matching local names</li>
65+
* <li>partition-level invalidation falls back to table-level invalidation</li>
66+
* </ul>
5267
*/
5368
public class PaimonExternalMetaCache extends AbstractExternalMetaCache {
5469
public static final String ENGINE = "paimon";

0 commit comments

Comments
 (0)