Skip to content

Commit

Permalink
HPCC-33100 Fix data loss, streaming from dafilesrv and network failure.
Browse files Browse the repository at this point in the history
If there is a broken socket whilst streaming from dafilesrv, the
underlying mechanism will dispose of the socket and reconnect
and retry the command. If the server side remained running and did
not receive notification of the closed socket, the client can
reconnect to the same server and the retry will cause the next
chunk of data in the stream to be retrieved, thereby losing the
earlier one that hit the socket issues.
Fix by avoiding the reconnect/retry mechanism at this level,
instead, on failure during streaming, establish a new stream
at the valid position using the serialized cursor.

Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Dec 10, 2024
1 parent 1caf985 commit ee42588
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions fs/dafsclient/rmtfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2316,9 +2316,19 @@ class CRemoteFilteredFileIOBase : public CRemoteBase, implements IRemoteFileIO
mrequest.append((RemoteFileCommandType)RFCStreamRead);
VStringBuffer json("{ \"handle\" : %u, \"format\" : \"binary\" }", handle);
mrequest.append(json.length(), json.str());
sendRemoteCommand(mrequest, newReply);
unsigned newHandle;
newReply.read(newHandle);
unsigned newHandle = 0;
try
{
sendRemoteCommand(mrequest, newReply, false);
newReply.read(newHandle);
}
catch (IJSOCK_Exception *e)
{
// will trigger new request with cursor
EXCLOG(e, "CRemoteFilteredFileIOBase:: socket failure whilst streaming, will attempt to reconnect with cursor");
newHandle = 0;
e->Release();
}
if (newHandle == handle)
{
reply.swapWith(newReply);
Expand Down

0 comments on commit ee42588

Please sign in to comment.