Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id ABFC0200C06 for ; Fri, 27 Jan 2017 13:39:27 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A7979160B5B; Fri, 27 Jan 2017 12:39:27 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EFB70160B47 for ; Fri, 27 Jan 2017 13:39:26 +0100 (CET) Received: (qmail 67370 invoked by uid 500); 27 Jan 2017 12:39:26 -0000 Mailing-List: contact dev-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list dev@ignite.apache.org Received: (qmail 67359 invoked by uid 99); 27 Jan 2017 12:39:26 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jan 2017 12:39:26 +0000 Received: from mail-ot0-f179.google.com (mail-ot0-f179.google.com [74.125.82.179]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id B1E481A018B for ; Fri, 27 Jan 2017 12:39:25 +0000 (UTC) Received: by mail-ot0-f179.google.com with SMTP id f9so196475833otd.1 for ; Fri, 27 Jan 2017 04:39:25 -0800 (PST) X-Gm-Message-State: AIkVDXJ2QGqtXrExVZJefjHoFA3YTPoSta7fD3CtooZTyPNq42u5eRcTe2z7iA5H0MIlzW98FdV22Ifpo/eWLH/g X-Received: by 10.157.7.53 with SMTP id 50mr3447249ote.91.1485520764804; Fri, 27 Jan 2017 04:39:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.54.129 with HTTP; Fri, 27 Jan 2017 04:38:54 -0800 (PST) In-Reply-To: References: From: Pavel Tupitsyn Date: Fri, 27 Jan 2017 15:38:54 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Binary object hash code resolution in Apache Ignite 2.0 To: dev@ignite.apache.org Content-Type: multipart/alternative; boundary=001a113f52d07e3b01054712c14d archived-at: Fri, 27 Jan 2017 12:39:27 -0000 --001a113f52d07e3b01054712c14d Content-Type: text/plain; charset=UTF-8 Makes sense to me. Ticket for reference: https://issues.apache.org/jira/browse/IGNITE-4558 On Fri, Jan 27, 2017 at 1:37 PM, Vladimir Ozerov wrote: > Folks, > > Historically we have fundamental flaw in how we deal with hashCode/equals > for BinaryObjects: > 1) hashCode() is taken from original deserialized object. > 2) But equals() is performed through binary array comparison. > > We recently introduced BinaryIdentityResolver [1] as a part of DML feature, > but we didn't change any existing semantics, because it might broke > applications running AI 1.x. > > Now I am thinking on how it should be designed properly in AI 2.0, and here > is my idea: > 1) Every type will use BinaryArrayIdentityResolver [2] unless it is > overridden in config > 2) Hash code is calculated only using resolver > 3) Equality is determined only using resolver > 4) Never ever use Object.hashCode(). > > This way we will have clean and consistent hashCode/equals semantics. > > Any objections or comments? > > Vladimir. > > [1] > https://github.com/apache/ignite/blob/master/modules/ > core/src/main/java/org/apache/ignite/binary/BinaryIdentityResolver.java > [2] > https://github.com/apache/ignite/blob/master/modules/ > core/src/main/java/org/apache/ignite/binary/BinaryArrayIdentityResolver. > java > --001a113f52d07e3b01054712c14d--