Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-7692

Sort PdxTypeToTypeIdMap by hash.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: native client
    • Labels:
      None

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mreddington Matthew Reddington
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: