Remove all in-code use of leadership "instance name" + constrain column to single value #325
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the addition of #301, and more specifically the schema-based
namespacing that it brings in around listen/notify, we're fully moving
towards a world where the recommendation for running multiple Rivers in
a single database is very definitive: isolate them by schema.
The elector's had a long-standing parameter called "instance name"
that's stored into the
river_leader
table, and which was prospectivelygoing to be used for River namespacing, but something we never made use
of it. In a world of schema isolation, each schema will have its own
river_leader
table, and no kind of additional namespacing is neededwithin the table.
I was originally going to try and approach herein we drop
name
out ofriver_leader
completely, but looking more closely, it's the table'sprimary key. We could add a new column that'd act as a primary key
instead (e.g. imagine a boolean primary key column with a check
constraint that makes sure it's always true), but nothing we'd add would
be that much better. Instead, I elected to give
name
a default valueof
default
(matching the previous default instance name), and add acheck constraint verifying that it's always
default
, making iteffectively a single row table. The nice part about this approach is
that we can put these changes into the V4 migration in #301, and we
won't require any additional changes in any future migration.
With
name
now constrained to a single value, we can simplify all theriver_leader
-based queries by removing their name parameters, thenremove instance name completely from elector code and drivers, giving us
a thorough overall cleanup.