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
35 changes: 1 addition & 34 deletions server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
import org.apache.iotdb.db.query.dataset.ShowDevicesResult;
import org.apache.iotdb.db.query.dataset.ShowTimeSeriesResult;
import org.apache.iotdb.db.rescon.MemTableManager;
import org.apache.iotdb.db.rescon.PrimitiveArrayManager;
import org.apache.iotdb.db.utils.RandomDeleteCache;
import org.apache.iotdb.db.utils.SchemaUtils;
import org.apache.iotdb.db.utils.TestOnly;
Expand Down Expand Up @@ -154,8 +153,6 @@ public class MManager {
// tag key -> tag value -> LeafMNode
private Map<String, Map<String, Set<MeasurementMNode>>> tagIndex = new ConcurrentHashMap<>();

// data type -> number
private Map<TSDataType, Integer> schemaDataTypeNumMap = new ConcurrentHashMap<>();
private AtomicLong totalSeriesNumber = new AtomicLong();
private boolean initialized;
protected static IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
Expand Down Expand Up @@ -332,7 +329,6 @@ public void clear() {
tagLogFile.close();
tagLogFile = null;
}
this.schemaDataTypeNumMap.clear();
initialized = false;
if (config.isEnableMTreeSnapshot() && timedCreateMTreeSnapshotThread != null) {
timedCreateMTreeSnapshotThread.shutdownNow();
Expand Down Expand Up @@ -473,7 +469,6 @@ public void createTimeseries(CreateTimeSeriesPlan plan, long offset) throws Meta
logger.warn("Current series number {} is too large...", totalSeriesNumber);
allowToCreateNewSeries = false;
}
updateSchemaDataTypeNumMap(type, 1);

// write log
if (!isRecovering) {
Expand Down Expand Up @@ -565,9 +560,6 @@ public void createAlignedTimeSeries(CreateAlignedTimeSeriesPlan plan) throws Met
logger.warn("Current series number {} is too large...", totalSeriesNumber);
allowToCreateNewSeries = false;
}
for (TSDataType type : dataTypes) {
updateSchemaDataTypeNumMap(type, 1);
}
// write log
if (!isRecovering) {
logWriter.createAlignedTimeseries(plan);
Expand Down Expand Up @@ -695,19 +687,12 @@ private PartialPath deleteOneTimeseriesUpdateStatisticsAndDropTrigger(PartialPat
int timeseriesNum = 0;
if (schema instanceof MeasurementSchema) {
removeFromTagInvertedIndex(pair.right);
updateSchemaDataTypeNumMap(schema.getType(), -1);
timeseriesNum = 1;
} else if (schema instanceof VectorMeasurementSchema) {
for (TSDataType dataType : schema.getValueTSDataTypeList()) {
updateSchemaDataTypeNumMap(dataType, -1);
timeseriesNum++;
}
timeseriesNum += schema.getValueTSDataTypeList().size();
}
PartialPath storageGroupPath = pair.left;

// update statistics in schemaDataTypeNumMap
updateSchemaDataTypeNumMap(pair.right.getSchema().getType(), -1);

// drop trigger with no exceptions
TriggerEngine.drop(pair.right);

Expand Down Expand Up @@ -762,8 +747,6 @@ public void deleteStorageGroups(List<PartialPath> storageGroups) throws Metadata
List<MeasurementMNode> leafMNodes = mtree.deleteStorageGroup(storageGroup);
for (MeasurementMNode leafMNode : leafMNodes) {
removeFromTagInvertedIndex(leafMNode);
// update statistics in schemaDataTypeNumMap
updateSchemaDataTypeNumMap(leafMNode.getSchema().getType(), -1);
}

// drop triggers with no exceptions
Expand All @@ -783,22 +766,6 @@ public void deleteStorageGroups(List<PartialPath> storageGroups) throws Metadata
}
}

/**
* update statistics in schemaDataTypeNumMap
*
* @param type data type
* @param num 1 for creating timeseries and -1 for deleting timeseries
*/
private synchronized void updateSchemaDataTypeNumMap(TSDataType type, int num) {
// add an array of the series type
schemaDataTypeNumMap.put(type, schemaDataTypeNumMap.getOrDefault(type, 0) + num);
// add an array of time
schemaDataTypeNumMap.put(
TSDataType.INT64, schemaDataTypeNumMap.getOrDefault(TSDataType.INT64, 0) + num);

PrimitiveArrayManager.updateSchemaDataTypeNum(schemaDataTypeNumMap, totalSeriesNumber.get());
}

/**
* Check if the given path is storage group or not.
*
Expand Down
Loading