Skip to content

Commit 469a5f5

Browse files
author
SqlRush
committed
style(cluster): spec-5.18 clang-format v18 — fast-gate Validate fix
Whitespace-only reformat of the spec-5.18 sources to clang-format v18 (the CI version); no behavioural change. Fixes the linkdb fast-gate Validate clang-format check (run 28316812451).
1 parent b0fd6dc commit 469a5f5

12 files changed

Lines changed: 169 additions & 142 deletions

src/backend/cluster/cluster_guc.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,14 +2250,15 @@ cluster_init_guc(void)
22502250
"its GRD/GES/PCM leftover cleaned up cluster-wide."),
22512251
&cluster_online_node_removal, false, PGC_POSTMASTER, 0, NULL, NULL, NULL);
22522252

2253-
DefineCustomIntVariable("cluster.node_removal_cleanup_timeout_ms",
2254-
gettext_noop("Deadline for the post-shrink cluster-wide removal cleanup."),
2255-
gettext_noop("If verify_no_leftover + all-survivor cleanup ACKs do not "
2256-
"complete within this bound, the removal enters "
2257-
"CLEANUP_BLOCKED (resumable, fail-closed — never reports "
2258-
"complete). Range [5000, 120000] ms."),
2259-
&cluster_node_removal_cleanup_timeout_ms, 30000, 5000, 120000, PGC_SIGHUP,
2260-
GUC_UNIT_MS, NULL, NULL, NULL);
2253+
DefineCustomIntVariable(
2254+
"cluster.node_removal_cleanup_timeout_ms",
2255+
gettext_noop("Deadline for the post-shrink cluster-wide removal cleanup."),
2256+
gettext_noop("If verify_no_leftover + all-survivor cleanup ACKs do not "
2257+
"complete within this bound, the removal enters "
2258+
"CLEANUP_BLOCKED (resumable, fail-closed — never reports "
2259+
"complete). Range [5000, 120000] ms."),
2260+
&cluster_node_removal_cleanup_timeout_ms, 30000, 5000, 120000, PGC_SIGHUP, GUC_UNIT_MS,
2261+
NULL, NULL, NULL);
22612262

22622263
/* spec-2.28 Sprint A Step 1 D7: 4 fence-lite GUCs (Q8 user approve). */
22632264

src/backend/cluster/cluster_node_remove.c

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extern PGDLLIMPORT bool cluster_enabled;
7474
/* on-slot StaticAssert: the removal marker must fit within the voting-slot
7575
* _reserved1 region after the 4.12 fence marker, clear of the slot crc32c. */
7676
StaticAssertDecl(CLUSTER_REMOVAL_MARKER_RESERVED1_OFFSET + sizeof(ClusterRemovalMarker)
77-
<= sizeof(((ClusterVotingSlot *)0)->_reserved1),
77+
<= sizeof(((ClusterVotingSlot *)0)->_reserved1),
7878
"removal marker must fit within voting-slot _reserved1 (after fence marker)");
7979

8080
static ClusterNodeRemoveState *nr_state = NULL;
@@ -347,8 +347,7 @@ nr_node_is_drained(int32 node_id)
347347
if (cluster_reconfig_is_clean_departed(node_id))
348348
return true;
349349
st = cluster_membership_get_state(node_id);
350-
return st == CLUSTER_MEMBER_DEAD || st == CLUSTER_MEMBER_ABSENT
351-
|| st == CLUSTER_MEMBER_REMOVED;
350+
return st == CLUSTER_MEMBER_DEAD || st == CLUSTER_MEMBER_ABSENT || st == CLUSTER_MEMBER_REMOVED;
352351
}
353352

