Skip to content
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

Merged
merged 22 commits into from Aug 26, 2019
Merged

[IOTDB-173] add batch rpc interface #351

merged 22 commits into from Aug 26, 2019

Conversation

qiaojialin
Copy link
Member

@qiaojialin qiaojialin commented Aug 22, 2019

write total 90000 points, batch size = 100, 300 batch

jdbc batch statement

image

batch rpc interface:

image

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t1?

Copy link
Member Author

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

Copy link
Contributor

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.

Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change values of results

Copy link
Member Author

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<>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Integer[] instead

Copy link
Member Author

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
Copy link
Member

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!

Copy link
Member Author

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/Session.java Outdated Show resolved Hide resolved
client/src/main/java/org/apache/iotdb/session/Session.java Outdated Show resolved Hide resolved
client/src/main/java/org/apache/iotdb/session/Session.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);
Copy link
Contributor

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.

@qiaojialin qiaojialin changed the title add batch rpc interface [IOTDB-173] add batch rpc interface Aug 23, 2019
client/pom.xml Outdated Show resolved Hide resolved
Copy link
Contributor

@jt2594838 jt2594838 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine.

@jixuan1989
Copy link
Member

I have tested the interface and when using this interface to write data in batch
e.g., write 1000 data points of device 1 first, then 1000 data points of device 2, then ...
Comparing with using Statement.executeBatch(), using this interface is 5 faster than Statement.executeBatch().

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()) {
Copy link
Contributor

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.

Copy link
Member Author

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.

@qiaojialin qiaojialin merged commit 6ce1f41 into master Aug 26, 2019
@qiaojialin qiaojialin deleted the rpc_client branch September 2, 2019 12:33
neuyilan pushed a commit that referenced this pull request Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants