-
Notifications
You must be signed in to change notification settings - Fork 22
Implement Durable State handling with MySQL (#174) #363
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
Conversation
| UNIQUE KEY state_global_offset_uk (global_offset) | ||
| ); | ||
| CREATE INDEX state_tag_idx on durable_state (tag); | ||
| CREATE INDEX state_global_offset_idx on durable_state (global_offset); |
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.
[nit] add a newline at end of file
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.
👍
| // case MySQL => | ||
| // e shouldBe an[java.sql.SQLIntegrityConstraintViolationException] | ||
| case MySQL => | ||
| e shouldBe an[java.sql.SQLIntegrityConstraintViolationException] |
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.
'a' not 'an' before 'j'
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.
Just for MySQL with an inconsistency with the line below (case Oracle)?
Or both for Oracle and SqlServer (not H2 and Postgres)
| case MySQL => slick.jdbc.MySQLProfile | ||
| case SqlServer => slick.jdbc.SQLServerProfile | ||
| case Oracle => slick.jdbc.OracleProfile | ||
| case _ => throw new UnsupportedOperationException(s"Unsupported <$s> for durableState.") |
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.
keep this - it causes no harm and is useful if we add a new db type and forget to support it here
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.
If a new DBMS is added, isn't it easier to have a non-exhaustive match reported by the IDE (and even some plugins) rather than a case _ that would hide it?
| } finally { | ||
| system.actorSelection("system/" + "pekko-persistence-jdbc-durable-state-sequence-actor").resolveOne().onComplete { | ||
| case Success(actorRef) => { | ||
| case Success(actorRef) => |
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'm not a big fan of reformatting existing code that is not related to the PR
| @@ -0,0 +1,21 @@ | |||
| /* | |||
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.
new files should use the standard Apache header unless there are methods copied in from existing files - where we should use that file's header
eg https://github.com/apache/pekko-persistence-jdbc/blob/main/project/PekkoCoreDependency.scala#L1
|
|
|
I was fixing the tests when I realized that my code doesn't cover the case of "update the durable state record whose revision is -1 compared to the one I'm passing to the update" (WHERE clause in UPDATE This is something you can't do with the |
|
@marcopaggioro thanks for having a look at solving the issue. |
#174
VARCHAR tagin the Postgres schema of thedurable_statetable ➡️VARCHARwithout a fixed length is not available in MySQL, becomeVARCHAR(255), as specified in the Oracle and SQLServer schema.state_payload BYTEAin the Postgres schema of thedurable_statetable ➡️BYTEAis not available in MySQL, but becomeLONGBLOB.global_offset BIGSERIALin the Postgres schema of thedurable_statetable ➡️BIGSERIAL(used asBIGINTwith auto-increment) is not available in MySQL, becomeBIGINT AUTO_INCREMENTand add aUNIQUE KEYtoglobal_offset.SequenceNextValUpdateronly for MySQL and useREPLACEquery