@@ -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. */
7676StaticAssertDecl (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
8080static 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)
753746static void
754747nr_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 );
0 commit comments