You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-13 01:00:23 +02:00
Add protocolKeepAlive() to send noops to all remotes.
While the local processes are doing their jobs the remote connection from the main process may timeout. Send occasional noops to ensure that doesn't happen.
This commit is contained in:
@ -89,6 +89,10 @@
|
||||
<p><code>httpClientRequest()</code> accepts a body parameter.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Add <code>protocolKeepAlive()</code> to send <id>noops</id> to all remotes.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Make <code>strLstDup()</code> null-tolerant.</p>
|
||||
</release-item>
|
||||
|
@ -327,6 +327,26 @@ protocolRemoteGet(ProtocolStorageType protocolStorageType)
|
||||
FUNCTION_LOG_RETURN(PROTOCOL_CLIENT, protocolHelperClient->client);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Send keepalives to all remotes
|
||||
***********************************************************************************************************************************/
|
||||
void
|
||||
protocolKeepAlive(void)
|
||||
{
|
||||
FUNCTION_LOG_VOID(logLevelTrace);
|
||||
|
||||
if (protocolHelper.memContext != NULL)
|
||||
{
|
||||
for (unsigned int clientIdx = 0; clientIdx < protocolHelper.clientRemoteSize; clientIdx++)
|
||||
{
|
||||
if (protocolHelper.clientRemote[clientIdx].client != NULL)
|
||||
protocolClientNoOp(protocolHelper.clientRemote[clientIdx].client);
|
||||
}
|
||||
}
|
||||
|
||||
FUNCTION_LOG_RETURN_VOID();
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Free the protocol objects and shutdown processes
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -26,6 +26,7 @@ Constants
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
void protocolKeepAlive(void);
|
||||
ProtocolClient *protocolLocalGet(ProtocolStorageType protocolStorageType, unsigned int protocolId);
|
||||
ProtocolClient *protocolRemoteGet(ProtocolStorageType protocolStorageType);
|
||||
|
||||
|
@ -629,6 +629,10 @@ testRun(void)
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("protocolGet()"))
|
||||
{
|
||||
// Call keep alive before any remotes exist
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_RESULT_VOID(protocolKeepAlive(), "keep alive");
|
||||
|
||||
// Simple protocol start
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
StringList *argList = strLstNew();
|
||||
@ -647,6 +651,7 @@ testRun(void)
|
||||
TEST_ASSIGN(client, protocolRemoteGet(protocolStorageTypeRepo), "get remote protocol");
|
||||
TEST_RESULT_PTR(protocolRemoteGet(protocolStorageTypeRepo), client, "get remote cached protocol");
|
||||
TEST_RESULT_PTR(protocolHelper.clientRemote[0].client, client, "check position in cache");
|
||||
TEST_RESULT_VOID(protocolKeepAlive(), "keep alive");
|
||||
TEST_RESULT_VOID(protocolFree(), "free remote protocol objects");
|
||||
TEST_RESULT_VOID(protocolFree(), "free remote protocol objects again");
|
||||
|
||||
|
Reference in New Issue
Block a user