Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,9 @@ public boolean equals(Object other) {
* selected files to false.
*/
protected void releaseAllLocks() {
if (isHoldingWriteLock == null) {
return;
}
for (int i = 0; i < filesView.sourceFilesInLog.size(); ++i) {
TsFileResource resource = filesView.sourceFilesInLog.get(i);
if (isHoldingWriteLock[i]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@

package org.apache.iotdb.db.storageengine.dataregion.compaction.inner;

import org.apache.iotdb.commons.conf.CommonDescriptor;
import org.apache.iotdb.commons.conf.IoTDBConstant;
import org.apache.iotdb.commons.exception.IllegalPathException;
import org.apache.iotdb.commons.utils.JVMCommonUtils;
import org.apache.iotdb.db.storageengine.dataregion.compaction.constant.CompactionTaskType;
import org.apache.iotdb.db.storageengine.dataregion.compaction.execute.exception.CompactionExceptionHandler;
import org.apache.iotdb.db.storageengine.dataregion.compaction.execute.performer.ICompactionPerformer;
import org.apache.iotdb.db.storageengine.dataregion.compaction.execute.performer.impl.FastCompactionPerformer;
import org.apache.iotdb.db.storageengine.dataregion.compaction.execute.task.InnerSpaceCompactionTask;
import org.apache.iotdb.db.storageengine.dataregion.compaction.execute.task.subtask.FastCompactionTaskSummary;
import org.apache.iotdb.db.storageengine.dataregion.compaction.execute.utils.CompactionUtils;
import org.apache.iotdb.db.storageengine.dataregion.compaction.execute.utils.log.CompactionLogger;
Expand Down Expand Up @@ -56,6 +59,19 @@ public class InnerSpaceCompactionExceptionTest extends AbstractInnerSpaceCompact

ICompactionPerformer performer = new FastCompactionPerformer(false);

@Test
public void testDiskSpaceInsufficient() throws IOException {
JVMCommonUtils.setDiskSpaceWarningThreshold(1);
try {
InnerSpaceCompactionTask task =
new InnerSpaceCompactionTask(0, tsFileManager, seqResources, true, performer, 0);
Assert.assertFalse(task.start());
} finally {
JVMCommonUtils.setDiskSpaceWarningThreshold(
CommonDescriptor.getInstance().getConfig().getDiskSpaceWarningThreshold());
}
}

/**
* Test when all source files exist, and target file is not complete. System should delete target
* file and its resource at this time.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class JVMCommonUtils {

private static final int CPUS = Runtime.getRuntime().availableProcessors();

private static final double diskSpaceWarningThreshold =
private static double diskSpaceWarningThreshold =
CommonDescriptor.getInstance().getConfig().getDiskSpaceWarningThreshold();

/**
Expand Down Expand Up @@ -123,4 +123,9 @@ public static int getCpuCores() {
public static int getMaxExecutorPoolSize() {
return MAX_EXECUTOR_POOL_SIZE;
}

@TestOnly
public static void setDiskSpaceWarningThreshold(double threshold) {
diskSpaceWarningThreshold = threshold;
}
}
Loading