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 8e49f0b43014490bae4ec2659715e343db38f920
Author: Annpurna Shahani <ashah...@vmware.com>
AuthorDate: Sat Mar 4 12:59:21 2023 +0530

    Fixed the string comparison warning
    
    * Due to commit eb4db09544bcb8b6ea52f47effe8e30b0f736a97 string comparison
      was giving below warning, fixed the string comparison code
    
      pg_rewind.c: In function ‘main’:
      pg_rewind.c:318:75: warning: comparison with string literal results in 
unspecified behavior [-Waddress]
         318 |  while(getenv("SUSPEND_PG_REWIND") != NULL && 
getenv("SUSPEND_PG_REWIND") == "true")
             |
    
    * Now when SUSPEND_PG_REWIND is set to true, pg_rewind process will sleep
      for 120 seconds (enough for validating the skip pg_rewind warning in 
testcase)
    
    * Also placed the suspend pg_rewind code block under #ifdef FAULT_INJECTOR 
to
      avoid shipping this in production build as suggested in
      https://github.com/greenplum-db/gpdb/pull/14476#discussion_r1110459120
---
 src/bin/pg_rewind/pg_rewind.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index f366b0e26b..b366bf3e32 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -352,6 +352,21 @@ main(int argc, char **argv)
 
        sanityChecks();
 
+#ifdef FAULT_INJECTOR
+       /*
+        * SUSPEND_PG_REWIND is used for testing purposes. If set to true, the 
pg_rewind process will be
+        * suspended for 120 seconds, so that it's entry can be checked in the 
pg_stat_activity table.
+        * The goal being that we can run another instance of gprecoverseg and 
assert that it ignores
+        * recovery for segments that already have an active pg_rewind process.
+        */
+       char* suspend_pg_rewind = getenv("SUSPEND_PG_REWIND");
+       if(suspend_pg_rewind != NULL && strcmp(suspend_pg_rewind, "true") == 0)
+       {
+               pg_log_info("pg_rewind suspended");
+               sleep(120);
+       }
+#endif
+
        /*
         * Find the common ancestor timeline between the clusters.
         *


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

Reply via email to