pjfanning opened a new pull request, #608: URL: https://github.com/apache/pekko-persistence-jdbc/pull/608
### Motivation `H2SequenceNextValUpdater` looks up the column default that provides the next global offset with `TABLE_SCHEMA = 'PUBLIC'` hard coded, so it finds nothing when `jdbc-durable-state-store.tables.durable_state.schemaName` points at another schema. `upsertObject` then fails with `NoSuchElementException: empty.head`. `H2DurableStateStorePluginSchemaSpec` covers exactly that configuration and fails when it is run on its own: ``` sbt "core/testOnly org.apache.pekko.persistence.jdbc.state.scaladsl.H2DurableStateStorePluginSchemaSpec" [info] - must persist states successfully *** FAILED *** [info] The future returned an exception of type: java.util.NoSuchElementException, with message: empty.head. ``` It only passes as part of the full core test run because an earlier suite leaves a `durable_state` table behind in the `PUBLIC` schema of the shared H2 in-memory database, and that table happens to answer the query. ### Modification Use the configured schema name, falling back to `PUBLIC`, and compare it case insensitively, because H2 upper cases unquoted identifiers unless the database was created with `DATABASE_TO_UPPER=false`. ### Result Durable state works on H2 with a schema other than `PUBLIC`. ### Tests - `sbt "core/testOnly org.apache.pekko.persistence.jdbc.state.scaladsl.H2DurableStateStorePluginSchemaSpec"` - passed; the same command fails on `main`. That existing spec is the directional test for this fix. - `sbt "core/testOnly *DurableState*"` - passed - `scalafmt --mode diff-ref=upstream/main` - no changes ### References None - found while making the durable state store close its connection pool (#606) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
