Hi all,

Recent changes on Apache IoTDB master make the following schema-deletion 
operations asynchronous by default:

- Tree model: `DELETE TIMESERIES`
- Table model: `DROP TABLE`
- Table model: `ALTER TABLE ... DROP COLUMN`

These operations can require many DataRegions to write deletion markers (mods). 
For large schemas, the DataRegion mod-file work can be slow; waiting for it in 
the original DDL request could cause the request to time out, while providing 
no useful view of the work in progress. The asynchronous procedures let the DDL 
return after the task is submitted, then expose procedure status and mod-write 
counts for monitoring.

A successful asynchronous response means “accepted,” not “fully completed.” The 
response includes a procedure ID. Clients that need to know when deletion has 
finished should poll the corresponding progress view rather than assuming that 
the DDL response means all mod-file work is done.

For tree-model time-series deletion, run:

DELETE TIMESERIES root.sg.device.*;
SHOW DELETE TIMESERIES PROGRESS;

The result includes `ProcedureId`, `QueryId`, `Paths`, `State`, `Progress`, 
`ErrorMessage`, `WrittenModFileCount`, and `RemainingModFileCount`. Match the 
row by `ProcedureId`; `Progress` identifies the current procedure phase rather 
than an ETA or percentage. `State = SUCCESS` with `RemainingModFileCount = 0` 
indicates completion. Check `ErrorMessage` if the task fails.

For table-model deletion, query the relevant `information_schema` table, 
optionally filtering by the procedure ID returned by the DDL:
 
SELECT * FROM information_schema.drop_table_procedures
WHERE procedure_id = 123;

SELECT * FROM information_schema.drop_table_column_procedures
WHERE procedure_id = 456;
 
The first view reports `DROP TABLE` tasks; the second reports dropped-column 
tasks. They include the database/table (and column, where applicable), 
procedure ID, state, progress, error message, and written/remaining mod-file 
counts. As above, a successful state with zero remaining count indicates that 
the tracked deletion work is complete.

The synchronous behavior can be selected with the ConfigNode system property 
`enable_sync_schema_deletion`:
 
enable_sync_schema_deletion=false
 
`false` is the default and returns after task submission. Set it to `true` to 
make these DDL requests wait for their deletion procedures to finish before 
returning. Configure it consistently on the ConfigNodes and restart them for 
the change to take effect. Synchronous waiting can reintroduce long-running 
requests and client/RPC timeouts for large deletions, so the default 
asynchronous mode is recommended when callers can poll progress.

Best,
Justin Chen

Reply via email to