fix(ha/auth): Migrate users during rolling upgrade between Memgraph instances of different versions by colinbarry · Pull Request #4301 · memgraph/memgraph · GitHub
Skip to content

fix(ha/auth): Migrate users during rolling upgrade between Memgraph instances of different versions#4301

Open
colinbarry wants to merge 39 commits into
masterfrom
fix/migrate-users-in-rolling-upgrade
Open

fix(ha/auth): Migrate users during rolling upgrade between Memgraph instances of different versions#4301
colinbarry wants to merge 39 commits into
masterfrom
fix/migrate-users-in-rolling-upgrade

Conversation

@colinbarry

@colinbarry colinbarry commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

User/role data sent over the wire was not being migrated.

During a rolling upgrade from 3.9 to 3.10.1, LBAC grants are lost when a 3.9 MAIN replicates auth data to an upgraded 3.10.1 REPLICA. The old MAIN serializes user/role structs in V3 format, but the REPLICA's Deserialize expects V4; the result is that FGA fields are silently dropped. When failover occurs and REPLICA becomes MAIN, it does so with sheared user configurations.

  • RPC versioning for auth replication: Versioned UpdateAuthDataReq/Res using the existing LoadWithUpgrade/SaveWithDowngrade framework. The existing wire format is now V1 (kVersion=1); upgraded nodes send V2. When a new REPLICA receives a V1 request from an old MAIN, it reads the raw JSON, migrates it via MigrateAuthJson, then deserializes. V2 Load also applies MigrateAuthJson on reception, ensuring forward compatibility with future entity versions without needing RPC version bumps in parallel to user version bumps.
  • Per-entity migration on deserialize: Extracted existing V2 -> V3 and V3 -> V4 migration logic into MigrateAuthJson(). Each user or role now carries a "version" field.
  • Separated auth store-level from entity-level versioning: Auth store versions (V1 -> V2 -> V5) are now reserved for structural KV store changes such as key prefix migrations. Entity schema changes (such as fine-grained access) are handled per-entity on deserialize.
  • ISSU test coverage: Added verify_fga_post_upgrade.sh to confirm FGA grants survive mid-upgrade (on REPLICA while old MAIN is still running) and post-upgrade. ISSU test need further enhancement, but that will come in successive PRs.

@colinbarry colinbarry self-assigned this Jun 25, 2026
@colinbarry colinbarry added the bug bug label Jun 25, 2026
@colinbarry

colinbarry commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@colinbarry colinbarry force-pushed the fix/migrate-users-in-rolling-upgrade branch from 5d20789 to 316734c Compare June 25, 2026 09:59
@colinbarry colinbarry changed the title test: Update ISSU test to validate LBAC survives migration fix: Migrate users during rolling upgrade between Memgraph instances of different versions Jun 25, 2026
@colinbarry colinbarry added this to the mg-v3.11.1 or 3.12 milestone Jun 25, 2026
@colinbarry colinbarry added Docs - changelog only Docs - changelog only CI -build=community -test=core Run community build and core tests on push CI -build=jepsen -test=core Run jepsen build and core tests on push CI -build=debug -test=core Run debug build and core tests on push CI -build=debug -test=integration Run debug build and integration tests on push CI -build=release -test=core Run release build and core tests on push CI -build=release -test=e2e Run release build and e2e tests on push CI -build=release -test=query_modules Run release build and query modules tests on push CI -build=coverage -test=clang_tidy labels Jun 25, 2026
@colinbarry colinbarry force-pushed the fix/migrate-users-in-rolling-upgrade branch 2 times, most recently from 556927c to df60fa6 Compare June 26, 2026 09:26
@colinbarry colinbarry changed the title fix: Migrate users during rolling upgrade between Memgraph instances of different versions fix(ha/auth): Migrate users during rolling upgrade between Memgraph instances of different versions Jun 26, 2026
@colinbarry colinbarry force-pushed the fix/migrate-users-in-rolling-upgrade branch from 3ee6c93 to e7a6dc1 Compare June 26, 2026 13:24
@colinbarry colinbarry force-pushed the fix/migrate-users-in-rolling-upgrade branch 2 times, most recently from 94838ef to 37708d3 Compare July 1, 2026 08:47
@colinbarry colinbarry force-pushed the fix/migrate-users-in-rolling-upgrade branch from 37708d3 to 1e2a3ec Compare July 1, 2026 08:49
Comment thread tests/issu/test_upgrade.sh Outdated
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug bug CI -build=community -test=core Run community build and core tests on push CI -build=coverage -test=clang_tidy CI -build=debug -test=core Run debug build and core tests on push CI -build=debug -test=integration Run debug build and integration tests on push CI -build=jepsen -test=core Run jepsen build and core tests on push CI -build=release -test=core Run release build and core tests on push CI -build=release -test=e2e Run release build and e2e tests on push CI -build=release -test=query_modules Run release build and query modules tests on push Docs - changelog only Docs - changelog only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants