-
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] Introduce CacheStats and expose ScanStats #4678
Conversation
d3fb51e
to
223e7bc
Compare
223e7bc
to
1213bad
Compare
@JingsongLi Ready for review now, PTAL, thx~ |
paimon-core/src/main/java/org/apache/paimon/catalog/CachingCatalog.java
Outdated
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/utils/ObjectsCache.java
Outdated
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/operation/metrics/CatalogCacheStats.java
Outdated
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/catalog/CachingCatalog.java
Outdated
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/operation/metrics/CatalogCacheStats.java
Outdated
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/operation/metrics/CatalogCacheStats.java
Outdated
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/operation/metrics/CatalogCacheStats.java
Outdated
Show resolved
Hide resolved
public class CatalogCacheStats { | ||
private long databaseCacheSize; | ||
private long tableCacheSize; | ||
private long manifestCacheSize; |
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.
What it means? Memory size or something else?
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.
Size. I added a new long value to evaluate bytes in mem.
@@ -305,6 +316,23 @@ public void invalidateTable(Identifier identifier) { | |||
} | |||
} | |||
|
|||
public CatalogCacheStats getCatalogCacheStats() { |
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.
where call this method?
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.
It's for other engine to see these stats when selecting a Paimon table.
this.databaseCacheSize = databaseCacheSize; | ||
} | ||
|
||
public long getTableCacheSize() { |
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.
where call these four getXXX method?
this.missedObject = new AtomicLong(0); | ||
} | ||
|
||
public AtomicLong getHitObject() { |
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.
when call this method?
paimon-core/src/main/java/org/apache/paimon/operation/metrics/ScanMetrics.java
Outdated
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/table/source/snapshot/SnapshotReaderImpl.java
Outdated
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/utils/ObjectsFile.java
Outdated
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/utils/SegmentsCache.java
Outdated
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/catalog/CachingCatalog.java
Outdated
Show resolved
Hide resolved
public static final ConfigOption<Boolean> CACHE_STATS_ENABLED = | ||
key("cache.cache-stats-enabled") | ||
.booleanType() | ||
.defaultValue(false) |
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 default value is false?
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.
Don't want to affect other engines who do not need this metrics. You think true is better?
b180968
to
ca1cf74
Compare
paimon-core/src/main/java/org/apache/paimon/table/system/AuditLogTable.java
Outdated
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/operation/AbstractFileStoreScan.java
Outdated
Show resolved
Hide resolved
paimon-core/src/main/java/org/apache/paimon/operation/metrics/ObjectCacheStats.java
Outdated
Show resolved
Hide resolved
4cfb98b
to
64f7419
Compare
paimon-core/src/main/java/org/apache/paimon/operation/AbstractFileStoreScan.java
Outdated
Show resolved
Hide resolved
64f7419
to
e299d86
Compare
} | ||
|
||
public void reportScan(ScanStats scanStats) { | ||
latestScan = scanStats; | ||
durationHistogram.update(scanStats.getDuration()); | ||
} | ||
|
||
public void reportCache(CacheMetrics cacheMetrics) { | ||
this.cacheMetrics = cacheMetrics; |
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 set cacheMetrics again? You should use this cacheMetrics...
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.
Just want to make the code unified....
+1 |
Purpose
Linked issue: close #xxx
Add CacheSizes for CachingCatalog and CacheMetrics for ObjectCache so that engine can get cache stats at query level.
Tests
added
API and Format
CachingCatalog.estimatedCacheSizes
ScanMetrics.getLatestScan
ScanMetrics.getCacheMetrics
Documentation
added