github-actions[bot] commented on code in PR #66018:
URL: https://github.com/apache/doris/pull/66018#discussion_r3663697749
##########
fe/be-java-extensions/paimon-scanner/src/main/java/org/apache/doris/paimon/PaimonJniScanner.java:
##########
@@ -574,6 +577,39 @@ private void initTable() {
}
}
+ private void initTableAndReader() throws IOException {
+ // Old FE Version maybe not contains serialized_table_cache_key, maybe
need delete now is 4.x
+ if (tableCacheKey == null || tableCacheKey.isEmpty()) {
+ initTable();
+ initReader();
+ return;
+ }
+ PaimonTableCache.TableCacheEntry cachedEntry =
PaimonTableCache.acquire(tableCacheKey);
+ if (cachedEntry != null) {
+ // get from cache
+ tableCacheEntry = cachedEntry;
Review Comment:
[P2] Release the serialized loader payload after resolving the table. Every
scanner still receives a freshly allocated Java string for serialized_table and
stores it in the long-lived params map. On this warm-hit path the value is
never deserialized, yet it remains reachable until the split scanner is
destroyed, so N concurrent warm scanners retain N full Base64 table payloads
even though the cache shares the Table object. Remove the loader-only entry
after a hit or successful deserialize (and add a warm-hit retention test) so
the memory optimization also removes this avoidable Java-heap scaling.
##########
fe/be-java-extensions/paimon-scanner/src/main/java/org/apache/doris/paimon/PaimonTableCache.java:
##########
@@ -0,0 +1,82 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.paimon;
+
+import com.google.common.base.Preconditions;
+import org.apache.paimon.table.Table;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
+final class PaimonTableCache {
+ private static final ConcurrentHashMap<String, TableCacheEntry>
TABLE_CACHE = new ConcurrentHashMap<>();
+
+ private PaimonTableCache() {
+ }
+
+ static TableCacheEntry acquire(String cacheKey) {
Review Comment:
[P2] Expose cache outcomes in the scanner profile. This new
memory/performance cache records no production hit, miss/load, publication
race, active-entry, or lease statistics; size() is test-only. A successful warm
reuse is therefore indistinguishable from the known cold stampede or close-gap
reload, so operators cannot verify the optimization or diagnose its memory
behavior. Please export per-scanner outcome deltas and true occupancy/lease
gauges through PaimonJniScanner.getStatistics()—not repeated process-global
cumulative snapshots, which the native collectors would overcount—and add
counter-semantics tests.
--
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]