Skip to content

Commit 86741a8

Browse files
authored
Fix compaction test metadata lease cleanup (#18172)
1 parent 350c6c7 commit 86741a8

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/AbstractCompactionTest.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.apache.iotdb.db.storageengine.dataregion.compaction;
2121

22+
import org.apache.iotdb.commons.conf.CommonDescriptor;
2223
import org.apache.iotdb.commons.conf.IoTDBConstant;
2324
import org.apache.iotdb.commons.exception.IllegalPathException;
2425
import org.apache.iotdb.commons.exception.MetadataException;
@@ -31,6 +32,7 @@
3132
import org.apache.iotdb.db.exception.StorageEngineException;
3233
import org.apache.iotdb.db.queryengine.execution.fragment.FragmentInstanceContext;
3334
import org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache.TreeDeviceSchemaCacheManager;
35+
import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseManager;
3436
import org.apache.iotdb.db.storageengine.buffer.BloomFilterCache;
3537
import org.apache.iotdb.db.storageengine.buffer.ChunkCache;
3638
import org.apache.iotdb.db.storageengine.buffer.TimeSeriesMetadataCache;
@@ -154,6 +156,9 @@ public class AbstractCompactionTest {
154156
private final long oldLongestExpiredTime =
155157
IoTDBDescriptor.getInstance().getConfig().getMaxExpiredTime();
156158

159+
private final long oldMetadataLeaseFenceMs =
160+
CommonDescriptor.getInstance().getConfig().getMetadataLeaseFenceMs();
161+
157162
protected static File STORAGE_GROUP_DIR =
158163
new File(
159164
TestConstant.BASE_OUTPUT_PATH
@@ -200,6 +205,8 @@ public class AbstractCompactionTest {
200205

201206
public void setUp()
202207
throws IOException, WriteProcessException, MetadataException, InterruptedException {
208+
CommonDescriptor.getInstance().getConfig().setMetadataLeaseFenceMs(Long.MAX_VALUE);
209+
MetadataLeaseManager.getInstance().recoveryLeaseForTest(true);
203210
fileCount = 0;
204211
if (!SEQ_DIRS.exists()) {
205212
Assert.assertTrue(SEQ_DIRS.mkdirs());
@@ -495,6 +502,8 @@ public void tearDown() throws IOException, StorageEngineException {
495502
.getConfig()
496503
.setInnerCompactionTaskSelectionModsFileThreshold(oldModsFileSize);
497504
IoTDBDescriptor.getInstance().getConfig().setMaxExpiredTime(oldLongestExpiredTime);
505+
CommonDescriptor.getInstance().getConfig().setMetadataLeaseFenceMs(oldMetadataLeaseFenceMs);
506+
MetadataLeaseManager.getInstance().recoveryLeaseForTest(true);
498507
TSFileDescriptor.getInstance().getConfig().setGroupSizeInByte(oldChunkGroupSize);
499508

500509
TSFileDescriptor.getInstance().getConfig().setMaxNumberOfPointsInPage(oldPagePointMaxNumber);

0 commit comments

Comments
 (0)