You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Matthew Reddington (Jira)" <ji...@apache.org> on 2020/01/13 18:19:00 UTC

[jira] [Created] (GEODE-7692) Sort PdxTypeToTypeIdMap by hash.

Matthew Reddington created GEODE-7692:
-----------------------------------------

             Summary: Sort PdxTypeToTypeIdMap by hash. 
                 Key: GEODE-7692
                 URL: https://issues.apache.org/jira/browse/GEODE-7692
             Project: Geode
          Issue Type: Bug
          Components: native client
            Reporter: Matthew Reddington


PdxTypeToTypeIdMap sorts its keys by "class name", which is not unique and is the root cause of all our Pdx troubles. The key is a PdxType, and the sorting order should be determined by a hash of the class name and PdxTFieldTypes. Use boost::hash_combine to hash the fields and then hash the field hashes.
 * This hashing strategy is called a Merkle Tree.
 * hash_combine relies on a magic number where each bit has a random chance of being 0 or 1. This has the effect of spreading consecutive values far apart. Their random number is the multiplicative inverse of phi - imaginary numbers are good for this, according to my research.

You can't hash the type ID because this is always 0 for local types, and it's also 0 for remote types for which we haven't yet received the type id from the server, or we have constructed a PdxType to perform a lookup to find the type id in the PdxTypeRegistry, which uses this very map for type id lookup.



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