ptrdom commented on code in PR #515: URL: https://github.com/apache/pekko-persistence-r2dbc/pull/515#discussion_r4423962130
########## ddl-scripts/migration/snapshot_start_from_snapshot_postgres.sql: ########## @@ -0,0 +1,13 @@ +-- Adds the snapshot columns and index that are needed by the queries that use snapshots as starting points +-- (eventsBySlicesStartingFromSnapshots, eventsByPersistenceIdStartingFromSnapshot and their current variants). +-- Use this for both the BYTEA and the JSONB schema. See the migration guide for a rolling update procedure. + +ALTER TABLE snapshot ADD COLUMN IF NOT EXISTS db_timestamp timestamp with time zone; +ALTER TABLE snapshot ADD COLUMN IF NOT EXISTS tags TEXT ARRAY; + +-- populate the new columns from the corresponding events +UPDATE snapshot s SET db_timestamp = e.db_timestamp, tags = e.tags + FROM event_journal e + WHERE s.persistence_id = e.persistence_id AND s.seq_nr = e.seq_nr; Review Comment: Sorry, the new spec broke CI on Postgres and Yugabyte, though not directly: `CurrentPersistenceIdsQuerySpec` "retrieve all ids" fails. The spec expects the ids in creation order, but the query returns them sorted by persistence id, and the entity types come from the `TestData` counter that all specs share. The one extra `nextEntityType()` call moved its entity types to `TestEntity-96` to `TestEntity-100`, and `TestEntity-100` sorts first. It isn't caused by this PR as such: on `main` the spec already fails when run alone (its entity types are then `TestEntity-6` to `TestEntity-10`), and the durable state `CurrentPersistenceIdsQuerySpec` has the same problem. Fix for both specs, on the same branch: https://github.com/ptrdom/pekko-persistence-r2dbc/commit/0780dea540af7a44d7365a50013a08d5530099d8 (`git cherry-pick 0780dea`, it applies on top of 98b2cc6). The expected ids are sorted like the query results, and the "entity type after id" tests take the after id from the ids of that entity type. - Both specs failed before the fix in a setup that crosses a digit boundary, and pass after. - `sbt core/test` on PostgreSQL and Yugabyte: 452 succeeded, 0 failed. - Both specs and `StartFromSnapshotMigrationScriptSpec` pass on MySQL, MariaDB and H2. -- 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]
