Skip to content

Fixes to Visibility SQL query converter - #11801

Merged
rodrigozhou merged 2 commits into
mainfrom
rodrigozhou/vis-sql-fix-qc
Sep 2, 2026
Merged

rodrigozhou merged 2 commits into
mainfrom
rodrigozhou/vis-sql-fix-qc

Conversation

@rodrigozhou

Copy link
Copy Markdown
Contributor

What changed?

  • Fix parsing ExecutionStatus in tuple (eg: ExecutionStatus IN ('Running', 'Completed'))
  • Fix parsing negative double values (eg: CustomDouble > -1.5 was returning an error)
  • Return error when comparing non-bool types with boolean value (eg: StartTime = true was not returning an error).
  • Return error when comparing Text type search attribute with an empty string/no tokens (eg: CustomText = ' '). It was already returning an error with PostgreSQL and SQLite, now also returning an error with MySQL and Elasticsearch.
  • Added unit tests covering all Visibility stores to make sure they all behave the same. One exception: ExecutionStatus STARTS_WITH works with Elasticsearch, but not with SQL. That's because in Elasticsearch we store as string, while in SQL we store as int.

Why?

Bug fixes, and comprehensive unit tests to ensure uniform behavior.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Potential risks

@rodrigozhou
rodrigozhou requested a review from a team August 26, 2026 18:35
@rodrigozhou
rodrigozhou requested review from a team as code owners August 26, 2026 18:35
@rodrigozhou rodrigozhou added reliability-2026 Reliability related changes release/1.32.0 labels Aug 27, 2026
@rodrigozhou
rodrigozhou force-pushed the rodrigozhou/vis-sql-fix-qc branch 3 times, most recently from 1081a2c to 4fcc319 Compare August 28, 2026 00:29
if v, ok := value.(string); !ok {
return nil, valueTypeErr
} else if strings.TrimSpace(v) == "" {
return nil, NewConverterError(

@awln-temporal awln-temporal Aug 28, 2026 •

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.

is it ok to break any existing query use cases for customers that may be setting empty string for Text typed custom search attributes if using ES or MySQL? Probably fine I assume since no tokens generated for empty string, but let's just call it out explicitly in PR description

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In both ES and MySQL, if the user compares against an empty string (ie., no tokens), it would return no results, which is already likely not what the user wants.
I think in this case, returning an error is fine.
It's already in the PR description.
cc: @yiminc @yycptt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what happens when user explicit compares against an empty string?

@rodrigozhou rodrigozhou Sep 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Eg: CustomText = '' matches nothing no matter what's in CustomText.
In PG and SQLite, it would return an error already

@yycptt yycptt Sep 1, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see makes sense to me. I think returning an explicit error is better than a silent wrong/empty result.

@rodrigozhou
rodrigozhou force-pushed the rodrigozhou/vis-sql-fix-qc branch from 4fcc319 to 39095d1 Compare September 1, 2026 23:43
@rodrigozhou
rodrigozhou merged commit 985f195 into main Sep 2, 2026
91 checks passed
@rodrigozhou
rodrigozhou deleted the rodrigozhou/vis-sql-fix-qc branch September 2, 2026 20:33
awln-temporal added a commit that referenced this pull request Sep 3, 2026
## What changed?

Backports the remaining merged PRs labeled
[release/1.32.0](https://github.com/temporalio/temporal/issues?q=state%3Aclosed%20label%3Arelease%2F1.32.0)
onto release/v1.32.x, in main merge order:

- [#11599](#11599) Optimize
Visibility PostgreSQL upgrade schema v1.14
- [#11723](#11723) Validate
history pagination branch token against mutable state
- [#11800](#11800) Capture
panics in Visibility query converter
- [#11813](#11813) Capture
panic in ServiceErrorInterceptor
- [#11829](#11829) Return
empty Elasticsearch page token when the result is smaller than the page
- [#11839](#11839) Fix
FirstWorkflowTaskBackoff accumulation upon Continue-As-New
- [#11801](#11801) Fix
Visibility SQL query conversion

[#11265](#11265) and
[#11564](#11564) were already
present on release/v1.32.x and are not duplicated here.

## Testing

- Targeted unit tests for Visibility query conversion, RPC interception,
History branch-token validation, and Continue-As-New backoff
- make GOLANGCI_LINT_FIX=false
GOLANGCI_LINT_BASE_REV=origin/release/v1.32.x lint-code

---------

Co-authored-by: Rodrigo Zhou <[email protected]>
Co-authored-by: Prathyush PV <[email protected]>
Co-authored-by: Yichao Yang <[email protected]>
@awln-temporal awln-temporal mentioned this pull request Sep 4, 2026
5 tasks done
simvlad added a commit that referenced this pull request Sep 4, 2026
## What changed?

Backports the 12 merged PRs labeled
[release/1.32.0](https://github.com/temporalio/temporal/issues?q=repo%3Atemporalio%2Ftemporal+is%3Apr+label%3Arelease%2F1.32.0)
that were not yet on `release/v1.32.x`, applied in `main` merge order.
Also fixes mixedbrain test by bumping go version to 1.26.8 in mixedbrain
folder (broken by #11928).

| # | PR | Author | What / Why |
|---|----|--------|------------|
| 1 | [#11546](#11546)
fix(batcher): scope deterministic request IDs to the batch job ID |
@spkane31 | Two batch operations sending the same signal to the same
workflow/run ID only delivered one — the request ID was hashed from
workflow ID / run ID / signal name, so the second was de-duped in signal
logic. Including the batch job ID in the hash keeps separate signals
distinct. |
| 2 | [#11642](#11642) Fix
batch operations targeting paused executions | @fretz12 | A paused
execution is still non-terminal, but the old `Running`-only filter
silently skipped paused targets. Users issuing a batch
terminate/signal/cancel reasonably expect it to apply to them. |
| 3 | [#11666](#11666) Fix
activity timeout regeneration after unpause | @fretz12 | Timeout tasks
that fired while an activity was paused were discarded, but the
activity's timer-task status still claimed they existed — preventing
recreation after unpause and potentially making the timeout ineffective.
Also fixes `ResetActivity` bypassing normal unpause handling, and
running activities returning early without clearing paused state. |
| 4 | [#11696](#11696) Treat
missing Worker Deployment Version as deleted | @rkannan82 | Treats
`NotFound` from the Version workflow delete update as success. When a
Version workflow is already closed or its history is gone, `NotFound`
blocked the Deployment workflow from removing its stale version
reference. Fixes #11539. |
| 5 | [#11725](#11725) Fix
batch activity unpause visibility query scope | @fretz12 | The server
replaced the caller's visibility query with the activity-type predicate,
which could broaden the batch scope and unpause activities in workflows
the caller never selected. |
| 6 | [#11806](#11806) Fix
activity operator command metric label collision | @fretz12 | WFA and
SAA emitted the same Prometheus metric names
(`activity_pause`/`unpause`/`reset`/`update_options`) with **different
label sets**, causing descriptor registration failures and dropped
metrics. Both now use the standard per-activity label schema and emit
once per affected activity. **See "Backport adaptation" below.** |
| 7 | [#11930](#11930)
Prioritize worker versioning workflows | @ShahabT | Worker versioning
workflows share the per-namespace worker task queue with other system
workflows. Raising their initial workflow-task priority above default
keeps versioning operations from queueing behind default-priority work.
|
| 8 | [#11910](#11910)
[Visibility] Fix legacy visibility query converter | @rodrigozhou |
Fixes to the legacy visibility query converter for both SQL and
Elasticsearch. |
| 9 | [#11699](#11699)
dynamic partitioning: use probability of AddTask to root partition to
estimate overall add task rate | @carlydf | A previous PR changed
AddTask load-balancing from uniform random to backlog-aware,
invalidating the uniform-distribution assumption behind the
add-task-rate estimate. Now estimates from the probability of AddTask
hitting the root partition, and guarantees the root retains at least a
1% chance of selection regardless of its backlog. |
| 10 | [#11935](#11935)
[Visibility] Enable unified query converter by default | @rodrigozhou |
Flips the default now that the unified query converter is stable and
ready to replace the old one. Depends on #11910 and #11801. |

## How did you test it?

- [x] built — `go build ./...`
- [x] `make fmt` — no changes
- [x] `go vet -tags disable_grpc_modules,test_dep ./tests/...` — clean
- [x] `make GOLANGCI_LINT_FIX=false
GOLANGCI_LINT_BASE_REV=origin/release/v1.32.x lint-code` — **0 issues**
- [x] covered by existing tests — 21 affected packages, **20 pass**

---------

Co-authored-by: Sean Kane <[email protected]>
Co-authored-by: Fred Tzeng <[email protected]>
Co-authored-by: Kannan <[email protected]>
Co-authored-by: Shahab Tajik <[email protected]>
Co-authored-by: Rodrigo Zhou <[email protected]>
Co-authored-by: Carly de Frondeville <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Vladyslav Simonenko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants