HTHou commented on code in PR #18132:
URL: https://github.com/apache/iotdb/pull/18132#discussion_r3593653470
##########
iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java:
##########
@@ -2857,6 +2867,572 @@ public void insertRelationalTablet(Tablet tablet)
}
}
+ /**
+ * insert relational Tablets.
+ *
+ * @param tablets data batches
+ */
+ public void insertRelationalTablets(List<Tablet> tablets)
+ throws IoTDBConnectionException, StatementExecutionException {
+ final boolean recordMergeTabletsCost = enableMergeTablets;
+ long mergeTabletsCost = 0;
+ if (enableMergeTablets) {
+ final long mergeTabletsStartTime = System.nanoTime();
+ tablets = mergeRelationalTablets(tablets);
+ mergeTabletsCost = System.nanoTime() - mergeTabletsStartTime;
+ }
+ if (tablets.isEmpty()) {
+ throw new BatchExecutionException(SessionMessages.NO_TABLET_INSERTING);
+ }
+ final long insertTabletsStartTime = System.nanoTime();
+ if (enableRedirection) {
+ insertRelationalTabletsWithLeaderCache(tablets);
+ } else {
+ TSInsertTabletsReq request = genTSInsertTabletsReq(tablets, false,
false);
+ request.setWriteToTable(true);
+ for (Tablet tablet : tablets) {
+
request.addToColumnCategoriesList(toEnumOrdinalsAsBytes(tablet.getColumnTypes()));
+ }
+ try {
+ getDefaultSessionConnection().insertTablets(request);
Review Comment:
**High:** In the `enableRedirection == false` branch, this still calls the
one-argument `insertTablets(request)` overload. That overload passes
`request.getPrefixPaths()` to `verifySuccessWithRedirectionForMultiDevices`;
for a relational request this list has one table name per Tablet, while the
server now emits one redirect sub-status per row. For example, a single two-row
Tablet whose rows are redirected produces two sub-statuses but only one prefix
path, so processing the second status accesses `devices.get(1)` and throws
`IndexOutOfBoundsException` after the write has already succeeded, instead of
reaching the ignored `RedirectException`. Please pass row-aligned device IDs
here as the enabled-redirection path does, or use a verification path that
deliberately ignores redirect metadata. A regression test should cover
redirection disabled, a multi-row Tablet, and a non-local leader.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]