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

fix: don't set idle when backtracking, check for forward behind latest backtracking #104

Merged
merged 4 commits into from
Nov 28, 2024

Conversation

leviramsey
Copy link
Contributor

No description provided.

@@ -300,7 +300,7 @@ import org.slf4j.Logger
}

def nextQuery(state: QueryState): (QueryState, Option[Source[Envelope, NotUsed]]) = {
val newIdleCount = if (state.itemCount == 0) state.idleCount + 1 else 0
val newIdleCount = if (state.itemCount == 0 && !state.backtracking) state.idleCount + 1 else 0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the backtracking query has a definite endpoint in the past, it's not unexpected that a query would return zero items nor would returning zero items suggest anything about whether we're caught up.

case Some(latestBacktracking) if latestBacktracking.isAfter(t.timestamp) && log.isInfoEnabled =>
val errStr = s"event from query for persistenceId ${env.persistenceId} seqNr ${env.sequenceNr} " +
s"timestamp ${t.timestamp} was before last event from backtracking or heartbeat $latestBacktracking."
log.info(errStr)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could maybe make this debug or throttle in some way... an info log per event might be overkill, but a debug is probably too likely to get lost.

This isn't necessarily a problem, since it will arise if starting from idle in a slice

@patriknw patriknw force-pushed the idle-backtracking-fix branch from 1d3fb3d to 6ae1c13 Compare November 28, 2024 14:34
val newIdleCountBeforeHeartbeat =
if (state.backtracking) state.idleCountBeforeHeartbeat
else if (state.itemCount == 0) state.idleCountBeforeHeartbeat + 1
else 0
Copy link
Member

Choose a reason for hiding this comment

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

I think I want to play safe here. The idleCount is used for something else so I don't want to risk breaking that.

Copy link
Member

@patriknw patriknw left a comment

Choose a reason for hiding this comment

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

LGTM

@patriknw patriknw merged commit 6f61cbe into akka:main Nov 28, 2024
5 checks passed
@leviramsey leviramsey deleted the idle-backtracking-fix branch November 28, 2024 15:34
@leviramsey
Copy link
Contributor Author

Refs #95

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