github-actions[bot] commented on code in PR #69705:
URL: https://github.com/apache/doris/pull/69705#discussion_r4391386989
##########
regression-test/suites/cloud_p0/cache/ttl/test_ttl_lru_evict.groovy:
##########
@@ -206,65 +209,53 @@ suite("test_ttl_lru_evict") {
}
}
- clearFileCache.call() {
- respCode, body -> {}
- }
-
- long ttl_cache_evict_size_begin = 0;
- getMetricsMethod.call() {
- respCode, body ->
- assertEquals("${respCode}".toString(), "200")
- String out = "${body}".toString()
- def strs = out.split('\n')
- Boolean flag1 = false;
- for (String line in strs) {
- if (flag1) break;
- if (line.contains("ttl_cache_evict_size")) {
- if (line.startsWith("#")) {
+ // Values of every metric line whose name contains the given name, one per
cache path.
+ def getMetricValues = { String name ->
+ def values = []
+ getMetricsMethod.call() {
+ respCode, body ->
+ assertEquals("${respCode}".toString(), "200")
+ for (String line in "${body}".toString().split('\n')) {
+ if (line.startsWith("#") || !line.contains(name)) {
continue
}
- def i = line.indexOf(' ')
- ttl_cache_evict_size_begin = line.substring(i).toLong()
- flag1 = true
+ values.add(line.substring(line.indexOf('
')).trim().toLong())
}
- }
- assertTrue(flag1)
+ }
+ assertTrue(!values.isEmpty(), "metric ${name} not found")
+ return values
}
- // load for MANY times to this dup table to make cache full enough to evict
- // It will takes huge amount of time, so it should be p1/p2 level case.
- // But someone told me it is the right place. Never mind just do it!
+ clearFileCache.call() {
+ respCode, body -> {}
+ }
- for (int i = 0; i < 10; i++) {
+ long ttl_cache_evict_size_begin =
getMetricValues("ttl_cache_evict_size")[0]
+ long ttl_cache_size_begin = getMetricValues("ttl_cache_size")[0]
+ long cache_capacity = getMetricValues("file_cache_capacity").sum()
+
+ // first, we test whether ttl evict actively.
+ // Load to this dup table until the TTL queue overflows. A fixed number of
loads only
+ // overflows it on a small enough cache, so keep loading, bounded by the
cache capacity.
+ long evicted = 0
+ long loads = 0
+ long max_loads = 10
+ while (evicted <= 238860800 && loads < max_loads) {
load_customer_once("customer_ttl")
+ loads++
+ if (loads == 1) {
+ long bytes_per_load = getMetricValues("ttl_cache_size")[0] -
ttl_cache_size_begin
Review Comment:
[P2] Refresh the TTL-size gauge before measuring the first load
`file_cache_ttl_cache_size` is updated only by `run_background_monitor()`
after its interval (5 seconds by default); neither synchronous clear nor a
FINISHED load refreshes it. If this BE previously had more TTL bytes than the
first load produces, `ttl_cache_size_begin` can still contain that pre-clear
sample, so this subtraction becomes negative and the new assertion fails on a
healthy cache. A longer monitor interval can also leave both reads identical.
Establish a refreshed post-clear baseline and wait for a post-load sample, or
measure the actual cache entries before computing `bytes_per_load` and the load
bound.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]