Skip to content

BITSET and BITFIELD SET only propagate command when the value changed.#9403

Merged
oranagra merged 3 commits intoredis:unstablefrom
enjoy-binbin:bitset_bitfield_dirty
Aug 22, 2021
Merged

BITSET and BITFIELD SET only propagate command when the value changed.#9403
oranagra merged 3 commits intoredis:unstablefrom
enjoy-binbin:bitset_bitfield_dirty

Conversation

@enjoy-binbin
Copy link
Contributor

@enjoy-binbin enjoy-binbin commented Aug 20, 2021

In old way, we always increase server.dirty in BITSET and BITFIELD SET.
Even the command doesn't really change anything. This commit make
sure BITSET and BITFIELD SET only increase dirty when the value changed.

Because of that, if the value not changed, some others implications:

  • Avoid adding useless AOF
  • Reduce replication traffic
  • Will not trigger keyspace notifications (setbit)
  • Will not invalidate WATCH
  • Will not sent the invalidation message to the tracking client

Fixes #1314

…nged.

In old way, we always increase server.dirty in BITSET and BITFIELD SET/INCRBY.
Even the command doesn't really change anything.
Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the top comment to specify the implications (excessive AOF and replica traffic, keyspace notification, WATCH and client tracking in validations.

@oranagra oranagra added release-notes indication that this issue needs to be mentioned in the release notes state:to-be-merged The PR should be merged soon, even if not yet ready, this is used so that it won't be forgotten labels Aug 21, 2021
@enjoy-binbin enjoy-binbin changed the title BITSET and BITFIELD SET/INCRBY only increase dirty when the value changed. BITSET and BITFIELD SET only increase dirty when the value changed. Aug 21, 2021
@enjoy-binbin enjoy-binbin force-pushed the bitset_bitfield_dirty branch from e7d6941 to f96dd72 Compare August 21, 2021 16:28
@oranagra oranagra changed the title BITSET and BITFIELD SET only increase dirty when the value changed. BITSET and BITFIELD SET only propagate command when the value changed. Aug 22, 2021
@oranagra oranagra merged commit 0835f59 into redis:unstable Aug 22, 2021
@enjoy-binbin enjoy-binbin deleted the bitset_bitfield_dirty branch August 22, 2021 07:27
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Sep 8, 2021
redis#9403)

In old way, we always increase server.dirty in BITSET and BITFIELD SET.
Even the command doesn't really change anything. This commit make 
sure BITSET and BITFIELD SET only increase dirty when the value changed.

Because of that, if the value not changed, some others implications:
- Avoid adding useless AOF
- Reduce replication traffic
- Will not trigger keyspace notifications (setbit)
- Will not invalidate WATCH
- Will not sent the invalidation message to the tracking client
guybe7 added a commit to guybe7/redis that referenced this pull request Mar 21, 2022
Bug introduced in redis#9403, caused inconsistency between master and
replica in case just the length (i.e. set a high-index bit to 0)
changed.
oranagra pushed a commit that referenced this pull request Mar 21, 2022
…10459)

Bug introduced in #9403, caused inconsistency between master and
replica in case just the length (i.e. set a high-index bit to 0)
changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes indication that this issue needs to be mentioned in the release notes state:to-be-merged The PR should be merged soon, even if not yet ready, this is used so that it won't be forgotten

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: don't mark server.dirty if bitset doesn't change the value

2 participants