Skip to content

Commit

Permalink
HPCC-31627 Remove legacy central node delay
Browse files Browse the repository at this point in the history
Some very old redundant code that was not being hit until
the HPCC-18382 changes were introduced caused random delays
when sockets were connecting in Thor.
This was spuriously seen when SORT was connecting merge
streams, introducing significant delays overall.

Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Jun 17, 2024
1 parent 8a7b442 commit 57a8ce6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
25 changes: 2 additions & 23 deletions system/jlib/jsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1538,20 +1538,8 @@ void CSocket::connect_wait(unsigned timems)
bool exit = false;
int err;
unsigned refuseddelay = 1;
while (!exit) {
#ifdef CENTRAL_NODE_RANDOM_DELAY
ForEachItemIn(cn,CentralNodeArray) {
const SocketEndpoint &ep=CentralNodeArray.item(cn);
if (ep.ipequals(targetip)) {
unsigned sleeptime = getRandom() % 1000;
StringBuffer s;
ep.getHostText(s);
DBGLOG("Connection to central node %s - sleeping %d milliseconds", s.str(), sleeptime);
Sleep(sleeptime);
break;
}
}
#endif
while (!exit)
{
unsigned remaining;
exit = tm.timedout(&remaining);
bool blockselect = exit; // if last time round block
Expand Down Expand Up @@ -6189,15 +6177,6 @@ ISocketBufferReader *createSocketBufferReader(const char *trc)
}


extern jlib_decl void markNodeCentral(SocketEndpoint &ep)
{
#ifdef CENTRAL_NODE_RANDOM_DELAY
CriticalBlock block(CSocket::crit);
CentralNodeArray.append(ep);
#endif
}


static CSocket *prepareSocket(unsigned idx,const SocketEndpoint &ep, ISocketConnectNotify &inotify)
{
Owned<CSocket> sock = new CSocket(ep,sm_tcp,NULL);
Expand Down
2 changes: 0 additions & 2 deletions system/jlib/jsocket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,6 @@ interface ISocketBufferReader: extends IInterface

extern jlib_decl ISocketBufferReader *createSocketBufferReader(const char *trc=NULL);

extern jlib_decl void markNodeCentral(SocketEndpoint &ep); // random delay for linux

interface ISocketConnectNotify
{
public:
Expand Down
1 change: 0 additions & 1 deletion thorlcr/slave/thslavemain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ int main( int argc, const char *argv[] )
SocketEndpoint masterEp(master);
localHostToNIC(masterEp);
setMasterPortBase(masterEp.port);
markNodeCentral(masterEp);

if (RegisterSelf(masterEp))
{
Expand Down

0 comments on commit 57a8ce6

Please sign in to comment.