Repository navigation
Conversation
|
CI reported an error in Validation passed on Windows 11 with JDK 17: Updated from source head |
|
Scoped re-review: column deletion progress. Confirmed and fixed the missing observability for The new Column-progress validation at
Reviewed source head: This was a scoped fix round, not an independent review of the full PR. The PR remains a draft pending a fresh independent review of the complete latest diff. Remote CI was not awaited. Requested follow-up: internal deletion RPC deadlinesThe tree/column deletion requests still used the default client deadline. They now use the same temporary Validation at Follow-up source baseline: The PR remains a draft pending a fresh independent review of the complete latest diff. This requested follow-up is not another independent review round. Remote CI was not awaited. |
| final String paths = "[" + sql.substring(sql.lastIndexOf(' ') + 1) + "]"; | ||
| // Poll the ConfigNode directly so diagnostics do not add SQL audit records to this test. | ||
| try (SyncConfigNodeIServiceClient client = | ||
| (SyncConfigNodeIServiceClient) EnvFactory.getEnv().getLeaderConfigNodeConnection()) { | ||
| final long previousProcedureId = | ||
| client.showDeleteTimeSeriesProcedures().getProcedureInfoList().stream() | ||
| .filter(p -> paths.equals(p.getPathPatterns())) | ||
| .mapToLong(p -> p.getProcedureId()) | ||
| .max() | ||
| .orElse(-1L); | ||
| statement.execute(sql); | ||
| await() | ||
| .atMost(60, TimeUnit.SECONDS) | ||
| .pollInSameThread() | ||
| .pollInterval(20, TimeUnit.MILLISECONDS) | ||
| .until( | ||
| () -> { | ||
| final java.util.Optional< | ||
| org.apache.iotdb.confignode.rpc.thrift.TDeleteTimeSeriesProcedureInfo> | ||
| procedure = | ||
| client.showDeleteTimeSeriesProcedures().getProcedureInfoList().stream() | ||
| .filter(p -> paths.equals(p.getPathPatterns())) | ||
| .filter(p -> p.getProcedureId() > previousProcedureId) | ||
| .max(java.util.Comparator.comparingLong(p -> p.getProcedureId())); | ||
| if (!procedure.isPresent()) { | ||
| return false; | ||
| } | ||
| if ("ROLLEDBACK".equals(procedure.get().getState())) { | ||
| throw new AssertionError( | ||
| "Timeseries deletion procedure " | ||
| + procedure.get().getProcedureId() | ||
| + " rolled back: " | ||
| + procedure.get().getErrorMessage()); | ||
| } | ||
| return "SUCCESS".equals(procedure.get().getState()); | ||
| }); | ||
| } |
There was a problem hiding this comment.
Why is TestUtils.deleteTimeSeries not applied here.
And mind the import.
There was a problem hiding this comment.
This test deliberately keeps progress polling out of SQL. TestUtils.deleteTimeSeries submits through a Session and then polls SHOW DELETE TIMESERIES PROGRESS, which would add audit events and change the exact audit-log expectations of this test. The test keeps its JDBC submission and uses direct ConfigNode RPC for diagnostics; the imports are now explicit.
| @Test | ||
| public void testColumnDeletionWaitsForFinalization() { | ||
| final AtomicInteger probes = new AtomicInteger(); | ||
| final ResultSet absentColumn = | ||
| (ResultSet) | ||
| Proxy.newProxyInstance( | ||
| ResultSet.class.getClassLoader(), | ||
| new Class<?>[] {ResultSet.class}, | ||
| (proxy, method, args) -> { | ||
| if ("next".equals(method.getName())) { | ||
| return false; | ||
| } | ||
| if ("close".equals(method.getName())) { | ||
| return null; | ||
| } | ||
| throw new UnsupportedOperationException(method.getName()); | ||
| }); | ||
| final Statement statement = | ||
| (Statement) | ||
| Proxy.newProxyInstance( | ||
| Statement.class.getClassLoader(), | ||
| new Class<?>[] {Statement.class}, | ||
| (proxy, method, args) -> { | ||
| if ("executeQuery".equals(method.getName())) { | ||
| return absentColumn; | ||
| } | ||
| if ("execute".equals(method.getName())) { | ||
| assertEquals( | ||
| "ALTER TABLE test.t DROP COLUMN IF EXISTS \"removed\"\"column\"", args[0]); | ||
| if (probes.incrementAndGet() == 1) { | ||
| throw new SQLException( | ||
| "deletion still finalizing", | ||
| null, | ||
| TSStatusCode.OVERLAP_WITH_EXISTING_TASK.getStatusCode()); | ||
| } | ||
| return false; | ||
| } | ||
| throw new UnsupportedOperationException(method.getName()); | ||
| }); | ||
| TestUtils.waitForColumnDeletion(statement, "test.t", "removed\"column"); | ||
| assertEquals(2, probes.get()); | ||
| } |
There was a problem hiding this comment.
This does not seem to be an integration test.
There was a problem hiding this comment.
Agreed. The test only used proxy Statement/ResultSet objects and never exercised an IoTDB environment, so I removed it from the integration-test class. The real table-deletion IT now exercises TestUtils.dropColumn against IoTDB.
| Awaitility.await() | ||
| .pollInterval(200, TimeUnit.MILLISECONDS) | ||
| .atMost(60, TimeUnit.SECONDS) | ||
| .until( | ||
| () -> { | ||
| boolean present = false; | ||
| try (ResultSet result = | ||
| statement.executeQuery("DESCRIBE " + database + ".sensor DETAILS")) { | ||
| while (result.next()) { | ||
| present |= "changing".equals(result.getString(1)); | ||
| } | ||
| } | ||
| if (!present) { | ||
| return true; | ||
| } | ||
| // A failed task retains its pre-delete marker. Retrying the drop after restoring | ||
| // the RPC completes it; a still-running task rejects the overlapping request. | ||
| try { | ||
| update("ALTER TABLE sensor DROP COLUMN changing"); | ||
| } catch (SQLException e) { | ||
| assertTrue( | ||
| e.getMessage(), | ||
| e.getErrorCode() == TSStatusCode.OVERLAP_WITH_EXISTING_TASK.getStatusCode() | ||
| || e.getErrorCode() == TSStatusCode.COLUMN_NOT_EXISTS.getStatusCode()); | ||
| } | ||
| return false; | ||
| }); | ||
| TestUtils.waitForColumnDeletion(statement, database + ".sensor", "changing"); |
There was a problem hiding this comment.
Are the two waits duplicated?
There was a problem hiding this comment.
The waits cover different outcomes. The first loop belongs to the injected-failure recovery scenario: it retries while the column remains and confirms schema removal after the RPC is restored. waitForColumnDeletion then waits for the asynchronous procedure to finish durable finalization before dependent DDL. The visible schema check overlaps, but the completion probe does not.
| statement.execute("ALTER TABLE t DROP COLUMN attr"); | ||
| TestUtils.waitForColumnDeletion(progress, "async_drop_column_db.t", "attr"); |
There was a problem hiding this comment.
Why not TestUtils.dropColumn?
There was a problem hiding this comment.
Changed to TestUtils.dropColumn, which submits the DDL and waits for completion through the shared helper. The IT covers field and attribute deletion, plus a quoted column name.
| public void setTimeseriesDeletionExecutionIntervalMs(long intervalMs) { | ||
| if (intervalMs <= 0) { | ||
| throw new IllegalArgumentException(CommonMessages.SIZE_MUST_BE_POSITIVE); | ||
| } | ||
| timeseriesDeletionExecutionIntervalMs = intervalMs; | ||
| } |
There was a problem hiding this comment.
Updated: zero and negative values normalize to 0, which the scheduler treats as no start interval. The properties template documents this, and tests cover both values plus runtime reload.
| if (prefix.hasWildcard()) { | ||
| remaining.appendPathPattern(path); | ||
| continue; | ||
| } | ||
| final Map<String, TDatabaseSchema> matched = | ||
| manager.getClusterSchemaManager().getMatchedDatabaseSchemasByPrefix(prefix); |
There was a problem hiding this comment.
May still delete a database if it is fully covered by the prefix.
There was a problem hiding this comment.
Yes. A literal prefix ending in ** still matches full tree-model databases and routes those through the database-schema procedure path, with the template check retained and schemas recreated by the durable procedure. Patterns that do not cover a whole database continue through per-timeseries deletion.
| final String[] databaseNodes = databasePath.getNodes(); | ||
| for (PartialPath path : getPatternTree().getAllPathPatterns()) { | ||
| if (!PathPatternUtil.isMultiLevelMatchWildcard(path.getMeasurement()) | ||
| || path.getNodeLength() <= 1) { | ||
| continue; | ||
| } | ||
| final PartialPath prefix = | ||
| new PartialPath(Arrays.copyOf(path.getNodes(), path.getNodeLength() - 1)); | ||
| if (!prefix.hasWildcard() | ||
| && prefix.getNodeLength() <= databaseNodes.length | ||
| && Arrays.equals( | ||
| prefix.getNodes(), Arrays.copyOf(databaseNodes, prefix.getNodeLength()))) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; |
There was a problem hiding this comment.
Is it possible to search the database nodes directly in the pattern tree and check whether the matching node is a "**" or contains a child of "**", without constructing the intermediate paths?
There was a problem hiding this comment.
The async procedure keeps the schema manager prefix lookup. It strips only terminal ** to form the literal prefix and calls getMatchedDatabaseSchemasByPrefix; it does not synthesize intermediate paths. Prefixes containing wildcards stay on the normal pattern-tree path. This preserves the indexed lookup and its matching semantics.
| public String getDeleteProgress() { | ||
| final DeleteTimeSeriesState state = getCurrentState(); | ||
| return isFinished() || state == null ? getState().name() : state.name(); | ||
| } |
There was a problem hiding this comment.
A detailed progress assembling dropping table?
There was a problem hiding this comment.
Progress is phase-based rather than a percentage: the procedure exposes queued/running/finalizing status and phases such as preparation, blacklist construction, cache/data/schema deletion, and database recreation. Region deletion does not supply reliable per-series completion counts, so a percentage would be misleading.
| private List<Procedure<ConfigNodeProcedureEnv>> copyDeletionProcedures( | ||
| List<Procedure<ConfigNodeProcedureEnv>> procedures) { | ||
| final List<Procedure<ConfigNodeProcedureEnv>> copies = new ArrayList<>(procedures.size()); | ||
| for (Procedure<ConfigNodeProcedureEnv> procedure : procedures) { | ||
| try { | ||
| copies.add(copyDeletionProcedure(procedure)); | ||
| } catch (IOException e) { | ||
| throw new IllegalStateException(ConfigNodeMessages.LOAD_PROCEDURE_WAL_FAILED, e); | ||
| } | ||
| } | ||
| return copies; | ||
| } |
There was a problem hiding this comment.
Add a detailed explaination about why copying is necessary.
There was a problem hiding this comment.
The comment now explains the ownership boundary: ProcedureInfo retains the last consensus-applied instance, while the executor mutates its working instance before the next consensus write. The serialized copy keeps uncommitted state changes from appearing durable when a write fails, protecting retries and recovery.
| # Minimum interval between starting tree-model timeseries deletion tasks, in milliseconds. | ||
| # Measured when tasks leave the queue to start execution; submissions are not rate-limited. | ||
| # effectiveMode: restart | ||
| # Datatype: long, greater than 0 | ||
| timeseries_deletion_execution_interval_ms=1000 |
There was a problem hiding this comment.
The execution interval is hot-reloadable: configuration updates the ProcedureExecutor scheduler and wakes workers waiting on the interval. Tests cover applying a runtime change, waking an existing wait after an interval decrease, and keeping the scheduler in sync when a later setting fails validation.
Independent review: two-patch scopeThis round reviewed only Finding (P2, fixed): In No other confirmed issues were found in the two-patch scope. The review checked progress aggregation and per-Region replica deduplication, procedure/task correlation under retries and replica changes, persistence and older serialized state, view-column compatibility, information-schema registration/RPC/routing/result fields, error and terminal-state reporting, long-running deletion RPC deadlines, bounded cache-invalidation broadcasts, and shared A separate user-requested change in the final update makes Verification: On final candidate The 1C1D/1C3D ITs, Chinese compile, full build, and full regression were not rerun on the final candidate. A separate clean remote build attempt could not resolve Maven Surefire from Maven Central and did not execute tests. Remote CI was not awaited. A fresh independent review is required after this behavior fix; the PR remains Draft. |
|
Independent re-review completed in this session (one round). Three P2 behavioral findings were fixed and pushed. The PR remains Draft pending a fresh independent re-review.
Original column-progress and RPC changes
The previous timeout-restoration repair was independently checked in dispatch cleanup, callbacks, retries and replica switching. The synchronous-dispatch regression now asserts the original timeout inside The requested diff and relevant call contexts were also checked for Region/replica counting, Additional deletion-interval hot reload
Verification
|
|
Independent re-review completed in this session (one round). One P2 behavioral finding was repaired. The PR remains Draft pending a fresh independent re-review.
Original column-progress and RPC changes
The full current diff and relevant callers were inspected, including synchronous dispatch exceptions and timeout restoration before pool return, success/error callbacks, retries, replica switching and finite cache-invalidation broadcasts. Region deduplication, executing-replica counts, unknown versus zero values, procedure/task IDs, concurrent and late responses, persistence and old formats, view-column compatibility, information-schema registration/query/filtering, terminal errors, and the shared Additional deletion-interval hot reload No new confirmed finding. Checked configuration applicability and positive-value validation, serialized configuration application, reconciliation in Verification
|
Independent Review SummaryCompared with base Found one test-logic issue at No source-behavior issue was confirmed in the complete PR diff. Final local commit and confirmed source/PR head: Verification: Spotless apply and |
|
Addressed the 12 inline comments in a1cb725: reused the shared column-drop helper and removed the proxy-only IT; kept direct ConfigNode RPC polling in the audit test so diagnostics do not add audit events; documented non-positive execution intervals and covered runtime reload; separated table-task conflicts from tree deletion; retained the whole-database prefix optimization and template validation; and clarified why stored procedure copies are required. Phase-based progress and the two-stage column wait remain intentional because they track different procedure phases and completion conditions. Validation: Spotless and git diff --check passed; 10 targeted ConfigNode unit tests passed; IoTDBTableIT#testAsyncDropColumn passed under both TableSimpleIT and TableClusterIT (one test each). Remote Maven attempts were blocked because Maven Central was unreachable, and the offline retry lacked the Checkstyle plugin. The local commit and PR head are a1cb725. The PR remains Draft pending a fresh independent review. |
|
Fixed the failing AsyncTimeSeriesDeletionTest.testFullDatabaseDeletionReservesTableAndDatabaseChanges case. checkDuplicateTableTask now treats a pending full-database tree timeseries deletion as a conflict for table-model operations in the same database, including while the procedure is finalizing. The correlated DELETE_DATABASE_PROCEDURE from that deletion may continue, while another table operation with the same query ID remains blocked. Validation on 8325dc3: a clean ConfigNode dependency-closure run passed 18 tests, with 0 failures, errors, or skips. Spotless and git diff --check passed. The remote attempt could not reach compilation because the required TsFile snapshot was absent from that host cache; the matching snapshot source was built locally and the focused test passed locally. Starting PR head: a1cb725. Final local, source-branch, and PR head: 8325dc3. The PR remains Draft pending an independent re-review of the full diff. |
Description
Tree-model
DELETE/DROP TIMESERIESand table-modelALTER TABLE ... DROP COLUMNreturn after durable admission of a background procedure. Callers can inspect tree deletion withSHOW DELETE TIMESERIES PROGRESSand column deletion withinformation_schema.drop_table_column_procedures, then wait for completion before dependent DDL.DROP TABLE. Share counter aggregation and persistence between table and column deletion.Tree-model asynchronous deletion configuration
Configure these ConfigNode settings in
iotdb-system.properties. The execution interval can be changed at runtime; queue capacity and task concurrency take effect after a ConfigNode restart.timeseries_deletion_queue_capacity1024timeseries_deletion_execution_interval_ms1000(1 second)timeseries_deletion_max_concurrent_tasks1The execution interval applies when tasks leave the queue to start execution. Enqueue requests are not throttled by this interval. With the defaults, up to 1024 tasks can wait, one task executes at a time, and successive task starts are at least 1 second apart.
Example: submit tree deletions and track completion
Each
DELETE TIMESERIESreturns after its task has been durably admitted, with a task/procedure ID in the response message. It does not wait for deletion to finish. The two requests can be submitted back-to-back; with the default scheduler settings, their tasks execute one at a time and start at least 1 second apart.SHOW DELETE TIMESERIES PROGRESSreturnsProcedureId,QueryId,Paths,State,Progress, andErrorMessage. Match each returned procedure ID and poll until itsStateisSUCCESSbefore recreating the corresponding timeseries or issuing dependent DDL.FINALIZINGstill means completion is being persisted;ROLLEDBACKindicates failure and should be checked withErrorMessage.For example, after the task for
root.async_delete_demo.d1.s1reportsSUCCESS, the series can be recreated:Example: track column deletion
After submitting
ALTER TABLE ... DROP COLUMN, query its procedure:The columns are
database,table_name,column_name,procedure_id,state,progress,error_message,written_mod_file_count, andremaining_mod_file_count. Wait forstate = 'SUCCESS'before dependent DDL. Completed procedures remain visible for the existing procedure-result retention period.The mod-file counters use the same aggregation as
information_schema.drop_table_procedures: one executing replica per Region contributes, so replicas do not multiply counts. Unavailable counts remainNULL; attribute deletion and field deletion without data finish with0written and0remaining. Column progress is persisted and older serialized column procedures remain readable.DESCRIBE ... DETAILScontinues to show the column'sDELETINGstatus while deletion is in progress.Validation
Latest RPC-deadline follow-up at
2686b541cf22021dae6514dd3c5fa3c5f2836676: clean English ConfigNode dependency-closure compilation and all 3 request-manager tests passed. These exercise deadline removal and pooled-client timeout restoration on success/error for 7 deletion request types, plus bounded tree/table/column cache invalidation. Spotless andgit diff --checkpassed.The column-progress runtime and Chinese compilation results below are from
5a50867adb08f638f2d5c7a74532045bf8d97af7; those checks were not rerun for the RPC-deadline follow-up.Column-progress update at
5a50867adb08f638f2d5c7a74532045bf8d97af7: 32 targeted unit tests passed with no failures, errors, or skips, covering procedure persistence/backward compatibility, running and retained task results, counter aggregation, view compatibility, and DataRegion column-deletion mod files.Both new column-progress ITs passed in 1C1D. A clean English integration-test dependency-closure
verify -pl integration-test -am -P with-integration-tests,TableClusterITbuild passed all 3 cases in the complete mod-progress IT class, with no failures, errors, or skips. Reports and node logs confirm the 1C3D topology and multi-node query verification.Clean Chinese test compilation of ConfigNode and its IoTDB dependency closure passed. Spotless,
git diff --check, message-key/placeholder parity, and integration-test discovery checks passed.Earlier tree-deletion validation is historical: the preceding implementation had 56 targeted unit-test and 8 targeted IT passes, including 1C1D/1C3D and Memory/PBTree coverage. The selected audit IT was skipped by its existing class-level
@Ignore; its body did not run. These results were not rerun for this column-progress update.Verification reused third-party dependency caches and disabled Maven extensions/build caching. The relevant IoTDB dependency closures were rebuilt from source. Checkstyle was skipped and Enforcer remained at the repository default skipped setting.
Not run: full-reactor English/Chinese builds, complete distribution packaging, the remaining affected IT matrix (including the Session-path test update), the audit IT body, and real-cluster leader-switch race scenarios.
This PR has:
The column-progress update is a scoped fix. The PR remains a draft pending a fresh independent review of the complete latest diff.
Key changed classes
ProcedureManager,ProcedureExecutor,DeleteTimeSeriesProcedure,DeleteTimeSeriesProcedureScheduler,ConfigProcedureStore,DropTableColumnProcedure,TableDeletionModProgress, information-schema suppliers, SQL parsing/progress RPC classes, and integration-test completion helpers.