wtclient: spin session key indices if required

If the tower returns CreateSessionCodeAlreadyExists in response to the
CreateSession message from the client, then skip forward a few key
indices until we find one that the server does not return the error
for. This will allow a client to recover after a data loss incident.
This commit is contained in:
Elle Mouton
2023-03-29 12:40:25 +02:00
parent 24016c35c7
commit ba33f6a697
3 changed files with 59 additions and 36 deletions

View File

@@ -2014,14 +2014,12 @@ var clientTests = []clientTest{
},
},
{
// Demonstrate that the client is unable to upload state updates
// to a tower if the client deletes its database after already
// having created and started to use a session with a tower.
// This happens because the session key is generated
// deterministically and will only be unique for new sessions
// if the same DB is used. The server therefore rejects these
// updates with the StateUpdateCodeClientBehind error.
name: "demonstrate the StateUpdateCodeClientBehind error",
// Demonstrate that the client is unable to recover after
// deleting its database by skipping through key indices until
// it gets to one that does not result in the
// CreateSessionCodeAlreadyExists error code being returned from
// the server.
name: "continue after client database deletion",
cfg: harnessCfg{
localBalance: localBalance,
remoteBalance: remoteBalance,
@@ -2063,9 +2061,8 @@ var clientTests = []clientTest{
// Attempt to back up the remaining tasks.
h.backupStates(chanID, numUpdates/2, numUpdates, nil)
// Show that the server does not get the remaining
// updates.
h.waitServerUpdates(nil, waitTime)
// Show that the server does get the remaining updates.
h.waitServerUpdates(hints[numUpdates/2:], waitTime)
},
},
}