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 E3C5C200C52 for ; Mon, 10 Apr 2017 17:34:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E255E160B99; Mon, 10 Apr 2017 15:34:05 +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 0E585160B85 for ; Mon, 10 Apr 2017 17:34:04 +0200 (CEST) Received: (qmail 98632 invoked by uid 500); 10 Apr 2017 15:34:03 -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 98615 invoked by uid 99); 10 Apr 2017 15:34:03 -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; Mon, 10 Apr 2017 15:34:03 +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 1CEC4C002D for ; Mon, 10 Apr 2017 15:34:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 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, RCVD_IN_SORBS_SPAM=0.5, 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 qQyxUDeks441 for ; Mon, 10 Apr 2017 15:34:01 +0000 (UTC) Received: from mail-qk0-f180.google.com (mail-qk0-f180.google.com [209.85.220.180]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id D1D235F30C for ; Mon, 10 Apr 2017 15:34:00 +0000 (UTC) Received: by mail-qk0-f180.google.com with SMTP id h67so116504881qke.0 for ; Mon, 10 Apr 2017 08:34:00 -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=ZlXDk40xTR+yuL3m5h4KW5lJEusUESPq/ribCN/QbgA=; b=pOpU6n1JGwdtLGxJBMeTm32QGg9mO85vl8VXTRXn9oIOhk5iFfdydd9LwL+YZoiz5T xIIPA1ZXpTd8Y5bBNNoHvKNYJwXJxmjbQvuYwlH4P8f/DY+TavyZNvaemx3df6sIyIDG EiHor4IwNeBcXj/7a4/G0/xATSCPLXNVNACTYZ9D4YCrCtgPlpu8ZQJaj2uZfgy0ihK4 chVP9X5k3vKT5DJoE+UQ1UN5OPVpHsCLChikejIEdBRHiOZ+G6RdK5tb1vRUWtZWptsv BQUvcJZz1HXbN40kVyzaXniXJFbu6QXRoFemCK2WSxtNfKZ0ObRXeeino3ks7yNt1kAV pOsg== 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=ZlXDk40xTR+yuL3m5h4KW5lJEusUESPq/ribCN/QbgA=; b=iLLCdmUOdZeZv3WmuQEmB6GwP9FKFGkmqvDxszcr/u2i8ygyq9uKu+aO/30WUZDNqF qr/P66vADe1AJX4WqvIZ0KfMTZ09nMCuh0j5xrmEzewwUU1CBG1Ka8jwqLwqMLkd+ryQ ILceg+nuJbPVN6vaZo3X99uco9tOZ3CitEVD60HQIAThKXD9ZRd3wO5c2DIWX0nSmHF3 CpFAZ83s+fZG1OZ6/qzZ6fe0dCEqYR3v7nLK35pXwPepuZ38iOS/s7nQhcqBut9U007r Xe5/51q+IMWGseCNS0RTx2SR4t/fRUt3jmOUANt86iNyxS0L9j729iExu903Zu5UuDMg TzoA== X-Gm-Message-State: AN3rC/5ZgZ5v9kXBC66luGCNvSBbaUcMPAkta45UGWBYwXQsoAiI4UsdS0NcfZWNBSCa4/fHp2JzkKzYMBsURg== X-Received: by 10.129.82.69 with SMTP id g66mr4054445ywb.107.1491838440261; Mon, 10 Apr 2017 08:34:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.220.131 with HTTP; Mon, 10 Apr 2017 08:33:19 -0700 (PDT) In-Reply-To: References: From: Sergi Vladykin Date: Mon, 10 Apr 2017 18:33:19 +0300 Message-ID: Subject: Re: Sorting fields of Binarilyzable objects on write To: dev@ignite.apache.org Content-Type: multipart/alternative; boundary=001a114dad1a4b6604054cd1b4cb archived-at: Mon, 10 Apr 2017 15:34:06 -0000 --001a114dad1a4b6604054cd1b4cb Content-Type: text/plain; charset=UTF-8 I even think that in DML we have to just calculate hashCode in order of QueryEntity regardless of order in Binarylizable. Sergi 2017-04-10 18:29 GMT+03:00 Dmitriy Setrakyan : > Does anyone disagree about having users sort the fields themselves, as > Sergi and I suggested above? > > On Mon, Apr 10, 2017 at 8:21 AM, Pavel Tupitsyn > wrote: > > > Sergi, DML writes fields in alphabetic order and computes hash code > > accordingly. > > If user-defined Binarylizable impl uses different order, hash codes will > be > > inconsistent. > > > > On Mon, Apr 10, 2017 at 6:18 PM, Sergi Vladykin < > sergi.vladykin@gmail.com> > > wrote: > > > > > What is correct or incorrect ordering for DML? > > > > > > Sergi > > > > > > 2017-04-10 18:14 GMT+03:00 Dmitriy Setrakyan : > > > > > > > I would agree that it should be on a user to always sort the fields, > if > > > we > > > > make it a part of the contract. However, in this case, we should > always > > > > throw exception if user somehow provides fields in the wrong order. > > > > > > > > D. > > > > > > > > On Mon, Apr 10, 2017 at 8:07 AM, Sergi Vladykin < > > > sergi.vladykin@gmail.com> > > > > wrote: > > > > > > > > > Could you please elaborate why would we want to sort fields in > > > > > Binarilyzable > > > > > classes? > > > > > > > > > > If you are taking from stable binary representation perspective, > > then I > > > > > think it is a problem of user, but not ours. > > > > > > > > > > Sergi > > > > > > > > > > 2017-04-10 17:53 GMT+03:00 Vladimir Ozerov : > > > > > > > > > > > Zapalniki, > > > > > > > > > > > > Inspired by IGNITE-4669 (.NET: Sort binary object fields) [1]. > > > > > > > > > > > > Currently we sort binary object fields before when writing them > to > > > the > > > > > > output stream in case of standard (Serializable) objects and > > > > > > BinaryObjectBuilder. This makes sense as we have stable binary > > object > > > > > > representation irrespective of fields order, which is very > > important > > > > e.g. > > > > > > for DML. And it works fine from performance perspective as well: > > > > > > - For standard classes we sort fields only once during > > > initialization; > > > > > > - For builder we have to maintain the whole object graph in > memory > > > > before > > > > > > writing anyway as builder is mutable, so sorting doesn't impose > > > serious > > > > > > performance hit. > > > > > > > > > > > > But what to do with Binarilyzable classes? We can sort their > fields > > > as > > > > > > well, but it means that: > > > > > > 1) We will not be able to write them directly to stream. Instead, > > we > > > > will > > > > > > accumulate values in memory, and write only when the whole object > > > graph > > > > > is > > > > > > known. > > > > > > 2) Currently reads are mostly sequential from memory perspective. > > > With > > > > > this > > > > > > change reads will become random. > > > > > > > > > > > > So we will loose both read and write serialization performance. > How > > > do > > > > > you > > > > > > think - do we need this change or not? > > > > > > > > > > > > Vladimir. > > > > > > > > > > > > [1] https://issues.apache.org/jira/browse/IGNITE-4669 > > > > > > > > > > > > > > > > > > > > > --001a114dad1a4b6604054cd1b4cb--