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

Change event sourcing log level to debug #163

Merged
merged 5 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- Enhance leader's replication response handling [PR#160](https://github.com/lerna-stack/akka-entity-replication/pull/160)
- Change event sourcing log level to debug
[PR#163](https://github.com/lerna-stack/akka-entity-replication/pull/163)

### Fixed
- RaftActor might delete committed entries [#152](https://github.com/lerna-stack/akka-entity-replication/issues/152)
Expand Down
13 changes: 2 additions & 11 deletions src/main/scala/lerna/akka/entityreplication/raft/Leader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ private[raft] trait Leader { this: RaftActor =>
val newCommittedEntriesOrError = currentData.resolveCommittedEntriesForEventSourcing
newCommittedEntriesOrError match {
case Left(UnknownCurrentEventSourcingIndex) =>
if (log.isInfoEnabled) {
log.info(
if (log.isDebugEnabled) {
log.debug(
"[Leader] doesn't know eventSourcingIndex yet. " +
"sending AppendCommittedEntries(shardId=[{}], entries=empty) to CommitLogStore [{}] to fetch such an index.",
shardId,
Expand Down Expand Up @@ -374,15 +374,6 @@ private[raft] trait Leader { this: RaftActor =>
settings.eventSourcedMaxAppendCommittedEntriesSize,
settings.eventSourcedMaxAppendCommittedEntriesSize,
).toSeq
if (log.isInfoEnabled) {
log.info(
s"[Leader] sending [{}] batched AppendCommittedEntries(shardId=[$shardId]). [{}] entries with indices [{}..{}] will be sent in multiple batches.",
batches.size,
limitedNewCommittedEntries.size,
limitedNewCommittedEntries.head.index,
limitedNewCommittedEntries.last.index,
)
}
negokaz marked this conversation as resolved.
Show resolved Hide resolved
batches.foreach { batchedEntries =>
assert(
batchedEntries.sizeIs > 0,
Expand Down
12 changes: 6 additions & 6 deletions src/main/scala/lerna/akka/entityreplication/raft/RaftActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ private[raft] class RaftActor(
}

def handleSnapshotTick(): Unit = {
if (log.isInfoEnabled) {
log.info(
if (log.isDebugEnabled) {
log.debug(
"[{}] sending AppendCommittedEntries(shardId=[{}], entries=empty) to CommitLogStore [{}] to fetch the latest eventSourcingIndex at SnapshotTick. " +
"The current eventSourcingIndex is [{}].",
currentState,
Expand Down Expand Up @@ -778,16 +778,16 @@ private[raft] class RaftActor(
case None =>
val newEventSourcingIndex = appendCommittedEntriesResponse.currentIndex
applyDomainEvent(DetectedNewEventSourcingIndex(newEventSourcingIndex)) { _ =>
if (log.isInfoEnabled) {
log.info("[{}] detected new event sourcing index [{}].", currentState, newEventSourcingIndex)
if (log.isDebugEnabled) {
log.debug("[{}] detected new event sourcing index [{}].", currentState, newEventSourcingIndex)
}
}
case Some(currentEventSourcingIndex) =>
if (currentEventSourcingIndex < appendCommittedEntriesResponse.currentIndex) {
val newEventSourcingIndex = appendCommittedEntriesResponse.currentIndex
applyDomainEvent(DetectedNewEventSourcingIndex(newEventSourcingIndex)) { _ =>
if (log.isInfoEnabled) {
log.info(
if (log.isDebugEnabled) {
log.debug(
"[{}] detected new event sourcing index [{}]. The old index was [{}].",
currentState,
newEventSourcingIndex,
Expand Down