From user-return-18505-archive-asf-public=cust-asf.ponee.io@ignite.apache.org Fri Mar 23 14:32:01 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 0935918064D for ; Fri, 23 Mar 2018 14:32:00 +0100 (CET) Received: (qmail 36435 invoked by uid 500); 23 Mar 2018 13:31:59 -0000 Mailing-List: contact user-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ignite.apache.org Delivered-To: mailing list user@ignite.apache.org Received: (qmail 36425 invoked by uid 99); 23 Mar 2018 13:31:59 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Mar 2018 13:31:59 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 4650AC0047 for ; Fri, 23 Mar 2018 13:31:59 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.879 X-Spam-Level: * X-Spam-Status: No, score=1.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id EU4OXXpFlFAf for ; Fri, 23 Mar 2018 13:31:56 +0000 (UTC) Received: from mail-ua0-f173.google.com (mail-ua0-f173.google.com [209.85.217.173]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 89AF65F216 for ; Fri, 23 Mar 2018 13:31:56 +0000 (UTC) Received: by mail-ua0-f173.google.com with SMTP id b13so7755451uam.10 for ; Fri, 23 Mar 2018 06:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=LrcVFZQdqcTS0Src9hmmH841PTGZDz18kgxtUqr6fcc=; b=iT1rqRnotYwbi+euSSefYxNtE1pn4UImcEdME5kF2GAKQUXzMAjQpSM1vFh1E9KPhn S2eqe6pUpEHBh2IsfftHzOend8/UvTWTHXC1Le+mSelO871DoTAr12k0q6j6S+XOmBgu +x/t7EDESYXKKrB+OWDu+kgioq9hcHUkEkh1m6O8FsVEHTjC52ajh+E3dXkgn3sxkx+Y ZqhCMD/1qSZcqtmPPbxT03KRhDumFS5GAnV50ff9kvj6oaCwP7wCKjd22BN67M54JUgQ MR5TQum2pzVa66eXGPF345j3mlrbsQ5VM3qyDECkp9CO3QiFQfJKqzKNVZtk4UI+NGWQ DHcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=LrcVFZQdqcTS0Src9hmmH841PTGZDz18kgxtUqr6fcc=; b=CVeKb13IOO/ATqP4rOq0wUBQ41xk5Ua9BwPpv1CPBQXYsXTJCO/GaVH2Fke8gT0I1k C+OSYNr7SghYyNgyLwX1QvDmYiJ9ewtaQVv+WQ0ipH8VMIVCKwradQqBq5pQsjAaSwn3 lBgyVLW76Ubl/Q8lBnlcsuUFtbr1HOdEGZL0w5YuxE3rsQuSG6S3b7SsCe4DXh6gGv4n MgVCU3kIRfJRfKVXa+2AaIqAm1/dAMLwiJWb0sR3JcLqQ6AnY4gbuxXDTHr1e6xN8XGy gxzzt/QBhSulKcKXcu7KabSIIqFj2L7f+ekZ2XFsZ7DjQKL9awle6ipkb0ylg7LbbRxW Hlrw== X-Gm-Message-State: AElRT7HUS84vMtL1+nOAHfD4seD6OJRwDkGenZZ82fuY0AgsMpqCgxdS GxnbFKXNw1prc4BUQkthi0cMogDwH9fsY7K/jUfwDQ== X-Google-Smtp-Source: AG47ELuw5vzAdKpOgHKyw5hDaKZEseE6Coi8uKqITJkpWgl5Q8kLuZAk0Bn1Zx8Pm1OrQA7hFFk488D7nJVPqapvyhA= X-Received: by 10.176.72.197 with SMTP id y5mr19324054uac.122.1521811915749; Fri, 23 Mar 2018 06:31:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.6.100 with HTTP; Fri, 23 Mar 2018 06:31:55 -0700 (PDT) In-Reply-To: <1521787141112-0.post@n6.nabble.com> References: <1521787141112-0.post@n6.nabble.com> From: Andrey Mashenkov Date: Fri, 23 Mar 2018 16:31:55 +0300 Message-ID: Subject: Re: Same object different hashes To: user@ignite.apache.org Content-Type: multipart/alternative; boundary="001a1146698aa7435205681472e1" --001a1146698aa7435205681472e1 Content-Type: text/plain; charset="UTF-8" Hi, LiteralByteString has 'hash' field for caching hash code. It is equals to zero by default that means that it was not calculated yet. LiteralByteString can change its state after hash() method called. So, from Ignite perspective, they will be two different objects when serialized before and after the hash() call. On Fri, Mar 23, 2018 at 9:39 AM, Ariel Tubaltsev wrote: > When fetching a key from different data structures on the client side, I > can > end up with not finding the object in the cache after putting it there. > > Server logs will show different hash values for the same object: > > PUT: > *** Received event [cache=demo, evt=CACHE_OBJECT_PUT, > key=com.google.protobuf.ByteString$LiteralByteString [idHash=2039727365, > hash=-943417763, bytes=[86, 83], hash=0] > > GET succeeds: > *** Received event [cache=demo, evt=CACHE_OBJECT_READ, > key=com.google.protobuf.ByteString$LiteralByteString [idHash=1894334736, > hash=-943417763, bytes=[86, 83], hash=0] > > GET fails: *** Received event [cache=demo, evt=CACHE_OBJECT_READ, > key=com.google.protobuf.ByteString$LiteralByteString [idHash=1467314555, > hash=-941523632, bytes=[86, 83], hash=4671] > > Hash of 4671 is a valid Java hash. Why in first 2 cases hash is 0? > I believe the reason for discrepancies is different values of hash > -943417763 and -941523632. Can you point how it's calculated? > > Thank you > Ariel > > > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ > -- Best regards, Andrey V. Mashenkov --001a1146698aa7435205681472e1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

LiteralB= yteString has 'hash' field for caching hash code. It is equals to z= ero by default that means that it was not calculated yet.=C2=A0
LiteralByteStri= ng can change its state after=C2=A0hash() method called.=C2=A0
So,=C2=A0= from Ignite perspective, they will be two different objects = when=C2=A0serialized before and after the hash() call.



On Fri, Mar 23, 2018 at 9:39 AM= , Ariel Tubaltsev <tubaltzev@gmail.com> wrote:
When fetching a key from different data structures o= n the client side, I can
end up with not finding the object in the cache after putting it there.

Server logs will show different hash values for the same object:

PUT:
*** Received event [cache=3Ddemo, evt=3DCACHE_OBJECT_PUT,
key=3Dcom.google.protobuf.ByteString$LiteralByteString [idHash=3D20397= 27365,
hash=3D-943417763, bytes=3D[86, 83], hash=3D0]

GET succeeds:
*** Received event [cache=3Ddemo, evt=3DCACHE_OBJECT_READ,
key=3Dcom.google.protobuf.ByteString$LiteralByteString [idHash=3D18943= 34736,
hash=3D-943417763, bytes=3D[86, 83], hash=3D0]

GET fails: *** Received event [cache=3Ddemo, evt=3DCACHE_OBJECT_READ,
key=3Dcom.google.protobuf.ByteString$LiteralByteString [idHash=3D14673= 14555,
hash=3D-941523632, bytes=3D[86, 83], hash=3D4671]

Hash of 4671 is a valid Java hash. Why in first 2 cases hash is 0?
I believe the reason for discrepancies is different values of hash
-943417763 and -941523632. Can you point how it's calculated?

Thank you
Ariel





--
Sent from: http://apache-ignite-users.70518.x6.= nabble.com/



--
Best regards,
Andrey V. Mashenkov
--001a1146698aa7435205681472e1--