You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: StoreSessionStorage does not override readAll, so journal replay issues one get per segment #3995
JournalSessionLog.scan bulk-loads committed segments through AtomicSessionStorage.readAll, which was added in #3666. StoreSessionStorage, used by remote workspace stores such as JDBC/MySQL, Redis and MongoDB, does not override readAll. It therefore falls back to the default per-path implementation, and replay of a large journal becomes one BaseStore.get round-trip per commit segment.
A journal with 2,658 commit segments performs 2,658 JdbcStore.get calls. On a remote MySQL instance this takes tens of seconds.
To Reproduce
Use a remote workspace store backed by BaseStore with supportsAtomicSessionStorage() == true (for example JdbcStore over MySQL).
Create a session journal with thousands of commit segments.
Call scan/readAfter, or restore the session.
Observe one get per segment in the SQL log and replay latency that grows linearly with the segment count.
Expected behavior
StoreSessionStorage should implement readAll by fetching the requested journal objects in bulk, so journal replay uses a bounded number of store queries instead of one per segment.
Actual behavior
The default AtomicSessionStorage.readAll calls read(path) for every path, and StoreSessionStorage.read calls store.get(namespace, path) once per segment.
Environment
AgentScope-Java Version: 2.1.0-SNAPSHOT
Java Version: 17
OS: Linux
Store: remote JDBC/MySQL (the same path applies to Redis and MongoDB through BaseStore)
Proposed fix
Add an opt-in BulkReadableStore extends BaseStore capability that declares getAll(namespace, keys), keeping BaseStore itself source-compatible:
InMemoryStore, JDBC, MySQL, PostgreSQL, MongoDB and Redis implement getAll;
JDBC/MySQL/PostgreSQL use batched IN (...) queries; MongoDB uses $in; Redis uses bounded HGETALL pipelines;
StoreSessionStorage.readAll uses a direct get for a single path, getAll for multiple paths when the store is bulk-readable, and otherwise keeps the paged search fallback with missing-path reads and per-key fallback when search is unsupported;
preserve the exact read semantics: missing paths are absent, version < 1 throws SessionLogException, values are base64-decoded, duplicate paths are deduplicated.
Tests cover parity with per-path read, more than 256 paths, fallback behavior, versions, missing paths, and the JDBC/MySQL/PostgreSQL/MongoDB/Redis implementations.
Activity
perf(harness): batch journal segment reads from workspace stores