partition_gardener 0.3.8 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +5 -3
- data/docs/THIRD_PARTY_LICENSE_MANIFEST.tsv +35 -13
- data/docs/changelogs/20261113104337_partman-probe-aborts-open-transactions.md +26 -0
- data/docs/changelogs/20261113110417_opt-in-boot-side-paths.md +25 -0
- data/docs/changelogs/20261113130745_cut-patch-release-0-3-9.md +29 -0
- data/docs/changelogs/20261113132159_github-release-title-from-version.md +26 -0
- data/docs/changelogs/20261113154500_ruby-gems-changelog-github-release-notes.md +30 -0
- data/docs/changelogs/20261119083632_premake-monthly-default-overlap-create.md +25 -0
- data/docs/changelogs/20261119085211_cut-patch-release-0-3-10.md +26 -0
- data/docs/configuration.md +11 -1
- data/docs/cutover.md +2 -0
- data/docs/issues/20261113104337_partman-probe-aborts-open-transactions.md +29 -0
- data/docs/issues/20261113110417_opt-in-boot-side-paths.md +36 -0
- data/docs/issues/20261119083632_premake-monthly-default-overlap-create.md +28 -0
- data/docs/reviews/20261113130745_engineering-audit-release-preparation.md +46 -0
- data/docs/reviews/20261119085211_engineering-audit-release-preparation.md +40 -0
- data/exe/partition_gardener +2 -0
- data/lib/partition_gardener/connection.rb +7 -0
- data/lib/partition_gardener/date_range_maintenance.rb +92 -22
- data/lib/partition_gardener/premake_monthly_maintenance.rb +12 -4
- data/lib/partition_gardener/rails.rb +11 -6
- data/lib/partition_gardener/railtie.rb +12 -0
- data/lib/partition_gardener/stdlib_extensions.rb +7 -3
- data/lib/partition_gardener/version.rb +1 -1
- data/lib/partition_gardener.rb +6 -6
- metadata +16 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9eed30d07f65d2f44a6eecdf810203aa5f8795c2a21335a524712223afe11441
|
|
4
|
+
data.tar.gz: 8128a4853d2f7ffdaa135fd7207b4435cf21d594a2eccc881f18d12ffdc0f303
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c0250bd7fc94ce768ec218d468bfd1b555ad71aa5138d2024d6f38a322be35602efbcdc18d270bb91d8914dea6e7d584ef782e1025d5e7fc1c986229302174b5
|
|
7
|
+
data.tar.gz: a274a06f511ce1d7d65fdda3626a68d933916bf543b33dc7c6b9780461ae2ecf6995388a3ff4bedac89ae4dbeccd3e86593c8c9489887d1fd8cae57ac4d1c42a
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.3.10 (2026-11-19)
|
|
6
|
+
|
|
7
|
+
- Fix monthly premake so overlapping rows already in the default partition are moved into the new month child and attached under a parent write lock before create, instead of failing with a partition check violation
|
|
8
|
+
|
|
9
|
+
## 0.3.9 (2026-11-13)
|
|
10
|
+
|
|
11
|
+
- Make Railtie, CLI, HotSwitchConcern, and Integer duration helpers opt-in requires instead of loading them from the default `partition_gardener` require; hosts that need Rails defaults must require `partition_gardener/railtie`, and hot-switch migrations must require `partition_gardener/migration/hot_switch_concern`
|
|
12
|
+
- Fix register-time `partman.part_config` probe so a missing relation does not abort an open Postgres transaction (`PG::InFailedSqlTransaction` after Ruby rescued `StatementInvalid`)
|
|
13
|
+
|
|
5
14
|
## 0.3.8 (2026-11-05)
|
|
6
15
|
|
|
7
16
|
- Fix hot-switch migrations aborting with `SystemStackError` when included into `ActiveRecord::Migration` on Rails 8 (private `connection` override recursed through `DefaultStrategy`)
|
data/README.md
CHANGED
|
@@ -49,8 +49,8 @@ Complements migration gems (e.g. [pg_party](https://github.com/rkrage/pg_party))
|
|
|
49
49
|
## Quick start
|
|
50
50
|
|
|
51
51
|
```ruby
|
|
52
|
-
# Gemfile
|
|
53
|
-
gem "partition_gardener"
|
|
52
|
+
# Gemfile — require the railtie only when you want Rails connection/today defaults
|
|
53
|
+
gem "partition_gardener", require: ["partition_gardener", "partition_gardener/railtie"]
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
```ruby
|
|
@@ -143,9 +143,11 @@ See [docs/partition_landscape.md](docs/partition_landscape.md) for the template
|
|
|
143
143
|
|
|
144
144
|
## Hot-switch migrations
|
|
145
145
|
|
|
146
|
-
`PartitionGardener::Migration::HotSwitchConcern` (alias `HotSwitchPartitionedTable`) consolidates cutover migration helpers.
|
|
146
|
+
`PartitionGardener::Migration::HotSwitchConcern` (alias `HotSwitchPartitionedTable`) consolidates cutover migration helpers. Require it explicitly in the migration file:
|
|
147
147
|
|
|
148
148
|
```ruby
|
|
149
|
+
require "partition_gardener/migration/hot_switch_concern"
|
|
150
|
+
|
|
149
151
|
class PartitionEventsHotSwitch < ActiveRecord::Migration[8.0]
|
|
150
152
|
include PartitionGardener::Migration::HotSwitchConcern
|
|
151
153
|
|
|
@@ -1,42 +1,62 @@
|
|
|
1
1
|
bundle gem version licenses
|
|
2
|
-
root
|
|
3
|
-
root
|
|
4
|
-
root
|
|
2
|
+
root actionpack 8.1.4.1 MIT
|
|
3
|
+
root actionview 8.1.4.1 MIT
|
|
4
|
+
root activemodel 8.1.4.1 MIT
|
|
5
|
+
root activerecord 8.1.4.1 MIT
|
|
6
|
+
root activesupport 8.1.4.1 MIT
|
|
5
7
|
root appraisal 2.5.0 MIT
|
|
6
8
|
root ast 2.4.3 MIT
|
|
7
9
|
root base64 0.3.0 Ruby|BSD-2-Clause
|
|
8
10
|
root bigdecimal 4.1.3 Ruby|BSD-2-Clause
|
|
11
|
+
root builder 3.3.0 MIT
|
|
9
12
|
root bundler 4.0.16 MIT
|
|
10
13
|
root concurrent-ruby 1.3.8 MIT
|
|
11
14
|
root connection_pool 3.0.2 MIT
|
|
15
|
+
root crass 1.0.8 MIT
|
|
12
16
|
root diff-lcs 1.6.2 MIT|Artistic-1.0-Perl|GPL-2.0-or-later
|
|
13
17
|
root drb 2.2.3 Ruby|BSD-2-Clause
|
|
18
|
+
root erb 6.0.7 Ruby|BSD-2-Clause
|
|
19
|
+
root erubi 1.13.1 MIT
|
|
14
20
|
root i18n 1.15.2 MIT
|
|
21
|
+
root io-console 0.9.5 Ruby|BSD-2-Clause
|
|
22
|
+
root irb 1.19.0 Ruby|BSD-2-Clause
|
|
15
23
|
root json 3.1.0 Ruby
|
|
16
24
|
root language_server-protocol 3.17.0.6 MIT
|
|
17
25
|
root lint_roller 1.1.0 MIT
|
|
18
26
|
root logger 1.7.0 Ruby|BSD-2-Clause
|
|
19
|
-
root
|
|
27
|
+
root loofah 2.25.3 MIT
|
|
28
|
+
root minitest 6.1.0 MIT
|
|
29
|
+
root nokogiri 1.19.7 MIT
|
|
20
30
|
root parallel 2.3.0 MIT
|
|
21
31
|
root parser 3.3.13.0 MIT
|
|
22
|
-
root partition_gardener 0.3.
|
|
32
|
+
root partition_gardener 0.3.10 MIT
|
|
23
33
|
root pg 1.6.3 BSD-2-Clause
|
|
24
|
-
root polyrun
|
|
25
|
-
root
|
|
26
|
-
root
|
|
34
|
+
root polyrun 3.0.0 MIT
|
|
35
|
+
root pp 0.6.4 Ruby|BSD-2-Clause
|
|
36
|
+
root prettyprint 0.2.1 Ruby|BSD-2-Clause
|
|
37
|
+
root prism 2.1.0 MIT
|
|
38
|
+
root prosopite 2.5.0 Apache-2.0
|
|
27
39
|
root racc 1.8.1 Ruby|BSD-2-Clause
|
|
28
40
|
root rack 3.2.8 MIT
|
|
41
|
+
root rack-session 2.1.2 MIT
|
|
42
|
+
root rack-test 2.3.0 MIT
|
|
43
|
+
root rackup 2.3.1 MIT
|
|
44
|
+
root rails-dom-testing 2.3.0 MIT
|
|
45
|
+
root rails-html-sanitizer 1.7.2 MIT
|
|
46
|
+
root railties 8.1.4.1 MIT
|
|
29
47
|
root rainbow 3.1.1 MIT
|
|
30
48
|
root rake 13.4.2 MIT
|
|
31
49
|
root rbs 4.2.0 BSD-2-Clause|Ruby
|
|
50
|
+
root rdoc 8.1.0 Ruby|GPL-2.0-only
|
|
32
51
|
root regexp_parser 2.13.1 MIT
|
|
52
|
+
root reline 0.7.0 Ruby
|
|
33
53
|
root rspec 3.13.2 MIT
|
|
34
|
-
root rspec-core 3.13.
|
|
35
|
-
root rspec-expectations 3.13.
|
|
36
|
-
root rspec-mocks 3.13.
|
|
37
|
-
root rspec-support 3.13.
|
|
54
|
+
root rspec-core 3.13.7 MIT
|
|
55
|
+
root rspec-expectations 3.13.6 MIT
|
|
56
|
+
root rspec-mocks 3.13.9 MIT
|
|
57
|
+
root rspec-support 3.13.8 MIT
|
|
38
58
|
root rubocop 1.91.0 MIT
|
|
39
|
-
root rubocop-ast 1.
|
|
59
|
+
root rubocop-ast 1.51.0 MIT
|
|
40
60
|
root rubocop-capybara 2.23.0 MIT
|
|
41
61
|
root rubocop-factory_bot 2.28.0 MIT
|
|
42
62
|
root rubocop-performance 1.26.1 MIT
|
|
@@ -58,3 +78,5 @@ root tzinfo 2.0.6 MIT
|
|
|
58
78
|
root unicode-display_width 3.3.0 MIT
|
|
59
79
|
root unicode-emoji 4.3.0 MIT
|
|
60
80
|
root uri 1.1.2 Ruby|BSD-2-Clause
|
|
81
|
+
root useragent 0.16.11 MIT
|
|
82
|
+
root zeitwerk 2.8.3 MIT
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Register-time partman probe no longer aborts an open transaction when partman.part_config is missing.
|
|
2
|
+
|
|
3
|
+
## Participants
|
|
4
|
+
|
|
5
|
+
Andrei Makarov (@amkisko)
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- Gate the `partman.part_config` SELECT on `to_regclass(...)::text` so absence is a null result, not an error that marks the transaction aborted.
|
|
10
|
+
- Document that a savepoint wrap also works but costs more on the common no-partman path.
|
|
11
|
+
|
|
12
|
+
## Effects
|
|
13
|
+
|
|
14
|
+
- `Registry.register` / `MaintenanceBackend.validate!` stay safe inside RSpec transactional examples and other outer transactions without pg_partman.
|
|
15
|
+
- Host prepend workarounds that only checked `to_regclass` can be removed after this gem version is locked.
|
|
16
|
+
|
|
17
|
+
## Next
|
|
18
|
+
|
|
19
|
+
- Cut into CHANGELOG under `## 0.3.9 (2026-11-13)`.
|
|
20
|
+
- Commit, tag `0.3.9`, push, and run `make release`.
|
|
21
|
+
|
|
22
|
+
## Source
|
|
23
|
+
|
|
24
|
+
- docs/issues/20261113104337_partman-probe-aborts-open-transactions.md
|
|
25
|
+
- lib/partition_gardener/connection.rb
|
|
26
|
+
- spec/integration/partman_probe_transaction_spec.rb
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Default require no longer pulls Railtie, CLI, HotSwitch, or Integer duration helpers.
|
|
2
|
+
|
|
3
|
+
## Participants
|
|
4
|
+
|
|
5
|
+
Andrei Makarov (@amkisko)
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- Treat side paths as opt-in requires; document Gemfile and migration require lines.
|
|
10
|
+
- Keep `auto_configure` on the railtie so requiring the railtie remains one clear consent switch.
|
|
11
|
+
|
|
12
|
+
## Effects
|
|
13
|
+
|
|
14
|
+
- Apps boot without gem Railtie configuration unless they require `partition_gardener/railtie`.
|
|
15
|
+
- Cutover migrations and the CLI load only when those entry points are required.
|
|
16
|
+
- Boot footprint report and contract spec capture the default-require inventory.
|
|
17
|
+
|
|
18
|
+
## Next
|
|
19
|
+
|
|
20
|
+
- Cut into CHANGELOG under `## 0.3.9 (2026-11-13)`.
|
|
21
|
+
- Commit, tag `0.3.9`, push, and run `make release`.
|
|
22
|
+
|
|
23
|
+
## Source
|
|
24
|
+
|
|
25
|
+
- docs/issues/20261113110417_opt-in-boot-side-paths.md
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Cut patch release 0.3.9
|
|
2
|
+
|
|
3
|
+
## Participants
|
|
4
|
+
|
|
5
|
+
Andrei Makarov (@amkisko)
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- Bump `PartitionGardener::VERSION` to `0.3.9`.
|
|
10
|
+
- Record the opt-in boot side paths and partman probe transaction fix in `CHANGELOG.md` under `## 0.3.9 (2026-11-13)`.
|
|
11
|
+
- Stay on `main`. No trunk branch.
|
|
12
|
+
|
|
13
|
+
## Effects
|
|
14
|
+
|
|
15
|
+
- Moved the Unreleased notes into the 0.3.9 section.
|
|
16
|
+
- Synced path-gem lockfile versions to 0.3.9.
|
|
17
|
+
- Tightened boot footprint `$LOADED_FEATURES` matching to `lib/partition_gardener` so checkout paths under `vendor/bundle` are not counted as gardener files.
|
|
18
|
+
- GitHub release notes now come from the matching `CHANGELOG.md` section via `--notes-file` instead of `--generate-notes`.
|
|
19
|
+
- Pass `--title` with the version: `--notes-file` alone left release `name` empty ("undefined" in Discord/Slack). Live `0.3.9` title repaired with `gh release edit`.
|
|
20
|
+
|
|
21
|
+
## Next
|
|
22
|
+
|
|
23
|
+
- Commit the prepared tree on `main`, tag `0.3.9`, push, and run `make release` (gem push, tag push, GitHub release).
|
|
24
|
+
|
|
25
|
+
## Source
|
|
26
|
+
|
|
27
|
+
- Fix notes: `docs/changelogs/20261113110417_opt-in-boot-side-paths.md`, `docs/changelogs/20261113104337_partman-probe-aborts-open-transactions.md`
|
|
28
|
+
- Issues: `docs/issues/20261113110417_opt-in-boot-side-paths.md`, `docs/issues/20261113104337_partman-probe-aborts-open-transactions.md`
|
|
29
|
+
- `CHANGELOG.md`, `lib/partition_gardener/version.rb`
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# GitHub release create with --notes-file left release name empty.
|
|
2
|
+
|
|
3
|
+
## Participants
|
|
4
|
+
|
|
5
|
+
Andrei Makarov (@amkisko)
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- Pass `--title` with the gem version whenever creating a release from changelog notes.
|
|
10
|
+
- Repair the published `0.3.9` release name in place (`gh release edit`); do not re-cut the gem.
|
|
11
|
+
|
|
12
|
+
## Effects
|
|
13
|
+
|
|
14
|
+
- `gh release create` without `--generate-notes` does not fill `name`; empty name shows as "undefined" in Discord/Slack GitHub notifications.
|
|
15
|
+
- `usr/bin/release.rb` now runs `gh release create VERSION --title VERSION --notes-file ...`.
|
|
16
|
+
- Live release `0.3.9` name set to `0.3.9` (was empty string).
|
|
17
|
+
|
|
18
|
+
## Next
|
|
19
|
+
|
|
20
|
+
- Commit the release script and spec fix on `main`.
|
|
21
|
+
|
|
22
|
+
## Source
|
|
23
|
+
|
|
24
|
+
- usr/bin/release.rb
|
|
25
|
+
- spec/release_spec.rb
|
|
26
|
+
- https://github.com/amkisko/partition_gardener.rb/releases/tag/0.3.9
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Propagate CHANGELOG GitHub release notes across amkisko Ruby gems.
|
|
2
|
+
|
|
3
|
+
## Participants
|
|
4
|
+
|
|
5
|
+
Andrei Makarov (@amkisko)
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- Same contract as partition_gardener and pray `github.sh`: release body from the matching `CHANGELOG.md` section; always pass `--title` with the version/tag.
|
|
10
|
+
- Batch-update every amkisko gem that uses `usr/bin/release.rb` plus `usr/lib/release_version_check.rb`.
|
|
11
|
+
- Skip `annotator` (app zip release, already has `--title`, still on `--generate-notes`).
|
|
12
|
+
- Do not create per-language GitHub releases for pray; that tree already publishes one `vX.Y.Z` release from root CHANGELOG.
|
|
13
|
+
|
|
14
|
+
## Effects
|
|
15
|
+
|
|
16
|
+
- 24 gems received `changelog_notes_for` / `require_changelog_notes!` and `gh release create VERSION --title VERSION --notes-file tmp/github-release-notes.md`.
|
|
17
|
+
- 5 gems with `spec/release_spec.rb` assert `--title` and `--notes-file` (plus partition_gardener).
|
|
18
|
+
- Changelog reads use `File.foreach(..., encoding: "UTF-8")`.
|
|
19
|
+
- `lepiota.rb` still has `## 0.1.0 (Unreleased)` while `VERSION` is `0.1.0`; `require_changelog_notes!` will refuse until that heading is cut to a dated release section (same class of failure as the existing version heading check).
|
|
20
|
+
|
|
21
|
+
## Next
|
|
22
|
+
|
|
23
|
+
- Commit each gem repo on its own (operator).
|
|
24
|
+
- Optional later: annotator notes-file; Elixir/Rust/Crystal/CLI scripts; repair empty historical GitHub release names with `gh release edit`.
|
|
25
|
+
|
|
26
|
+
## Source
|
|
27
|
+
|
|
28
|
+
- `usr/bin/release.rb` / `usr/lib/release_version_check.rb` in the updated gem checkouts under `amkisko/`
|
|
29
|
+
- `kiskolabs/pray/scripts/release/github.sh`
|
|
30
|
+
- `docs/changelogs/20261113132159_github-release-title-from-version.md`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Premake monthly default overlap create
|
|
2
|
+
|
|
3
|
+
## Participants
|
|
4
|
+
|
|
5
|
+
Andrei Makarov
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- Fix PremakeMonthlyMaintenance so missing month children are materialized through ensure_archive_partition_attached! with the default partition as the source when it exists.
|
|
10
|
+
- Add materialize_partition_from_source! that locks the parent for writes, drains overlapping rows into a detached child, then attaches.
|
|
11
|
+
- Keep create/attach CheckViolation recovery via a savepoint so an outer advisory transaction stays usable.
|
|
12
|
+
|
|
13
|
+
## Effects
|
|
14
|
+
|
|
15
|
+
- Integration fixtures with synthetic rows in the default for the current and next month complete without CheckViolation; row identity stays on the parent; children hold the moved rows.
|
|
16
|
+
- Second maintenance pass is a no-op for already-attached months.
|
|
17
|
+
|
|
18
|
+
## Next
|
|
19
|
+
|
|
20
|
+
- Cut into CHANGELOG under `## 0.3.10 (2026-11-19)`.
|
|
21
|
+
- Commit, tag `0.3.10`, push, and run `make release`.
|
|
22
|
+
|
|
23
|
+
## Source
|
|
24
|
+
|
|
25
|
+
- docs/issues/20261119083632_premake-monthly-default-overlap-create.md
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Cut patch release 0.3.10
|
|
2
|
+
|
|
3
|
+
## Participants
|
|
4
|
+
|
|
5
|
+
Andrei Makarov
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- Bump `PartitionGardener::VERSION` to `0.3.10`.
|
|
10
|
+
- Record the monthly premake default-overlap create fix in `CHANGELOG.md` under `## 0.3.10 (2026-11-19)`.
|
|
11
|
+
- Stay on `main`. No trunk branch.
|
|
12
|
+
|
|
13
|
+
## Effects
|
|
14
|
+
|
|
15
|
+
- Moved the Unreleased notes into the 0.3.10 section.
|
|
16
|
+
- Synced path-gem lockfile versions to 0.3.10.
|
|
17
|
+
|
|
18
|
+
## Next
|
|
19
|
+
|
|
20
|
+
- Commit the prepared tree on `main`, tag `0.3.10`, push, and run `make release` (gem push, tag push, GitHub release).
|
|
21
|
+
|
|
22
|
+
## Source
|
|
23
|
+
|
|
24
|
+
- Fix note: `docs/changelogs/20261119083632_premake-monthly-default-overlap-create.md`
|
|
25
|
+
- Issue: `docs/issues/20261119083632_premake-monthly-default-overlap-create.md`
|
|
26
|
+
- `CHANGELOG.md`, `lib/partition_gardener/version.rb`
|
data/docs/configuration.md
CHANGED
|
@@ -10,6 +10,9 @@ Pick layout and maintainer first ([decision_flow.md](decision_flow.md), [tooling
|
|
|
10
10
|
## Global configuration
|
|
11
11
|
|
|
12
12
|
```ruby
|
|
13
|
+
# Gemfile — railtie is opt-in (sets Active Record + Time.zone defaults)
|
|
14
|
+
gem "partition_gardener", require: ["partition_gardener", "partition_gardener/railtie"]
|
|
15
|
+
|
|
13
16
|
# config/initializers/partition_gardener.rb
|
|
14
17
|
PartitionGardener.configure do |config|
|
|
15
18
|
config.notifier = ->(message_or_error, context: {}) {
|
|
@@ -25,7 +28,14 @@ PartitionGardener.configure do |config|
|
|
|
25
28
|
end
|
|
26
29
|
```
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
Default `require "partition_gardener"` does not load the Railtie, CLI, hot-switch concern, or Integer duration helpers. Opt in:
|
|
32
|
+
|
|
33
|
+
- `require "partition_gardener/railtie"` — Rails defaults for `connection_resolver` and `today_resolver` (disable with `config.partition_gardener.auto_configure = false` in `config/application.rb`)
|
|
34
|
+
- `require "partition_gardener/cli"` — CLI (also loaded by `exe/partition_gardener`)
|
|
35
|
+
- `require "partition_gardener/migration/hot_switch_concern"` — cutover migrations
|
|
36
|
+
- `require "partition_gardener/stdlib_extensions"` then `PartitionGardener.install_stdlib_extensions!` — `Integer#minutes` / `#seconds` when Active Support is absent
|
|
37
|
+
|
|
38
|
+
When the railtie is required and `auto_configure` is true, it sets `connection_resolver` and `today_resolver` during Rails initialization.
|
|
29
39
|
|
|
30
40
|
`notifier` (default: no-op proc) — receives errors and info messages with a `context:` hash (`table_name`, `job`, `action`, …).
|
|
31
41
|
|
data/docs/cutover.md
CHANGED
|
@@ -34,6 +34,8 @@ For cross-database copies (production → staging, or a second cluster during mi
|
|
|
34
34
|
Use `PartitionGardener::Migration::HotSwitchConcern` in a migration:
|
|
35
35
|
|
|
36
36
|
```ruby
|
|
37
|
+
require "partition_gardener/migration/hot_switch_concern"
|
|
38
|
+
|
|
37
39
|
class PartitionEventsHotSwitch < ActiveRecord::Migration[8.0]
|
|
38
40
|
include PartitionGardener::Migration::HotSwitchConcern
|
|
39
41
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# When partman.part_config is absent, the register-time probe still aborts an open Postgres transaction after Ruby rescues StatementInvalid.
|
|
2
|
+
|
|
3
|
+
## Participants
|
|
4
|
+
|
|
5
|
+
Andrei Makarov (@amkisko)
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- Probe with `to_regclass('partman.part_config')::text` before selecting from the table so a missing relation returns null instead of raising.
|
|
10
|
+
- Keep `MaintenanceBackend.partman_parent_configured?` rescue as defense for unrelated statement failures.
|
|
11
|
+
- Prefer `to_regclass` over a savepoint wrap: local measurement showed the missing-relation savepoint path about 3x slower than the catalog null check.
|
|
12
|
+
|
|
13
|
+
## Effects
|
|
14
|
+
|
|
15
|
+
- Reproduced before the fix: `MaintenanceBackend.partman_parent_configured?` returned false inside an open transaction, then `SELECT 1` raised `PG::InFailedSqlTransaction`.
|
|
16
|
+
- After the fix: the same sequence leaves the outer transaction usable; `Registry.register` no longer poisons transactional RSpec examples on DBs without pg_partman.
|
|
17
|
+
- Integration specs cover absent probe, register inside a transaction, and a hit when a stub `partman.part_config` lists the parent.
|
|
18
|
+
|
|
19
|
+
## Next
|
|
20
|
+
|
|
21
|
+
- Publish `0.3.9` (`make release` after commit and clean tree). Host apps can drop prepend workarounds once that version is locked.
|
|
22
|
+
- Optional later: cache the relation presence check across a register burst if register volume ever makes the extra round trip when partman is installed measurable.
|
|
23
|
+
|
|
24
|
+
## Source
|
|
25
|
+
|
|
26
|
+
- lib/partition_gardener/connection.rb (`partman_parent_configured?`)
|
|
27
|
+
- lib/partition_gardener/maintenance_backend.rb
|
|
28
|
+
- spec/integration/partman_probe_transaction_spec.rb
|
|
29
|
+
- docs/changelogs/20261113104337_partman-probe-aborts-open-transactions.md
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Default require loaded CLI, HotSwitch, Railtie (when Rails::Railtie was defined), and an Integer duration monkey-patch without an explicit host opt-in.
|
|
2
|
+
|
|
3
|
+
## Participants
|
|
4
|
+
|
|
5
|
+
Andrei Makarov (@amkisko)
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- Keep maintenance/register/run on the default require so existing jobs and initializers keep working.
|
|
10
|
+
- Make Railtie, CLI, HotSwitchConcern, and stdlib Integer helpers explicit requires.
|
|
11
|
+
- Railtie uses `config.partition_gardener.auto_configure` (default true once the railtie is loaded) so hosts can require the railtie file without overwriting resolvers.
|
|
12
|
+
- Record boot footprint with `usr/reports/boot_footprint.rb` and a subprocess contract spec.
|
|
13
|
+
|
|
14
|
+
## Effects
|
|
15
|
+
|
|
16
|
+
- Before (this machine, 20 cold subprocesses): mean 37.64 ms, 55 gardener files; Integer duration patch installed when Active Support Duration was absent; CLI and HotSwitch constants always defined; Railtie auto-loaded whenever `Rails::Railtie` was already defined.
|
|
17
|
+
- After (same method, 20 cold subprocesses): mean 34.75 ms, 52 gardener files; CLI / HotSwitch / Railtie / stdlib_extensions absent from default require.
|
|
18
|
+
- Absolute time win is small while the maintenance stack stays eager; the contract win is consent (no silent Railtie or monkey-patch).
|
|
19
|
+
- Specs that use CLI or HotSwitch require those files directly.
|
|
20
|
+
|
|
21
|
+
## Next
|
|
22
|
+
|
|
23
|
+
- Publish `0.3.9` (`make release` after commit and clean tree).
|
|
24
|
+
- Host apps that relied on silent Railtie defaults must add `partition_gardener/railtie` to the Gemfile require list (or set resolvers in an initializer, which many already do).
|
|
25
|
+
- Hot-switch migrations must `require "partition_gardener/migration/hot_switch_concern"`.
|
|
26
|
+
- Optional later: further slim the default require if app boot budgets demand it; keep that behind an explicit runtime entry point rather than silent autoload.
|
|
27
|
+
|
|
28
|
+
## Source
|
|
29
|
+
|
|
30
|
+
- lib/partition_gardener.rb
|
|
31
|
+
- lib/partition_gardener/railtie.rb
|
|
32
|
+
- lib/partition_gardener/rails.rb
|
|
33
|
+
- lib/partition_gardener/stdlib_extensions.rb
|
|
34
|
+
- spec/partition_gardener/boot_footprint_spec.rb
|
|
35
|
+
- usr/reports/boot_footprint.rb
|
|
36
|
+
- docs/changelogs/20261113110417_opt-in-boot-side-paths.md
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Premake monthly create fails when the default partition already holds that month
|
|
2
|
+
|
|
3
|
+
## Participants
|
|
4
|
+
|
|
5
|
+
Andrei Makarov
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- On the first-create path, move overlapping default rows into a detached child and attach under a parent `SHARE ROW EXCLUSIVE` write lock in one transaction (or under the existing advisory transaction when one is open).
|
|
10
|
+
- Reuse the archive materialize helper from date-range maintenance so premake and archive attach share the same drain-then-attach contract.
|
|
11
|
+
- Wrap speculative `CREATE TABLE ... PARTITION OF` and bare `ATTACH` attempts in a savepoint when an outer transaction is open so a `CheckViolation` does not abort the whole table run.
|
|
12
|
+
|
|
13
|
+
## Effects
|
|
14
|
+
|
|
15
|
+
- Before: PremakeMonthlyMaintenance called `create_partition` for missing months before `drain_default_partition`. A row already in the default for that month raised `ActiveRecord::CheckViolation` (`updated partition constraint for default partition ... would be violated by some row`).
|
|
16
|
+
- After: the same fixture ends with the matching rows in the monthly children, November-style horizon children attached, default empty for those keys, and a second ordinary maintenance pass clean.
|
|
17
|
+
- Regression coverage: `spec/integration/premake_monthly_spec.rb` (overlap create and second pass); `spec/partition_gardener/attach_retry_spec.rb` updated for the lock path.
|
|
18
|
+
|
|
19
|
+
## Next
|
|
20
|
+
|
|
21
|
+
- Publish `0.3.10` (`make release` after commit and clean tree). Host apps that added a one-off preparation step before `run!` can drop it once that version is locked.
|
|
22
|
+
|
|
23
|
+
## Source
|
|
24
|
+
|
|
25
|
+
- lib/partition_gardener/premake_monthly_maintenance.rb
|
|
26
|
+
- lib/partition_gardener/date_range_maintenance.rb
|
|
27
|
+
- spec/integration/premake_monthly_spec.rb
|
|
28
|
+
- docs/changelogs/20261119083632_premake-monthly-default-overlap-create.md
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Engineering audit and release preparation
|
|
2
|
+
|
|
3
|
+
## Participants
|
|
4
|
+
|
|
5
|
+
Andrei Makarov (@amkisko)
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- Continue on main. Do not commit, tag, push, or publish in this session.
|
|
10
|
+
- Cut patch release version 0.3.9 for opt-in boot side paths and the partman probe transaction fix. Set the CHANGELOG heading date to 2026-11-13.
|
|
11
|
+
- Re-check lint, executable coverage, workflow YAML parse, package boundaries, and cold-require cost after the cut.
|
|
12
|
+
|
|
13
|
+
## Effects
|
|
14
|
+
|
|
15
|
+
- Bump `PartitionGardener::VERSION` and path-gem lockfiles to 0.3.9. Move the Unreleased bullets under `## 0.3.9 (2026-11-13)`.
|
|
16
|
+
- Fix boot footprint counting so paths under a checkout named `partition_gardener.rb` (including `vendor/bundle`) do not inflate `gardener_files`. Loose filter reported 68; `lib/partition_gardener` filter reports 52 and restores the `< 55` contract.
|
|
17
|
+
- Publish GitHub release body from the matching `CHANGELOG.md` section (`gh release create --title VERSION --notes-file`), not commit auto-notes. First cut omitted `--title` and left `name` empty; repaired live `0.3.9` and the script.
|
|
18
|
+
- Final serial JSON report: 196 examples, 0 failures with `INTEGRATION=1` and PostgreSQL; no pending examples. Parallel polyrun with five workers: exit 0.
|
|
19
|
+
- Required project checks passed: rubocop (84 files, no offenses), rbs validate, `INTEGRATION=1` polyrun parallel-rspec. Environment: Ruby 4.0.2, `BUNDLE_PATH=vendor/bundle`.
|
|
20
|
+
- `release_spec`: 2 examples, 0 failures.
|
|
21
|
+
- Build the gem, verify it with `Gem::Package#verify`, and confirm the changelog heading matches version 0.3.9. Compressed package: 124928 bytes; source payload: 433997 bytes across 116 packaged paths. These are compressed versus uncompressed sizes, not interchangeable quantities.
|
|
22
|
+
- Cold process measurement on macOS arm64 with `/usr/bin/time -p` and `bundle exec ruby -Ilib`: 0.17 CPU seconds, 0.25 elapsed seconds. Peak RSS via `/usr/bin/time -l`: 30687232 bytes. Local smoke ceilings: 1 MiB compressed gem, 128 MiB RSS, 2 CPU seconds. Measured gem size, RSS, and CPU fit those ceilings. CPU seconds are the energy proxy; electricity use was not measured.
|
|
23
|
+
- Parse every workflow YAML, verify lockfile own-gem versions at 0.3.9, and run `git diff --check`. All passed. RubyGems has no `0.3.9` yet.
|
|
24
|
+
|
|
25
|
+
## Next
|
|
26
|
+
|
|
27
|
+
- Commit, tag 0.3.9, push, and publish remain operator steps; this session did not run them. When the tree is clean, `make release` runs gem push, tag, and GitHub release.
|
|
28
|
+
- Host apps that relied on silent Railtie defaults must require `partition_gardener/railtie`. Hot-switch migrations must require `partition_gardener/migration/hot_switch_concern`.
|
|
29
|
+
- Hosted GitHub Actions and the complete supported Ruby/framework matrix were not executed locally beyond the default Gemfile path used by `make test`.
|
|
30
|
+
- Scope limits: production traffic, production database size and query plans, external service retention, and co-located resource interference were not measured. The local byte/CPU results do not establish those properties.
|
|
31
|
+
- Trace review follows local file/log and protocol emissions. No live customer identities or credentials were used. Data retention and deletion in embedding applications remain host contracts.
|
|
32
|
+
- Database-boundary mode applies to PostgreSQL maintenance DDL and the register-time partman catalog probe.
|
|
33
|
+
|
|
34
|
+
## Source
|
|
35
|
+
|
|
36
|
+
- AGENTS.md
|
|
37
|
+
- .agents/skills/engineering-audit/SKILL.md
|
|
38
|
+
- .agents/skills/changelog-update/SKILL.md
|
|
39
|
+
- CHANGELOG.md
|
|
40
|
+
- Makefile
|
|
41
|
+
- spec/README.md
|
|
42
|
+
- docs/changelogs/20261113130745_cut-patch-release-0-3-9.md
|
|
43
|
+
- docs/changelogs/20261113110417_opt-in-boot-side-paths.md
|
|
44
|
+
- docs/changelogs/20261113104337_partman-probe-aborts-open-transactions.md
|
|
45
|
+
- docs/issues/20261113110417_opt-in-boot-side-paths.md
|
|
46
|
+
- docs/issues/20261113104337_partman-probe-aborts-open-transactions.md
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Engineering audit and release preparation
|
|
2
|
+
|
|
3
|
+
## Participants
|
|
4
|
+
|
|
5
|
+
Andrei Makarov
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- Continue on main. Do not commit, tag, push, or publish in this session.
|
|
10
|
+
- Cut patch release version 0.3.10 for the monthly premake default-overlap create fix. Set the CHANGELOG heading date to 2026-11-19.
|
|
11
|
+
|
|
12
|
+
## Effects
|
|
13
|
+
|
|
14
|
+
- Bump `PartitionGardener::VERSION` and path-gem lockfiles to 0.3.10. Move the Unreleased bullet under `## 0.3.10 (2026-11-19)`.
|
|
15
|
+
- Final serial JSON report: 201 examples, 0 failures with `INTEGRATION=1` and PostgreSQL; no pending examples. Parallel polyrun with five workers: exit 0.
|
|
16
|
+
- Required project checks passed: rubocop (121 files, no offenses), rbs validate, `INTEGRATION=1` polyrun parallel-rspec. Environment: Ruby 4.0.2.
|
|
17
|
+
- `release_spec`: 5 examples, 0 failures.
|
|
18
|
+
- Build the gem, verify it with `Gem::Package#verify`, and confirm the changelog heading matches version 0.3.10. Compressed package: 128000 bytes across 122 packaged paths.
|
|
19
|
+
- Cold process measurement on macOS arm64 with `/usr/bin/time -p` and `bundle exec ruby -Ilib`: 0.19 CPU seconds, 0.33 elapsed seconds. Peak RSS was not captured in this run (`time -l` failed under the agent sandbox). Local smoke ceilings: 1 MiB compressed gem, 128 MiB RSS, 2 CPU seconds. Measured gem size and CPU fit those ceilings. CPU seconds are the energy proxy; electricity use was not measured.
|
|
20
|
+
- Parse every workflow YAML, verify lockfile own-gem versions at 0.3.10, and run `git diff --check`. All passed. RubyGems has no `0.3.10` yet.
|
|
21
|
+
|
|
22
|
+
## Next
|
|
23
|
+
|
|
24
|
+
- Commit, tag 0.3.10, push, and publish remain operator steps; this session did not run them. When the tree is clean, `make release` runs gem push, tag, and GitHub release.
|
|
25
|
+
- Host apps that added a one-off preparation step before monthly premake `run!` can drop it once this version is locked.
|
|
26
|
+
- Hosted GitHub Actions and the complete supported Ruby/framework matrix were not executed locally beyond the default Gemfile path.
|
|
27
|
+
- Scope limits: production traffic, production database size and query plans, external service retention, and co-located resource interference were not measured. The local byte/CPU results do not establish those properties.
|
|
28
|
+
- Trace review follows local file/log and protocol emissions. No live customer identities or credentials were used. Data retention and deletion in embedding applications remain host contracts.
|
|
29
|
+
- Database-boundary mode applies to PostgreSQL maintenance DDL for monthly premake create when the default partition already holds overlapping rows.
|
|
30
|
+
|
|
31
|
+
## Source
|
|
32
|
+
|
|
33
|
+
- AGENTS.md
|
|
34
|
+
- .agents/skills/engineering-audit/SKILL.md
|
|
35
|
+
- .agents/skills/changelog-update/SKILL.md
|
|
36
|
+
- CHANGELOG.md
|
|
37
|
+
- Makefile
|
|
38
|
+
- docs/changelogs/20261119085211_cut-patch-release-0-3-10.md
|
|
39
|
+
- docs/changelogs/20261119083632_premake-monthly-default-overlap-create.md
|
|
40
|
+
- docs/issues/20261119083632_premake-monthly-default-overlap-create.md
|
data/exe/partition_gardener
CHANGED
|
@@ -246,6 +246,13 @@ module PartitionGardener
|
|
|
246
246
|
end
|
|
247
247
|
|
|
248
248
|
def partman_parent_configured?(table_name)
|
|
249
|
+
# to_regclass returns null when the relation is missing; a direct SELECT would
|
|
250
|
+
# abort an open transaction even if Ruby rescues StatementInvalid.
|
|
251
|
+
relation = connection.execute(
|
|
252
|
+
"SELECT to_regclass('partman.part_config')::text AS relation_oid"
|
|
253
|
+
).first
|
|
254
|
+
return false if Blank.blank?(relation&.fetch("relation_oid", nil))
|
|
255
|
+
|
|
249
256
|
qualified_name = "#{schema_name}.#{table_name}"
|
|
250
257
|
sql = <<~SQL
|
|
251
258
|
SELECT 1
|
|
@@ -234,47 +234,117 @@ module PartitionGardener
|
|
|
234
234
|
|
|
235
235
|
return if Connection.partition_attached?(table_name, partition_name)
|
|
236
236
|
|
|
237
|
-
if
|
|
237
|
+
if overlapping_source_rows?(source_partition_name, where_condition)
|
|
238
|
+
materialize_partition_from_source!(
|
|
239
|
+
partition_name: partition_name,
|
|
240
|
+
source_partition_name: source_partition_name,
|
|
241
|
+
for_values_clause: for_values_clause,
|
|
242
|
+
where_condition: where_condition
|
|
243
|
+
)
|
|
244
|
+
elsif Connection.partition_exists?(partition_name)
|
|
245
|
+
attach_archive_partition!(table_name, partition_name, for_values_clause, where_condition)
|
|
246
|
+
else
|
|
247
|
+
create_partition_or_materialize_from_default!(
|
|
248
|
+
partition_name: partition_name,
|
|
249
|
+
for_values_clause: for_values_clause,
|
|
250
|
+
where_condition: where_condition
|
|
251
|
+
)
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
def overlapping_source_rows?(source_partition_name, where_condition)
|
|
256
|
+
return false unless Connection.partition_exists?(source_partition_name)
|
|
257
|
+
|
|
258
|
+
Connection.count_rows_in_partition(source_partition_name, where_condition).positive?
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
def create_partition_or_materialize_from_default!(partition_name:, for_values_clause:, where_condition:)
|
|
262
|
+
with_statement_savepoint do
|
|
263
|
+
@executor.create_partition(table_name, partition_name, for_values_clause)
|
|
264
|
+
end
|
|
265
|
+
rescue => error
|
|
266
|
+
raise unless check_violation?(error)
|
|
267
|
+
|
|
268
|
+
materialize_partition_from_source!(
|
|
269
|
+
partition_name: partition_name,
|
|
270
|
+
source_partition_name: default_partition_name(table_name),
|
|
271
|
+
for_values_clause: for_values_clause,
|
|
272
|
+
where_condition: where_condition
|
|
273
|
+
)
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
def materialize_partition_from_source!(partition_name:, source_partition_name:, for_values_clause:, where_condition:)
|
|
277
|
+
with_parent_write_lock do
|
|
238
278
|
@executor.ensure_detached_partition_table!(table_name, partition_name, conflict_key: conflict_key)
|
|
239
|
-
|
|
279
|
+
drain_overlapping_rows_into_partition!(
|
|
240
280
|
source_partition_name,
|
|
241
281
|
partition_name,
|
|
242
|
-
where_condition
|
|
243
|
-
conflict_key,
|
|
244
|
-
cursor_columns: cursor_columns
|
|
282
|
+
where_condition
|
|
245
283
|
)
|
|
284
|
+
|
|
285
|
+
default_name = default_partition_name(table_name)
|
|
286
|
+
if default_name != source_partition_name
|
|
287
|
+
drain_overlapping_rows_into_partition!(default_name, partition_name, where_condition)
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
@executor.attach_partition(table_name, partition_name, for_values_clause)
|
|
246
291
|
end
|
|
292
|
+
end
|
|
247
293
|
|
|
248
|
-
|
|
249
|
-
|
|
294
|
+
def drain_overlapping_rows_into_partition!(source_partition_name, partition_name, where_condition)
|
|
295
|
+
return unless Connection.partition_exists?(source_partition_name)
|
|
296
|
+
return unless Connection.count_rows_in_partition(source_partition_name, where_condition).positive?
|
|
297
|
+
|
|
298
|
+
@executor.drain_rows_between_partitions!(
|
|
299
|
+
source_partition_name,
|
|
300
|
+
partition_name,
|
|
301
|
+
where_condition,
|
|
302
|
+
conflict_key,
|
|
303
|
+
cursor_columns: cursor_columns
|
|
304
|
+
)
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
def with_parent_write_lock
|
|
308
|
+
lock_sql = "LOCK TABLE #{Connection.quoted_table(table_name)} IN SHARE ROW EXCLUSIVE MODE"
|
|
309
|
+
|
|
310
|
+
if connection.respond_to?(:transaction_open?) && connection.transaction_open?
|
|
311
|
+
connection.execute(lock_sql)
|
|
312
|
+
yield
|
|
250
313
|
else
|
|
251
|
-
|
|
314
|
+
connection.transaction do
|
|
315
|
+
connection.execute(lock_sql)
|
|
316
|
+
yield
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
def with_statement_savepoint
|
|
322
|
+
if connection.respond_to?(:transaction_open?) && connection.transaction_open?
|
|
323
|
+
connection.transaction(requires_new: true) { yield }
|
|
324
|
+
else
|
|
325
|
+
yield
|
|
252
326
|
end
|
|
253
327
|
end
|
|
254
328
|
|
|
255
329
|
def attach_archive_partition!(table_name, partition_name, for_values_clause, where_condition)
|
|
256
|
-
|
|
330
|
+
with_statement_savepoint do
|
|
331
|
+
@executor.attach_partition(table_name, partition_name, for_values_clause)
|
|
332
|
+
end
|
|
257
333
|
rescue => error
|
|
258
334
|
raise unless check_violation?(error)
|
|
259
335
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
where_condition,
|
|
267
|
-
conflict_key,
|
|
268
|
-
cursor_columns: cursor_columns
|
|
269
|
-
)
|
|
270
|
-
end
|
|
271
|
-
|
|
272
|
-
@executor.attach_partition(table_name, partition_name, for_values_clause)
|
|
336
|
+
materialize_partition_from_source!(
|
|
337
|
+
partition_name: partition_name,
|
|
338
|
+
source_partition_name: default_partition_name(table_name),
|
|
339
|
+
for_values_clause: for_values_clause,
|
|
340
|
+
where_condition: where_condition
|
|
341
|
+
)
|
|
273
342
|
end
|
|
274
343
|
|
|
275
344
|
def check_violation?(error)
|
|
276
345
|
message = error.message.to_s
|
|
277
346
|
return true if message.include?("CheckViolation") || message.include?("check constraint")
|
|
347
|
+
return true if message.include?("updated partition constraint")
|
|
278
348
|
|
|
279
349
|
error.cause && check_violation?(error.cause)
|
|
280
350
|
end
|
|
@@ -24,13 +24,21 @@ module PartitionGardener
|
|
|
24
24
|
|
|
25
25
|
def ensure_month_partition!(identifier)
|
|
26
26
|
partition_name = @config[:partition_name_format].call(identifier)
|
|
27
|
-
for_values_clause = @config[:partition_definition].call(identifier)
|
|
28
|
-
|
|
29
27
|
return if Connection.partition_attached?(table_name, partition_name)
|
|
30
28
|
|
|
29
|
+
default_name = default_partition_name(table_name)
|
|
30
|
+
if Connection.partition_exists?(default_name)
|
|
31
|
+
ensure_archive_partition_attached!(
|
|
32
|
+
identifier,
|
|
33
|
+
partition_name: partition_name,
|
|
34
|
+
source_partition_name: default_name
|
|
35
|
+
)
|
|
36
|
+
return
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
for_values_clause = @config[:partition_definition].call(identifier)
|
|
31
40
|
if Connection.partition_exists?(partition_name)
|
|
32
|
-
|
|
33
|
-
:attach_archive_partition!,
|
|
41
|
+
attach_archive_partition!(
|
|
34
42
|
table_name,
|
|
35
43
|
partition_name,
|
|
36
44
|
for_values_clause,
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
require "rails"
|
|
2
|
-
|
|
3
1
|
module PartitionGardener
|
|
4
2
|
class Railtie < Rails::Railtie
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
config.partition_gardener = ActiveSupport::OrderedOptions.new
|
|
4
|
+
# Requiring partition_gardener/railtie opts in; set false to load the railtie
|
|
5
|
+
# without overwriting connection_resolver / today_resolver.
|
|
6
|
+
config.partition_gardener.auto_configure = true
|
|
7
|
+
|
|
8
|
+
initializer "partition_gardener.connection" do |app|
|
|
9
|
+
next unless app.config.partition_gardener.auto_configure
|
|
10
|
+
|
|
11
|
+
PartitionGardener.configure do |configuration|
|
|
12
|
+
configuration.connection_resolver = -> { ActiveRecord::Base.connection }
|
|
13
|
+
configuration.today_resolver = -> { Time.zone.today }
|
|
9
14
|
end
|
|
10
15
|
end
|
|
11
16
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Opt-in Rails integration. Host apps that want Active Record and Time.zone
|
|
2
|
+
# defaults should require this file (Gemfile require list or an initializer).
|
|
3
|
+
#
|
|
4
|
+
# gem "partition_gardener", require: ["partition_gardener", "partition_gardener/railtie"]
|
|
5
|
+
#
|
|
6
|
+
# Or:
|
|
7
|
+
#
|
|
8
|
+
# # config/application.rb / an initializer
|
|
9
|
+
# require "partition_gardener/railtie"
|
|
10
|
+
#
|
|
11
|
+
require "rails/railtie"
|
|
12
|
+
require_relative "rails"
|
|
@@ -8,8 +8,12 @@ module PartitionGardener
|
|
|
8
8
|
self
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
|
-
end
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
# Opt-in for non-ActiveSupport hosts (CLI/scripts). Rails apps already have Duration.
|
|
13
|
+
def self.install_stdlib_extensions!
|
|
14
|
+
return if defined?(ActiveSupport::Duration)
|
|
15
|
+
return if Integer.included_modules.include?(IntegerDurationMethods)
|
|
16
|
+
|
|
17
|
+
Integer.include(IntegerDurationMethods)
|
|
18
|
+
end
|
|
15
19
|
end
|
data/lib/partition_gardener.rb
CHANGED
|
@@ -3,8 +3,6 @@ require "date"
|
|
|
3
3
|
require_relative "partition_gardener/version"
|
|
4
4
|
require_relative "partition_gardener/date_calendar"
|
|
5
5
|
require_relative "partition_gardener/date_bucket"
|
|
6
|
-
require_relative "partition_gardener/stdlib_extensions"
|
|
7
|
-
require "pg"
|
|
8
6
|
require_relative "partition_gardener/pg_connection"
|
|
9
7
|
require_relative "partition_gardener/blank"
|
|
10
8
|
require_relative "partition_gardener/predicate"
|
|
@@ -53,8 +51,12 @@ require_relative "partition_gardener/audit"
|
|
|
53
51
|
require_relative "partition_gardener/archive_retention"
|
|
54
52
|
require_relative "partition_gardener/registry"
|
|
55
53
|
require_relative "partition_gardener/config_document"
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
|
|
55
|
+
# Side paths are opt-in (not loaded by default require):
|
|
56
|
+
# require "partition_gardener/cli"
|
|
57
|
+
# require "partition_gardener/migration/hot_switch_concern"
|
|
58
|
+
# require "partition_gardener/railtie"
|
|
59
|
+
# require "partition_gardener/stdlib_extensions" then PartitionGardener.install_stdlib_extensions!
|
|
58
60
|
|
|
59
61
|
module PartitionGardener
|
|
60
62
|
MOVE_BATCH_SIZE = 10_000
|
|
@@ -213,5 +215,3 @@ module PartitionGardener
|
|
|
213
215
|
private :plan_all, :emit_run_metadata, :run_single_table!
|
|
214
216
|
end
|
|
215
217
|
end
|
|
216
|
-
|
|
217
|
-
require_relative "partition_gardener/rails" if defined?(Rails::Railtie)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: partition_gardener
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrei Makarov
|
|
@@ -85,14 +85,14 @@ dependencies:
|
|
|
85
85
|
requirements:
|
|
86
86
|
- - ">="
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: 2.2.
|
|
88
|
+
version: 2.2.9
|
|
89
89
|
type: :development
|
|
90
90
|
prerelease: false
|
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
93
|
- - ">="
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 2.2.
|
|
95
|
+
version: 2.2.9
|
|
96
96
|
- !ruby/object:Gem::Dependency
|
|
97
97
|
name: prosopite
|
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -281,6 +281,13 @@ files:
|
|
|
281
281
|
- docs/changelogs/20261021220000_cut-patch-release-0-3-7.md
|
|
282
282
|
- docs/changelogs/20261105085411_hot-switch-migration-connection-stack-overflow.md
|
|
283
283
|
- docs/changelogs/20261105090326_cut-patch-release-0-3-8.md
|
|
284
|
+
- docs/changelogs/20261113104337_partman-probe-aborts-open-transactions.md
|
|
285
|
+
- docs/changelogs/20261113110417_opt-in-boot-side-paths.md
|
|
286
|
+
- docs/changelogs/20261113130745_cut-patch-release-0-3-9.md
|
|
287
|
+
- docs/changelogs/20261113132159_github-release-title-from-version.md
|
|
288
|
+
- docs/changelogs/20261113154500_ruby-gems-changelog-github-release-notes.md
|
|
289
|
+
- docs/changelogs/20261119083632_premake-monthly-default-overlap-create.md
|
|
290
|
+
- docs/changelogs/20261119085211_cut-patch-release-0-3-10.md
|
|
284
291
|
- docs/cli.md
|
|
285
292
|
- docs/configuration.md
|
|
286
293
|
- docs/cutover.md
|
|
@@ -292,6 +299,9 @@ files:
|
|
|
292
299
|
- docs/issues/20260916113300_opaque-composite-public-ids.md
|
|
293
300
|
- docs/issues/20260917123253_ci-drop-automatic-dependency-audit.md
|
|
294
301
|
- docs/issues/20261105085411_hot-switch-migration-connection-stack-overflow.md
|
|
302
|
+
- docs/issues/20261113104337_partman-probe-aborts-open-transactions.md
|
|
303
|
+
- docs/issues/20261113110417_opt-in-boot-side-paths.md
|
|
304
|
+
- docs/issues/20261119083632_premake-monthly-default-overlap-create.md
|
|
295
305
|
- docs/monitoring.md
|
|
296
306
|
- docs/naming.md
|
|
297
307
|
- docs/operations.md
|
|
@@ -305,6 +315,8 @@ files:
|
|
|
305
315
|
- docs/reviews/20261029150855_engineering-audit-release-preparation.md
|
|
306
316
|
- docs/reviews/20261105085411_engineering-audit-hot-switch-connection.md
|
|
307
317
|
- docs/reviews/20261105090507_engineering-audit-release-preparation.md
|
|
318
|
+
- docs/reviews/20261113130745_engineering-audit-release-preparation.md
|
|
319
|
+
- docs/reviews/20261119085211_engineering-audit-release-preparation.md
|
|
308
320
|
- docs/schemas/partition_garden.schema.json
|
|
309
321
|
- docs/schemas/plan_report.schema.json
|
|
310
322
|
- docs/tooling_split.md
|
|
@@ -349,6 +361,7 @@ files:
|
|
|
349
361
|
- lib/partition_gardener/predicate.rb
|
|
350
362
|
- lib/partition_gardener/premake_monthly_maintenance.rb
|
|
351
363
|
- lib/partition_gardener/rails.rb
|
|
364
|
+
- lib/partition_gardener/railtie.rb
|
|
352
365
|
- lib/partition_gardener/registry.rb
|
|
353
366
|
- lib/partition_gardener/run_failed.rb
|
|
354
367
|
- lib/partition_gardener/run_metrics.rb
|