Skip to content

External storage: Test oversized query result storage - #879

Open
yuandrew wants to merge 1 commit into
mainfrom
test-external-storage-query-results
Open

yuandrew wants to merge 1 commit into
mainfrom
test-external-storage-query-results

Conversation

@yuandrew

@yuandrew yuandrew commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

What was changed

Verify supported SDKs offload oversized query results before applying the server payload limit.

Why?

Go had a bug, might as well write cross-SDK tests to verify this is Go only bug

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

Verify supported SDKs offload oversized query results before applying the server payload limit.
@yuandrew
yuandrew requested review from a team as code owners September 1, 2026 22:13
@jmaeagle99 jmaeagle99 self-assigned this Sep 2, 2026
Comment thread package.json
"@google-cloud/storage": "^7.0.0",
"@grpc/grpc-js": "^1.12.4",
"@protobuf-ts/protoc": "^2.8.1",
"@temporalio/activity": "^1.21.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these should already be updated to 1.21.1 in main.

@@ -0,0 +1,11 @@
{
"go": {
"minVersion": "1.48.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only works for Go and not for any other language. See https://github.com/temporalio/features/blob/main/harness/go/cmd/run.go#L103. Probably either need to add harness support or do runtime skips. I'm okay with the latter on this for now. I can follow up with general config support.

@@ -0,0 +1,11 @@
{
"go": {
"minVersion": "1.48.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"minVersion": "1.48.0"
"minVersion": "v1.48.0"

driverName = "query-result-memory"
// Exceed the server limit so the SDK must offload the result.
resultSize = 3 * 1024 * 1024
storageThreshold = 1024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default threshold is 256 KiB, which is much lower than the result size for each of these tests. Probably do not need to specify the threshold explicitly.

return fmt.Errorf("query result did not use external storage")
}

if err := r.Client.SignalWorkflow(ctx, run.GetID(), run.GetRunID(), finishSignal, nil); err != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be done in a finally to make sure we let the workflow close if an assertion is failed earlier. Not in a defer because CheckResultDefault waits for the run result and would deadlock.

}
return payloads, nil
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make a func (d *memoryDriver) calls() (int, int) func so we get both values under the same lock to avoid tearing.

if result != strings.Repeat("a", resultSize) {
return fmt.Errorf("unexpected query result")
}
if storage.storeCalls() == 0 || storage.retrieveCalls() == 0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

storage is package scoped so if this is run multiple times due to variants or any future fanout or sharing across tests, these assertions won't hold. Probably need to snapshot the storage counts before executing the query, snapshot again after, and make sure the difference is what we expect (likely should be 1 for store and retrieve).

assert driver.retrieves > 0

await handle.signal(Workflow.finish)
await handle.result()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the harness do this already?

}

func (*memoryDriver) Type() string {
return driverName

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use a unique test driver name for features, in case these are run against cloud? This is going to be reported on worker heartbeat.

The query returns 3 MiB, above the server's default 2 MiB error limit. The
checker verifies the value and confirms that storage and retrieval occurred.

Go, Python, and TypeScript currently expose functional external storage.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably can remove this as that's demonstrated by what's implemented as tests in here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants