Skip to content

Combine PostgreSQL Visibility schema upgrades from v1.10 through v1.13 - #10371

Merged
rodrigozhou merged 1 commit into
mainfrom
rodrigozhou/pg-vis-schema-update
Jun 4, 2026
Merged

rodrigozhou merged 1 commit into
mainfrom
rodrigozhou/pg-vis-schema-update

Conversation

@rodrigozhou

@rodrigozhou rodrigozhou commented May 23, 2026 •

Copy link
Copy Markdown
Contributor

What changed?

Combine PostgreSQL Visibility schema upgrades from v1.10 through v1.13

Why?

Adding one column at a time requires scanning the entire table. So, combining all the schema changes in v1.30.0 release into a single SQL upgrade file.

#10358

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 review from a team as code owners May 23, 2026 06:56
CREATE INDEX IF NOT EXISTS by_temporal_reported_problems ON executions_visibility USING GIN (namespace_id, TemporalReportedProblems jsonb_path_ops);

-- v1.11
-- Indexes for the pre-allocated CHASM search attributes

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.

can we remove some of them and add back at a later release? I think only small number of them are actually used.

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.

I'm ok either way, but it's kind of weird to have these in another version. It might seem out of sync with other SQL DBs schemas.

"MinCompatibleVersion": "0.1",
"Description": "add TemporalReportedProblems column",
"SchemaUpdateCqlFiles": [
"add_temporal_reported_columns.sql"

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.

shall we remove those sql files as well?

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.

I was thinking of leaving just for the record, but I'm fine with removing as well. No strong feelings.



-- v1.10
CREATE INDEX IF NOT EXISTS by_temporal_reported_problems ON executions_visibility USING GIN (namespace_id, TemporalReportedProblems jsonb_path_ops);

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.

do we need to use CONCURRENTLY to avoid locking the entire table? but hmm I think handling failed index creation will be tricky...

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.

I wonder if it is still better to do this, given we can have many indices, especially for CHASM search attributes? But, doing this logic in the script might make it hard to read.

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.

Added CONCURRENTLY to CREATE INDEX.
Also added logic to drop invalid indices, ie., if CREATE INDEX fails, they can re-run the file: it will drop the invalid index first, and then try to create it again.

@rodrigozhou
rodrigozhou force-pushed the rodrigozhou/pg-vis-schema-update branch from 81dd960 to 56a530a Compare June 1, 2026 23:00
@rodrigozhou
rodrigozhou requested a review from yycptt June 3, 2026 05:54
@rodrigozhou
rodrigozhou force-pushed the rodrigozhou/pg-vis-schema-update branch from 56a530a to 237dff7 Compare June 4, 2026 20:34
@rodrigozhou
rodrigozhou enabled auto-merge (squash) June 4, 2026 20:34
@rodrigozhou
rodrigozhou merged commit afdffd7 into main Jun 4, 2026
73 checks passed
@rodrigozhou
rodrigozhou deleted the rodrigozhou/pg-vis-schema-update branch June 4, 2026 22:36
yycptt pushed a commit that referenced this pull request Jun 5, 2026
… through v1.13 (#10371) (#10556)

Backport of #10371 to release/v1.31.x for the v1.31.1 patch.

Co-authored-by: Rodrigo Zhou <[email protected]>
fretz12 added a commit that referenced this pull request Jun 12, 2026
… through v1.13 (#10371) (#10681)

Cherry-picks #10371 to release/v1.30.x for v1.30.5.

Co-authored-by: Rodrigo Zhou <[email protected]>
jiechenz pushed a commit that referenced this pull request Jun 12, 2026
#10371)

## What changed?
Combine PostgreSQL Visibility schema upgrades from v1.10 through v1.13

## Why?
Adding one column at a time requires scanning the entire table. So,
combining all the schema changes in v1.30.0 release into a single SQL
upgrade file.

#10358

## How did you test it?
- [x] built
- [x] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

## Potential risks
rodrigozhou added a commit that referenced this pull request Aug 17, 2026
## What changed?
Apply same optimizations in
#10371 for v1.14.

## Why?
Better upgrade script.

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

## Potential risks
Duncanma added a commit to temporalio/documentation that referenced this pull request Nov 18, 2026
* Align the server upgrade guide with current upgrade guidance

Corrects three claims in the upgrade guide against the server-operations
upgrade playbook:

- Skipping a minor version isn't blocked by unreadable data formats. The
  server doesn't enforce the path; stepping one minor at a time avoids
  skipping version-gated startup work, and it's the tested path.
- Always run the schema update before rolling out the binary, rather than
  checking release notes for whether one is needed. One run applies every
  intermediate schema version.
- Replace the fixed 10-minute wait per version with the metrics to watch.

Adds the release-notes override, the PostgreSQL v1.30/v1.31 Visibility
table rebuild (fixed in v1.30.5, v1.31.1, and v1.31.3 by
temporalio/temporal#10371 and #11599), the startup schema check, service
order, rollback, and passive-first upgrades with Multi-Cluster
Replication, plus a pointer from the Multi-Cluster Replication page.

* Record the upgrade guide alignment in the Kapa decision log

* Use counter rates for upgrade checks and scope passive-first upgrades

Four of the verification metrics are counters, so the near-zero targets apply to their recent rate. Passive-first ordering only holds when one Temporal Service is active for every Global Namespace.
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.

3 participants