Skip to content

Commit 2666267

Browse files
committed
Restructure UPGRADE.md to the Yiisoft DB package format
Follow the yiisoft/db UPGRADE.md layout: package title, upgrade-notes introduction, cumulative-upgrade note and a version-transition section with a per-topic heading. Verified version: latest tag 1.1.0, change listed under '1.1.1 under development' in CHANGELOG.md (disclosed as unreleased, no release decision invented). Keeps the required coordinated drain of all old-mapping workers before the new mapping starts, the reverse procedure on rollback, and the no-mixed-mappings rule.
1 parent aac0005 commit 2666267

1 file changed

Lines changed: 32 additions & 12 deletions

File tree

‎UPGRADE.md‎

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
# Upgrading Yii PostgreSQL PDO Mutex
22

3-
## Full-width advisory lock keys
3+
This file contains the upgrade notes. These notes highlight changes that could break your
4+
application when you upgrade the package from one version to another.
45

5-
`PgsqlMutex` now derives two signed 32-bit PostgreSQL advisory-lock keys from the first eight bytes of the SHA-1
6-
hash of the mutex name. Previously it used two unsigned 16-bit keys from the first four bytes. The larger
7-
64-bit keyspace reduces accidental contention between unrelated mutex names; hash collisions are still possible.
6+
> **Important!** The following upgrading instructions are cumulative. That is, if you want
7+
> to upgrade from version A to version C and there is version B between A and C, you need
8+
> to following the instructions for both A and B.
89
9-
This changes the PostgreSQL keys for existing mutex names. Workers using the old and new mappings do not
10-
coordinate: they can hold different advisory locks for the same mutex name at the same time.
10+
## Upgrade from 1.1 to 1.1.1
1111

12-
Before starting any workers with the new mapping, stop or drain **all** workers using the old mapping that
13-
coordinate through these mutexes, and let them finish their protected operations and release their locks.
14-
Include web processes, queue workers, scheduled jobs and other applications sharing the locks. Restart them
15-
with the same mapping. Do not overlap old and new workers during a rolling deployment. Apply the same
16-
coordinated transition when rolling back.
12+
1.1.1 is under development; the version number is taken from [CHANGELOG.md](CHANGELOG.md).
1713

18-
The public API is unchanged. No persistent database data needs migrating; the change affects session-level locks.
14+
### Full-width advisory lock keys
15+
16+
`PgsqlMutex` now derives two signed 32-bit PostgreSQL advisory-lock keys from the first eight
17+
bytes of the SHA-1 hash of the mutex name, instead of two unsigned 16-bit keys from the first
18+
four bytes. The larger 64-bit keyspace reduces accidental contention between unrelated mutex
19+
names; hash collisions are still possible.
20+
21+
The public API is unchanged. No persistent database data needs migrating; the change affects
22+
session-level advisory locks.
23+
24+
#### Required coordinated transition
25+
26+
The PostgreSQL keys for existing mutex names change. Old and new mappings do not coordinate:
27+
workers on the old mapping and workers on the new mapping can hold **different** advisory locks
28+
for the same mutex name at the same time, so exclusion for the same name is broken while both
29+
mappings run.
30+
31+
Before starting any process with the new mapping, stop or drain **all** old-mapping processes
32+
that coordinate through these mutexes and let them finish their protected operations and release
33+
their locks. This includes web processes, queue workers, scheduled jobs and other applications
34+
sharing the same locks. Do not overlap old and new mappings during a rolling deployment.
35+
36+
When rolling back to the old mapping, apply the same transition in reverse: stop or drain all
37+
new-mapping processes first, then start the old ones. Never run old and new mappings together
38+
while same-name exclusion is required.

0 commit comments

Comments
 (0)