Skip to content

Commit

Permalink
Revert "[IOTDB-3184] Implement Timeseries version and blacklist (apac…
Browse files Browse the repository at this point in the history
…he#5998)"

This reverts commit a024ef7.
  • Loading branch information
liuminghui233 committed May 25, 2022
1 parent c834341 commit 8a60557
Show file tree
Hide file tree
Showing 28 changed files with 83 additions and 321 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,6 @@ public void createTimeseries(CreateTimeSeriesPlan plan, long offset) throws Meta
}
}

@Override
public void createTimeseries(CreateTimeSeriesPlan plan, long offset, String version)
throws MetadataException {
throw new UnsupportedOperationException(
"RSchemaRegion currently doesn't support timeseries with version");
}

@TestOnly
protected void createTimeseries(
PartialPath path,
Expand Down Expand Up @@ -534,13 +527,6 @@ public void createAlignedTimeSeries(CreateAlignedTimeSeriesPlan plan) throws Met
}
}

@Override
public void createAlignedTimeSeries(CreateAlignedTimeSeriesPlan plan, List<String> versionList)
throws MetadataException {
throw new UnsupportedOperationException(
"RSchemaRegion currently doesn't support timeseries with version");
}

private void createEntityRecursively(String[] nodes, int start, int end, boolean aligned)
throws RocksDBException, MetadataException, InterruptedException {
if (start <= end) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,6 @@ public void setLastCacheContainer(ILastCacheContainer lastCacheContainer) {
throw new UnsupportedOperationException();
}

@Override
public String getVersion() {
throw new UnsupportedOperationException();
}

@Override
public void setVersion(String version) {
throw new UnsupportedOperationException();
}

@Override
public void serializeTo(MLogWriter logWriter) throws IOException {
throw new UnsupportedOperationException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ public SchemaTree get(PartialPath devicePath, String[] measurements) {
devicePath.concatNode(
schemaCacheEntry.getSchemaEntryId()), // the cached path may be alias path
schemaCacheEntry.getMeasurementSchema(),
null,
schemaCacheEntry.isAligned(),
schemaCacheEntry.getVersion());
schemaCacheEntry.getAlias(),
schemaCacheEntry.isAligned());
}
}
return schemaTree;
Expand All @@ -84,9 +83,17 @@ public void put(SchemaTree schemaTree) {
SchemaCacheEntry schemaCacheEntry =
new SchemaCacheEntry(
(MeasurementSchema) measurementPath.getMeasurementSchema(),
measurementPath.isUnderAlignedEntity(),
measurementPath.getVersion());
measurementPath.isMeasurementAliasExists()
? measurementPath.getMeasurementAlias()
: null,
measurementPath.isUnderAlignedEntity());
cache.put(new PartialPath(measurementPath.getNodes()), schemaCacheEntry);
if (measurementPath.isMeasurementAliasExists()) {
// cache alias path
cache.put(
measurementPath.getDevicePath().concatNode(measurementPath.getMeasurementAlias()),
schemaCacheEntry);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ public class SchemaCacheEntry {

private final MeasurementSchema measurementSchema;

private final boolean isAligned;
private final String alias;

private final String version;
private final boolean isAligned;

private volatile ILastCacheContainer lastCacheContainer = null;

SchemaCacheEntry(MeasurementSchema measurementSchema, boolean isAligned, String version) {
SchemaCacheEntry(MeasurementSchema measurementSchema, String alias, boolean isAligned) {
this.measurementSchema = measurementSchema;
this.alias = alias;
this.isAligned = isAligned;
this.version = version;
}

public String getSchemaEntryId() {
Expand All @@ -52,12 +52,12 @@ public TSDataType getTsDataType() {
return measurementSchema.getType();
}

public boolean isAligned() {
return isAligned;
public String getAlias() {
return alias;
}

public String getVersion() {
return version;
public boolean isAligned() {
return isAligned;
}

public ILastCacheContainer getLastCacheContainer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,6 @@ public ILastCacheContainer getLastCacheContainer() {
@Override
public void setLastCacheContainer(ILastCacheContainer lastCacheContainer) {}

@Override
public String getVersion() {
throw new UnsupportedOperationException("insert measurement mnode doesn't support this method");
}

@Override
public void setVersion(String version) {
throw new UnsupportedOperationException("insert measurement mnode doesn't support this method");
}

@Override
public IMeasurementSchema getSchema() {
return schema;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,4 @@ public interface IMeasurementMNode extends IMNode {
ILastCacheContainer getLastCacheContainer();

void setLastCacheContainer(ILastCacheContainer lastCacheContainer);

String getVersion();

void setVersion(String version);
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ public class MeasurementMNode extends MNode implements IMeasurementMNode {
/** last value cache */
private volatile ILastCacheContainer lastCacheContainer = null;

private String version = null;

/**
* MeasurementMNode factory method. The type of returned MeasurementMNode is according to the
* schema type. The default type is UnaryMeasurementMNode, which means if schema == null, an
Expand Down Expand Up @@ -150,16 +148,6 @@ public void setLastCacheContainer(ILastCacheContainer lastCacheContainer) {
this.lastCacheContainer = lastCacheContainer;
}

@Override
public String getVersion() {
return version;
}

@Override
public void setVersion(String version) {
this.version = version;
}

@Override
public void serializeTo(MLogWriter logWriter) throws IOException {
logWriter.serializeMeasurementMNode(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,6 @@ protected void collectMeasurement(IMeasurementMNode node) {
// only when user query with alias, the alias in path will be set
path.setMeasurementAlias(node.getAlias());
}
path.setVersion(node.getVersion());
result.add(path);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.slf4j.LoggerFactory;

import java.nio.ByteBuffer;
import java.util.Objects;

public class MeasurementPath extends PartialPath {

Expand All @@ -45,8 +44,6 @@ public class MeasurementPath extends PartialPath {
// alias of measurement, null pointer cannot be serialized in thrift so empty string is instead
private String measurementAlias = "";

private String version = null;

public MeasurementPath() {}

public MeasurementPath(String measurementPath) throws IllegalPathException {
Expand Down Expand Up @@ -126,14 +123,6 @@ public void setUnderAlignedEntity(boolean underAlignedEntity) {
isUnderAlignedEntity = underAlignedEntity;
}

public String getVersion() {
return version;
}

public void setVersion(String version) {
this.version = version;
}

@Override
public PartialPath copy() {
MeasurementPath result = new MeasurementPath();
Expand All @@ -146,15 +135,6 @@ public PartialPath copy() {
return result;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
MeasurementPath that = (MeasurementPath) o;
return Objects.equals(version, that.version);
}

/**
* if isUnderAlignedEntity is true, return an AlignedPath with only one sub sensor otherwise,
* return itself
Expand Down Expand Up @@ -193,8 +173,6 @@ public void serialize(ByteBuffer byteBuffer) {
}
ReadWriteIOUtils.write(isUnderAlignedEntity, byteBuffer);
ReadWriteIOUtils.write(measurementAlias, byteBuffer);

ReadWriteIOUtils.write(version, byteBuffer);
}

public static MeasurementPath deserialize(ByteBuffer byteBuffer) {
Expand All @@ -211,9 +189,6 @@ public static MeasurementPath deserialize(ByteBuffer byteBuffer) {
}
measurementPath.isUnderAlignedEntity = ReadWriteIOUtils.readBool(byteBuffer);
measurementPath.measurementAlias = ReadWriteIOUtils.readString(byteBuffer);

measurementPath.version = ReadWriteIOUtils.readString(byteBuffer);

measurementPath.nodes = partialPath.getNodes();
measurementPath.device = partialPath.getDevice();
measurementPath.fullPath = partialPath.getFullPath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,8 @@ public interface ISchemaRegion {
// region Interfaces for Timeseries operation
void createTimeseries(CreateTimeSeriesPlan plan, long offset) throws MetadataException;

void createTimeseries(CreateTimeSeriesPlan plan, long offset, String version)
throws MetadataException;

void createAlignedTimeSeries(CreateAlignedTimeSeriesPlan plan) throws MetadataException;

void createAlignedTimeSeries(CreateAlignedTimeSeriesPlan plan, List<String> versionList)
throws MetadataException;

/**
* Delete all timeseries matching the given path pattern. If using prefix match, the path pattern
* is used to match prefix path. All timeseries start with the matched prefix path will be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,6 @@ public void createTimeseries(CreateTimeSeriesPlan plan) throws MetadataException

@SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning
public void createTimeseries(CreateTimeSeriesPlan plan, long offset) throws MetadataException {
createTimeseries(plan, offset, null);
}

@Override
public void createTimeseries(CreateTimeSeriesPlan plan, long offset, String version)
throws MetadataException {
if (!memoryStatistics.isAllowToCreateNewSeries()) {
throw new SeriesOverflowException();
}
Expand All @@ -522,8 +516,6 @@ public void createTimeseries(CreateTimeSeriesPlan plan, long offset, String vers
plan.getProps(),
plan.getAlias());

leafMNode.setVersion(version);

// the cached mNode may be replaced by new entityMNode in mtree
mNodeCache.invalidate(path.getDevicePath());

Expand Down Expand Up @@ -615,12 +607,6 @@ public void createAlignedTimeSeries(
* @param plan CreateAlignedTimeSeriesPlan
*/
public void createAlignedTimeSeries(CreateAlignedTimeSeriesPlan plan) throws MetadataException {
createAlignedTimeSeries(plan, null);
}

@Override
public void createAlignedTimeSeries(CreateAlignedTimeSeriesPlan plan, List<String> versionList)
throws MetadataException {
if (!memoryStatistics.isAllowToCreateNewSeries()) {
throw new SeriesOverflowException();
}
Expand All @@ -647,12 +633,6 @@ public void createAlignedTimeSeries(CreateAlignedTimeSeriesPlan plan, List<Strin
plan.getCompressors(),
plan.getAliasList());

if (versionList != null) {
for (int i = 0; i < measurements.size(); i++) {
measurementMNodeList.get(i).setVersion(versionList.get(i));
}
}

// the cached mNode may be replaced by new entityMNode in mtree
mNodeCache.invalidate(prefixPath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,13 +538,6 @@ public void createTimeseries(CreateTimeSeriesPlan plan, long offset) throws Meta
}
}

@Override
public void createTimeseries(CreateTimeSeriesPlan plan, long offset, String version)
throws MetadataException {
throw new UnsupportedOperationException(
"SchemaRegion schema file mode currently doesn't support timeseries with version");
}

/**
* Add one timeseries to metadata tree, if the timeseries already exists, throw exception
*
Expand Down Expand Up @@ -707,13 +700,6 @@ public void createAlignedTimeSeries(CreateAlignedTimeSeriesPlan plan) throws Met
}
}

@Override
public void createAlignedTimeSeries(CreateAlignedTimeSeriesPlan plan, List<String> versionList)
throws MetadataException {
throw new UnsupportedOperationException(
"SchemaRegion schema file mode currently doesn't support timeseries with version");
}

/**
* Delete all timeseries matching the given path pattern. If using prefix match, the path pattern
* is used to match prefix path. All timeseries start with the matched prefix path will be
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class SchemaExecutionVisitor extends PlanVisitor<TSStatus, ISchemaRegion>
public TSStatus visitCreateTimeSeries(CreateTimeSeriesNode node, ISchemaRegion schemaRegion) {
try {
PhysicalPlan plan = node.accept(new PhysicalPlanTransformer(), new TransformerContext());
schemaRegion.createTimeseries((CreateTimeSeriesPlan) plan, -1, node.getVersion());
schemaRegion.createTimeseries((CreateTimeSeriesPlan) plan, -1);
} catch (MetadataException e) {
logger.error("{}: MetaData error: ", IoTDBConstant.GLOBAL_DB_NAME, e);
return RpcUtils.getStatus(TSStatusCode.METADATA_ERROR, e.getMessage());
Expand All @@ -67,8 +67,7 @@ public TSStatus visitCreateAlignedTimeSeries(
CreateAlignedTimeSeriesNode node, ISchemaRegion schemaRegion) {
try {
PhysicalPlan plan = node.accept(new PhysicalPlanTransformer(), new TransformerContext());
schemaRegion.createAlignedTimeSeries(
(CreateAlignedTimeSeriesPlan) plan, node.getVersionList());
schemaRegion.createAlignedTimeSeries((CreateAlignedTimeSeriesPlan) plan);
} catch (MetadataException e) {
logger.error("{}: MetaData error: ", IoTDBConstant.GLOBAL_DB_NAME, e);
return RpcUtils.getStatus(TSStatusCode.METADATA_ERROR, e.getMessage());
Expand Down

0 comments on commit 8a60557

Please sign in to comment.