ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitriy Setrakyan <dsetrak...@apache.org>
Subject Re: Sorting fields of Binarilyzable objects on write
Date Thu, 13 Apr 2017 11:25:49 GMT
Vova, can you give an example of when writing out of order would be the
only option?

On Thu, Apr 13, 2017 at 4:20 AM, Vladimir Ozerov <vozerov@gridgain.com>
wrote:

> Folks,
>
> If you restrict writes in certain order and conditions, Binarylizable
> interfaces turns into an unusable bullshit :-) Remember that not all binary
> objects participate in DML, and even if so, not all binary objects are
> cache keys. I think we should simply print a warning to log, informing user
> about potential problems if order is violated.
>
> On Thu, Apr 13, 2017 at 2:16 PM, Alexey Goncharuk <
> alexey.goncharuk@gmail.com> wrote:
>
> > That is cool, completely forgot about it :)
> >
> > 2017-04-13 14:07 GMT+03:00 Pavel Tupitsyn <ptupitsyn@apache.org>:
> >
> > > Alexey, we can read fields in any order in non-raw mode.
> > > Dmitriy's suggestion would work.
> > >
> > > On Thu, Apr 13, 2017 at 1:56 PM, Alexey Goncharuk <
> > > alexey.goncharuk@gmail.com> wrote:
> > >
> > > > Dmitriy,
> > > >
> > > > How would then reader determine which field to read (a and b could
> the
> > of
> > > > different size)? c in this case must be written first.
> > > >
> > > > 2017-04-13 0:29 GMT+03:00 Dmitriy Setrakyan <dsetrakyan@apache.org>:
> > > >
> > > > > Vladimir,
> > > > >
> > > > > Would this be valid?
> > > > >
> > > > > *void writeBinary(BinaryWriter w) {*
> > > > >
> > > > > *    if (c)*
> > > > > *        w.writeInt("A", a)*
> > > > > *    else*
> > > > > *        w.writeInt("B", b)*
> > > > >
> > > > > *    w.writeBoolean("C", c);*
> > > > > *}*
> > > > >
> > > > > D.
> > > > >
> > > > > On Wed, Apr 12, 2017 at 1:07 AM, Vladimir Ozerov <
> > vozerov@gridgain.com
> > > >
> > > > > wrote:
> > > > >
> > > > > > Consider the following code:
> > > > > >
> > > > > > void writeBinary(BinaryWriter w) {
> > > > > >     w.writeBoolean("C", c);
> > > > > >
> > > > > >     if (c)
> > > > > >         w.writeInt("A", a)
> > > > > >     else
> > > > > >         w.writeInt("B", b)
> > > > > > }
> > > > > >
> > > > > > How are we going to force user to follow the contract in this
> case?
> > > > > >
> > > > > > On Wed, Apr 12, 2017 at 9:16 AM, Dmitriy Setrakyan <
> > > > > dsetrakyan@apache.org>
> > > > > > wrote:
> > > > > >
> > > > > > > I think it is OK for users to do their own sorting, but
we
> should
> > > > > > > definitely validate the correct order and throw an exception
if
> > it
> > > is
> > > > > > not.
> > > > > > >
> > > > > > > D.
> > > > > > >
> > > > > > > On Tue, Apr 11, 2017 at 11:02 PM, Pavel Tupitsyn <
> > > > ptupitsyn@apache.org
> > > > > >
> > > > > > > wrote:
> > > > > > >
> > > > > > > > QueryEntity order is not only harder for the users,
it will
> be
> > > > > > nightmare
> > > > > > > to
> > > > > > > > implement.
> > > > > > > > What if there is no QueryEntity defined? What if the
same
> class
> > > is
> > > > > used
> > > > > > > in
> > > > > > > > multiple QueryEntity?
> > > > > > > > I don't think serialization code has to be tied to
> QueryEntity
> > in
> > > > any
> > > > > > > way,
> > > > > > > > this violates separation of concerns.
> > > > > > > >
> > > > > > > > So I guess we can agree on sorting fields alphabetically.
> > > > > > > >
> > > > > > > > Let's get to the initial question:
> > > > > > > > * Should we do the sorting for the user (performance
hit)?
> > > > > > > > * Should we at least validate user-defined order?
> > > > > > > >
> > > > > > > > On Wed, Apr 12, 2017 at 2:12 AM, Dmitriy Setrakyan
<
> > > > > > > dsetrakyan@apache.org>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > On Tue, Apr 11, 2017 at 1:28 PM, Sergi Vladykin
<
> > > > > > > > sergi.vladykin@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > I'm just trying to understand the current
state of things
> > and
> > > > > > risks.
> > > > > > > > May
> > > > > > > > > be
> > > > > > > > > > we need to do some adjustments here before
2.0 to be on
> the
> > > > safe
> > > > > > > side.
> > > > > > > > > >
> > > > > > > > > > Actually looks like this not really important,
we just
> have
> > > to
> > > > > > > clearly
> > > > > > > > > > document that DML builds keys this way and
require from
> > user
> > > to
> > > > > do
> > > > > > > the
> > > > > > > > > same
> > > > > > > > > > to be able to use cache API.
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > I think it is important from the usability stand
point. A
> > user
> > > > can
> > > > > > > always
> > > > > > > > > sort fields alphabetically in his or her mind.
However,
> > trying
> > > to
> > > > > > > > remember
> > > > > > > > > the field order from some QueryEntity is a lot
harder.
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message