On 2025/03/12 21:57, torikoshia wrote:
Hi,

After an off-list discussion with Fujii-san, I'm now trying to modify the 
following message that is output when a client attempts to connect instead of 
changing the log level as the original proposal:

   $ psql: error: connection to server at "localhost" (::1), port 5433 failed: 
FATAL:  the database system is not yet accepting connections
     DETAIL:  Consistent recovery state has not been yet reached.

I have now 2 candidates to do this.

Thanks for the patches!


The 1st one(v1-0001-Change-log-message-when-hot-standby-is-not-access.patch) is 
a simple update to the existing log messages, explicitly mentioning that 
snapshot overflow could be a possible cause.
The 2nd(v1-0001-Make-it-clear-when-hot-standby-is-inaccessible-du.patch) one 
introduces new states for pmState and CAC_state (which manages whether 
connections can be accepted) to represent waiting for a non-overflowed snapshot.

The advantage of the 2nd one is that it makes it clear whether the connection 
failure is due to not reaching a consistent recovery state or a snapshot 
overflow. However, I haven't found other significant benefits, and I feel it 
might be overkill.

I agree that adding a new postmaster signal and state for
this minor issue seems unnecessary.


Personally, I feel 1st patch may be sufficient, but I would appreciate any 
feedback.

Agreed.

-                                                        errdetail("Consistent 
recovery state has not been yet reached.")));
+                                                        errdetail("Consistent 
recovery state has not been yet reached, or snappshot is pending because subtransaction 
is overflowed."),
+                                                        errhint("In the latter 
case, find and close the transaction with more than %d subtransactions", 
PGPROC_MAX_CACHED_SUBXIDS)));

This message might be too detailed. Instead, how about simplifying it
to something like: "Consistent recovery state has not been reached,
or snapshot is not ready for hot standby."

We can then update the documentation to clarify that overflowed subtransactions
may delay snapshot readiness for hot standby and explain how to address it.
For example, the current description - "it will begin accepting connections once
the recovery has brought the system to a consistent state." - should be updated
to reflect this condition.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION



Reply via email to