1 Reply Latest reply on Jun 19, 2014 5:28 AM by isavin

    Infinispan C++ connector versioned value issue and resolution

    lanore

      Hello, we are trying to use infinispan with Java and cpp client, and got an issue with versioned value.

      We are using Infinispan 6.0.2.Final configured with JBoss AS7.

       

      The c++ versioned value feature is not working when the server is configured as clustered mode.

      Observation :

         - with standalone mode :

             version at server : 1 (I checked the version value by adding some debug code to the server-core module)

             version at client :  1

             replaceWithVersion result : success

       

         - with clustered mode :

             version at server : 4294969598 (I checked the version value by adding some debug code to the server-core module)

                                       This is because the first 4bytes of the version is used to store cluster related information, according to the javadoc,

             version at client :  1

                                       The first 4 bytes is ignored.

       

      Our debugging result :

            There was a type mismatch bug in the C++ connector.

       

      int64_t AbstractTransport::readLong()
      {
        hrbytes longBytes;
        readBytes(longBytes, 8);
        long result = 0;   <-- 4bytes, should be 8bytes datatype which is int64_t
        for (int i = 0; i < 8 ; i++) {
          result <<= 8;
          result ^= (int64_t) *(longBytes.bytes()+i) & 0xFF;
        }
        return result;
      }
      
      
      

       

      How we resolved this issue :

          We just changed the declaration of result variable as follows.

       

        int64_t result = 0;   <-- now it is 8bytes
      
      
      

        

       

      We are now having not problem with cpp versioned value.

       

      If this is a real bug, please someone patch the code.