Skip to content

[feature] add GTID_NON_DETERMINISM flag to reject non-deterministic c… - #439

Merged
qiongtubao merged 3 commits into
feature/ror-update-8.2.0from
feature/gtid_rewrite_commands_8x
Aug 13, 2026
Merged

[feature] add GTID_NON_DETERMINISM flag to reject non-deterministic c…#439
qiongtubao merged 3 commits into
feature/ror-update-8.2.0from
feature/gtid_rewrite_commands_8x

Conversation

@qiongtubao

Copy link
Copy Markdown

…ommands in GTID

Add CMD_GTID_NON_DETERMINISM (1ULL<<30) flag to mark commands whose results are non-deterministic and thus unsafe inside GTID transactions:

  • Blocking operations (BLPOP, BRPOP, BLMOVE, BLMPOP, BZMPOP, BZPOPMAX, BZPOPMIN, BRPOPLPUSH)
  • Random/time-based commands (SPOP, SRANDMEMBER, RANDOMKEY — via rewrite-command flag handling)
  • Expiry with time generation (EXPIRE, EXPIREAT, PEXPIRE, SETEX, PSETEX, SETEX, GETEX, GETSET, SETRANGE, APPEND, INCRBYFLOAT)
  • Hash field operations (HINCRBY, HINCRBYFLOAT, HEXPIRE, HPEXPIRE, HGETDEL, HGETEX, HSETEX)

Flag parsing and reply support:

  • src/server.c: "rewrite_command" in addReplyFlagsForCommand
  • src/module.c: "rewrite-command" in commandFlagsFromString

Users sending these commands directly in GTID context are rejected, while MASTER replication (CLIENT_MASTER) bypasses the check, ensuring correct propagation.

deps/xredis-gtid updated to 2cbc573 (reject rewrite commands inside GTID and add tests).

@qiongtubao
qiongtubao force-pushed the feature/gtid_rewrite_commands_8x branch from 03f4ea1 to 5527f37 Compare August 9, 2026 18:56
gd.zhou added 3 commits August 13, 2026 16:23
…ommands in GTID

Add CMD_GTID_NON_DETERMINISM (1ULL<<30) flag to mark commands whose
results are non-deterministic and thus unsafe inside GTID transactions:
- Blocking operations (BLPOP, BRPOP, BLMOVE, BLMPOP, BZMPOP, BZPOPMAX,
  BZPOPMIN, BRPOPLPUSH)
- Random/time-based commands (SPOP, SRANDMEMBER, RANDOMKEY — via
  rewrite-command flag handling)
- Expiry with time generation (EXPIRE, EXPIREAT, PEXPIRE, SETEX, PSETEX,
  SETEX, GETEX, GETSET, SETRANGE, APPEND, INCRBYFLOAT)
- Hash field operations (HINCRBY, HINCRBYFLOAT, HEXPIRE, HPEXPIRE,
  HGETDEL, HGETEX, HSETEX)

Flag parsing and reply support:
- src/server.c: "rewrite_command" in addReplyFlagsForCommand
- src/module.c: "rewrite-command" in commandFlagsFromString

Users sending these commands directly in GTID context are rejected,
while MASTER replication (CLIENT_MASTER) bypasses the check, ensuring
correct propagation.

deps/xredis-gtid updated to 2cbc573 (reject rewrite commands inside GTID
and add tests).
@qiongtubao
qiongtubao force-pushed the feature/gtid_rewrite_commands_8x branch from 5527f37 to f274abe Compare August 13, 2026 08:35
@qiongtubao
qiongtubao merged commit 9fbf91d into feature/ror-update-8.2.0 Aug 13, 2026
2 of 7 checks passed
@qiongtubao
qiongtubao deleted the feature/gtid_rewrite_commands_8x branch August 13, 2026 08:38
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