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 0e4928cd83eed173f80a1840f7347e14d5eb62e4
Author: Ashwin Agrawal <[email protected]>
AuthorDate: Tue Oct 25 15:47:42 2022 -0700

    gp_replica_check: cosmetic changes to output
    
    Added code to print thread id for passed or failed status to easily
    correlate the message result with the data directory. Some minor
    formatting along the way.
---
 gpcontrib/gp_replica_check/gp_replica_check.py | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/gpcontrib/gp_replica_check/gp_replica_check.py 
b/gpcontrib/gp_replica_check/gp_replica_check.py
index 0e92d9b320..5d4a3b41e8 100755
--- a/gpcontrib/gp_replica_check/gp_replica_check.py
+++ b/gpcontrib/gp_replica_check/gp_replica_check.py
@@ -54,9 +54,9 @@ class ReplicaCheck(threading.Thread):
         self.lock = threading.Lock()
 
     def __str__(self):
-        return '(%s) Host: %s, Port: %s, Database: %s\n\
-Primary Data Directory Location: %s\n\
-Mirror Data Directory Location: %s' % (self.getName(), self.host, self.port, 
self.datname,
+        return '\n(%s) ---------\nHost: %s, Port: %s, Database: %s\n\
+Primary Location: %s\n\
+Mirror  Location: %s' % (self.getName(), self.host, self.port, self.datname,
                                           self.ploc, self.mloc)
 
     def wait_for_wal_sync(self):
@@ -102,7 +102,7 @@ Mirror Data Directory Location: %s' % (self.getName(), 
self.host, self.port, sel
 
 
     def run(self):
-        self.wait_for_wal_sync();
+        self.wait_for_wal_sync()
         cmd = '''PGOPTIONS='-c gp_role=utility' psql -h %s -p %s -c "select * 
from gp_replica_check('%s', '%s', '%s')" %s''' % (self.host, self.port,
                                                                                
                                                         self.ploc, self.mloc,
                                                                                
                                                         self.relation_types,
@@ -115,11 +115,12 @@ Mirror Data Directory Location: %s' % (self.getName(), 
self.host, self.port, sel
                 self.result = True if res.strip().split('\n')[-2].strip() == 
't' else False
                 with self.lock:
                     print(self)
-                    print (res)
-                    if not self.result:
-                        print("replica check failed")
-
-            except subprocess.CalledProcessError as e:
+                    if self.result:
+                        print("(%s) ** passed **" % (self.getName()))
+                    else:
+                        print("(%s) --> failed <--" % (self.getName()))
+                        print (res)
+            except:
                 with self.lock:
                     print(self)
                     print('returncode: (%s), cmd: (%s), output: (%s)' % 
(e.returncode, e.cmd, e.output))


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to