Commit e964783
authored
### What changes were proposed in this pull request?
This pull request introduces major performance and functionality
improvements to the Metalake and table metadata management system. The
most significant change is the addition of a Caffeine-based cache for
Metalake entities, which reduces redundant storage access and improves
efficiency. Additionally, it adds a new method for querying tables by
their fully qualified names and optimizes database schema indexing for
faster lookups.
### Metalake caching and management improvements
* Introduced a static Caffeine cache (`metalakeCache`) in
`MetalakeManager` to store `BaseMetalake` objects, with automatic expiry
and scheduled cleanup. This cache is now used in `metalakeInUse`,
`loadMetalake`, and is invalidated on alter, drop, enable, and disable
operations to ensure consistency.
[[1]](diffhunk://#diff-21ed56786d4199a9ebee9969aae3195dff5037135c738ff4b8ba2072fa72d6a0R23-R36)
[[2]](diffhunk://#diff-21ed56786d4199a9ebee9969aae3195dff5037135c738ff4b8ba2072fa72d6a0R74-R86)
[[3]](diffhunk://#diff-21ed56786d4199a9ebee9969aae3195dff5037135c738ff4b8ba2072fa72d6a0L87-R107)
[[4]](diffhunk://#diff-21ed56786d4199a9ebee9969aae3195dff5037135c738ff4b8ba2072fa72d6a0R138-R155)
[[5]](diffhunk://#diff-21ed56786d4199a9ebee9969aae3195dff5037135c738ff4b8ba2072fa72d6a0R194-R209)
[[6]](diffhunk://#diff-21ed56786d4199a9ebee9969aae3195dff5037135c738ff4b8ba2072fa72d6a0R301-R302)
[[7]](diffhunk://#diff-21ed56786d4199a9ebee9969aae3195dff5037135c738ff4b8ba2072fa72d6a0R353-R354)
[[8]](diffhunk://#diff-21ed56786d4199a9ebee9969aae3195dff5037135c738ff4b8ba2072fa72d6a0R381)
[[9]](diffhunk://#diff-21ed56786d4199a9ebee9969aae3195dff5037135c738ff4b8ba2072fa72d6a0R416)
### Table metadata querying enhancements
* Added a new method `selectTableByFullQualifiedName` to
`TableMetaMapper`, its SQL provider, and the service layer, allowing
retrieval of table metadata using metalake, catalog, schema, and table
names directly, improving query flexibility and performance.
[[1]](diffhunk://#diff-464816dcd4652ac061d317d0ed9ab3a98db358f2db517ce70bbf61fa35624db9R59-R67)
[[2]](diffhunk://#diff-e160fd550934e3ac047abde64991c6ab5edc44602bf8cfd8587596f10b0b58efR72-R80)
[[3]](diffhunk://#diff-19aff10a8b33dded8f085dc93250ba296ca800b5a68630a22537e83b0bd9b730R236-R292)
[[4]](diffhunk://#diff-c0bc429f18cd462c3a3c1fe65c7da0966c338a96737d69b6e32b17257d97a52cL88-L92)
[[5]](diffhunk://#diff-c0bc429f18cd462c3a3c1fe65c7da0966c338a96737d69b6e32b17257d97a52cR347-R363)
### Database schema and indexing optimizations
* Added composite indexes (`idx_name_da`) on the `metalake_name`,
`catalog_name`, `schema_name`, and `table_name` columns (with
`deleted_at`) in both H2 and MySQL schema scripts, significantly
improving query performance for lookups by name.
[[1]](diffhunk://#diff-3ca2c363f5538fb4838a31233c4c858b4928e9ec65b5b86bf35a8c5f653133bfR31)
[[2]](diffhunk://#diff-3ca2c363f5538fb4838a31233c4c858b4928e9ec65b5b86bf35a8c5f653133bfR49)
[[3]](diffhunk://#diff-3ca2c363f5538fb4838a31233c4c858b4928e9ec65b5b86bf35a8c5f653133bfR66)
[[4]](diffhunk://#diff-3ca2c363f5538fb4838a31233c4c858b4928e9ec65b5b86bf35a8c5f653133bfR83)
[[5]](diffhunk://#diff-6fac45e3da22ec7d24ca5ec0b78c5a03d653fabd65dd8040b2c59404fc49fb21R33-R38)
[[6]](diffhunk://#diff-ac6c56c7547bd70d3951716f2b543beea23964b906792b527b833e6229404f70R31)
[[7]](diffhunk://#diff-ac6c56c7547bd70d3951716f2b543beea23964b906792b527b833e6229404f70R48)
[[8]](diffhunk://#diff-ac6c56c7547bd70d3951716f2b543beea23964b906792b527b833e6229404f70R64)
[[9]](diffhunk://#diff-ac6c56c7547bd70d3951716f2b543beea23964b906792b527b833e6229404f70R83)
### Why are the changes needed?
To improve performance
Fix: #9429
### Does this PR introduce _any_ user-facing change?
N/A
### How was this patch tested?
Existing test
1 parent 0c28d77 commit e964783
File tree
66 files changed
+1291
-178
lines changed- authorizations
- authorization-chain
- authorization-ranger
- catalogs
- catalog-fileset/src/test/java/org/apache/gravitino/catalog/fileset
- integration/test
- catalog-hive
- src/test/java/org/apache/gravitino/catalog/hive/integration/test
- catalog-jdbc-doris
- src/test/java/org/apache/gravitino/catalog/doris
- integration/test
- operation
- catalog-jdbc-mysql
- catalog-jdbc-oceanbase
- catalog-jdbc-postgresql
- catalog-jdbc-starrocks
- src/test/java/org/apache/gravitino/catalog/starrocks
- integration/test
- operation
- catalog-kafka
- src/test/java/org/apache/gravitino/catalog/kafka
- catalog-lakehouse-generic
- src/test/java/org/apache/gravitino/catalog/lakehouse/generic
- catalog-lakehouse-hudi
- catalog-lakehouse-iceberg
- catalog-lakehouse-paimon
- src/test/java/org/apache/gravitino/catalog/lakehouse/paimon/integration/test
- catalog-model
- src/test/java/org/apache/gravtitino/catalog/model
- clients
- client-java
- src/test/java/org/apache/gravitino/client/integration/test
- cli
- filesystem-hadoop3/src/test/java/org/apache/gravitino/filesystem/hadoop/integration/test
- core/src
- main/java/org/apache/gravitino
- storage/relational
- mapper
- provider/base
- service
- test/java/org/apache/gravitino
- job
- local
- metalake
- storage
- relational
- service
- flink-connector/flink
- iceberg/iceberg-rest-server
- integration-test-common
- src/test/java/org/apache/gravitino/integration/test/util
- lance/lance-rest-server
- spark-connector
- v3.3/spark
- v3.4/spark
- v3.5/spark
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
66 files changed
+1291
-178
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
157 | 162 | | |
158 | 163 | | |
159 | 164 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
124 | | - | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
| 340 | + | |
339 | 341 | | |
340 | 342 | | |
341 | 343 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | | - | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
87 | | - | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
0 commit comments