Skip to content

ServerSideTransaction.execute ignores PipelineExecuteOptions argument #2343

@bhshkh

Description

@bhshkh

Description:

When executing a pipeline within a transaction, the ServerSideTransaction.execute method that accepts a PipelineExecuteOptions parameter completely ignores it and instantiates an empty options object instead.

Steps to Reproduce / Code Snippet:
In google-cloud-firestore/src/main/java/com/google/cloud/firestore/ServerSideTransaction.java:

  @Nonnull
  @Override
  public ApiFuture<Pipeline.Snapshot> execute(
      @Nonnull Pipeline pipeline, @Nonnull PipelineExecuteOptions options) {
    try (TraceUtil.Scope ignored = transactionTraceContext.makeCurrent()) {
      // BUG: ignores the 'options' parameter entirely
      return pipeline.execute(new PipelineExecuteOptions(), transactionId, null);
    }
  }

Because of this, any custom options explicitly provided during transaction.execute(pipeline, options) get dropped before the underlying gRPC ExecutePipelineRequest is dispatched.

Expected Behavior:
The method should propagate the correctly populated options object provided in the method signature:

  @Nonnull
  @Override
  public ApiFuture<Pipeline.Snapshot> execute(
      @Nonnull Pipeline pipeline, @Nonnull PipelineExecuteOptions options) {
    try (TraceUtil.Scope ignored = transactionTraceContext.makeCurrent()) {
      return pipeline.execute(options, transactionId, null);
    }
  }

Impact:
Integration tests like ITPipelineTest.testPipelineInTransactionsWithOptions end up inadvertently testing with empty options because instances like new PipelineExecuteOptions().with("foo", "bar") are discarded silently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: firestoreIssues related to the googleapis/java-firestore API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions