You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by yj...@apache.org on 2025/01/06 08:39:41 UTC

(cloudberry) 13/20: FTS: remove dead code and fix some typo

This is an automated email from the ASF dual-hosted git repository.

yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 25c8b9de06dea9c32705d915ab98160d65fd95f2
Author: Junwang Zhao <zh...@gmail.com>
AuthorDate: Tue Feb 28 15:14:11 2023 -0800

    FTS: remove dead code and fix some typo
    
    these code seems useless, so just remove them and keep the codebase
    neat and clean.
    
    Co-authored-by: Junwang Zhao <zh...@gmail.com>
---
 src/backend/fts/README                   |  2 +-
 src/backend/fts/fts.c                    |  2 +-
 src/backend/replication/gp_replication.c |  2 +-
 src/include/postmaster/fts.h             | 68 +-------------------------------
 4 files changed, 4 insertions(+), 70 deletions(-)

diff --git a/src/backend/fts/README b/src/backend/fts/README
index 90f73e412b..fab5bfcd4a 100644
--- a/src/backend/fts/README
+++ b/src/backend/fts/README
@@ -5,7 +5,7 @@ Fault Tolerance Service (FTS)
 This document illustrates the mechanism of a GPDB component called
 Fault Tolerance Service (FTS), which also works for Cloudberry Database:
 
- - This sections explains how FTS probe process is started. The FTS
+1. This sections explains how FTS probe process is started. The FTS
    probe process is running on the coordinator node only. It starts as a
    background worker process managed by the BackgroundWorker structure
    (see src/include/postmaster/bgworker.h). Greenplum sets up a group of
diff --git a/src/backend/fts/fts.c b/src/backend/fts/fts.c
index 3da780092d..67bcb7ccf8 100644
--- a/src/backend/fts/fts.c
+++ b/src/backend/fts/fts.c
@@ -162,7 +162,7 @@ CdbComponentDatabases *readCdbComponentInfoAndUpdateStatus(void)
 	}
 
 	/*
-	 * Initialize fts_stausVersion after populating the config details in
+	 * Initialize fts_statusVersion after populating the config details in
 	 * shared memory for the first time after FTS startup.
 	 */
 	if (ftsProbeInfo->status_version == 0)
diff --git a/src/backend/replication/gp_replication.c b/src/backend/replication/gp_replication.c
index b0d971a36c..e89c91a960 100644
--- a/src/backend/replication/gp_replication.c
+++ b/src/backend/replication/gp_replication.c
@@ -434,7 +434,7 @@ FTSReplicationStatusRetrieveDisconnectTime(FTSReplicationStatus *replication_sta
  *
  * Detect the primary-mirror replication attempt count.
  * If the replication keeps crash, we should consider mark
- * mirror down directly. Since the walsender keeps resarting,
+ * mirror down directly. Since the walsender keeps restarting,
  * walsender->replica_disconnected_at keeps updated.
  * So ignore it.
  *
diff --git a/src/include/postmaster/fts.h b/src/include/postmaster/fts.h
index 694bdd9e7d..eb29ccbf3c 100644
--- a/src/include/postmaster/fts.h
+++ b/src/include/postmaster/fts.h
@@ -34,78 +34,12 @@ extern bool am_ftsprobe;
 extern bool am_ftshandler;
 extern bool am_mirror;
 
-/*
- * ENUMS
- */
-
-enum probe_result_e
-{
-	PROBE_DEAD            = 0x00,
-	PROBE_ALIVE           = 0x01,
-	PROBE_SEGMENT         = 0x02,
-	PROBE_FAULT_CRASH     = 0x08,
-	PROBE_FAULT_MIRROR    = 0x10,
-	PROBE_FAULT_NET       = 0x20,
-};
-
-#define PROBE_CHECK_FLAG(result, flag) (((result) & (flag)) == (flag))
-
-#define PROBE_IS_ALIVE(dbInfo) \
-	PROBE_CHECK_FLAG(probe_results[(dbInfo)->dbid], PROBE_ALIVE)
-#define PROBE_HAS_FAULT_CRASH(dbInfo) \
-	PROBE_CHECK_FLAG(probe_results[(dbInfo)->dbid], PROBE_FAULT_CRASH)
-#define PROBE_HAS_FAULT_MIRROR(dbInfo) \
-	PROBE_CHECK_FLAG(probe_results[(dbInfo)->dbid], PROBE_FAULT_MIRROR)
-#define PROBE_HAS_FAULT_NET(dbInfo) \
-	PROBE_CHECK_FLAG(probe_results[(dbInfo)->dbid], PROBE_FAULT_NET)
-
-/*
- * primary/mirror state after probing;
- * this is used to transition the segment pair to next state;
- * we ignore the case where both segments are down, as no transition is performed;
- * each segment can be:
- *    1) (U)p or (D)own
- */
-enum probe_transition_e
-{
-	TRANS_D_D = 0x01,	/* not used for state transitions */
-	TRANS_D_U = 0x02,
-	TRANS_U_D = 0x04,
-	TRANS_U_U = 0x08,
-
-	TRANS_SENTINEL
-};
-
-#define IS_VALID_TRANSITION(trans) \
-	(trans == TRANS_D_D || trans == TRANS_D_U || trans == TRANS_U_D || trans == TRANS_U_U)
-
 /* buffer size for SQL command */
 #define SQL_CMD_BUF_SIZE     1024
 
 /*
- * STRUCTURES
+ * Interface for checking if FTS is active
  */
-
-/* prototype */
-struct CdbComponentDatabaseInfo;
-
-typedef struct
-{
-	int	dbid;
-	int16 segindex;
-	uint8 oldStatus;
-	uint8 newStatus;
-} FtsSegmentStatusChange;
-
-typedef struct
-{
-	CdbComponentDatabaseInfo *primary;
-	CdbComponentDatabaseInfo *mirror;
-	uint32 stateNew;
-	uint32 statePrimary;
-	uint32 stateMirror;
-} FtsSegmentPairState;
-
 extern bool FtsIsActive(void);
 
 extern void SetSkipFtsProbe(bool skipFtsProbe);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org