Skip to content

UNOMI-943: Fix 3.1.0 migration resume and document script authoring#810

Merged
sergehuber merged 3 commits into
masterfrom
UNOMI-943-migration
Jul 7, 2026
Merged

UNOMI-943: Fix 3.1.0 migration resume and document script authoring#810
sergehuber merged 3 commits into
masterfrom
UNOMI-943-migration

Conversation

@sergehuber

Copy link
Copy Markdown
Contributor

Plain-language summary

Operators who upgrade from Unomi 3.0 to 3.1 run Groovy migration scripts while the server is stopped. If a migration run fails partway through and is resumed, rollover index aliases for events and sessions could stay misconfigured. That breaks new writes after restart.

This change fixes that resume bug and adds a short manual for contributors so future migration scripts avoid the same mistake.

What changed

  • Hoist 3.1.0-configure-rollover-aliases to a top-level migration step in migrate-3.1.0-01-tenantDocumentIds.groovy so resume after failure still configures event/session write aliases (UNOMI-943).
  • Fail fast in MigrationUtils.getFileWithoutComments when a bundled Painless/JSON resource is missing, with the same message as resourceAsString.
  • Add unit test for the missing-resource case.
  • Add manual section Writing migration scripts (writing-migration-scripts.adoc): step tracking, nested-step pitfall, idempotent transforms, testing, and a pre-merge checklist. Link from migrations hub, unomi:migrate help, and 3.0→3.1 guide.

Test plan

  • mvn -pl tools/shell-commands -am test -Dtest=MigrationUtilsTest
  • CI: unit tests + ES/OS integration matrix (includes Migrate16xToCurrentVersionIT migration chain on ES)

References

UNOMI-943

Hoist rollover alias configuration to a top-level migration step so resume
after failure can still configure write aliases. Fail fast in
getFileWithoutComments when a bundled resource is missing.
Add a contributor guide covering step tracking, nested performMigrationStep
anti-patterns, idempotent transforms, bundled resources, and testing.
Regression test seeds history with a completed outer step and proves nested
performMigrationStep never runs on resume. Extract requireResource helper;
clean up history.json in MigrationIT finally blocks.
@sergehuber sergehuber merged commit a843e7a into master Jul 7, 2026
9 of 10 checks passed
@sergehuber sergehuber deleted the UNOMI-943-migration branch July 7, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant