Skip to content
Permalink
Browse files
[IOTDB-4222] Create data region repeatedly when concurrently deleting…
… and creating storage groups (#7112)
HeimingZ committed on Aug 25
1 parent 2513190 commit 94657cf836ea6407cfd374f36324333e8194b919
Showing 1 changed file with 3 additions and 2 deletions.
}

@SuppressWarnings("java:S2445")
// actually storageGroupMNode is a unique object on the mtree, synchronize it is reasonable
public DataRegion getProcessor(IStorageGroupMNode storageGroupMNode, int dataRegionId)
throws DataRegionException, StorageEngineException {
DataRegion processor = dataRegion[dataRegionId];
if (processor == null) {
// if finish recover
if (isDataRegionReady[dataRegionId].get()) {
synchronized (storageGroupMNode) {
// it's unsafe to synchronize MNode here because
// concurrent deletions and creations will create a new MNode
synchronized (isDataRegionReady[dataRegionId]) {
processor = dataRegion[dataRegionId];
if (processor == null) {
processor =
StorageEngine.getInstance()
.buildNewStorageGroupProcessor(
storageGroupMNode.getPartialPath(),
storageGroupMNode,
String.valueOf(dataRegionId));
dataRegion[dataRegionId] = processor;

COLLECTOR-SAHAB / covering test: testRecover

processor.config.startUpNanosecond=3986748360747 only occurs in the patched version.

COLLECTOR-SAHAB / covering test: testRecover

processor.config.startUpNanosecond=2864588280556 only occurs in the original version.

}
}
} else {
// not finished recover, refuse the request
throw new StorageGroupNotReadyException(
storageGroupMNode.getFullPath(), TSStatusCode.STORAGE_GROUP_NOT_READY.getStatusCode());
}
}
return processor;

COLLECTOR-SAHAB / covering test: testRecover

{return-object}.config.startUpNanosecond=3986748360747 only occurs in the patched version.

COLLECTOR-SAHAB / covering test: testRecover

{return-object}.config.startUpNanosecond=2864588280556 only occurs in the original version.

}
/**

0 comments on commit 94657cf

Please sign in to comment.