Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gap fill with wrong seq num & not inflating correctly if end seq is 0 #83

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

douglasmuraoka
Copy link
Contributor

Found three minor issues.

One in sequenceResetGap, where the gap fill seq num was set with newSeq (should be startGap, because the seq num represents the start of the gap).

Another issue is when the endSeqNo is 0. The existing code doesn't handle this scenario, and no gap fills are created. In this case, when the end seq no is 0, we should consider it as the latest seq num sent to the other peer (that's why I get it from this.sessionState.lastSentSeqNum(), but let me know if this inaccurate).

And the last issue is when we resend messages with zero messages retrieved from the store. In a situation where the only message sent to the other peer is login (seq num=1), for example, the store will be empty. But still, we have to generate a gap fill from 1 to 1 to respond to the ResendRequest message. The current code doesn't return anything (empty array of messages to be sent to peer).

@douglasmuraoka douglasmuraoka changed the title fix: gap fill with wrong seq num & not inflating correctly if end seq is 0 Gap fill with wrong seq num & not inflating correctly if end seq is 0 Dec 10, 2023
@@ -72,23 +72,88 @@ test('end to end logon', async () => {
test('session send resendRequest when logged on', async () => {
const runner: SkeletonRunner = new SkeletonRunner(experiment, 2)
const factory = experiment.client.config.factory
const resend = factory?.resendRequest(1, 2)
const resend = factory?.resendRequest(1, 1)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this scenario, we've only sent the login message so far, so there's no reason for it to have end seq num = 2 (unless it is 2 on purpose, for some reason)...

expect(serverResets).toEqual(0)
})

test('session send resendRequest with endSeqNo = 0 when logged on', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test must have the same behavior as above, as end seq num = 0 should be resolved to 1 (which is the last seq num sent).

@douglasmuraoka
Copy link
Contributor Author

@TimelordUK let me know if it would be better to split these into smaller PRs so we discuss them individually.

@TimelordUK
Copy link
Owner

This is great work and really very much appreciated. Replay has been tricky to get right and you have really moved things forward. I may add some more tests later. I am checking now and will merge very soon. Thanks a lot for another good PR

@TimelordUK TimelordUK merged commit af6883b into TimelordUK:master Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants