jixuan1989 commented on a change in pull request #2468:
URL: https://github.com/apache/iotdb/pull/2468#discussion_r579747024
##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
##########
@@ -1828,30 +1829,14 @@ public MNode
getSeriesSchemasAndReadLockDevice(InsertPlan plan) throws MetadataE
MNode deviceMNode = getDeviceNodeWithAutoCreate(deviceId);
// 2. get schema of each measurement
+ // if do not has measurement
+ MeasurementMNode measurementMNode;
+ TSDataType dataType;
for (int i = 0; i < measurementList.length; i++) {
try {
- // if do not has measurement
- MeasurementMNode measurementMNode;
- if (!deviceMNode.hasChild(measurementList[i])) {
- // could not create it
- if (!config.isAutoCreateSchemaEnabled()) {
- // but measurement not in MTree and cannot auto-create, try the
cache
- measurementMNode = getMeasurementMNode(deviceMNode,
measurementList[i]);
- if (measurementMNode == null) {
- throw new PathNotExistException(deviceId + PATH_SEPARATOR +
measurementList[i]);
- }
- } else {
- // create it
-
- TSDataType dataType = getTypeInLoc(plan, i);
- // create it, may concurrent created by multiple thread
- internalCreateTimeseries(deviceId.concatNode(measurementList[i]),
dataType);
- measurementMNode = (MeasurementMNode)
deviceMNode.getChild(measurementList[i]);
- }
- } else {
- measurementMNode = getMeasurementMNode(deviceMNode,
measurementList[i]);
- }
-
+ dataType = getTypeInLoc(plan, i);
Review comment:
`getTypeInLoc` is not a lightweight function in some cases.
Therefore, I do not think putting `isAutoCreateSchemaEnabled()` check behind
of this is a good change.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]