Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6e6e7a5
Influxdb service adapts to distributed MPP framework
Jul 26, 2022
d32c0dc
fix InfluxFirstFunction,InfluxLastFunction,InfluxMeanFunction
Jul 26, 2022
9e24ad1
Merge branch 'apache:master' into influxdb-service-mpp
KeeProMise Jul 26, 2022
ec08137
Create InfluxDB Protocol Test
KeeProMise Jul 27, 2022
e47bb08
Using the '.*' form of import should be avoided
Jul 27, 2022
57da703
Merge remote-tracking branch 'origin/influxdb-service-mpp' into influ…
Jul 27, 2022
19afe30
spotless apply
Jul 28, 2022
34d4642
influxdb mpp test
Jul 28, 2022
21fb41c
Merge remote-tracking branch 'upstream/master' into influxdb-service-mpp
Jul 28, 2022
3485075
influxdb mpp test
Jul 28, 2022
b688c4d
Modified to rely on an AbstractInfluxDBMetaManager
Jul 28, 2022
9ba89db
Merge branch 'apache:master' into new_influxdb_Mpp
KeeProMise Jul 29, 2022
e0241b6
Generate tag timestamps using AtomicLong
Jul 29, 2022
1ef83e8
Merge branch 'apache:master' into new_influxdb_Mpp
KeeProMise Jul 29, 2022
5b94822
Merge remote-tracking branch 'origin/new_influxdb_Mpp' into influxdb-…
Jul 29, 2022
3482ca2
IDtable add getDiskSchemaEntries()
Aug 16, 2022
2a6b394
Merge remote-tracking branch 'upstream/master' into idtable-disk_read
Aug 16, 2022
9845157
IDtable add deleteTimeserie method
Aug 16, 2022
73b8afb
Merge remote-tracking branch 'upstream/master' into idtable-disk_read
Aug 16, 2022
6cf0506
IDtable add deleteTimeserie method
Aug 18, 2022
fff9512
IDtable add deleteTimeserie method
Aug 18, 2022
790de6e
IDtable add deleteTimeserie method
Aug 18, 2022
d82524f
add AutoIncrementDeviceID
Aug 20, 2022
6f67816
StandAloneAutoIncDeviceID
Aug 22, 2022
db56e67
Merge branch 'apache:master' into master
KeeProMise Aug 23, 2022
8210f7f
no
Aug 23, 2022
6d43024
Merge remote-tracking branch 'origin/master'
Aug 23, 2022
227a5c1
Merge remote-tracking branch 'origin/master' into idtable_add_autoIncID
Aug 23, 2022
ab65bdb
add clean
Aug 23, 2022
cd3a97d
cleanEnv first
Aug 23, 2022
17b8dba
fix:test error
Aug 23, 2022
83d3794
fix:test error
Aug 24, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.iotdb.db.engine.memtable.IWritableMemChunk;
import org.apache.iotdb.db.engine.memtable.IWritableMemChunkGroup;
import org.apache.iotdb.db.exception.runtime.FlushRunTimeException;
import org.apache.iotdb.db.metadata.idtable.entry.IDeviceID;
import org.apache.iotdb.db.metadata.idtable.deviceID.IDeviceID;
import org.apache.iotdb.db.rescon.SystemInfo;
import org.apache.iotdb.db.service.metrics.MetricService;
import org.apache.iotdb.db.service.metrics.enums.Metric;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import org.apache.iotdb.db.engine.querycontext.ReadOnlyMemChunk;
import org.apache.iotdb.db.exception.WriteProcessException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.metadata.idtable.deviceID.IDeviceID;
import org.apache.iotdb.db.metadata.idtable.entry.DeviceIDFactory;
import org.apache.iotdb.db.metadata.idtable.entry.IDeviceID;
import org.apache.iotdb.db.metadata.utils.ResourceByPathUtils;
import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertRowNode;
import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertTabletNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.iotdb.db.engine.querycontext.ReadOnlyMemChunk;
import org.apache.iotdb.db.exception.WriteProcessException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.metadata.idtable.entry.IDeviceID;
import org.apache.iotdb.db.metadata.idtable.deviceID.IDeviceID;
import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertRowNode;
import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertTabletNode;
import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package org.apache.iotdb.db.engine.memtable;

