-
Notifications
You must be signed in to change notification settings - Fork 51
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
V1.1.x issue 98 #100
Merged
Merged
V1.1.x issue 98 #100
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
60d38d2
make bloop compilable
spangaer 5705670
disable scalariform autoformat
spangaer 2567a6b
akka/akka-persistence-dynamodb#98 test that fails on issue
spangaer 0fd6383
akka/akka-persistence-dynamodb#98 minimalistic fix
spangaer 9bb07fa
akka/akka-persistence-dynamodb#98 tail chasing fix
spangaer 48a410f
Merge branch 'v1.1.x_issue-98_tail-chasing-fix' into v1.1.x_issue-98
spangaer a9e6d07
akka/akka-persistence-dynamodb#98 additional test that verified pages…
spangaer a1abbc5
Merge branch 'v1.1.x_issue-98_tail-chasing-fix' into v1.1.x_issue-98
spangaer a1bf40b
adapt to PR remarks iteration 1
spangaer 748208b
retrigger checks
spangaer 9cd8826
Merge branch 'master' into v1.1.x_issue-98
coreyoconnor 2d30d81
Delete metals.sbt
coreyoconnor c659dfb
Fixup merge
coreyoconnor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,7 @@ project/project/target | |
.settings/ | ||
.cache | ||
.aws | ||
|
||
|
||
.bloop | ||
.metals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
src/test/scala/akka/persistence/dynamodb/journal/PersistAllConsistencySpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/** | ||
* Copyright (C) 2021 Typesafe Inc. <http://www.typesafe.com> | ||
*/ | ||
package akka.persistence.dynamodb.journal | ||
|
||
import org.scalactic.ConversionCheckedTripleEquals | ||
import org.scalatest._ | ||
import org.scalatest.concurrent.ScalaFutures | ||
import akka.actor.ActorSystem | ||
import akka.persistence._ | ||
import akka.persistence.JournalProtocol._ | ||
import akka.testkit._ | ||
import akka.persistence.journal.AsyncWriteTarget.ReplaySuccess | ||
import com.amazonaws.services.dynamodbv2.model._ | ||
import java.util.{ HashMap => JHMap } | ||
import akka.persistence.dynamodb._ | ||
|
||
class PersistAllConsistencySpec | ||
extends TestKit(ActorSystem("PersistAllConsistencySpec")) | ||
with ImplicitSender | ||
with WordSpecLike | ||
with BeforeAndAfterAll | ||
with Matchers | ||
with ScalaFutures | ||
with ConversionCheckedTripleEquals | ||
with DynamoDBUtils | ||
with IntegSpec { | ||
|
||
override def beforeAll(): Unit = { | ||
super.beforeAll() | ||
ensureJournalTableExists() | ||
} | ||
|
||
override def afterAll(): Unit = { | ||
client.shutdown() | ||
system.terminate().futureValue | ||
super.afterAll() | ||
} | ||
|
||
override val persistenceId = "PersistAllConsistencySpec" | ||
lazy val journal = Persistence(system).journalFor("") | ||
|
||
import settings._ | ||
|
||
"DynamoDB Journal (persistAll)" must { | ||
|
||
"recover correctly if the first write is a batch" in { | ||
journal ! Purge(persistenceId, testActor) | ||
expectMsg(Purged(persistenceId)) | ||
|
||
val start = nextSeqNr | ||
val end = 10 | ||
println(s"start: ${start}; end: ${end}") | ||
val padding = AtomicWrite((start to end).map(i => persistentRepr(f"h-$i"))) :: Nil | ||
|
||
journal ! WriteMessages(padding, testActor, 1) | ||
expectMsg(WriteMessagesSuccessful) | ||
(start to end).foreach(i => expectMsg(WriteMessageSuccess(generatedMessages(i), 1))) | ||
|
||
journal ! ReplayMessages(start, Long.MaxValue, Long.MaxValue, persistenceId, testActor) | ||
(start to end).foreach(i => expectMsg(ReplayedMessage(generatedMessages(i)))) | ||
expectMsg(RecoverySuccess(end)) | ||
} | ||
|
||
for (t <- Seq(("last", 3), ("middle", 2), ("first", 1))) | ||
s"correctly cross page boundaries with AtomicWrite position ${t._1}" in { | ||
val start1 = nextSeqNr | ||
val end1 = ((start1 / PartitionSize) + 1) * PartitionSize - t._2 | ||
println(s"start: ${start1}; end: ${end1}") | ||
val padding = AtomicWrite((start1 to end1).map(i => persistentRepr(f"h-$i"))) :: Nil | ||
|
||
journal ! WriteMessages(padding, testActor, 1) | ||
expectMsg(WriteMessagesSuccessful) | ||
(start1 to end1).foreach(i => expectMsg(WriteMessageSuccess(generatedMessages(i), 1))) | ||
|
||
val start2 = nextSeqNr | ||
val end2 = start2 + 2 | ||
println(s"start: ${start2}; end: ${end2}") | ||
val subject = AtomicWrite((start2 to end2).map(i => persistentRepr(f"h-$i"))) :: Nil | ||
|
||
journal ! WriteMessages(subject, testActor, 1) | ||
expectMsg(WriteMessagesSuccessful) | ||
(start2 to end2).foreach(i => expectMsg(WriteMessageSuccess(generatedMessages(i), 1))) | ||
|
||
journal ! ReplayMessages(start1, Long.MaxValue, Long.MaxValue, persistenceId, testActor) | ||
(start1 to end2).foreach(i => expectMsg(ReplayedMessage(generatedMessages(i)))) | ||
expectMsg(RecoverySuccess(end2)) | ||
} | ||
|
||
s"recover correctly when the last partition event ends on ${PartitionSize - 1}" in { | ||
val start = nextSeqNr | ||
val end = ((start / PartitionSize) + 1) * PartitionSize - 1 | ||
println(s"start: ${start}; end: ${end}") | ||
val padding = AtomicWrite((start to end).map(i => persistentRepr(f"h-$i"))) :: Nil | ||
|
||
journal ! WriteMessages(padding, testActor, 1) | ||
expectMsg(WriteMessagesSuccessful) | ||
(start to end).foreach(i => expectMsg(WriteMessageSuccess(generatedMessages(i), 1))) | ||
|
||
journal ! ReplayMessages(start, Long.MaxValue, Long.MaxValue, persistenceId, testActor) | ||
(start to end).foreach(i => expectMsg(ReplayedMessage(generatedMessages(i)))) | ||
expectMsg(RecoverySuccess(end)) | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove change from PR? Or is this no longer required with the updated sbt-pgp plugin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I don't know. I just made an effort to make it build. I haven't actually done PGP signed publishes.
This part specifically I stumbled on in this commit:
akka/akka-persistence-dynamodb@0192e14
So it looks like it can do without.