This is an automated email from the ASF dual-hosted git repository. yuqi1129 pushed a commit to branch issue_11221_gravitino_home_pid in repository https://gitbox.apache.org/repos/asf/gravitino.git
commit 4b8d36bc08540246768be568c8686b38066169ad Author: yuqi <[email protected]> AuthorDate: Tue May 26 21:46:52 2026 +0800 fix a fakay test --- .../gravitino/stats/storage/LancePartitionStatisticStorage.java | 3 ++- .../gravitino/stats/storage/TestLancePartitionStatisticStorage.java | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/apache/gravitino/stats/storage/LancePartitionStatisticStorage.java b/core/src/main/java/org/apache/gravitino/stats/storage/LancePartitionStatisticStorage.java index ec2579f7a7..5755d1bd56 100644 --- a/core/src/main/java/org/apache/gravitino/stats/storage/LancePartitionStatisticStorage.java +++ b/core/src/main/java/org/apache/gravitino/stats/storage/LancePartitionStatisticStorage.java @@ -21,6 +21,7 @@ package org.apache.gravitino.stats.storage; import com.fasterxml.jackson.core.JsonProcessingException; import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.RemovalCause; import com.github.benmanes.caffeine.cache.RemovalListener; import com.github.benmanes.caffeine.cache.Scheduler; import com.google.common.annotations.VisibleForTesting; @@ -207,7 +208,7 @@ public class LancePartitionStatisticStorage implements PartitionStatisticStorage .removalListener( (RemovalListener<Long, DatasetHolder>) (key, value, cause) -> { - if (value != null) { + if (value != null && cause != RemovalCause.EXPLICIT) { closeDatasetHolder(value); } }) diff --git a/core/src/test/java/org/apache/gravitino/stats/storage/TestLancePartitionStatisticStorage.java b/core/src/test/java/org/apache/gravitino/stats/storage/TestLancePartitionStatisticStorage.java index 5a6ae16e98..79d3525700 100644 --- a/core/src/test/java/org/apache/gravitino/stats/storage/TestLancePartitionStatisticStorage.java +++ b/core/src/test/java/org/apache/gravitino/stats/storage/TestLancePartitionStatisticStorage.java @@ -662,6 +662,12 @@ public class TestLancePartitionStatisticStorage { properties.put("location", location); properties.put("datasetCacheSize", "10"); + EntityStore entityStore = mock(EntityStore.class); + TableEntity tableEntity = mock(TableEntity.class); + when(entityStore.get(any(), any(), any())).thenReturn(tableEntity); + when(tableEntity.id()).thenReturn(1L); + FieldUtils.writeField(GravitinoEnv.getInstance(), "entityStore", entityStore, true); + LancePartitionStatisticStorage storage = new LancePartitionStatisticStorage(properties); try {
