未验证 提交 619172ff 编写于 作者: H HTHou

fix sonar

上级 4b023b75
......@@ -136,10 +136,7 @@ public class VmMergeUtils {
for (RestorableTsFileIOWriter vmWriter : vmWriters) {
TsFileSequenceReader reader = buildReaderFromVmWriter(vmWriter,
writer, tsFileSequenceReaderMap, storageGroup);
if (reader == null) {
continue;
}
if (!vmWriter.getMetadatasForQuery().containsKey(deviceId)) {
if (reader == null || !vmWriter.getMetadatasForQuery().containsKey(deviceId)) {
continue;
}
List<ChunkMetadata> chunkMetadataList = vmWriter.getMetadatasForQuery()
......
......@@ -594,7 +594,7 @@ public class StorageGroupProcessor {
}
vmTsFileResourceMap.values()
.forEach(tsFileResources -> tsFileResources
.forEach((subVmTsFileResources) -> subVmTsFileResources.sort(this::compareVMFileName)));
.forEach(subVmTsFileResources -> subVmTsFileResources.sort(this::compareVMFileName)));
return vmTsFileResourceMap;
}
......@@ -632,7 +632,7 @@ public class StorageGroupProcessor {
writer = pair.left;
vmWriters = pair.right;
vmWriters.forEach(
(subVmWriters) -> subVmWriters.forEach(RestorableTsFileIOWriter::makeMetadataVisible));
subVmWriters -> subVmWriters.forEach(RestorableTsFileIOWriter::makeMetadataVisible));
} catch (StorageGroupProcessorException e) {
logger.warn("Skip TsFile: {} because of error in recover: ", tsFileResource.getTsFilePath(),
e);
......@@ -2244,7 +2244,6 @@ public class StorageGroupProcessor {
* @param filePartitionId the partition id of the new file
* @return load the file successfully
* @UsedBy sync module, load external tsfile module.
* @UsedBy sync module, load external tsfile module.
*/
private boolean loadTsFileByType(LoadTsFileType type, File syncedTsFile,
TsFileResource tsFileResource, long filePartitionId)
......
......@@ -608,14 +608,14 @@ public class TsFileProcessor {
try {
TimeUnit.MILLISECONDS.sleep(1);
File parent = tsFileResource.getTsFile().getParentFile();
File newVmFile = FSFactoryProducer.getFSFactory().getFile(parent,
return FSFactoryProducer.getFSFactory().getFile(parent,
tsFileResource.getTsFile().getName() + IoTDBConstant.FILE_NAME_SEPARATOR + level
+ IoTDBConstant.FILE_NAME_SEPARATOR + System
.currentTimeMillis() + VM_SUFFIX);
return newVmFile;
} catch (InterruptedException e) {
logger.error("{}: {}, closing task is interrupted.",
storageGroupName, tsFileResource.getTsFile().getName(), e);
Thread.currentThread().interrupt();
return null;
} finally {
vmFileCreateLock.writeLock().unlock();
......@@ -716,7 +716,7 @@ public class TsFileProcessor {
if (config.isEnableVm()) {
logger.info("[Flush] flush a vm");
File newVmFile = createNewVMFile(tsFileResource, 0);
if (vmWriters.size() <= 0) {
if (vmWriters.isEmpty()) {
vmWriters.add(new ArrayList<>());
vmTsFileResources.add(new ArrayList<>());
}
......@@ -1174,15 +1174,15 @@ public class TsFileProcessor {
try {
TimeUnit.MILLISECONDS.sleep(1);
File parent = writer.getFile().getParentFile();
File newTmpFile = FSFactoryProducer.getFSFactory().getFile(parent,
return FSFactoryProducer.getFSFactory().getFile(parent,
writer.getFile().getName() + IoTDBConstant.FILE_NAME_SEPARATOR + System
.currentTimeMillis()
+ VM_SUFFIX + IoTDBConstant.PATH_SEPARATOR
+ PATH_UPGRADE);
return newTmpFile;
} catch (InterruptedException e) {
logger.error("{}: {}, closing task is interrupted.",
storageGroupName, tsFileResource.getTsFile().getName(), e);
Thread.currentThread().interrupt();
return null;
} finally {
vmFileCreateLock.writeLock().unlock();
......
......@@ -719,8 +719,8 @@ public class TsFileResource {
}
/**
* Used when load new TsFiles not generated by the server Check and get the time partition TODO:
* when the partition violation happens, split the file and load into different partitions
* Used when load new TsFiles not generated by the server Check and get the time partition
* TODO:when the partition violation happens, split the file and load into different partitions
*
* @throws PartitionViolationException if the data of the file cross partitions or it is empty
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册