BalaKaza commented on code in PR #7513:
URL: https://github.com/apache/geode/pull/7513#discussion_r842118341


##########
geode-for-redis/src/main/java/org/apache/geode/redis/internal/data/RedisSet.java:
##########
@@ -86,12 +93,19 @@ public static int smove(RedisKey sourceKey, RedisKey 
destKey, byte[] member,
       RegionProvider regionProvider) {
     RedisSet source = regionProvider.getTypedRedisData(REDIS_SET, sourceKey, 
false);
     RedisSet destination = regionProvider.getTypedRedisData(REDIS_SET, 
destKey, false);
-    List<byte[]> memberList = new ArrayList<>();
-    memberList.add(member);
-    if (source.srem(memberList, regionProvider.getDataRegion(), sourceKey) == 
0) {
+    if (!source.sismember(member)) {
       return 0;
     }
-    destination.sadd(memberList, regionProvider.getDataRegion(), destKey);
+    if (sourceKey.equals(destKey)) {
+      return 1;
+    }
+
+    List<byte[]> memberList = new ArrayList<>();
+    memberList.add(member);
+    RedisSet newSource = new RedisSet(source);
+    newSource.srem(memberList, regionProvider.getDataRegion(), sourceKey);
+    RedisSet newDestination = new RedisSet(destination);
+    newDestination.sadd(memberList, regionProvider.getDataRegion(), destKey);

Review Comment:
   Also, I think this test has two checks that it's doing but the wrong type 
error on destination takes precedence and it might not be required as we have 
other tests to do that.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to