shuwenwei opened a new pull request, #19237:
URL: https://github.com/apache/iotdb/pull/19237
## Motivation
Table session Tablet insertion currently resolves the target database from
the database configured when the session was opened or from the session's
current database. A session that needs to write the same Tablet operation to
multiple databases must execute `USE`, which changes session state and is
inconvenient for mixed-database workloads.
This change adds a request-scoped database argument to Tablet insertion
without changing the session's current database.
## Changes
- Add `ITableSession.insert(Tablet tablet, String database)`.
- Propagate the optional database through `TSInsertTabletReq`, including
leader-cache grouping and redirects.
- Apply the requested database only to the current `InsertTabletStatement`;
the session and connection database remain unchanged.
- Treat a null database like the existing one-argument API and use the
session's current database.
- Reject empty or tree-model database names at the server boundary.
- Update both direct and pooled `ITableSession` implementations.
- Add table-model integration coverage for writing to two databases, null
fallback, and current-database preservation.
## Example
Before, changing the write target also changes session state:
```java
session.executeNonQueryStatement("USE db1");
session.insert(tabletForDb1);
session.executeNonQueryStatement("USE db2");
session.insert(tabletForDb2);
```
After, each insertion can select its database without changing the current
database:
```java
session.insert(tabletForDb1, "db1");
session.insert(tabletForDb2, "db2");
// Null uses the session's current database.
session.insert(tabletForCurrentDb, null);
```
## Compatibility
The database is carried by a new optional Thrift field, so existing
one-argument insert requests remain unchanged. As agreed for this change, the
new overload relies on a same-version or newer server; an older server can
ignore the unknown optional field and fall back to its session database.
## Validation
- `./mvnw spotless:apply` succeeded for the affected modules.
- `git diff --check` passed.
- Per repository constraints, no build or test execution was performed.
--
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]