-
Notifications
You must be signed in to change notification settings - Fork 99
Wip 301 pure op crdts #405
Wip 301 pure op crdts #405
Conversation
I've created the class |
@gabrielgiussi thanks a lot for the PR. Please bear with me that a review might take some time ... Since they actually replace the existing CRDT implementations we will have to make sure that they all pass eventuate-chaos tests. @volkerstampa can you setup the chaos tests for the new implementation? Alternatively, if you want to have them merged earlier so that users can start to experiment with, I propose the old implementation and the new pure op-based to co-exist for a while. WDYT? |
I could give it a try if you want. I mean add a chaos-test for the AWSet for example.
I agree, I will reset the old classes as they were and move the new implementations to a package |
Currently the chaos tests are mainly testing eventuate itself and not so much the CRDTs. The only existing test-client uses the CRDT-counter. If we want to chaos-test each CRDT implementation corresponding test-clients would have to be written first. I can assist when it comes to implementing those but atm I cannot take care of the implementation by myself. @gabrielgiussi It would be great if you could give it a try. |
@gabrielgiussi thanks for giving it a try! Regarding a separate implementation, what about adding a new module e.g. |
@krasserm I'll add a new module, but I did some minor changes to |
I've run the counter scenario with eventuate 0.10 and I've got
It's ok that the expected counter value differs? |
@gabrielgiussi Duplication is ok for the moment. It allows us to do further experiments without interfering with the existing implementation. |
@gabrielgiussi regarding the CRDT chaos runs: I remember that we had a bug in calculating the expected value but I thought it was fixed. That's a bug in eventuate-chaos itself. @volkerstampa have you encountered these issues as well? |
As long as the exit code of the test program is 0, the test is green, i.e. all nodes converged to the same value. The reported expected counter value is actually only correct if all commands sent during the test can be processed successfully, however this is not guaranteed under chaos, so the expectation is actually wrong and thus the report is sort of misleading. There is actually an open issue for this: RBMHTechnology/eventuate-chaos#12 |
@volkerstampa thanks for clarifying |
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.
I am sorry, but I think I cannot do a solid review atm. As I pointed out before I am not really into the CRDT stuff and it does not look like that I have the time to look into this in the level of detail required for a review.
I pointed out a few formal things regarding changes in the other sources outside of the crdt module.
.travis.yml
Outdated
- .travis/test-stream.sh $TRAVIS_SCALA_VERSION | ||
- .travis/test-spark.sh $TRAVIS_SCALA_VERSION | ||
- .travis/test-vertx.sh $TRAVIS_SCALA_VERSION | ||
- find $HOME/.sbt -name "*.lock" | xargs rm | ||
- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm | ||
after_success: | ||
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ]; then .travis/publish-all.sh $TRAVIS_SCALA_VERSION; fi | ||
- sbt ++$TRAVIS_SCALA_VERSION publish |
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.
Not sure why this is changed? We only want to publish from master, right? And spark is not yet on scala 2.12, is it? So we still need the publish-script?!?
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.
I've modified the travis.yml to publish my own artifacts but I shouldn't have included in this PR.
build.sbt
Outdated
@@ -9,12 +9,12 @@ import ProjectDependencies._ | |||
|
|||
version in ThisBuild := "0.10-SNAPSHOT" | |||
|
|||
organization in ThisBuild := "com.rbmhtechnology" | |||
organization in ThisBuild := "oss.gabrielgiussi" |
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.
I guess this needs to be switched back!?!
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.
You guess wrong. Martin doesn't told you? 😏
Same as above, I've updated the organization to publish my own artifacts to jfrog so the eventuate-chaos build could download them.
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.
You guess wrong. Martin doesn't told you?
Looks like I miss something. Can you please enlighten me?
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.
Sorry Martin, I'm not very good with jokes.
These changes shouldn't have been included in the PR, I just changed the organization to publish my own artifacts to jfrog so they will be available to the eventuate-chaos travis build.
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.
I should have noticed it 😆 I'm currently living in a parallel universe 😉 Thanks for all you effort and good work!
@@ -79,6 +79,9 @@ case class VectorTime(value: Map[String, Long] = Map.empty) { | |||
def <->(that: VectorTime): Boolean = | |||
conc(that) | |||
|
|||
def ||(that: VectorTime): Boolean = |
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.
Do we really need another symbolic operator for this? I do not even find a reference to it?!?
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.
I've included ||
initially because is how is represented in literature but I didn't replace the reference to <->
. If you agree with me that ||
is better I could update the only reference that exists to <->
, if not I'll delete it.
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.
I propose to stick with the old symbol as ||
looks too much like a boolean or
import com.rbmhtechnology.eventuate.ReplicationProtocol.ReplicationEndpointInfo | ||
import com.typesafe.config.Config | ||
|
||
case class EventuateNodeTest(endpointId: String, connections: Set[String], logs: Set[String], val role: RoleName, customConfig: Option[Config] = None) { |
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.
val
is redundant.
|
||
def endpointNodeWithLogs(name: String, logs: Set[String], connections: Set[String], customConfig: Option[Config] = None) = EventuateNodeTest(name, connections, logs, role(name), customConfig) | ||
|
||
def setNodesConfig(configs: Set[(RoleName, Config)]) = configs.map { case (roleName, config) => nodeConfig(roleName)(config) } |
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.
Should rather be a foreach
instead of a map
. And I would propose to add the type annotation : Unit
to make that explicit.
if (events.map(_.payload).contains(ValueUpdated(AddOp(randomNr())))) throw IntegrationTestException else super.write(events, partition, clock) | ||
} | ||
|
||
// FIXME allow use write-batch-size > 1 |
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.
Is that still open? Do you still plan to fix this?
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.
I've tried without success with
class TestEventLog(id: String) extends LeveldbEventLog(id, "log-test") {
override def write(events: Seq[DurableEvent], partition: Long, clock: EventLogClock): Unit = {
val containsStop = events.map(_.payload).exists {
case ValueUpdated(AddOp(s)) => s.toString.startsWith("stop")
case _ => false
}
if (!containsStop && events.map(_.payload).contains(ValueUpdated(AddOp(randomNr())))) throw IntegrationTestException else super.write(events, partition, clock)
}
}
I can't see what I'm missing, so I could let the FIXME
as a reminder or delete it.
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.
For me both is fine.
.travis.yml
Outdated
@@ -6,25 +6,19 @@ cache: | |||
directories: | |||
- $HOME/.ivy2/cache | |||
- $HOME/.sbt/boot/ | |||
before_install: |
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.
Why is that removed?
@gabrielgiussi The changes to eventuate-chaos in general look ok to me. Not sure if you want to open a PR for this as well?!? But probably only makes sense if this PR is merged ... Thanks again for all your effort. |
If this PR is eventually merged I will open a PR for eventuate-chaos. |
@gabrielgiussi Sorry for the really looong delay. are you still interested in merging this PR? It seems like neither Martin nor me will have time for a thorough review. As the new code is in a separate module the proposal is that the PR can be merged, once the small issues outside of the new module are fixed and you could consider yourself the owner of the new module. WDYT? |
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.
Seems there is a compile failure due to the deleted ||
: https://travis-ci.org/RBMHTechnology/eventuate/jobs/409323287#L2443
2fe88fd
to
51eea98
Compare
@volkerstampa thanks for taking time to review this PR. If you think it helps to the project I will be happy to merge it and be the owner of the module. |
@gabrielgiussi Thanks for the contribution and special thanks for your patience. Please squash all commits and I will merge the PR. |
51eea98
to
eb75ec1
Compare
Some notes:
Seq[Operation]
Seq[Operation]
) is aSeq[Operation]
(because the VectorTime is no longer needed). This save us a VectorTime per operation in memory, but it forces to create a Versioned with VectorTime.Zero per operation each time a new operation is delivered, so is open to discussion.(1) An improvement will be to be able to define the Set implementation.