You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2021/09/14 22:45:00 UTC

[jira] [Commented] (GEODE-9446) Remove unnecessary uses of byte[] in RedisSortedSet

    [ https://issues.apache.org/jira/browse/GEODE-9446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17415206#comment-17415206 ] 

ASF subversion and git services commented on GEODE-9446:
--------------------------------------------------------

Commit b1ee81018c2a8e30bc4bf7f6d9c91f5d94d148c7 in geode's branch refs/heads/develop from Hale Bales
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=b1ee810 ]

GEODE-9446: Remove unecessary byte arrays from RedisSortedSet (#6783)

- add list of doubles to store scores instead of storing them as byte[]s in the same list as members (used to be score,member,score,member,...)
- throw NumberFormatException when given NaN as an increment or score
- add more tests

Signed-off-by: Ray Ingles <ri...@vmware.com>

> Remove unnecessary uses of byte[] in RedisSortedSet
> ---------------------------------------------------
>
>                 Key: GEODE-9446
>                 URL: https://issues.apache.org/jira/browse/GEODE-9446
>             Project: Geode
>          Issue Type: Improvement
>          Components: redis
>    Affects Versions: 1.15.0
>            Reporter: Donal Evans
>            Assignee: Hale Bales
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.15.0
>
>
> The current implementation of {{RedisSortedSet}} uses an {{AbstractOrderedStatisticsEntry}} class containing both {{double}} score and {{byte[]}} scoreBytes fields. The {{double}} field is required to allow the sorting behaviour required of the data structure, but the {{byte[]}} field is not necessary except when returning results to the client.
> The class should be refactored to eliminate the {{byte[]}} scoreBytes field from {{AbstractOrderedStatisticsEntry}} and reduce the memory overhead of operations.
> As part of this refactoring, the below call to {{members.put()}} should be removed fromĀ {{memberAdd()}} as it will no longer be necessary.
> {code:java}
> protected synchronized byte[] memberAdd(byte[] memberToAdd, byte[] scoreToAdd) {
> ...
> } else {
>   scoreSet.remove(existingEntry);
>   byte[] oldScore = existingEntry.scoreBytes;
>   existingEntry.updateScore(stripTrailingZeroFromDouble(scoreToAdd));
>   members.put(memberToAdd, existingEntry); <<< remove this
>   scoreSet.add(existingEntry);
>   return oldScore;
> }
> {code}
> Also, uses of theĀ {{stripTrailingZeroFromDouble()}} method should be moved to just prior to the response being returned to the client, to ensure that the format of the returned String representations of double values match native Redis.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)