[IOTDB-1473] Fix the bug that run SessionExample.java will be failed in#3770
Conversation
|
The basic idea is good, but if you let the DataGroupMembers handle the schema creation and time partitioning is enabled, one tablet may be split into several smaller tablets and they are handled by more than one DataGroupMembers, so the auto-creation may be duplicated and only one of the attempts will succeed. Have you looked into such a case? |
Thanks for your reminder. For the case you mentioned, yes, it's the drawback of the solution but at the same time, it's trade off. There would be same schema creation request submit to meta group but the possibility is small. It only happens if ingestion time series records in the tablet to same storage group fall into different time partition and then different data group. This means either time partition interval is very small or time range of the tablet is widely which are corner cases. Let me test the cases to make sure things work well. The drawback previous solution is obvious, Thanks. |
cluster/src/main/java/org/apache/iotdb/cluster/server/member/DataGroupMember.java
Outdated
Show resolved
Hide resolved
hi, I tested the case that multi different data group submit the same schema creation request. Finally, only one schema creation plan actually executed. Everything works well in the situation. Cluster Env: 4 nodes, replication_num=3, multi-raft-factor=2, enable-partition=true, partition_interval=604800 main test code as below. |
cluster mode. Root cause is auto create schema fail in cluster mode.
bb4ffc5 to
10e02dc
Compare
OneSizeFitsQuorum
left a comment
There was a problem hiding this comment.
LGTM~
In fact, I really like this implementation. This will save us a round of RTT in most cases.
However, there are some cases that may need further fixing, @MrQuansy will continue to fix in PR3638 after your PR is merged. You can continue to communicate with each other.
Thank you for your contribution!
Note this is the replacement of PR: #3755
JIRA issue: https://issues.apache.org/jira/projects/IOTDB/issues/IOTDB-1473
The issue happens because auto create schema not work in cluster mode. The
insertTables()tries to insert timeseries toroot.sg1.d2.s1,root.sg1.d2.s2,root.sg1.d2.s3but which aren't created until the insertion. The schema create logic fail in the execution path which cause the issue.Actually, there are three errors auto create schema related in the cluster as far as I can know (comment out the create timeseries related code in
SessionExample.javato reproduce).This PR fixed the first two of situations. Has filed a JIRA issue to track the third situation which need some more discussion.
Fix logic
Rule
Put the create schema logic as low level as possible in cluster handle logic. Previous, schema auto creating logic is handle in
Coordinator.javawhich often fails becausePathNotExistExceptionoften be wrapped. And it can't handle batch insertion as well.According to the rule, we move the schema creating logic to
executeNonQueryPlaninDataGroupMember.java.Concrete fix
insertTablet()fails because this kind of insertion will callforwardMultiSubPlan()which will return a wrapper result instead of 304 error directly which cause the error handling logic doesn't work.For
insertTablets(), it also need to apply measurements according to failed measurements for all subinsertTablet.