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

Can't use java enums inside a cache key

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Information Provided
    • None
    • None
    • None

    Description

      Use case:

      • Partitioned region with one shard
      • I put data which key contains an enum.
      • Sometimes the data is not returned when we ask for that key. Although it's not caught in the client, this exception is raised :
      PartitionedRegionException( "Object hashCode inconsistent between cache peers. Here ...)
      

      I Believe it's related to the limitation of using raw java enum in the hashcode generation. When a server checks hashcode consistency with its peers, it will fail for those keys, since the enum hashcode is equal to Object.Identity a.k.a: its address in the JVM. For this reason the hascode will differ between two peers.

      You maybe aware of this limitation.

      • If so it should be properly mentioned in the documentation, possibly with example and workaround (like using the enum's ordinal()). I could not find it any such thing.
      • Otherwise, is it something that could be handled better? For example by sending the whole keys instead of hashes?

      Regards,
      Naoufal

      Attachments

        Issue Links

          Activity

            People

              karensmolermiller Karen Smoler Miller
              Naouff Naoufal
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: