Skip to content

Commit

Permalink
GEODE-10171: Update versioning for no-op operations (apache#7527)
Browse files Browse the repository at this point in the history
Modified lrem to not update versioning if nothing was removed from the
list.
  • Loading branch information
Kris-10-0 authored Mar 31, 2022
1 parent 59af2c8 commit fb17fe4
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,18 @@ public List<byte[]> lrange(int start, int stop) {
*/
public int lrem(int count, byte[] element, Region<RedisKey, RedisData> region, RedisKey key) {
List<Integer> removedIndexes;
byte version;
byte newVersion;
synchronized (this) {
removedIndexes = elementList.remove(element, count);
version = incrementAndGetVersion();
}
if (removedIndexes.isEmpty()) {
return 0;
}

if (!removedIndexes.isEmpty()) {
storeChanges(region, key,
new RemoveElementsByIndex(version, removedIndexes));
newVersion = incrementAndGetVersion();
}

storeChanges(region, key,
new RemoveElementsByIndex(newVersion, removedIndexes));
return removedIndexes.size();
}

Expand Down

0 comments on commit fb17fe4

Please sign in to comment.