354353
/* generate a per-attempt removal identity (R14 folds it into the event id). */
@@ -428,8 +427,8 @@ cluster_node_remove_request(int32 node_id)
428427
nr_state->coordinator_node_id = cluster_node_id;
429428
nr_state->remove_epoch = 0;
430429
nr_state->removal_event_id = nr_make_event_id(node_id);
431-
nr_state->target_last_incarnation =
432-
cluster_membership_get_last_admitted_incarnation(node_id);
430+
nr_state->target_last_incarnation
431+
= cluster_membership_get_last_admitted_incarnation(node_id);
433432
nr_state->remove_baseline_dead_gen = cluster_cssd_get_dead_generation();
434433
nr_state->fence_armed = false;
435434
nr_state->membership_shrunk = false;
@@ -444,8 +443,7 @@ cluster_node_remove_request(int32 node_id)
444443
}
445444
/* RESUME: keep the existing target/epoch; just re-arm the drive from SHRUNK by
446445
* moving CLEANUP_BLOCKED back to CLEANUP (the lmon_tick retries the cleanup). */
447-
else if (verdict == CLUSTER_REMOVE_REQ_RESUME
448-
&& cur_phase == CLUSTER_REMOVE_CLEANUP_BLOCKED) {
446+
else if (verdict == CLUSTER_REMOVE_REQ_RESUME && cur_phase == CLUSTER_REMOVE_CLEANUP_BLOCKED) {
449447
pg_atomic_write_u32(&nr_state->phase, CLUSTER_REMOVE_CLEANUP);
450448
}
451449
LWLockRelease(&nr_state->lock);
@@ -507,8 +505,7 @@ cluster_node_remove_drive(void)
507505
pg_atomic_write_u32(&nr_state->phase, CLUSTER_REMOVE_PRECHECK);
508506
/* fall through to re-validate on the same tick */
509507
/* FALLTHROUGH */
510-
case CLUSTER_REMOVE_PRECHECK:
511-
{
508+
case CLUSTER_REMOVE_PRECHECK: {
512509
CLUSTER_INJECTION_POINT("cluster-node-remove-precheck");
513510
/* re-validate (a node may have come back ALIVE, or quorum lost). */
514511
if (!cluster_qvotec_in_quorum() || !nr_node_is_drained(node_id)) {
@@ -520,13 +517,12 @@ cluster_node_remove_drive(void)
520517
pg_atomic_write_u32(&nr_state->phase, CLUSTER_REMOVE_FENCE_ARMING);
521518
}
522519
/* FALLTHROUGH */
523-
case CLUSTER_REMOVE_FENCE_ARMING:
524-
{
520+
case CLUSTER_REMOVE_FENCE_ARMING: {
525521
uint64 baseline_epoch = cluster_epoch_get_current();
526522
uint64 new_epoch;
527523
bool contest = false;
528524

529-
(void) baseline_dead_gen; /* contest is now signalled by out_contest, not derived */
525+
(void)baseline_dead_gen; /* contest is now signalled by out_contest, not derived */
530526

531527
/* §2.5: durable REMOVING marker (pre-commit; not a trust source). */
532528
(void)nr_write_marker(CLUSTER_REMOVAL_MARKER_REMOVING, node_id, baseline_epoch,
@@ -540,17 +536,16 @@ cluster_node_remove_drive(void)
540536
* set) or because the fence submit did not reach majority (transient, NOT a
541537
* contest) — both fail-closed (nothing published on 0).
542538
*/
543-
new_epoch = cluster_reconfig_apply_node_removed_as_coordinator(node_id, baseline_epoch,
544-
removal_event_id,
545-
last_incarnation, &contest);
539+
new_epoch = cluster_reconfig_apply_node_removed_as_coordinator(
540+
node_id, baseline_epoch, removal_event_id, last_incarnation, &contest);
546541
if (new_epoch == 0) {
547542
if (contest) {
548543
/* a real death/contest intruded BEFORE the membership commit
549544
* (pre-SHRUNK) -> ABORTED_ESCALATE (hand to fail-stop 5.14). Routed
550545
* through classify_contest for the pre/post-SHRUNK discipline (here
551546
* always pre-SHRUNK: membership not yet shrunk). */
552-
ClusterRemovePhase next =
553-
cluster_node_remove_classify_contest(nr_state->membership_shrunk);
547+
ClusterRemovePhase next
548+
= cluster_node_remove_classify_contest(nr_state->membership_shrunk);
554549

555550
CLUSTER_INJECTION_POINT("cluster-node-remove-escalate");
556551
pg_atomic_write_u32(&nr_state->phase, next);
@@ -568,9 +563,9 @@ cluster_node_remove_drive(void)
568563
nr_state->remove_epoch = new_epoch;
569564
nr_state->fence_armed = true;
570565
nr_state->membership_shrunk = true; /* committed: N is now a fenced non-member */
571-
nr_state->cleanup_deadline_us =
572-
(TimestampTz)((uint64)GetCurrentTimestamp()
573-
+ (uint64)cluster_node_removal_cleanup_timeout_ms * 1000ULL);
566+
nr_state->cleanup_deadline_us
567+
= (TimestampTz)((uint64)GetCurrentTimestamp()
568+
+ (uint64)cluster_node_removal_cleanup_timeout_ms * 1000ULL);
574569
LWLockRelease(&nr_state->lock);
575570

576571
/* membership is committed-shrunk: advance to SHRINK_COMMITTING, which writes
@@ -579,8 +574,7 @@ cluster_node_remove_drive(void)
579574
pg_atomic_write_u32(&nr_state->phase, CLUSTER_REMOVE_SHRINK_COMMITTING);
580575
}
581576
/* FALLTHROUGH */
582-
case CLUSTER_REMOVE_SHRINK_COMMITTING:
583-
{
577+
case CLUSTER_REMOVE_SHRINK_COMMITTING: {
584578
uint64 epoch;
585579

586580
LWLockAcquire(&nr_state->lock, LW_SHARED);
@@ -601,8 +595,7 @@ cluster_node_remove_drive(void)
601595
}
602596
/* FALLTHROUGH */
603597
case CLUSTER_REMOVE_CLEANUP:
604-
case CLUSTER_REMOVE_CLEANUP_BLOCKED:
605-
{
598+
case CLUSTER_REMOVE_CLEANUP_BLOCKED: {
606599
uint64 epoch;
607600
bool clean;
608601

@@ -753,8 +746,8 @@ nr_announce_handler(const ClusterICEnvelope *env, const void *payload)
753746
static void
754747
nr_ack_handler(const ClusterICEnvelope *env, const void *payload)
755748
{
756-
const ClusterNodeRemoveCleanupAckPayload *p =
757-
(const ClusterNodeRemoveCleanupAckPayload *)payload;
749+
const ClusterNodeRemoveCleanupAckPayload *p
750+
= (const ClusterNodeRemoveCleanupAckPayload *)payload;
758751

759752
if (nr_state == NULL || !cluster_node_remove_ack_payload_valid(p))
760753
return;
@@ -898,11 +891,10 @@ cluster_node_remove_rebuild_from_disks(const int *fds, int n_disks)
898891
has[i] = true;
899892
}
900893

901-
if (!cluster_removal_marker_authority_decide(per_disk, has,
902-
(n_disks < CLUSTER_MAX_VOTING_DISKS
903-
? n_disks
904-
: CLUSTER_MAX_VOTING_DISKS),
905-
&authority))
894+
if (!cluster_removal_marker_authority_decide(
895+
per_disk, has,
896+
(n_disks < CLUSTER_MAX_VOTING_DISKS ? n_disks : CLUSTER_MAX_VOTING_DISKS),
897+
&authority))
906898
continue; /* no majority removal marker on this slot */
907899
/* structural-only validation (magic/version/crc/phase/range); the marker's
908900
* removed_node_id is the node to seed, not the slot it physically lives in. */
@@ -925,7 +917,7 @@ cluster_node_remove_rebuild_from_disks(const int *fds, int n_disks)
925917
fence_says_fenced = cluster_write_fence_verify_durable(authority.remove_epoch);
926918
resume = cluster_node_remove_recover_phase(true /* trust the durable marker */,
927919
authority.phase, &corrupt);
928-
(void) fence_says_fenced;
920+
(void)fence_says_fenced;
929921
if (corrupt)
930922
continue; /* unknown marker phase — ignore (struct_valid already vetted phase) */
931923

@@ -947,9 +939,9 @@ cluster_node_remove_rebuild_from_disks(const int *fds, int n_disks)
947939
nr_state->target_last_incarnation = authority.removed_incarnation;
948940
nr_state->fence_armed = true;
949941
nr_state->membership_shrunk = true;
950-
nr_state->cleanup_deadline_us =
951-
(TimestampTz)((uint64)GetCurrentTimestamp()
952-
+ (uint64)cluster_node_removal_cleanup_timeout_ms * 1000ULL);
942+
nr_state->cleanup_deadline_us
943+
= (TimestampTz)((uint64)GetCurrentTimestamp()
944+
+ (uint64)cluster_node_removal_cleanup_timeout_ms * 1000ULL);
953945
pg_atomic_write_u32(&nr_state->phase, (resume == CLUSTER_REMOVE_COMMITTED)
954946
? CLUSTER_REMOVE_COMMITTED
955947
: CLUSTER_REMOVE_CLEANUP);

src/backend/cluster/cluster_node_remove_policy.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ cluster_node_remove_phase_valid_transition(ClusterRemovePhase from, ClusterRemov
6868
/* escalate is reachable ONLY from a pre-SHRUNK active phase */
6969
if (to == CLUSTER_REMOVE_ABORTED_ESCALATE)
7070
return (from == CLUSTER_REMOVE_REQUESTED || from == CLUSTER_REMOVE_PRECHECK
71-
|| from == CLUSTER_REMOVE_FENCE_ARMING
72-
|| from == CLUSTER_REMOVE_SHRINK_COMMITTING);
71+
|| from == CLUSTER_REMOVE_FENCE_ARMING || from == CLUSTER_REMOVE_SHRINK_COMMITTING);
7372

7473
/* clean abort is reachable ONLY pre-fence-commit */
7574
if (to == CLUSTER_REMOVE_ABORTED)
@@ -183,9 +182,9 @@ cluster_node_remove_request_result_str(ClusterRemoveRequestResult r)
183182
* (SHRUNK/REMOVED) is recognised regardless of the live drained snapshot.
184183
*/
185184
ClusterRemoveRequestResult
186-
cluster_node_remove_precheck(bool feature_enabled, bool is_self, bool is_declared,
187-
bool is_drained, bool in_quorum, int marker_phase,
188-
bool cleanup_blocked, bool drive_active)
185+
cluster_node_remove_precheck(bool feature_enabled, bool is_self, bool is_declared, bool is_drained,
186+
bool in_quorum, int marker_phase, bool cleanup_blocked,
187+
bool drive_active)
189188
{
190189
if (!feature_enabled)
191190
return CLUSTER_REMOVE_REQ_FEATURE_DISABLED;
@@ -290,7 +289,7 @@ cluster_node_remove_recover_phase(bool fence_says_fenced, int marker_phase, bool
290289

291290
/* fence is durable (N is fenced): drive the removal to completion. */
292291
switch (marker_phase) {
293-
case 0: /* no removal marker yet */
292+
case 0: /* no removal marker yet */
294293
case CLUSTER_REMOVAL_MARKER_REMOVING:
295294
/* fenced but membership not committed -> finish the shrink+cleanup */
296295
return CLUSTER_REMOVE_SHRINK_COMMITTING;
@@ -392,7 +391,8 @@ cluster_removal_marker_unpack(const uint8 *reserved1, ClusterRemovalMarker *out)
392391
* region as-is (the caller zeroed it).
393392
*/
394393
void
395-
cluster_removal_marker_preserve_per_disk(uint8 *new_reserved1, const uint8 *prior_reserved1_same_disk)
394+
cluster_removal_marker_preserve_per_disk(uint8 *new_reserved1,
395+
const uint8 *prior_reserved1_same_disk)
396396
{
397397
ClusterRemovalMarker m;
398398

src/backend/cluster/cluster_node_remove_views.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ pg_cluster_remove_node(PG_FUNCTION_ARGS)
137137
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
138138
errmsg("cluster.enabled is off; node removal is not available")));
139139

140-
PG_RETURN_TEXT_P(
141-
cstring_to_text(cluster_node_remove_request_result_str(cluster_node_remove_request(node_id))));
140+
PG_RETURN_TEXT_P(cstring_to_text(
141+
cluster_node_remove_request_result_str(cluster_node_remove_request(node_id))));
142142
}
143143

144144
#else /* !USE_PGRAC_CLUSTER */

src/backend/cluster/cluster_qvotec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,8 @@ qvotec_build_baseline_marker(ClusterFenceMarker *out)
677677
memset(fenced, 0, sizeof(fenced));
678678
if (any_removed)
679679
cluster_reconfig_snapshot_removed_bitmap(fenced);
680-
cluster_fence_marker_build_baseline(out, CLUSTER_EPOCH_INITIAL, fenced,
681-
0 /* generation */, 0 /* event_id */,
680+
cluster_fence_marker_build_baseline(out, CLUSTER_EPOCH_INITIAL, fenced, 0 /* generation */,
681+
0 /* event_id */,
682682
CLUSTER_FENCE_BASELINE_INITIAL_ISSUER);
683683
} else {
684684
/* applied reconfig: republish its membership tuple, unioned with removed. */

src/backend/cluster/cluster_reconfig.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@ cluster_reconfig_compute_event_id_v2(uint8 reconfig_kind,
538538
* produces a distinct, non-deduped event id.
539539
*/
540540
uint64
541-
cluster_reconfig_compute_removal_event_id(const uint8 removed_bitmap[CLUSTER_RECONFIG_DEAD_BITMAP_BYTES],
542-
uint64 removal_event_id)
541+
cluster_reconfig_compute_removal_event_id(
542+
const uint8 removed_bitmap[CLUSTER_RECONFIG_DEAD_BITMAP_BYTES], uint64 removal_event_id)
543543
{
544544
uint8 hash_input[1 + CLUSTER_RECONFIG_DEAD_BITMAP_BYTES + sizeof(uint64)];
545545
Size off = 0;
@@ -1492,8 +1492,8 @@ cluster_reconfig_lmon_tick(void)
14921492
* re-admits it — it is no longer a member.
14931493
*/
14941494
for (b = 0; b < CLUSTER_RECONFIG_DEAD_BITMAP_BYTES; b++)
1495-
dead_bitmap[b] &= (uint8)~(ReconfigShmem->clean_departed_bitmap[b]
1496-
| ReconfigShmem->removed_bitmap[b]);
1495+
dead_bitmap[b] &= (uint8) ~(ReconfigShmem->clean_departed_bitmap[b]
1496+
| ReconfigShmem->removed_bitmap[b]);
14971497

14981498
LWLockRelease(&ReconfigShmem->lock);
14991499
} else {
@@ -1942,8 +1942,8 @@ cluster_reconfig_apply_node_removed_as_coordinator(int32 removed_node_id, uint64
19421942
marker.magic = CLUSTER_FENCE_MARKER_MAGIC;
19431943
marker.version = CLUSTER_FENCE_MARKER_VERSION;
19441944
marker.fence_epoch = new_epoch;
1945-
marker.fence_event_id = cluster_reconfig_compute_removal_event_id(removed_with_n,
1946-
removal_event_id);
1945+
marker.fence_event_id
1946+
= cluster_reconfig_compute_removal_event_id(removed_with_n, removal_event_id);
19471947
marker.fence_generation = cssd_dead_generation;
19481948
marker.issuer_node_id = cluster_node_id;
19491949
marker.marker_kind = CLUSTER_FENCE_MARKER_KIND_NODE_REMOVED;

src/include/cluster/cluster_guc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,8 @@ extern char *cluster_voting_disks;
445445
extern int cluster_quorum_poll_interval_ms;
446446
extern int cluster_voting_disk_io_timeout_ms;
447447
extern int cluster_voting_disk_size_bytes;
448-
extern bool cluster_online_join; /* spec-5.15 D7 */
449-
extern int cluster_join_convergence_timeout_ms; /* spec-5.15 D7 */
448+
extern bool cluster_online_join; /* spec-5.15 D7 */
449+
extern int cluster_join_convergence_timeout_ms; /* spec-5.15 D7 */
450450
extern bool cluster_online_node_removal; /* spec-5.18 D13 */
451451
extern int cluster_node_removal_cleanup_timeout_ms; /* spec-5.18 D13 */
452452

0 commit comments

Comments
 (0)