Skip to content

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

Open
qiongtubao wants to merge 1 commit into
feature/ror-update-8.2.0from
feature/gtid_rewrite_commands_8x
Open

[feature] add GTID_NON_DETERMINISM flag to reject non-deterministic c…#439
qiongtubao wants to merge 1 commit 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).

…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).
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