oracleloyall commented on code in PR #1447:
URL: https://github.com/apache/cloudberry/pull/1447#discussion_r2562450535


##########
src/backend/storage/lmgr/lock.c:
##########
@@ -939,11 +939,20 @@ LockAcquireExtended(const LOCKTAG *locktag,
                        {
                                /* Find the guy who should manage our locks */
                                volatile PGPROC * proc = 
FindProcByGpSessionId(gp_session_id);
-                               int count = 0;
-                               while(proc==NULL && count < 
find_writer_proc_retry_time)
+                               TimestampTz current_time;
+                               TimestampTz start_time;
+                               long        elapsed_secs;
+                               int         elapsed_usecs;
+                               start_time = GetCurrentTimestamp();
+
+                               while (proc == NULL)
                                {
+                                       current_time = GetCurrentTimestamp();
+                                       TimestampDifference(start_time, 
current_time, &elapsed_secs, &elapsed_usecs);
+                                       if (elapsed_secs >= 
gp_segment_connect_timeout / 2)
+                                               break;
+
                                        pg_usleep( /* microseconds */ 2000);
-                                       count++;
                                        CHECK_FOR_INTERRUPTS();

Review Comment:
   The creation timeout retry logic of cdbgang_createGang_async should be 
synchronized with the reader to avoid slow creation due to platform, container, 
network and other reasons, which would cause the reader to prematurely consider 
it an abnormal termination.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to