You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "Totoro-qaq (via GitHub)" <gi...@apache.org> on 2026/09/07 04:06:23 UTC
[I] perf(storage): scheduled-task point operations rewrite the full catalog [maka]
Totoro-qaq opened a new issue, #4954:
URL: https://github.com/apache/maka/issues/4954
## What happened
Updating one scheduled task reads and rewrites every scheduled task and pending fire claim. Binding an execution, advancing a native fire state, and settling a fire use the same path. Even a due scan with no changes deletes and reinserts both tables.
At main `492ff80f0f4abf3a917ce8f2c41b32fa9e3fc60c`, `SqliteScheduledTaskStore.mutate()` loads the complete state before `write()` deletes both tables and reinserts every record. `get(taskId)` also reads both tables before finding its target.
A local reproduction using the real owner lease, store API and SQLite connection produced the following counts. Each unrelated task also has one pending fire claim; measurements exclude fixture creation.
| Unrelated tasks / claims | JSON records returned by `get(target)` | Rows changed by `snooze(target)` | Rows changed by an unchanged `claimNextDue()` |
|---|---:|---:|---:|
| 0 / 0 | 1 | 2 | 2 |
| 32 / 32 | 65 | 130 | 130 |
| 256 / 256 | 513 | 1,026 | 1,026 |
Returned JSON records measure materialization, not all internal SQLite row visits. Changed rows are measured with `total_changes()` on the actual store connection and include deletes plus inserts. These are work counts, not latency or WAL-volume measurements.
Expected: point operations locate the affected task/claim through existing keys and update only relevant rows. Settlement updates the current task and removes its claim in one transaction. A due scan with no state changes performs no DML.
## How to reproduce
1. Build source at `492ff80f0f4abf3a917ce8f2c41b32fa9e3fc60c`.
2. Resolve a fresh interactive storage root, acquire its owner, and open `openInteractiveScheduledTaskStoreForWrite(owner.lease)`.
3. Through `store.create()`, create a target task and 0, 32, or 256 unrelated tasks scheduled for the future. Use `store.claimNow()` to create one pending claim for each unrelated task.
4. Acquire the observation lease through `runWithStorageRootLease()` using its canonical root path, so observation shares the store's actual connection.
5. After setup, measure `get(target.id)`, `snooze(target.id, 1000, now)`, and `claimNextDue(now)`. Keep `now` fixed before the target is due and before any task expires. Record returned JSON rows and the connection's `total_changes()` difference around each operation.
The unchanged poll returns `{ claim: null, expired: [] }` but still produces the writes shown above. Inspecting the executed statements confirms the unqualified deletes and full reinserts.
## Environment
- Source commit reproduced: `492ff80f0f4abf3a917ce8f2c41b32fa9e3fc60c`.
- Surface: Runtime Host / SQLite scheduled-task storage, exercised through its owner-protected store API.
- Reproduction environment: macOS 26.6.2; results confirmed with Node v22.23.1 and v24.18.0; npm 11.19.0 for builds.
- No external provider or timing-dependent sleep is required. Business fixtures are created through the store API.
## Logs, screenshots, or additional context
This tracks the scheduled-task whole-collection rewrite item from [Discussion #4876](https://github.com/apache/maka/discussions/4876).
Source evidence: [point get](https://github.com/apache/maka/blob/492ff80f0f4abf3a917ce8f2c41b32fa9e3fc60c/packages/storage/src/scheduled-task-store.ts#L248-L250), [full-state read and rewrite](https://github.com/apache/maka/blob/492ff80f0f4abf3a917ce8f2c41b32fa9e3fc60c/packages/storage/src/scheduled-task-store.ts#L585-L656), and [existing primary/unique keys](https://github.com/apache/maka/blob/492ff80f0f4abf3a917ce8f2c41b32fa9e3fc60c/packages/storage/src/sqlite-workflow-schema.ts#L74-L89).
Proposed scope: keyed task/claim reads and transactional row operations for point mutations; due discovery writes only newly expired tasks and at most one new claim. Preserve claim uniqueness, execution identity, expiry ordering, native-delivery state and restart recovery.
Full bounded-read treatment of due discovery, catalog listing, and the Host's schedule/residency refresh remains separate work. The Host's create limit is not a storage-layer bound. This issue does not claim to close all read-path items in #4876, and does not require a schema or protocol change.
<sub>Prepared with Codex; submitted with contributor approval.</sub>
--
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: commits-unsubscribe@maka.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [I] perf(storage): scheduled-task point operations rewrite the full catalog [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han closed issue #4954: perf(storage): scheduled-task point operations rewrite the full catalog
URL: https://github.com/apache/maka/issues/4954
--
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: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [I] perf(storage): scheduled-task point operations rewrite the full catalog [maka]
Posted by "Totoro-qaq (via GitHub)" <gi...@apache.org>.
Totoro-qaq commented on issue #4954:
URL: https://github.com/apache/maka/issues/4954#issuecomment-5573824031
Following the scope clarification in [#4947](https://github.com/apache/maka/issues/4947#issuecomment-5573633942), I’ll keep this issue and #4955 focused on scheduled-task row operations. I’m deferring a separate Usage diagnostic-column PR on my side.
Those fields already have a durable AgentRun attempt / Trace path, while the Usage projection primarily serves cost queries. Adding them to Usage would help cross-session filtering and reporting, but would not by itself fix execution failures, retry policy, or cost calculation.
I don’t currently have evidence of a concrete cross-session diagnostic workflow blocked by the missing columns. That is a limit of the evidence I have, not a claim that nobody needs them. I’ll revisit this if a concrete use case emerges.
<sub>Posted with Codex at the contributor’s direction.</sub>
--
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: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [I] perf(storage): scheduled-task point operations rewrite the full catalog [maka]
Posted by "Totoro-qaq (via GitHub)" <gi...@apache.org>.
Totoro-qaq commented on issue #4954:
URL: https://github.com/apache/maka/issues/4954#issuecomment-5564869837
take
--
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: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org