-
Notifications
You must be signed in to change notification settings - Fork 988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] Add cache for snapshots in CachingCatalog #4565
Conversation
SNAPSHOT_CACHE.put(path, snapshot); | ||
} | ||
return snapshot; | ||
} catch (FileNotFoundException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we can only catch IOException? There's no need to catch FileNotFoundException and throw it direct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tryFromPath
is just for FileNotFoundException
, invoker can know the file does not exists.
invalidateMetaCacheForPrefix(SCHEMA_CACHE, path); | ||
} | ||
|
||
private static void invalidateMetaCacheForPrefix(Cache<Path, ?> cache, String tablePath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be invalidateMetaCacheByPrefix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted
import org.apache.paimon.schema.TableSchema; | ||
import org.apache.paimon.tag.Tag; | ||
|
||
/** Cache for {@link Snapshot} and {@link Tag} and {@link TableSchema}. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this class reserved for future use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted
@@ -680,6 +681,9 @@ protected void dropTableImpl(Identifier identifier) { | |||
false, | |||
true)); | |||
|
|||
Path path = getTableLocation(identifier); | |||
invalidateMetaCacheForPrefix(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May invalidateMetaCacheForPrefix(path) can execute in AbstractCatalog#dropTable after dropTableImpl(identifier)?
Because If a new Catalog @OverRide AbstractCatalog#dropTableImpl, it may forget to call invalidateMetaCacheForPrefix(path).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted
} | ||
} | ||
|
||
public static Tag tryFromPath(FileIO fileIO, Path path) throws FileNotFoundException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not cache Tag and Changelog like Snapshot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tag is mutable, it is danger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
mark! |
Purpose
Considering that all snapshot files are immutable, we are considering adding cache to them. It is safe to cache them in Table Object.
Tests
API and Format
Documentation