Sharding with >= 10 partitions lead to non correct offset tracking (JDBC only)
See original GitHub issueLagom Version (1.2.x / 1.3.x / etc)
1.4.x
API (Scala / Java / Neither / Both)
Scala (not sure if reproduce in java)
Library Dependencies
val mysqlDriver = "mysql" % "mysql-connector-java" % "8.0.13"
reproduces also with postgres and h2
Expected Behavior
- create an entity with an id that gets mapped to a shard >9
- publish event to topic
- read_side_offsets should track offset of the published message with correct tag:
topicProducer-greetings org.example.hello.impl.HelloEvent18 1
Actual Behavior
http POST 127.0.0.1:9000/api/hello/test message=hello
- event is published twice to topic
- state of read_side_offsets as following:
topicProducer-greetings org.example.hello.impl.HelloEvent1 1
topicProducer-greetings org.example.hello.impl.HelloEvent18 1
Reproducible Test Case
project at: https://github.com/mikearnaldi/lagom-issue
Instructions
cd hello-impl; docker-compose up -d; cd ..
sbt runAll
http POST 127.0.0.1:9000/api/hello/test message=hello
the event gets a tag of org.example.hello.impl.HelloEvent18
but gets forwarded to read side twice with org.example.hello.impl.HelloEvent1
and org.example.hello.impl.HelloEvent18
Note
- I am using httpie as a client to issue http requests
- I was not able to reproduce with number of shards < 10
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Sharded Database Schema Design - Oracle Help Center
Sharded table partitions are distributed across shards at the tablespace level, based on a sharding key. Examples of keys include customer ID, account...
Read more >Understanding Shard Key Selection
Shard keys are vital in a distributed database like SingleStore. They are responsible for distribution of data across partitions. Shard key ...
Read more >Understanding Database Sharding | DigitalOcean
Sharding involves breaking up one's data into two or more smaller chunks, called logical shards. The logical shards are then distributed across ...
Read more >Apache ShardingSphere document
The project is committed to providing a multi‐source heterogeneous, enhanced database platform and further building an ecosystem around the upper layer of ...
Read more >Choosing the number of partitions for a topic | CDP Public Cloud
For example, if you want to be able to read 1 GB/sec, but your consumer is only able process 50 MB/sec, then you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We think we can build a workaround for this by filtering out the undesired events in memory.
If you query for
FooEvent1
and fetchesFooEvent10
because of this bug, we can filter out allFooEvent10
and only passFooEvent1
to read-side processors or topic producers.It has the drawback that we will be fetching more events than needed, but at least we won’t impact the offset table.
There is a workaround in akka-persistence-jdbc v3.5.3. Next Lagom version will contain it (see #2693)