This is an automated email from the ASF dual-hosted git repository.
zyk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 1bb7b0ac5e Remove code of last cache for old standalone (#8075)
1bb7b0ac5e is described below
commit 1bb7b0ac5e2dc4c4d6d0c5d9463d945561e504db
Author: Marcos_Zyk <[email protected]>
AuthorDate: Mon Nov 21 22:38:13 2022 +0800
Remove code of last cache for old standalone (#8075)
Remove code of last cache for old standalone (#8075)
---
.../apache/iotdb/db/integration/IoTDBLastIT.java | 102 ---------
.../schemaregion/rocksdb/mnode/REntityMNode.java | 11 -
.../rocksdb/mnode/RMeasurementMNode.java | 11 -
.../utils/ShowTimeSeriesResultUtils.java | 4 +-
.../iotdb/db/metadata/LocalSchemaProcessor.java | 126 ----------
.../metadata/cache/DataNodeLastCacheManager.java | 2 +-
.../iotdb/db/metadata/cache/SchemaCacheEntry.java | 4 +-
.../lastCache/container/ILastCacheContainer.java | 2 +-
.../lastCache/container/LastCacheContainer.java | 6 +-
.../lastCache/container/value/ILastCacheValue.java | 2 +-
.../lastCache/container/value/LastCacheValue.java | 2 +-
.../apache/iotdb/db/metadata/idtable/IDTable.java | 25 --
.../db/metadata/idtable/IDTableHashmapImpl.java | 32 ---
.../idtable/entry/InsertMeasurementMNode.java | 9 -
.../db/metadata/idtable/entry/SchemaEntry.java | 60 +----
.../db/metadata/lastCache/LastCacheManager.java | 255 ---------------------
.../iotdb/db/metadata/mnode/EntityMNode.java | 24 --
.../iotdb/db/metadata/mnode/IEntityMNode.java | 6 -
.../iotdb/db/metadata/mnode/IMeasurementMNode.java | 5 -
.../iotdb/db/metadata/mnode/MeasurementMNode.java | 21 --
.../mnode/estimator/BasicMNodSizeEstimator.java | 6 +-
.../db/metadata/mtree/MTreeBelowSGCachedImpl.java | 3 +-
.../db/metadata/mtree/MTreeBelowSGMemoryImpl.java | 3 +-
.../schemaregion/SchemaRegionMemoryImpl.java | 4 +-
.../schemaregion/SchemaRegionSchemaFileImpl.java | 4 +-
.../iotdb/db/query/executor/LastQueryExecutor.java | 65 +-----
.../iotdb/db/metadata/SchemaAdvancedTest.java | 25 --
.../iotdb/db/metadata/idtable/IDTableTest.java | 66 ------
.../db/metadata/idtable/LastQueryWithIDTable.java | 145 ------------
.../db/metadata/idtable/entry/SchemaEntryTest.java | 18 --
30 files changed, 24 insertions(+), 1024 deletions(-)
diff --git
a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBLastIT.java
b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBLastIT.java
index e5589e2df8..a2e3ca93d5 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBLastIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/IoTDBLastIT.java
@@ -19,7 +19,6 @@
package org.apache.iotdb.db.integration;
import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.service.IoTDB;
import org.apache.iotdb.db.utils.EnvironmentUtils;
import org.apache.iotdb.integration.env.EnvFactory;
import org.apache.iotdb.itbase.category.LocalStandaloneTest;
@@ -187,101 +186,6 @@ public class IoTDBLastIT {
}
}
- @Test
- public void lastCacheUpdateTest() {
- String[] retArray =
- new String[] {
- "500,root.ln.wf01.wt01.temperature,22.1,DOUBLE",
- "500,root.ln.wf01.wt01.status,false,BOOLEAN",
- "500,root.ln.wf01.wt01.id,5,INT32",
- "700,root.ln.wf01.wt01.temperature,33.1,DOUBLE",
- "700,root.ln.wf01.wt01.status,false,BOOLEAN",
- "700,root.ln.wf01.wt01.id,3,INT32",
- "700,root.ln.wf01.wt01.temperature,33.1,DOUBLE",
- "700,root.ln.wf01.wt01.status,false,BOOLEAN",
- "700,root.ln.wf01.wt01.id,3,INT32"
- };
-
- try (Connection connection = EnvFactory.getEnv().getConnection();
- Statement statement = connection.createStatement()) {
-
- boolean hasResultSet =
- statement.execute("select last temperature,status,id from
root.ln.wf01.wt01");
-
- assertTrue(hasResultSet);
- int cnt = 0;
- try (ResultSet resultSet = statement.getResultSet()) {
- while (resultSet.next()) {
- String ans =
- resultSet.getString(TIMESTAMP_STR)
- + ","
- + resultSet.getString(TIMESEIRES_STR)
- + ","
- + resultSet.getString(VALUE_STR)
- + ","
- + resultSet.getString(DATA_TYPE_STR);
- Assert.assertEquals(retArray[cnt], ans);
- cnt++;
- }
- }
-
- PartialPath path = new PartialPath("root.ln.wf01.wt01.temperature");
- IoTDB.schemaProcessor.resetLastCache(path);
-
- statement.execute(
- "insert into root.ln.wf01.wt01(time, temperature, status, id)
values(700, 33.1, false, 3)");
-
- // Last cache is updated with above insert sql
- long time = IoTDB.schemaProcessor.getLastCache(path).getTimestamp();
- Assert.assertEquals(700, time);
-
- hasResultSet = statement.execute("select last temperature,status,id from
root.ln.wf01.wt01");
- assertTrue(hasResultSet);
- try (ResultSet resultSet = statement.getResultSet()) {
- while (resultSet.next()) {
- String ans =
- resultSet.getString(TIMESTAMP_STR)
- + ","
- + resultSet.getString(TIMESEIRES_STR)
- + ","
- + resultSet.getString(VALUE_STR)
- + ","
- + resultSet.getString(DATA_TYPE_STR);
- Assert.assertEquals(retArray[cnt], ans);
- cnt++;
- }
- }
-
- statement.execute(
- "insert into root.ln.wf01.wt01(time, temperature, status, id)
values(600, 19.1, false, 1)");
-
- // Last cache is not updated with above insert sql
- time = IoTDB.schemaProcessor.getLastCache(path).getTimestamp();
- Assert.assertEquals(700, time);
-
- hasResultSet = statement.execute("select last temperature,status,id from
root.ln.wf01.wt01");
- assertTrue(hasResultSet);
- try (ResultSet resultSet = statement.getResultSet()) {
- while (resultSet.next()) {
- String ans =
- resultSet.getString(TIMESTAMP_STR)
- + ","
- + resultSet.getString(TIMESEIRES_STR)
- + ","
- + resultSet.getString(VALUE_STR)
- + ","
- + resultSet.getString(DATA_TYPE_STR);
- Assert.assertEquals(retArray[cnt], ans);
- cnt++;
- }
- }
- Assert.assertEquals(cnt, retArray.length);
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
@Test
public void lastWithUnSeqFilesTest() {
String[] retArray =
@@ -298,7 +202,6 @@ public class IoTDBLastIT {
Statement statement = connection.createStatement()) {
PartialPath path = new PartialPath("root.ln.wf01.wt02.temperature");
- IoTDB.schemaProcessor.resetLastCache(path);
boolean hasResultSet =
statement.execute("select last temperature,status,id from
root.ln.wf01.wt02");
@@ -343,7 +246,6 @@ public class IoTDBLastIT {
}
Assert.assertEquals(cnt, retArray.length);
- IoTDB.schemaProcessor.resetLastCache(path);
String[] retArray3 =
new String[] {
"900,root.ln.wf01.wt01.temperature,10.2,DOUBLE",
@@ -389,8 +291,6 @@ public class IoTDBLastIT {
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
- IoTDB.schemaProcessor.resetLastCache(new
PartialPath("root.ln.wf01.wt03.temperature"));
-
statement.execute(
"INSERT INTO root.ln.wf01.wt03(timestamp,status, id) values(500,
false, 9)");
statement.execute("flush");
@@ -440,8 +340,6 @@ public class IoTDBLastIT {
statement.execute("INSERT INTO root.ln.wf01.wt04(timestamp,temperature)
values(150,31.2)");
statement.execute("flush");
- IoTDB.schemaProcessor.resetLastCache(new
PartialPath("root.ln.wf01.wt04.temperature"));
-
boolean hasResultSet = statement.execute("select last temperature from
root.ln.wf01.wt04");
assertTrue(hasResultSet);
diff --git
a/schema-engine-rocksdb/src/main/java/org/apache/iotdb/db/metadata/schemaregion/rocksdb/mnode/REntityMNode.java
b/schema-engine-rocksdb/src/main/java/org/apache/iotdb/db/metadata/schemaregion/rocksdb/mnode/REntityMNode.java
index 22cd4e1045..8d74e21891 100644
---
a/schema-engine-rocksdb/src/main/java/org/apache/iotdb/db/metadata/schemaregion/rocksdb/mnode/REntityMNode.java
+++
b/schema-engine-rocksdb/src/main/java/org/apache/iotdb/db/metadata/schemaregion/rocksdb/mnode/REntityMNode.java
@@ -20,7 +20,6 @@
package org.apache.iotdb.db.metadata.schemaregion.rocksdb.mnode;
import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.db.metadata.lastCache.container.ILastCacheContainer;
import org.apache.iotdb.db.metadata.logfile.MLogWriter;
import org.apache.iotdb.db.metadata.mnode.IEntityMNode;
import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
@@ -125,16 +124,6 @@ public class REntityMNode extends RInternalMNode
implements IEntityMNode {
isAligned = (RSchemaConstants.FLAG_IS_ALIGNED & flag) > 0;
}
- @Override
- public ILastCacheContainer getLastCacheContainer(String measurementId) {
- return null;
- }
-
- @Override
- public Map<String, ILastCacheContainer> getTemplateLastCaches() {
- return null;
- }
-
@Override
public boolean isEntity() {
return true;
diff --git
a/schema-engine-rocksdb/src/main/java/org/apache/iotdb/db/metadata/schemaregion/rocksdb/mnode/RMeasurementMNode.java
b/schema-engine-rocksdb/src/main/java/org/apache/iotdb/db/metadata/schemaregion/rocksdb/mnode/RMeasurementMNode.java
index d5bdbd8a6f..4ad39a9b62 100644
---
a/schema-engine-rocksdb/src/main/java/org/apache/iotdb/db/metadata/schemaregion/rocksdb/mnode/RMeasurementMNode.java
+++
b/schema-engine-rocksdb/src/main/java/org/apache/iotdb/db/metadata/schemaregion/rocksdb/mnode/RMeasurementMNode.java
@@ -21,7 +21,6 @@ package
org.apache.iotdb.db.metadata.schemaregion.rocksdb.mnode;
import org.apache.iotdb.commons.exception.MetadataException;
import org.apache.iotdb.commons.path.MeasurementPath;
-import org.apache.iotdb.db.metadata.lastCache.container.ILastCacheContainer;
import org.apache.iotdb.db.metadata.logfile.MLogWriter;
import org.apache.iotdb.db.metadata.mnode.IEntityMNode;
import org.apache.iotdb.db.metadata.mnode.IMNode;
@@ -129,16 +128,6 @@ public class RMeasurementMNode extends RMNode implements
IMeasurementMNode {
this.alias = alias;
}
- @Override
- public ILastCacheContainer getLastCacheContainer() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setLastCacheContainer(ILastCacheContainer lastCacheContainer) {
- throw new UnsupportedOperationException();
- }
-
@Override
public boolean isPreDeleted() {
return false;
diff --git
a/schema-engine-tag/src/main/java/org/apache/iotdb/db/metadata/tagSchemaRegion/utils/ShowTimeSeriesResultUtils.java
b/schema-engine-tag/src/main/java/org/apache/iotdb/db/metadata/tagSchemaRegion/utils/ShowTimeSeriesResultUtils.java
index b49290ef97..d91413e81a 100644
---
a/schema-engine-tag/src/main/java/org/apache/iotdb/db/metadata/tagSchemaRegion/utils/ShowTimeSeriesResultUtils.java
+++
b/schema-engine-tag/src/main/java/org/apache/iotdb/db/metadata/tagSchemaRegion/utils/ShowTimeSeriesResultUtils.java
@@ -44,7 +44,7 @@ public class ShowTimeSeriesResultUtils {
schemaEntry.getTSDataType(),
schemaEntry.getTSEncoding(),
schemaEntry.getCompressionType(),
- schemaEntry.getLastTime(),
+ Long.MAX_VALUE,
new HashMap<>(),
new HashMap<>(),
null,
@@ -68,7 +68,7 @@ public class ShowTimeSeriesResultUtils {
schemaEntry.getTSDataType(),
schemaEntry.getTSEncoding(),
schemaEntry.getCompressionType(),
- schemaEntry.getLastTime(),
+ Long.MAX_VALUE,
new HashMap<>(),
new HashMap<>(),
null,
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/LocalSchemaProcessor.java
b/server/src/main/java/org/apache/iotdb/db/metadata/LocalSchemaProcessor.java
index ea731d555f..a7a08c9e9d 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/LocalSchemaProcessor.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/LocalSchemaProcessor.java
@@ -32,7 +32,6 @@ import
org.apache.iotdb.db.exception.metadata.PathAlreadyExistException;
import org.apache.iotdb.db.exception.metadata.PathNotExistException;
import org.apache.iotdb.db.exception.metadata.StorageGroupNotSetException;
import org.apache.iotdb.db.localconfignode.LocalConfigNode;
-import org.apache.iotdb.db.metadata.lastCache.LastCacheManager;
import org.apache.iotdb.db.metadata.mnode.IMNode;
import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
import org.apache.iotdb.db.metadata.mnode.IStorageGroupMNode;
@@ -51,7 +50,6 @@ import org.apache.iotdb.db.query.dataset.ShowTimeSeriesResult;
import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.iotdb.tsfile.read.TimeValuePair;
import org.apache.iotdb.tsfile.utils.Pair;
import org.apache.iotdb.tsfile.write.schema.IMeasurementSchema;
@@ -99,7 +97,6 @@ import static
org.apache.iotdb.tsfile.common.constant.TsFileConstant.PATH_SEPARA
* <li>Interfaces and methods for MNode query
* <li>Interfaces for alias and tag/attribute operations
* <li>Interfaces only for Cluster module usage
- * <li>Interfaces for lastCache operations
* <li>TestOnly Interfaces
* </ol>
*/
@@ -1012,129 +1009,6 @@ public class LocalSchemaProcessor {
}
// endregion
- // region Interfaces for lastCache operations
- /**
- * Update the last cache value of time series of given seriesPath.
- *
- * <p>SchemaProcessor will use the seriesPath to search the node first and
then process the
- * lastCache in the MeasurementMNode
- *
- * <p>Invoking scenario: (1) after executing insertPlan (2) after reading
last value from file
- * during last Query
- *
- * @param seriesPath the PartialPath of full path from root to Measurement
- * @param timeValuePair the latest point value
- * @param highPriorityUpdate the last value from insertPlan is high priority
- * @param latestFlushedTime latest flushed time
- */
- public void updateLastCache(
- PartialPath seriesPath,
- TimeValuePair timeValuePair,
- boolean highPriorityUpdate,
- Long latestFlushedTime) {
- IMeasurementMNode node;
- try {
- node = getMeasurementMNode(seriesPath);
- } catch (MetadataException e) {
- logger.warn("failed to update last cache for the {}, err:{}",
seriesPath, e.getMessage());
- return;
- }
-
- LastCacheManager.updateLastCache(node, timeValuePair, highPriorityUpdate,
latestFlushedTime);
- }
-
- /**
- * Update the last cache value in given MeasurementMNode. work.
- *
- * <p>Invoking scenario: (1) after executing insertPlan (2) after reading
last value from file
- * during last Query
- *
- * @param node the measurementMNode holding the lastCache
- * @param timeValuePair the latest point value
- * @param highPriorityUpdate the last value from insertPlan is high priority
- * @param latestFlushedTime latest flushed time
- */
- public void updateLastCache(
- IMeasurementMNode node,
- TimeValuePair timeValuePair,
- boolean highPriorityUpdate,
- Long latestFlushedTime) {
- LastCacheManager.updateLastCache(node, timeValuePair, highPriorityUpdate,
latestFlushedTime);
- }
-
- /**
- * Get the last cache value of time series of given seriesPath.
SchemaProcessor will use the
- * seriesPath to search the node.
- *
- * <p>Invoking scenario: last cache read during last Query
- *
- * @param seriesPath the PartialPath of full path from root to Measurement
- * @return the last cache value
- */
- public TimeValuePair getLastCache(PartialPath seriesPath) {
- IMeasurementMNode node;
- try {
- node = getMeasurementMNode(seriesPath);
- } catch (MetadataException e) {
- logger.warn("failed to get last cache for the {}, err:{}", seriesPath,
e.getMessage());
- return null;
- }
-
- return LastCacheManager.getLastCache(node);
- }
-
- /**
- * Get the last cache value in given MeasurementMNode.
- *
- * <p>Invoking scenario: last cache read during last Query
- *
- * @param node the measurementMNode holding the lastCache
- * @return the last cache value
- */
- public TimeValuePair getLastCache(IMeasurementMNode node) {
- return LastCacheManager.getLastCache(node);
- }
-
- /**
- * Reset the last cache value of time series of given seriesPath.
SchemaProcessor will use the
- * seriesPath to search the node.
- *
- * @param seriesPath the PartialPath of full path from root to Measurement
- */
- public void resetLastCache(PartialPath seriesPath) {
- IMeasurementMNode node;
- try {
- node = getMeasurementMNode(seriesPath);
- } catch (MetadataException e) {
- logger.warn("failed to reset last cache for the {}, err:{}", seriesPath,
e.getMessage());
- return;
- }
-
- LastCacheManager.resetLastCache(node);
- }
-
- /**
- * delete the last cache value of timeseries or subMeasurement of some
aligned timeseries, which
- * is under the device and matching the originalPath
- *
- * <p>Invoking scenario (1) delete timeseries
- *
- * @param deviceId path of device
- * @param originalPath origin timeseries path
- * @param startTime startTime
- * @param endTime endTime
- */
- public void deleteLastCacheByDevice(
- PartialPath deviceId, PartialPath originalPath, long startTime, long
endTime)
- throws MetadataException {
- IMNode node = getDeviceNode(deviceId);
- if (node.isEntity()) {
- LastCacheManager.deleteLastCacheByDevice(
- node.getAsEntityMNode(), originalPath, startTime, endTime);
- }
- }
- // endregion
-
// region TestOnly Interfaces
@TestOnly
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeLastCacheManager.java
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeLastCacheManager.java
index d7c409ba7d..7417160f47 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeLastCacheManager.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/DataNodeLastCacheManager.java
@@ -20,7 +20,7 @@
package org.apache.iotdb.db.metadata.cache;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.metadata.lastCache.container.ILastCacheContainer;
+import
org.apache.iotdb.db.metadata.cache.lastCache.container.ILastCacheContainer;
import org.apache.iotdb.tsfile.read.TimeValuePair;
import org.slf4j.Logger;
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/cache/SchemaCacheEntry.java
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/SchemaCacheEntry.java
index 66c49e3dc1..ad40c088e2 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/cache/SchemaCacheEntry.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/SchemaCacheEntry.java
@@ -19,8 +19,8 @@
package org.apache.iotdb.db.metadata.cache;
-import org.apache.iotdb.db.metadata.lastCache.container.ILastCacheContainer;
-import org.apache.iotdb.db.metadata.lastCache.container.LastCacheContainer;
+import
org.apache.iotdb.db.metadata.cache.lastCache.container.ILastCacheContainer;
+import
org.apache.iotdb.db.metadata.cache.lastCache.container.LastCacheContainer;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/container/ILastCacheContainer.java
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/ILastCacheContainer.java
similarity index 95%
rename from
server/src/main/java/org/apache/iotdb/db/metadata/lastCache/container/ILastCacheContainer.java
rename to
server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/ILastCacheContainer.java
index 831d9301ea..fe6d303a0a 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/container/ILastCacheContainer.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/ILastCacheContainer.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.iotdb.db.metadata.lastCache.container;
+package org.apache.iotdb.db.metadata.cache.lastCache.container;
import org.apache.iotdb.tsfile.read.TimeValuePair;
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/container/LastCacheContainer.java
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/LastCacheContainer.java
similarity index 91%
rename from
server/src/main/java/org/apache/iotdb/db/metadata/lastCache/container/LastCacheContainer.java
rename to
server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/LastCacheContainer.java
index 57ce10e267..65a2444f37 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/container/LastCacheContainer.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/LastCacheContainer.java
@@ -17,10 +17,10 @@
* under the License.
*/
-package org.apache.iotdb.db.metadata.lastCache.container;
+package org.apache.iotdb.db.metadata.cache.lastCache.container;
-import org.apache.iotdb.db.metadata.lastCache.container.value.ILastCacheValue;
-import org.apache.iotdb.db.metadata.lastCache.container.value.LastCacheValue;
+import
org.apache.iotdb.db.metadata.cache.lastCache.container.value.ILastCacheValue;
+import
org.apache.iotdb.db.metadata.cache.lastCache.container.value.LastCacheValue;
import org.apache.iotdb.tsfile.read.TimeValuePair;
/**
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/container/value/ILastCacheValue.java
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/value/ILastCacheValue.java
similarity index 94%
rename from
server/src/main/java/org/apache/iotdb/db/metadata/lastCache/container/value/ILastCacheValue.java
rename to
server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/value/ILastCacheValue.java
index 2a0c3d0979..f23241425b 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/container/value/ILastCacheValue.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/value/ILastCacheValue.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.iotdb.db.metadata.lastCache.container.value;
+package org.apache.iotdb.db.metadata.cache.lastCache.container.value;
import org.apache.iotdb.tsfile.read.TimeValuePair;
import org.apache.iotdb.tsfile.utils.TsPrimitiveType;
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/container/value/LastCacheValue.java
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/value/LastCacheValue.java
similarity index 95%
rename from
server/src/main/java/org/apache/iotdb/db/metadata/lastCache/container/value/LastCacheValue.java
rename to
server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/value/LastCacheValue.java
index d9fd930a2c..eba18df514 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/container/value/LastCacheValue.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/cache/lastCache/container/value/LastCacheValue.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.iotdb.db.metadata.lastCache.container.value;
+package org.apache.iotdb.db.metadata.cache.lastCache.container.value;
import org.apache.iotdb.tsfile.read.TimeValuePair;
import org.apache.iotdb.tsfile.utils.TsPrimitiveType;
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTable.java
b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTable.java
index 01529bfd8d..5b81f5bcc3 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTable.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTable.java
@@ -34,7 +34,6 @@ import org.apache.iotdb.db.metadata.idtable.entry.SchemaEntry;
import org.apache.iotdb.db.metadata.idtable.entry.TimeseriesID;
import
org.apache.iotdb.db.metadata.plan.schemaregion.write.ICreateAlignedTimeSeriesPlan;
import
org.apache.iotdb.db.metadata.plan.schemaregion.write.ICreateTimeSeriesPlan;
-import org.apache.iotdb.tsfile.read.TimeValuePair;
import org.apache.iotdb.tsfile.utils.Pair;
import org.apache.iotdb.tsfile.write.schema.IMeasurementSchema;
@@ -87,30 +86,6 @@ public interface IDTable {
*/
// IDeviceID getSeriesSchemas(InsertPlan plan) throws MetadataException;
- /**
- * get last cache of the timeseies
- *
- * @param timeseriesID timeseries ID of the timeseries
- * @throws MetadataException if the timeseries is not exits
- */
- TimeValuePair getLastCache(TimeseriesID timeseriesID) throws
MetadataException;
-
- /**
- * update last cache of the timeseies
- *
- * @param timeseriesID timeseries ID of the timeseries
- * @param pair last time value pair
- * @param highPriorityUpdate is high priority update
- * @param latestFlushedTime last flushed time
- * @throws MetadataException if the timeseries is not exits
- */
- void updateLastCache(
- TimeseriesID timeseriesID,
- TimeValuePair pair,
- boolean highPriorityUpdate,
- Long latestFlushedTime)
- throws MetadataException;
-
/** clear id table and close file */
void clear() throws IOException;
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTableHashmapImpl.java
b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTableHashmapImpl.java
index 090d338116..fc466920f4 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTableHashmapImpl.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/IDTableHashmapImpl.java
@@ -32,7 +32,6 @@ import org.apache.iotdb.db.metadata.idtable.entry.SchemaEntry;
import org.apache.iotdb.db.metadata.idtable.entry.TimeseriesID;
import
org.apache.iotdb.db.metadata.plan.schemaregion.write.ICreateAlignedTimeSeriesPlan;
import
org.apache.iotdb.db.metadata.plan.schemaregion.write.ICreateTimeSeriesPlan;
-import org.apache.iotdb.tsfile.read.TimeValuePair;
import org.apache.iotdb.tsfile.utils.Pair;
import org.apache.iotdb.tsfile.write.schema.IMeasurementSchema;
import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
@@ -170,37 +169,6 @@ public class IDTableHashmapImpl implements IDTable {
return new Pair<>(deletedNum, failedNames);
}
- /**
- * get last cache of the timeseies
- *
- * @param timeseriesID timeseries ID of the timeseries
- * @throws MetadataException if the timeseries is not exits
- */
- @Override
- public synchronized TimeValuePair getLastCache(TimeseriesID timeseriesID)
- throws MetadataException {
- return getSchemaEntry(timeseriesID).getCachedLast();
- }
-
- /**
- * update last cache of the timeseies
- *
- * @param timeseriesID timeseries ID of the timeseries
- * @param pair last time value pair
- * @param highPriorityUpdate is high priority update
- * @param latestFlushedTime last flushed time
- * @throws MetadataException if the timeseries is not exits
- */
- @Override
- public synchronized void updateLastCache(
- TimeseriesID timeseriesID,
- TimeValuePair pair,
- boolean highPriorityUpdate,
- Long latestFlushedTime)
- throws MetadataException {
- getSchemaEntry(timeseriesID).updateCachedLast(pair, highPriorityUpdate,
latestFlushedTime);
- }
-
@Override
public void clear() throws IOException {
if (IDiskSchemaManager != null) {
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/InsertMeasurementMNode.java
b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/InsertMeasurementMNode.java
index 1258bfb3e9..f079350c68 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/InsertMeasurementMNode.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/InsertMeasurementMNode.java
@@ -21,7 +21,6 @@ package org.apache.iotdb.db.metadata.idtable.entry;
import org.apache.iotdb.commons.path.MeasurementPath;
import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.metadata.lastCache.container.ILastCacheContainer;
import org.apache.iotdb.db.metadata.logfile.MLogWriter;
import org.apache.iotdb.db.metadata.mnode.IEntityMNode;
import org.apache.iotdb.db.metadata.mnode.IMNode;
@@ -56,14 +55,6 @@ public class InsertMeasurementMNode implements
IMeasurementMNode {
// region support methods
- @Override
- public ILastCacheContainer getLastCacheContainer() {
- return schemaEntry;
- }
-
- @Override
- public void setLastCacheContainer(ILastCacheContainer lastCacheContainer) {}
-
@Override
public boolean isPreDeleted() {
return false;
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/SchemaEntry.java
b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/SchemaEntry.java
index b938217f62..d9e8339c9c 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/SchemaEntry.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/SchemaEntry.java
@@ -24,13 +24,10 @@ import org.apache.iotdb.commons.utils.TestOnly;
import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.metadata.idtable.IDiskSchemaManager;
-import org.apache.iotdb.db.metadata.lastCache.container.ILastCacheContainer;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.iotdb.tsfile.read.TimeValuePair;
-import org.apache.iotdb.tsfile.utils.TsPrimitiveType;
import java.util.Objects;
@@ -40,7 +37,7 @@ import static
org.apache.iotdb.db.utils.EncodingInferenceUtils.getDefaultEncodin
* Schema entry of id table <br>
* Notice that this class is also a last cache container for last cache
*/
-public class SchemaEntry implements ILastCacheContainer {
+public class SchemaEntry {
/* 40 bits of disk pointer */
/* 1 byte of compressor */
@@ -48,10 +45,6 @@ public class SchemaEntry implements ILastCacheContainer {
/* 1 byte of type */
private long schema;
- private long lastTime;
-
- private TsPrimitiveType lastValue;
-
/** This static field will not occupy memory */
private static IoTDBConfig config =
IoTDBDescriptor.getInstance().getConfig();
@@ -63,8 +56,6 @@ public class SchemaEntry implements ILastCacheContainer {
schema |= dataType.serialize();
schema |= (((long) encoding.serialize()) << 8);
schema |= (((long) compressionType.serialize()) << 16);
-
- lastTime = Long.MIN_VALUE;
}
// used in recover
@@ -74,8 +65,6 @@ public class SchemaEntry implements ILastCacheContainer {
schema |= (((long) encoding.serialize()) << 8);
schema |= (((long) compressionType.serialize()) << 16);
- lastTime = Long.MIN_VALUE;
-
schema |= (diskPos << 24);
}
@@ -91,8 +80,6 @@ public class SchemaEntry implements ILastCacheContainer {
schema |= (((long) encoding.serialize()) << 8);
schema |= (((long) compressionType.serialize()) << 16);
- lastTime = Long.MIN_VALUE;
-
// write log file
if (config.isEnableIDTableLogFile()) {
DiskSchemaEntry diskSchemaEntry =
@@ -144,51 +131,6 @@ public class SchemaEntry implements ILastCacheContainer {
return CompressionType.deserialize((byte) (schema >> 16));
}
- public long getLastTime() {
- return lastTime;
- }
-
- public Object getLastValue() {
- return lastValue;
- }
-
- // region last cache
- @Override
- public TimeValuePair getCachedLast() {
- return lastValue == null ? null : new TimeValuePair(lastTime, lastValue);
- }
-
- @Override
- public void updateCachedLast(
- TimeValuePair timeValuePair, boolean highPriorityUpdate, Long
latestFlushedTime) {
- if (timeValuePair == null || timeValuePair.getValue() == null) {
- return;
- }
-
- if (lastValue == null) {
- // If no cached last, (1) a last query (2) an unseq insertion or (3) a
seq insertion will
- // update cache.
- if (!highPriorityUpdate || latestFlushedTime <=
timeValuePair.getTimestamp()) {
- lastTime = timeValuePair.getTimestamp();
- lastValue = timeValuePair.getValue();
- }
- } else if (timeValuePair.getTimestamp() > lastTime
- || (timeValuePair.getTimestamp() == lastTime && highPriorityUpdate)) {
- lastTime = timeValuePair.getTimestamp();
- lastValue = timeValuePair.getValue();
- }
- }
-
- @Override
- public void resetLastCache() {
- lastValue = null;
- }
-
- @Override
- public boolean isEmpty() {
- return lastValue == null;
- }
-
@Override
// Notice that we only compare schema
public boolean equals(Object o) {
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/LastCacheManager.java
b/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/LastCacheManager.java
deleted file mode 100644
index 6af1e596be..0000000000
---
a/server/src/main/java/org/apache/iotdb/db/metadata/lastCache/LastCacheManager.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.metadata.lastCache;
-
-import org.apache.iotdb.commons.path.MeasurementPath;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
-import org.apache.iotdb.db.metadata.lastCache.container.ILastCacheContainer;
-import org.apache.iotdb.db.metadata.mnode.IEntityMNode;
-import org.apache.iotdb.db.metadata.mnode.IMNode;
-import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
-import org.apache.iotdb.db.query.context.QueryContext;
-import org.apache.iotdb.db.query.control.QueryResourceManager;
-import org.apache.iotdb.db.query.executor.fill.LastPointReader;
-import org.apache.iotdb.tsfile.read.TimeValuePair;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-// this class provides all the operations on last cache
-public class LastCacheManager {
-
- private static final Logger logger =
LoggerFactory.getLogger(LastCacheManager.class);
-
- private static final boolean CACHE_ENABLED =
- IoTDBDescriptor.getInstance().getConfig().isLastCacheEnabled();
-
- /**
- * get the last cache value of time series of given seriesPath
- *
- * @param node the measurementMNode holding the lastCache When invoker only
has the target
- * seriesPath, the node could be null and SchemaProcessor will search
the node
- * @return the last cache value
- */
- public static TimeValuePair getLastCache(IMeasurementMNode node) {
- if (node == null) {
- return null;
- }
-
- checkIsTemplateLastCacheAndSetIfAbsent(node);
-
- ILastCacheContainer lastCacheContainer = node.getLastCacheContainer();
- return lastCacheContainer.getCachedLast();
- }
-
- /**
- * update the last cache value of time series of given seriesPath
- *
- * @param node the measurementMNode holding the lastCache When invoker only
has the target
- * seriesPath, the node could be null and SchemaProcessor will search
the node
- * @param timeValuePair the latest point value
- * @param highPriorityUpdate the last value from insertPlan is high priority
- * @param latestFlushedTime latest flushed time
- */
- public static void updateLastCache(
- IMeasurementMNode node,
- TimeValuePair timeValuePair,
- boolean highPriorityUpdate,
- Long latestFlushedTime) {
- if (node == null) {
- return;
- }
-
- checkIsTemplateLastCacheAndSetIfAbsent(node);
-
- ILastCacheContainer lastCacheContainer = node.getLastCacheContainer();
- lastCacheContainer.updateCachedLast(timeValuePair, highPriorityUpdate,
latestFlushedTime);
- }
-
- /**
- * reset the last cache value of time series of given seriesPath
- *
- * @param node the measurementMNode holding the lastCache When invoker only
has the target
- * seriesPath, the node could be null and SchemaProcessor will search
the node
- */
- public static void resetLastCache(IMeasurementMNode node) {
- if (node == null) {
- return;
- }
-
- checkIsTemplateLastCacheAndSetIfAbsent(node);
-
- ILastCacheContainer lastCacheContainer = node.getLastCacheContainer();
- lastCacheContainer.resetLastCache();
- }
-
- private static void checkIsTemplateLastCacheAndSetIfAbsent(IMeasurementMNode
node) {
- IEntityMNode entityMNode = node.getParent();
- if (entityMNode == null) {
- // cluster cached remote measurementMNode doesn't have parent
- return;
- }
- String measurement = node.getName();
-
- // if entityMNode doesn't have this child, the child is derived from
template
- if (!entityMNode.hasChild(measurement)) {
- ILastCacheContainer lastCacheContainer =
entityMNode.getLastCacheContainer(measurement);
- node.setLastCacheContainer(lastCacheContainer);
- }
- }
-
- /**
- * delete all the last cache value of any timeseries or aligned timeseries
under the entity
- *
- * @param node entity node
- */
- public static void deleteLastCacheByDevice(IEntityMNode node) {
- // process lastCache of timeseries represented by measurementNode
- for (IMNode child : node.getChildren().values()) {
- if (child.isMeasurement()) {
- child.getAsMeasurementMNode().getLastCacheContainer().resetLastCache();
- if (logger.isDebugEnabled()) {
- logger.debug(
- "[tryToDeleteLastCacheByDevice] Last cache for path: {} is set
to null",
- child.getFullPath());
- }
- }
- }
- // process lastCache of timeseries represented by template
- for (Map.Entry<String, ILastCacheContainer> entry :
node.getTemplateLastCaches().entrySet()) {
- entry.getValue().resetLastCache();
- if (logger.isDebugEnabled()) {
- logger.debug(
- "[tryToDeleteLastCacheByDevice] Last cache for path: {} is set to
null",
- node.getPartialPath().concatNode(entry.getKey()).getFullPath());
- }
- }
- }
-
- /**
- * delete the last cache value of timeseries or subMeasurement of some
aligned timeseries, which
- * is under the entity and matching the originalPath
- *
- * @param node entity node
- * @param originalPath origin timeseries path
- * @param startTime startTime
- * @param endTime endTime
- */
- public static void deleteLastCacheByDevice(
- IEntityMNode node, PartialPath originalPath, long startTime, long
endTime) {
- PartialPath path;
- ILastCacheContainer lastCacheContainer;
-
- // process lastCache of timeseries represented by measurementNode
- IMeasurementMNode measurementMNode;
- for (IMNode child : node.getChildren().values()) {
- if (child == null || !child.isMeasurement()) {
- continue;
- }
- path = child.getPartialPath();
- measurementMNode = child.getAsMeasurementMNode();
- if (originalPath.matchFullPath(path)) {
- lastCacheContainer = measurementMNode.getLastCacheContainer();
- if (lastCacheContainer == null) {
- continue;
- }
- deleteLastCache(path, lastCacheContainer, startTime, endTime);
- }
- }
-
- // process lastCache of timeseries represented by template
- for (Map.Entry<String, ILastCacheContainer> entry :
node.getTemplateLastCaches().entrySet()) {
- path = node.getPartialPath().concatNode(entry.getKey());
- if (originalPath.matchFullPath(path)) {
- lastCacheContainer = entry.getValue();
- if (lastCacheContainer == null) {
- continue;
- }
- deleteLastCache(path, lastCacheContainer, startTime, endTime);
- }
- }
- }
-
- private static void deleteLastCache(
- PartialPath path, ILastCacheContainer lastCacheContainer, long
startTime, long endTime) {
- TimeValuePair lastPair = lastCacheContainer.getCachedLast();
- if (lastPair != null
- && startTime <= lastPair.getTimestamp()
- && lastPair.getTimestamp() <= endTime) {
- lastCacheContainer.resetLastCache();
- if (logger.isDebugEnabled()) {
- logger.debug(
- "[tryToDeleteLastCache] Last cache for path: {} is set to null",
path.getFullPath());
- }
- }
- }
-
- /**
- * get the last value of timeseries represented by given measurementMNode
get last value from
- * cache in measurementMNode if absent, get last value from file
- *
- * @param node measurementMNode representing the target timeseries
- * @param queryContext query context
- * @return the last value
- */
- public static long getLastTimeStamp(IMeasurementMNode node, QueryContext
queryContext) {
- TimeValuePair last = getLastCache(node);
- if (last != null) {
- return getLastCache(node).getTimestamp();
- } else {
- try {
- // for the parameter "ascending": true or false both ok here,
- // because LastPointReader will do itself sort logic instead of
depending on fillOrderIndex.
- MeasurementPath measurementPath = node.getMeasurementPath();
- QueryDataSource dataSource =
- QueryResourceManager.getInstance()
- .getQueryDataSource(measurementPath, queryContext, null,
false);
- Set<String> measurementSet = new HashSet<>();
- measurementSet.add(node.getName());
- LastPointReader lastReader =
- new LastPointReader(
- measurementPath,
- node.getSchema().getType(),
- measurementSet,
- queryContext,
- dataSource,
- Long.MAX_VALUE,
- null);
- last = lastReader.readLastPoint();
- if (CACHE_ENABLED && last != null && last.getValue() != null) {
- updateLastCache(node, last, false, Long.MIN_VALUE);
- }
- return (last != null ? last.getTimestamp() : Long.MIN_VALUE);
- } catch (Exception e) {
- logger.error(
- "Something wrong happened while trying to get last time value pair
of {}",
- node.getFullPath(),
- e);
- return Long.MIN_VALUE;
- }
- }
- }
-}
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/EntityMNode.java
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/EntityMNode.java
index a3e11676c2..31d8112051 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/EntityMNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/EntityMNode.java
@@ -18,8 +18,6 @@
*/
package org.apache.iotdb.db.metadata.mnode;
-import org.apache.iotdb.db.metadata.lastCache.container.ILastCacheContainer;
-import org.apache.iotdb.db.metadata.lastCache.container.LastCacheContainer;
import org.apache.iotdb.db.metadata.mnode.visitor.MNodeVisitor;
import java.util.Collections;
@@ -38,8 +36,6 @@ public class EntityMNode extends InternalMNode implements
IEntityMNode {
private volatile boolean isAligned = false;
- private volatile Map<String, ILastCacheContainer> lastCacheMap = null;
-
@Override
public String getFullPath() {
if (fullPath == null) {
@@ -162,26 +158,6 @@ public class EntityMNode extends InternalMNode implements
IEntityMNode {
this.isAligned = isAligned;
}
- public ILastCacheContainer getLastCacheContainer(String measurementId) {
- checkLastCacheMap();
- return lastCacheMap.computeIfAbsent(measurementId, k -> new
LastCacheContainer());
- }
-
- @Override
- public Map<String, ILastCacheContainer> getTemplateLastCaches() {
- return lastCacheMap == null ? Collections.emptyMap() : lastCacheMap;
- }
-
- private void checkLastCacheMap() {
- if (lastCacheMap == null) {
- synchronized (this) {
- if (lastCacheMap == null) {
- lastCacheMap = new ConcurrentHashMap<>();
- }
- }
- }
- }
-
@Override
public void moveDataToNewMNode(IMNode newMNode) {
super.moveDataToNewMNode(newMNode);
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/IEntityMNode.java
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/IEntityMNode.java
index fc9b8d0f60..6bbf5717c1 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/IEntityMNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/IEntityMNode.java
@@ -18,8 +18,6 @@
*/
package org.apache.iotdb.db.metadata.mnode;
-import org.apache.iotdb.db.metadata.lastCache.container.ILastCacheContainer;
-
import java.util.Map;
public interface IEntityMNode extends IMNode {
@@ -48,8 +46,4 @@ public interface IEntityMNode extends IMNode {
boolean isAligned();
void setAligned(boolean isAligned);
-
- ILastCacheContainer getLastCacheContainer(String measurementId);
-
- Map<String, ILastCacheContainer> getTemplateLastCaches();
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/IMeasurementMNode.java
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/IMeasurementMNode.java
index 6b52235b40..5f4cccdf93 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/IMeasurementMNode.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/IMeasurementMNode.java
@@ -19,7 +19,6 @@
package org.apache.iotdb.db.metadata.mnode;
import org.apache.iotdb.commons.path.MeasurementPath;
-import org.apache.iotdb.db.metadata.lastCache.container.ILastCacheContainer;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.write.schema.IMeasurementSchema;
@@ -43,10 +42,6 @@ public interface IMeasurementMNode extends IMNode {
void setOffset(long offset);
- ILastCacheContainer getLastCacheContainer();
-
- void setLastCacheContainer(ILastCacheContainer lastCacheContainer);
-
boolean isPreDeleted();
void setPreDeleted(boolean preDeleted);
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/MeasurementMNode.java
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/MeasurementMNode.java
index 30d763c5d7..eeab5fff39 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/MeasurementMNode.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/MeasurementMNode.java
@@ -19,8 +19,6 @@
package org.apache.iotdb.db.metadata.mnode;
import org.apache.iotdb.commons.path.MeasurementPath;
-import org.apache.iotdb.db.metadata.lastCache.container.ILastCacheContainer;
-import org.apache.iotdb.db.metadata.lastCache.container.LastCacheContainer;
import org.apache.iotdb.db.metadata.logfile.MLogWriter;
import org.apache.iotdb.db.metadata.mnode.container.IMNodeContainer;
import org.apache.iotdb.db.metadata.mnode.container.MNodeContainers;
@@ -46,8 +44,6 @@ public class MeasurementMNode extends MNode implements
IMeasurementMNode {
private IMeasurementSchema schema;
/** whether this measurement is pre deleted and considered in black list */
private boolean preDeleted = false;
- /** last value cache */
- private volatile ILastCacheContainer lastCacheContainer = null;
/**
* MeasurementMNode factory method. The type of returned MeasurementMNode is
according to the
@@ -122,23 +118,6 @@ public class MeasurementMNode extends MNode implements
IMeasurementMNode {
this.alias = alias;
}
- @Override
- public ILastCacheContainer getLastCacheContainer() {
- if (lastCacheContainer == null) {
- synchronized (this) {
- if (lastCacheContainer == null) {
- lastCacheContainer = new LastCacheContainer();
- }
- }
- }
- return lastCacheContainer;
- }
-
- @Override
- public void setLastCacheContainer(ILastCacheContainer lastCacheContainer) {
- this.lastCacheContainer = lastCacheContainer;
- }
-
@Override
public boolean isPreDeleted() {
return preDeleted;
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/estimator/BasicMNodSizeEstimator.java
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/estimator/BasicMNodSizeEstimator.java
index 6cd167c328..ff695e753b 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/mnode/estimator/BasicMNodSizeEstimator.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/mnode/estimator/BasicMNodSizeEstimator.java
@@ -72,10 +72,9 @@ public class BasicMNodSizeEstimator implements
IMNodeSizeEstimator {
* <ol>
* <li>isAligned, 1B
* <li>aliasChildren reference, 8B
- * <li>lastCacheMap, 8B
* </ol>
*/
- protected static final int ENTITY_NODE_BASE_SIZE = 17;
+ protected static final int ENTITY_NODE_BASE_SIZE = 9;
/**
* The basic extra memory occupied by an MeasurementMNode based on MNode
occupation
@@ -84,10 +83,9 @@ public class BasicMNodSizeEstimator implements
IMNodeSizeEstimator {
* <li>alias reference, 8B
* <li>tagOffset, 8B
* <li>estimated schema size, 32B
- * <li>lastCache, 8B
* </ol>
*/
- protected static final int MEASUREMENT_NODE_BASE_SIZE = 56;
+ protected static final int MEASUREMENT_NODE_BASE_SIZE = 48;
// alias length, hashCode and occupation in aliasMap, 4 + 4 + 44 = 52B
protected static final int ALIAS_BASE_SIZE = 52;
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGCachedImpl.java
b/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGCachedImpl.java
index 154755e2c3..c4587739d6 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGCachedImpl.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGCachedImpl.java
@@ -84,7 +84,6 @@ import java.util.stream.Stream;
import static java.util.stream.Collectors.toList;
import static
org.apache.iotdb.commons.conf.IoTDBConstant.ONE_LEVEL_PATH_WILDCARD;
-import static
org.apache.iotdb.db.metadata.lastCache.LastCacheManager.getLastTimeStamp;
/**
* The hierarchical struct of the Metadata Tree is implemented in this class.
@@ -855,7 +854,7 @@ public class MTreeBelowSGCachedImpl implements
IMTreeBelowSG {
tsRow[3] = measurementSchema.getEncodingType().toString();
tsRow[4] = measurementSchema.getCompressor().toString();
tsRow[5] = String.valueOf(node.getOffset());
- tsRow[6] = needLast ? String.valueOf(getLastTimeStamp(node,
queryContext)) : null;
+ tsRow[6] = null;
tsRow[7] = deadbandInfo.left;
tsRow[8] = deadbandInfo.right;
Pair<PartialPath, String[]> temp = new
Pair<>(getCurrentPartialPath(node), tsRow);
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGMemoryImpl.java
b/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGMemoryImpl.java
index 436beb6058..0664964d8d 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGMemoryImpl.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGMemoryImpl.java
@@ -84,7 +84,6 @@ import java.util.stream.Stream;
import static java.util.stream.Collectors.toList;
import static
org.apache.iotdb.commons.conf.IoTDBConstant.ONE_LEVEL_PATH_WILDCARD;
-import static
org.apache.iotdb.db.metadata.lastCache.LastCacheManager.getLastTimeStamp;
/**
* The hierarchical struct of the Metadata Tree is implemented in this class.
@@ -795,7 +794,7 @@ public class MTreeBelowSGMemoryImpl implements
IMTreeBelowSG {
tsRow[3] = measurementSchema.getEncodingType().toString();
tsRow[4] = measurementSchema.getCompressor().toString();
tsRow[5] = String.valueOf(node.getOffset());
- tsRow[6] = needLast ? String.valueOf(getLastTimeStamp(node,
queryContext)) : null;
+ tsRow[6] = null;
tsRow[7] = deadbandInfo.left;
tsRow[8] = deadbandInfo.right;
Pair<PartialPath, String[]> temp = new
Pair<>(getCurrentPartialPath(node), tsRow);
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
index cb8cfa17cf..66a9a0b55e 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
@@ -1227,9 +1227,7 @@ public class SchemaRegionMemoryImpl implements
ISchemaRegion {
measurementSchema.getType(),
measurementSchema.getEncodingType(),
measurementSchema.getCompressor(),
- leaf.getLastCacheContainer().getCachedLast() != null
- ?
leaf.getLastCacheContainer().getCachedLast().getTimestamp()
- : 0,
+ 0,
tagAndAttributePair.left,
tagAndAttributePair.right,
deadbandInfo.left,
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionSchemaFileImpl.java
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionSchemaFileImpl.java
index 7efd30df49..e587ae43cb 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionSchemaFileImpl.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionSchemaFileImpl.java
@@ -1308,9 +1308,7 @@ public class SchemaRegionSchemaFileImpl implements
ISchemaRegion {
measurementSchema.getType(),
measurementSchema.getEncodingType(),
measurementSchema.getCompressor(),
- leaf.getLastCacheContainer().getCachedLast() != null
- ?
leaf.getLastCacheContainer().getCachedLast().getTimestamp()
- : 0,
+ 0,
tagAndAttributePair.left,
tagAndAttributePair.right,
deadbandInfo.left,
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
b/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
index 869c91c8b2..c602c30194 100644
---
a/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
+++
b/server/src/main/java/org/apache/iotdb/db/query/executor/LastQueryExecutor.java
@@ -19,7 +19,6 @@
package org.apache.iotdb.db.query.executor;
-import org.apache.iotdb.commons.exception.MetadataException;
import org.apache.iotdb.commons.path.MeasurementPath;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
@@ -28,9 +27,6 @@ import
org.apache.iotdb.db.engine.querycontext.QueryDataSource;
import org.apache.iotdb.db.engine.storagegroup.DataRegion;
import org.apache.iotdb.db.exception.StorageEngineException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.metadata.idtable.IDTable;
-import org.apache.iotdb.db.metadata.idtable.entry.TimeseriesID;
-import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
import org.apache.iotdb.db.metadata.utils.ResourceByPathUtils;
import org.apache.iotdb.db.qp.physical.crud.LastQueryPlan;
import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
@@ -38,7 +34,6 @@ import org.apache.iotdb.db.query.context.QueryContext;
import org.apache.iotdb.db.query.control.QueryResourceManager;
import org.apache.iotdb.db.query.dataset.ListDataSet;
import org.apache.iotdb.db.query.executor.fill.LastPointReader;
-import org.apache.iotdb.db.service.IoTDB;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.read.TimeValuePair;
import org.apache.iotdb.tsfile.read.common.Field;
@@ -312,75 +307,27 @@ public class LastQueryExecutor {
private static class SchemaProcessorLastCacheAccessor implements
LastCacheAccessor {
- private final MeasurementPath path;
- private IMeasurementMNode node;
-
- SchemaProcessorLastCacheAccessor(PartialPath seriesPath) {
- this.path = (MeasurementPath) seriesPath;
- }
+ SchemaProcessorLastCacheAccessor(PartialPath seriesPath) {}
public TimeValuePair read() {
- try {
- node = IoTDB.schemaProcessor.getMeasurementMNode(path);
- } catch (MetadataException e) {
- // cluster mode may not get remote node
- TimeValuePair timeValuePair;
- timeValuePair = IoTDB.schemaProcessor.getLastCache(path);
- if (timeValuePair != null) {
- return timeValuePair;
- }
- }
-
- if (node == null) {
- return null;
- }
-
- return IoTDB.schemaProcessor.getLastCache(node);
+ return null;
}
- public void write(TimeValuePair pair) {
- if (node == null) {
- IoTDB.schemaProcessor.updateLastCache(path, pair, false,
Long.MIN_VALUE);
- } else {
- IoTDB.schemaProcessor.updateLastCache(node, pair, false,
Long.MIN_VALUE);
- }
- }
+ public void write(TimeValuePair pair) {}
}
private static class IDTableLastCacheAccessor implements LastCacheAccessor {
- private PartialPath fullPath;
-
- IDTableLastCacheAccessor(PartialPath seriesPath) {
- fullPath = seriesPath;
- }
+ IDTableLastCacheAccessor(PartialPath seriesPath) {}
@Override
public TimeValuePair read() {
- try {
- IDTable table =
-
StorageEngine.getInstance().getProcessor(fullPath.getDevicePath()).getIdTable();
- return table.getLastCache(new TimeseriesID(fullPath));
- } catch (StorageEngineException | MetadataException e) {
- logger.error("last query can't find database: path is: " + fullPath);
- }
-
return null;
}
@Override
- public void write(TimeValuePair pair) {
- try {
- IDTable table =
-
StorageEngine.getInstance().getProcessor(fullPath.getDevicePath()).getIdTable();
- table.updateLastCache(new TimeseriesID(fullPath), pair, false,
Long.MIN_VALUE);
- } catch (MetadataException | StorageEngineException e) {
- logger.error("last query can't find database: path is: " + fullPath);
- }
- }
+ public void write(TimeValuePair pair) {}
}
- public static void clear() {
- ID_TABLE_ENABLED =
IoTDBDescriptor.getInstance().getConfig().isEnableIDTable();
- }
+ public static void clear() {}
}
diff --git
a/server/src/test/java/org/apache/iotdb/db/metadata/SchemaAdvancedTest.java
b/server/src/test/java/org/apache/iotdb/db/metadata/SchemaAdvancedTest.java
index 25b82f023a..230ad8fd09 100644
--- a/server/src/test/java/org/apache/iotdb/db/metadata/SchemaAdvancedTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/SchemaAdvancedTest.java
@@ -21,16 +21,12 @@ package org.apache.iotdb.db.metadata;
import org.apache.iotdb.commons.exception.MetadataException;
import org.apache.iotdb.commons.path.MeasurementPath;
import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.metadata.lastCache.LastCacheManager;
import org.apache.iotdb.db.metadata.mnode.IMNode;
-import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
import org.apache.iotdb.db.service.IoTDB;
import org.apache.iotdb.db.utils.EnvironmentUtils;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.iotdb.tsfile.read.TimeValuePair;
-import org.apache.iotdb.tsfile.utils.TsPrimitiveType;
import org.junit.After;
import org.junit.Assert;
@@ -204,25 +200,4 @@ public class SchemaAdvancedTest {
Assert.assertFalse(schemaProcessor.isPathExist(new
PartialPath("root.vehicle.d100")));
}
-
- @Test
- public void testCachedLastTimeValue() throws MetadataException {
- schemaProcessor.createTimeseries(
- new PartialPath("root.vehicle.d2.s0"),
- TSDataType.DOUBLE,
- TSEncoding.RLE,
- TSFileDescriptor.getInstance().getConfig().getCompressor(),
- Collections.emptyMap());
-
- TimeValuePair tv1 = new TimeValuePair(1000,
TsPrimitiveType.getByType(TSDataType.DOUBLE, 1.0));
- TimeValuePair tv2 = new TimeValuePair(2000,
TsPrimitiveType.getByType(TSDataType.DOUBLE, 3.0));
- TimeValuePair tv3 = new TimeValuePair(1500,
TsPrimitiveType.getByType(TSDataType.DOUBLE, 2.5));
- PartialPath path = new PartialPath("root.vehicle.d2.s0");
- IMeasurementMNode node = schemaProcessor.getMeasurementMNode(path);
- LastCacheManager.updateLastCache(node, tv1, true, Long.MIN_VALUE);
- LastCacheManager.updateLastCache(node, tv2, true, Long.MIN_VALUE);
- Assert.assertEquals(tv2.getTimestamp(),
schemaProcessor.getLastCache(node).getTimestamp());
- LastCacheManager.updateLastCache(node, tv3, true, Long.MIN_VALUE);
- Assert.assertEquals(tv2.getTimestamp(),
schemaProcessor.getLastCache(node).getTimestamp());
- }
}
diff --git
a/server/src/test/java/org/apache/iotdb/db/metadata/idtable/IDTableTest.java
b/server/src/test/java/org/apache/iotdb/db/metadata/idtable/IDTableTest.java
index 8239fc8ca3..2db3ce5a97 100644
--- a/server/src/test/java/org/apache/iotdb/db/metadata/idtable/IDTableTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/idtable/IDTableTest.java
@@ -30,7 +30,6 @@ package org.apache.iotdb.db.metadata.idtable;
// import org.apache.iotdb.db.metadata.idtable.entry.DiskSchemaEntry;
// import org.apache.iotdb.db.metadata.idtable.entry.IDeviceID;
// import org.apache.iotdb.db.metadata.idtable.entry.SchemaEntry;
-// import org.apache.iotdb.db.metadata.lastCache.container.ILastCacheContainer;
// import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
// import org.apache.iotdb.db.qp.Planner;
// import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
@@ -614,69 +613,4 @@ package org.apache.iotdb.db.metadata.idtable;
// fail("throw exception");
// }
// }
-//
-// @Test
-// public void testFlushTimeAndLastCache() {
-// LocalSchemaProcessor schemaProcessor = IoTDB.schemaProcessor;
-// try {
-// long time = 1L;
-//
-// schemaProcessor.setStorageGroup(new PartialPath("root.laptop"));
-// schemaProcessor.createTimeseries(
-// new PartialPath("root.laptop.d1.non_aligned_device.s1"),
-// TSDataType.valueOf("INT32"),
-// TSEncoding.valueOf("RLE"),
-// compressionType,
-// Collections.emptyMap());
-// schemaProcessor.createTimeseries(
-// new PartialPath("root.laptop.d1.non_aligned_device.s2"),
-// TSDataType.valueOf("INT64"),
-// TSEncoding.valueOf("RLE"),
-// compressionType,
-// Collections.emptyMap());
-//
-// TSDataType[] dataTypes = new TSDataType[] {TSDataType.INT32,
TSDataType.INT64};
-// String[] columns = new String[2];
-// columns[0] = "1";
-// columns[1] = "2";
-//
-// InsertRowPlan insertRowPlan =
-// new InsertRowPlan(
-// new PartialPath("root.laptop.d1.non_aligned_device"),
-// time,
-// new String[] {"s1", "s2"},
-// dataTypes,
-// columns,
-// false);
-// insertRowPlan.setMeasurementMNodes(
-// new IMeasurementMNode[insertRowPlan.getMeasurements().length]);
-//
-// // call getSeriesSchemasAndReadLockDevice
-// IDTable idTable = IDTableManager.getInstance().getIDTable(new
PartialPath("root.laptop"));
-//
-// idTable.getSeriesSchemas(insertRowPlan);
-//
-// IMeasurementMNode s2Node = insertRowPlan.getMeasurementMNodes()[1];
-// ILastCacheContainer cacheContainer = s2Node.getLastCacheContainer();
-// // last cache
-// cacheContainer.updateCachedLast(
-// new TimeValuePair(100L, new TsPrimitiveType.TsLong(1L)), false,
0L);
-// assertEquals(new TsPrimitiveType.TsLong(1L),
cacheContainer.getCachedLast().getValue());
-// assertEquals(100L, cacheContainer.getCachedLast().getTimestamp());
-//
-// cacheContainer.updateCachedLast(
-// new TimeValuePair(90L, new TsPrimitiveType.TsLong(2L)), false, 0L);
-// assertEquals(new TsPrimitiveType.TsLong(1L),
cacheContainer.getCachedLast().getValue());
-// assertEquals(100L, cacheContainer.getCachedLast().getTimestamp());
-//
-// cacheContainer.updateCachedLast(
-// new TimeValuePair(110L, new TsPrimitiveType.TsLong(2L)), false,
0L);
-// assertEquals(new TsPrimitiveType.TsLong(2L),
cacheContainer.getCachedLast().getValue());
-// assertEquals(110L, cacheContainer.getCachedLast().getTimestamp());
-//
-// } catch (MetadataException e) {
-// e.printStackTrace();
-// fail("throw exception");
-// }
-// }
// }
diff --git
a/server/src/test/java/org/apache/iotdb/db/metadata/idtable/LastQueryWithIDTable.java
b/server/src/test/java/org/apache/iotdb/db/metadata/idtable/LastQueryWithIDTable.java
deleted file mode 100644
index 50d8163788..0000000000
---
a/server/src/test/java/org/apache/iotdb/db/metadata/idtable/LastQueryWithIDTable.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.metadata.idtable;
-
-// public class LastQueryWithIDTable {
-// private final Planner processor = new Planner();
-//
-// private boolean isEnableIDTable = false;
-//
-// private boolean originalEnableCache = false;
-//
-// private String originalDeviceIDTransformationMethod = null;
-//
-// Set<String> retSet =
-// new HashSet<>(
-// Arrays.asList(
-// "113\troot.isp.d1.s3\t100003\tINT64",
-// "113\troot.isp.d1.s4\t1003\tINT32",
-// "113\troot.isp.d1.s5\tfalse\tBOOLEAN",
-// "113\troot.isp.d1.s6\tmm3\tTEXT",
-// "113\troot.isp.d1.s1\t13.0\tDOUBLE",
-// "113\troot.isp.d1.s2\t23.0\tFLOAT"));
-//
-// @Before
-// public void before() {
-//
IoTDBDescriptor.getInstance().getConfig().setAutoCreateSchemaEnabled(true);
-// isEnableIDTable =
IoTDBDescriptor.getInstance().getConfig().isEnableIDTable();
-// originalDeviceIDTransformationMethod =
-//
IoTDBDescriptor.getInstance().getConfig().getDeviceIDTransformationMethod();
-// originalEnableCache =
IoTDBDescriptor.getInstance().getConfig().isLastCacheEnabled();
-// IoTDBDescriptor.getInstance().getConfig().setEnableLastCache(false);
-//
-// IoTDBDescriptor.getInstance().getConfig().setEnableIDTable(true);
-//
IoTDBDescriptor.getInstance().getConfig().setDeviceIDTransformationMethod("SHA256");
-// EnvironmentUtils.envSetUp();
-// }
-//
-// @After
-// public void clean() throws IOException, StorageEngineException {
-//
IoTDBDescriptor.getInstance().getConfig().setEnableIDTable(isEnableIDTable);
-// IoTDBDescriptor.getInstance()
-// .getConfig()
-//
.setDeviceIDTransformationMethod(originalDeviceIDTransformationMethod);
-//
IoTDBDescriptor.getInstance().getConfig().setEnableLastCache(originalEnableCache);
-// EnvironmentUtils.cleanEnv();
-// }
-//
-// @Test
-// public void testLastCacheQueryWithoutCache()
-// throws QueryProcessException, MetadataException, InterruptedException,
-// QueryFilterOptimizationException, StorageEngineException,
IOException {
-//
-// insertDataInMemory();
-//
-// PlanExecutor executor = new PlanExecutor();
-// QueryPlan queryPlan =
-// (QueryPlan) processor.parseSQLToPhysicalPlan("select last * from
root.isp.d1");
-// QueryDataSet dataSet = executor.processQuery(queryPlan,
EnvironmentUtils.TEST_QUERY_CONTEXT);
-// Assert.assertEquals(3, dataSet.getPaths().size());
-// int count = 0;
-// while (dataSet.hasNext()) {
-// RowRecord record = dataSet.next();
-// assertTrue(retSet.contains(record.toString()));
-// count++;
-// }
-//
-// assertEquals(retSet.size(), count);
-//
-// // flush and test again
-// PhysicalPlan flushPlan = processor.parseSQLToPhysicalPlan("flush");
-// executor.processNonQuery(flushPlan);
-//
-// dataSet = executor.processQuery(queryPlan,
EnvironmentUtils.TEST_QUERY_CONTEXT);
-// Assert.assertEquals(3, dataSet.getPaths().size());
-// count = 0;
-// while (dataSet.hasNext()) {
-// RowRecord record = dataSet.next();
-// assertTrue(retSet.contains(record.toString()));
-// count++;
-// }
-// assertEquals(retSet.size(), count);
-//
-// // assert id table is not refresh
-// assertNull(
-// IDTableManager.getInstance()
-// .getIDTable(new PartialPath("root.isp.d1"))
-// .getLastCache(new TimeseriesID(new
PartialPath("root.isp.d1.s1"))));
-// }
-//
-// private void insertDataInMemory() throws IllegalPathException,
QueryProcessException {
-// long[] times = new long[] {110L, 111L, 112L, 113L};
-// List<Integer> dataTypes = new ArrayList<>();
-// dataTypes.add(TSDataType.DOUBLE.ordinal());
-// dataTypes.add(TSDataType.FLOAT.ordinal());
-// dataTypes.add(TSDataType.INT64.ordinal());
-// dataTypes.add(TSDataType.INT32.ordinal());
-// dataTypes.add(TSDataType.BOOLEAN.ordinal());
-// dataTypes.add(TSDataType.TEXT.ordinal());
-//
-// Object[] columns = new Object[6];
-// columns[0] = new double[4];
-// columns[1] = new float[4];
-// columns[2] = new long[4];
-// columns[3] = new int[4];
-// columns[4] = new boolean[4];
-// columns[5] = new Binary[4];
-//
-// for (int r = 0; r < 4; r++) {
-// ((double[]) columns[0])[r] = 10.0 + r;
-// ((float[]) columns[1])[r] = 20 + r;
-// ((long[]) columns[2])[r] = 100000 + r;
-// ((int[]) columns[3])[r] = 1000 + r;
-// ((boolean[]) columns[4])[r] = false;
-// ((Binary[]) columns[5])[r] = new Binary("mm" + r);
-// }
-//
-// InsertTabletPlan tabletPlan =
-// new InsertTabletPlan(
-// new PartialPath("root.isp.d1"),
-// new String[] {"s1", "s2", "s3", "s4", "s5", "s6"},
-// dataTypes);
-// tabletPlan.setTimes(times);
-// tabletPlan.setColumns(columns);
-// tabletPlan.setRowCount(times.length);
-//
-// PlanExecutor executor = new PlanExecutor();
-// executor.insertTablet(tabletPlan);
-// }
-// }
diff --git
a/server/src/test/java/org/apache/iotdb/db/metadata/idtable/entry/SchemaEntryTest.java
b/server/src/test/java/org/apache/iotdb/db/metadata/idtable/entry/SchemaEntryTest.java
index 7d0c82b24c..630c7550ea 100644
---
a/server/src/test/java/org/apache/iotdb/db/metadata/idtable/entry/SchemaEntryTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/metadata/idtable/entry/SchemaEntryTest.java
@@ -22,8 +22,6 @@ package org.apache.iotdb.db.metadata.idtable.entry;
import org.apache.iotdb.commons.exception.IllegalPathException;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.TimeValuePair;
-import org.apache.iotdb.tsfile.utils.TsPrimitiveType;
import org.junit.Test;
@@ -47,22 +45,6 @@ public class SchemaEntryTest {
assertEquals(
schemaEntry.getCompressionType(),
TSFileDescriptor.getInstance().getConfig().getCompressor());
-
- // last cache
- schemaEntry.updateCachedLast(
- new TimeValuePair(100L, new TsPrimitiveType.TsLong(1L)), false, 0L);
- assertEquals(new TsPrimitiveType.TsLong(1L), schemaEntry.getLastValue());
- assertEquals(100L, schemaEntry.getLastTime());
-
- schemaEntry.updateCachedLast(
- new TimeValuePair(90L, new TsPrimitiveType.TsLong(2L)), false, 0L);
- assertEquals(new TsPrimitiveType.TsLong(1L), schemaEntry.getLastValue());
- assertEquals(100L, schemaEntry.getLastTime());
-
- schemaEntry.updateCachedLast(
- new TimeValuePair(110L, new TsPrimitiveType.TsLong(2L)), false, 0L);
- assertEquals(new TsPrimitiveType.TsLong(2L), schemaEntry.getLastValue());
- assertEquals(110L, schemaEntry.getLastTime());
}
}
}