DonalEvans commented on a change in pull request #6699:
URL: https://github.com/apache/geode/pull/6699#discussion_r670868944
##########
File path:
geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/RedisSortedSet.java
##########
@@ -34,45 +35,44 @@
import java.util.Objects;
import it.unimi.dsi.fastutil.bytes.ByteArrays;
-import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap;
import org.apache.geode.annotations.VisibleForTesting;
import org.apache.geode.cache.Region;
import org.apache.geode.internal.InternalDataSerializer;
import org.apache.geode.internal.serialization.DeserializationContext;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.internal.serialization.SerializationContext;
+import org.apache.geode.internal.size.Sizeable;
import org.apache.geode.redis.internal.RedisConstants;
import org.apache.geode.redis.internal.collections.OrderStatisticsSet;
-import org.apache.geode.redis.internal.collections.OrderStatisticsTree;
+import org.apache.geode.redis.internal.collections.SizableOrderStatisticsTree;
+import
org.apache.geode.redis.internal.collections.SizeableObject2ObjectOpenCustomHashMapWithCursor;
import org.apache.geode.redis.internal.delta.AddsDeltaInfo;
import org.apache.geode.redis.internal.delta.DeltaInfo;
import org.apache.geode.redis.internal.delta.RemsDeltaInfo;
import
org.apache.geode.redis.internal.executor.sortedset.SortedSetRangeOptions;
import org.apache.geode.redis.internal.executor.sortedset.ZAddOptions;
public class RedisSortedSet extends AbstractRedisData {
- private Object2ObjectOpenCustomHashMap<byte[], OrderedSetEntry> members;
+ private SizeableObject2ObjectOpenCustomHashMapWithCursor<byte[],
OrderedSetEntry> members;
private OrderStatisticsSet<AbstractOrderedSetEntry> scoreSet;
+ // This field is used to keep track of the size associated with objects that
are referenced by
+ // both backing collections, since they will be counted twice otherwise
+ private int sizeInBytesAdjustment = 0;
- protected static final int BASE_REDIS_SORTED_SET_OVERHEAD = 184;
- protected static final int PER_PAIR_OVERHEAD = 48;
-
- private int sizeInBytes = BASE_REDIS_SORTED_SET_OVERHEAD;
+ protected static final int BASE_REDIS_SORTED_SET_OVERHEAD = 40;
Review comment:
These constants are determined experimentally using the tests found in
`RedisSortedSetTest`. I'll add a comment here pointing that out though, so
people know which tests to run if they modify these classes.
--
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]