import org.apache.iotdb.db.metadata.idtable.entry.IDeviceID;
import org.apache.iotdb.db.metadata.idtable.deviceID.IDeviceID;

import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
import org.apache.iotdb.db.exception.WriteProcessException;
import org.apache.iotdb.db.exception.WriteProcessRejectException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.metadata.idtable.deviceID.IDeviceID;
import org.apache.iotdb.db.metadata.idtable.entry.DeviceIDFactory;
import org.apache.iotdb.db.metadata.idtable.entry.IDeviceID;
import org.apache.iotdb.db.metadata.path.AlignedPath;
import org.apache.iotdb.db.metadata.utils.ResourceByPathUtils;
import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertRowNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.apache.iotdb.commons.exception.MetadataException;
import org.apache.iotdb.commons.utils.TestOnly;
import org.apache.iotdb.db.metadata.idtable.deviceID.IStatefulDeviceID;
import org.apache.iotdb.db.metadata.idtable.entry.DeviceIDFactory;
import org.apache.iotdb.db.metadata.idtable.entry.DiskSchemaEntry;
import org.apache.iotdb.db.metadata.idtable.entry.SchemaEntry;
Expand All @@ -38,6 +39,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -158,11 +160,29 @@ public void recover(IDTable idTable) {
TSEncoding.deserialize(cur.encoding),
CompressionType.deserialize(cur.compressor),
loc);
if (IStatefulDeviceID.class.isAssignableFrom(
DeviceIDFactory.getInstance().getDeviceIDClass())) {
IStatefulDeviceID statefulDeviceID =
(IStatefulDeviceID)
DeviceIDFactory.getInstance()
.getDeviceIDClass()
.getDeclaredConstructor()
.newInstance();
statefulDeviceID.recover(
cur.seriesKey.substring(
0, cur.seriesKey.length() - cur.measurementName.length() - 1),
cur.deviceID);
}
idTable.putSchemaEntry(cur.deviceID, cur.measurementName, schemaEntry, cur.isAligned);
}
loc += cur.entrySize;
}
} catch (IOException | MetadataException e) {
} catch (IOException
| MetadataException
| NoSuchMethodException
| InvocationTargetException
| InstantiationException
| IllegalAccessException e) {
logger.info("Last entry is incomplete, we will recover as much as we can.");
try {
outputStream.getChannel().truncate(loc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +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.deviceID.IDeviceID;
import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
import org.apache.iotdb.db.metadata.idtable.entry.DeviceIDFactory;
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.idtable.entry.TimeseriesID;
import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.exception.metadata.DataTypeMismatchException;
import org.apache.iotdb.db.metadata.idtable.deviceID.IDeviceID;
import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
import org.apache.iotdb.db.metadata.idtable.entry.DeviceIDFactory;
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.InsertMeasurementMNode;
import org.apache.iotdb.db.metadata.idtable.entry.SchemaEntry;
import org.apache.iotdb.db.metadata.idtable.entry.TimeseriesID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package org.apache.iotdb.db.metadata.idtable.entry;
package org.apache.iotdb.db.metadata.idtable.deviceID;

import java.nio.ByteBuffer;

Expand All @@ -29,7 +29,7 @@ public interface IDeviceID {
*
* @return string format device id
*/
public String toStringID();
String toStringID();

public void serialize(ByteBuffer byteBuffer);
void serialize(ByteBuffer byteBuffer);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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.deviceID;

/** stateful device id interface */
public interface IStatefulDeviceID extends IDeviceID {

/**
* recover state from devicePath and deviceID
*
* @param devicePath device path read from the non-volatile storage medium, like: "root.sg.x.d1"
* @param deviceID device ID read from the non-volatile storage medium
*/
void recover(String devicePath, String deviceID);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package org.apache.iotdb.db.metadata.idtable.entry;
package org.apache.iotdb.db.metadata.idtable.deviceID;

import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iotdb.db.metadata.idtable.entry;
package org.apache.iotdb.db.metadata.idtable.deviceID;

import org.apache.iotdb.db.metadata.idtable.IDTable;
import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/*
* 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.deviceID;

import org.apache.iotdb.commons.utils.TestOnly;
import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;

import java.nio.ByteBuffer;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/** Using auto-incrementing int as device id */
public class StandAloneAutoIncDeviceID implements IStatefulDeviceID {

// maintain the mapping relationship of devicePath to autoIncrementID,in order reducing memory
// consumption, the devicePath will actually be converted to SHA256DeviceID in advance
private static final Map<SHA256DeviceID, StandAloneAutoIncDeviceID> devicePath2autoIncrementID;

// increment from 0
int autoIncrementID;

static {
devicePath2autoIncrementID = new ConcurrentHashMap<>();
}

public StandAloneAutoIncDeviceID() {}

public StandAloneAutoIncDeviceID(int id) {
this.autoIncrementID = id;
}

public StandAloneAutoIncDeviceID(String deviceID) {
// if the device id string is a autoIncrementDeviceID form, like: "`1`",
// convert string directly to autoIncrementID
if (deviceID.startsWith("`") && deviceID.endsWith("`")) {
fromAutoIncrementDeviceID(deviceID);
} else {
buildAutoIncrementDeviceID(deviceID);
}
}

/**
* convert string directly to autoIncrementID
*
* @param deviceID device ID, like: "`1`"
*/
private void fromAutoIncrementDeviceID(String deviceID) {
deviceID = deviceID.substring(1, deviceID.length() - 1);
this.autoIncrementID = Integer.parseInt(deviceID);
}

/**
* build device id from a device path
*
* @param devicePath device path, like: "root.sg.x.d1"
*/
private void buildAutoIncrementDeviceID(String devicePath) {
SHA256DeviceID sha256DeviceID = new SHA256DeviceID(devicePath);
this.autoIncrementID =
devicePath2autoIncrementID.computeIfAbsent(
sha256DeviceID,
sha256DeviceID1 -> new StandAloneAutoIncDeviceID(devicePath2autoIncrementID.size()))
.autoIncrementID;
}

/**
* make sure the hashcode of any AutoIncrementDeviceID object with the equal autoIncrementID are
* equal,so use the autoIncrementID of type Long as the hashcode of the object
*/
@Override
public int hashCode() {
return this.autoIncrementID;
}

/** make sure any AutoIncrementDeviceID objects with equal autoIncrementID variables are equal */
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof StandAloneAutoIncDeviceID)) {
return false;
}
StandAloneAutoIncDeviceID that = (StandAloneAutoIncDeviceID) o;
return this.autoIncrementID == that.autoIncrementID;
}

@Override
public String toString() {
return "AutoIncrementDeviceID{" + "autoIncrementID=" + autoIncrementID + '}';
}

/**
* to string format
*
* @return string format device id
*/
@Override
public String toStringID() {
return "`" + autoIncrementID + "`";
}

/**
* recover map devicePath2autoIncrementID
*
* @param devicePath device path read from the non-volatile storage medium, like: "root.sg.x.d1"
* @param deviceID device ID read from the non-volatile storage medium, like: ""
*/
@Override
public void recover(String devicePath, String deviceID) {
SHA256DeviceID sha256DeviceID = new SHA256DeviceID(devicePath);
fromAutoIncrementDeviceID(deviceID);
devicePath2autoIncrementID.put(sha256DeviceID, this);
}

@TestOnly
public static void reset() {
devicePath2autoIncrementID.clear();
}

@Override
public void serialize(ByteBuffer byteBuffer) {
ReadWriteIOUtils.write(autoIncrementID, byteBuffer);
}

public static StandAloneAutoIncDeviceID deserialize(ByteBuffer byteBuffer) {
StandAloneAutoIncDeviceID autoIncrementDeviceID = new StandAloneAutoIncDeviceID();
autoIncrementDeviceID.autoIncrementID = ReadWriteIOUtils.readInt(byteBuffer);
return autoIncrementDeviceID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

package org.apache.iotdb.db.metadata.idtable.entry;

import org.apache.iotdb.db.metadata.idtable.deviceID.IDeviceID;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
Expand Down
Loading