Skip to content

gRPC TimeSeriesQuery and TimeSeriesLatest cannot run inside a client transaction #7370

Closed

Description

@robfrank

Found by the completeness sweep of #7326, which is the same gap on the three search RPCs.

TimeSeriesQueryRequest and TimeSeriesLatestRequest (added by #7305 / PR #7323) carry database and credentials but no TransactionContext, unlike ExecuteQueryRequest, LookupByRidRequest and - after #7326 - VectorSearchRequest. Both handlers resolve the database directly:

$ grep -n "public void timeSeries" -A 6 grpcw/src/main/java/com/arcadedb/server/grpc/ArcadeDbGrpcService.java
3400:  public void timeSeriesQuery(...)     -> getDatabase(...)
3631:  public void timeSeriesLatest(...)    -> getDatabase(req.getDatabase(), req.getCredentials())

So a client that opened a gRPC transaction, appended points through some other RPC in it and then queries the series reads outside its own transaction. POST/GET /api/v1/ts/{database}/... on the HTTP side runs through DatabaseAbstractHandler, which binds the session's transaction, so the two protocols disagree the same way #7326 describes.

Shape of the fix

Identical to #7326: add TransactionContext transaction to both request messages, resolve it with resolveAuthorizedTransaction, reject an unknown non-blank id with unknownTransactionStatus, run the body through submitToActiveTransaction, and stamp the open transaction on the request in RemoteGrpcDatabase. TimeSeriesQuery is server-streaming, so the streaming body needs the same treatment executeQueryStream already has rather than a plain unary submit.

Out of scope here

TimeSeriesWrite / TimeSeriesWriteStream are deliberately non-atomic - the proto documents that each measurement's batch commits its own shard transaction - so joining a caller's transaction is a separate design question, not the same bug.

Activity

  1. added
    enhancement
    grpc
    timeseries
    on Sep 10, 2026
  2. added this to the 26.10.1 milestone on Sep 10, 2026
  3. self-assigned this
    on Sep 10, 2026
  4. added
    in progress
    on Sep 10, 2026
  5. robfrank commented on Sep 10, 2026

    @robfrank
    CollaboratorAuthor

    Resolved by PR #7421 (not merged - the merge is yours).

    Both RPCs now carry a TransactionContext, resolve it with resolveAuthorizedTransaction, refuse an unknown non-blank id with unknownTransactionStatus, and run the read on the transaction's own executor - readInTransaction (the generalized searchInTransaction from #7326) for TimeSeriesLatest, streamQuery's streaming dispatch for the server-streaming TimeSeriesQuery. RemoteGrpcDatabase stamps the open transaction on both.

    Two premises in the issue turned out not to hold, and each is now pinned by a test rather than repeated:

    1. A time-series append is not part of the enclosing transaction at all - TimeSeriesShard.appendSamples opens its own begin/commit, and an ArcadeDB nested transaction is an independent transaction rather than a savepoint, so the sample is durable and global before any commit and survives the rollback. Measured with a DOCUMENT row in the same transaction as the control. Filed as TimeSeries appends are not part of the enclosing transaction, and TimeSeriesEngine's javadoc says they are #7410, which also covers TimeSeriesEngine's javadoc claiming the opposite. Consequence: the fix changes where a time-series read runs, not which samples it sees.
    2. The HTTP /api/v1/ts routes do not bind the session transaction either - all three extend AbstractServerHttpHandler, not DatabaseAbstractHandler. Filed as HTTP /api/v1/ts read routes ignore arcadedb-session-id and read outside the session transaction #7402. So this closes the gap on gRPC and leaves gRPC strictly more transactional than HTTP here.

    What is left of the reported bug, and what this actually fixes, is the silent fall-through: a request naming a transaction the server no longer knows was read straight through instead of answering FAILED_PRECONDITION. Reverting only the server dispatch fails exactly the two tests that assert that, and no others.

    TimeSeriesWrite/TimeSeriesWriteStream stay out of scope as the issue specifies; given #7410 that is the same fact stated at the RPC level.

  6. added a commit that references this issue on Sep 11, 2026
  7. robfrank commented on Sep 11, 2026

    @robfrank
    CollaboratorAuthor

    Fixed in PR #7421, now merged.

    TimeSeriesQuery and TimeSeriesLatest named a database and a caller, but carried no transaction, so both ran on a gRPC worker thread against a freshly resolved database handle - whatever transaction the caller believed it was inside. The visible symptom was the silent fall-through: a request naming a transaction the server no longer knew (reaped, committed, or never created) was answered as if nothing were wrong, where every other transaction-scoped RPC answers FAILED_PRECONDITION. Both requests now carry a TransactionContext, refuse an unknown non-blank id with that same status, and run the read on the transaction's own executor thread, so writes made inside a transaction are visible to a read issued inside it. The client stamps the connection's open transaction on both requests automatically.

    Still open

    Both are pinned by tests that fail when the behaviour changes, so neither can be closed silently.


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  8. removed
    in progress
    on Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgrpctimeseries

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions