jerryshao commented on code in PR #12445:
URL: https://github.com/apache/gravitino/pull/12445#discussion_r3783196824
##########
core/src/main/java/org/apache/gravitino/catalog/CatalogChangeLogListener.java:
##########
@@ -59,51 +72,87 @@ public CatalogChangeLogListener(CatalogManager
catalogManager) {
@Override
public void onEntityChange(List<EntityChangeRecord> changes) {
+ List<CatalogInvalidation> remoteInvalidations = new ArrayList<>();
for (EntityChangeRecord change : changes) {
+ if (!isCatalogChange(change)) {
+ continue;
+ }
+
+ Optional<NameIdentifier> identOpt = catalogIdentifier(change);
+ if (identOpt.isEmpty()) {
+ // Already logged. A row that names no catalog cannot leave a stale
entry behind, so it is
+ // skipped rather than escalated to a cache clear.
+ continue;
+ }
+ NameIdentifier ident = identOpt.get();
+
+ boolean localMutation;
try {
- if (!isCatalogChange(change)) {
- continue;
- }
-
- Optional<NameIdentifier> identOpt = catalogIdentifier(change);
- if (identOpt.isEmpty()) {
- continue;
- }
- NameIdentifier ident = identOpt.get();
-
- if (catalogManager.consumeLocalMutation(ident)) {
- LOG.debug(
- "Skipping catalog cache invalidation for local mutation: {},
change log id {}",
- ident,
- change.getId());
- continue;
- }
-
- // Logged at INFO on purpose: this tears down the cached catalog,
including its connection
- // pool and isolated classloader, and it is the main cross-node effect
of the change log.
- // CatalogManager logs the matching "Closing catalog" line when the
eviction runs.
- LOG.info(
- "Invalidating catalog cache for {} due to a remote {} recorded in
change log id {}",
+ localMutation = catalogManager.consumeLocalMutation(ident);
+ } catch (RuntimeException e) {
+ // The identifier is valid, so this record may name a remote mutation.
Treating an unknown
Review Comment:
What's the meaning of "name a remote mutation"? The comment is really hard
to understand.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]