New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IOTDB-173] add batch rpc interface #351
Conversation
example/client/src/main/java/org/apache/iotdb/client/SessionTest.java
Outdated
Show resolved
Hide resolved
example/client/src/main/java/org/apache/iotdb/client/StatementTest.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
Outdated
Show resolved
Hide resolved
for (Integer result : results) { | ||
long t2 = System.currentTimeMillis(); | ||
isAllSuccessful = isAllSuccessful && (result == TS_StatusCode.SUCCESS_STATUS.getValue() ? true : false); | ||
Measurement.INSTANCE.addOperationLatency(Operation.EXECUTE_ONE_SQL_IN_BATCH, t2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t1 is the whole batch, t2 is each statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try using more meaningful names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if so, I suggest remove this ..... it is almost 0...
try { | ||
getLogNode().write(batchInsertPlan); | ||
} catch (IOException e) { | ||
logger.error("write WAL failed", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change values of results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
latestTimeForEachDevice.putIfAbsent(batchInsertPlan.getDeviceId(), Long.MIN_VALUE); | ||
latestFlushedTimeForEachDevice.putIfAbsent(batchInsertPlan.getDeviceId(), Long.MIN_VALUE); | ||
|
||
List<Integer> results = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use Integer[] instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
switch (dataType) { | ||
case BOOLEAN: | ||
putBoolean(insertTime, (Boolean)value); | ||
//TODO if indexes.size() == times.length, could we write a chunk at a time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implement this. It is important!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
client/src/main/java/org/apache/iotdb/session/IoTDBRowBatch.java
Outdated
Show resolved
Hide resolved
client/src/main/java/org/apache/iotdb/session/IoTDBRowBatch.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/qp/physical/crud/BatchInsertPlan.java
Show resolved
Hide resolved
for (Integer result : results) { | ||
long t2 = System.currentTimeMillis(); | ||
isAllSuccessful = isAllSuccessful && (result == TS_StatusCode.SUCCESS_STATUS.getValue() ? true : false); | ||
Measurement.INSTANCE.addOperationLatency(Operation.EXECUTE_ONE_SQL_IN_BATCH, t2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try using more meaningful names.
example/client/src/main/java/org/apache/iotdb/client/ClientExample.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine.
I have tested the interface and when using this interface to write data in batch |
public static void main(String[] args) throws ClassNotFoundException, IoTDBSessionException { | ||
Class.forName("org.apache.iotdb.jdbc.IoTDBDriver"); | ||
try (Connection connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root"); | ||
Statement statement = connection.createStatement()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I hope you can add those metadata interfaces so that you may avoid using jdbc in your rpc example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I hope that too, I will add them in the next PR.
write total 90000 points, batch size = 100, 300 batch
jdbc batch statement
batch rpc interface: