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 A2264200C8E for ; Thu, 8 Jun 2017 14:49:37 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A0D47160BD5; Thu, 8 Jun 2017 12:49:37 +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 BF6B7160BCA for ; Thu, 8 Jun 2017 14:49:36 +0200 (CEST) Received: (qmail 47519 invoked by uid 500); 8 Jun 2017 12:49:35 -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 47506 invoked by uid 99); 8 Jun 2017 12:49:35 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Jun 2017 12:49:35 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 50F2DC66C1 for ; Thu, 8 Jun 2017 12:49:34 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1 X-Spam-Level: * X-Spam-Status: No, score=1 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gridgain-com.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id rof_CFSBOKTc for ; Thu, 8 Jun 2017 12:49:31 +0000 (UTC) Received: from mail-ua0-f176.google.com (mail-ua0-f176.google.com [209.85.217.176]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 2CC025F659 for ; Thu, 8 Jun 2017 12:49:31 +0000 (UTC) Received: by mail-ua0-f176.google.com with SMTP id q15so19205265uaa.2 for ; Thu, 08 Jun 2017 05:49:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gridgain-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=j1cUkvzkfcRhHFgzRWMG3RVkTmehBKCGg/mTRgXwqrU=; b=ATs/PY/2u+GHSfO9BYcHiKQ6zJPAwivb+X7WJ3W//usDbAe1kh0K3UljnVHggT5Jly PPU21nfLGBB99IPa8sKhvPf3ntIjBk5xmzCPp2HjybCiaQXkb3VJIiOlsGveapd0RBJ5 6HVjyYG4HrB6/G3OFN9It6nF0ZA0Bfe1VLTFQv2Pb37GCjrTVROnbTE25IDPOAMoxUop KZ+s3JQhSD/81GAby0SDbdPSq4P2i27zbemeKvOkSiUn2d23m5ey7ToWYwtEUwC1G5uS 5yUuOp4F5M3EsjKMsoXI119QXKxFHlidNJ0LFVmGy1ay6ybq0VoImjp+MMfRsYy5wY5L Rd9w== 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=j1cUkvzkfcRhHFgzRWMG3RVkTmehBKCGg/mTRgXwqrU=; b=G9Y+gqKFSoeL/RZUKXI6lYGHUMCGEhvUfAnRWyjORK/+EqDanAnv51iMNWaaSpSbua +V1XFE0D1xFiepIyrgIevDUkFsqM1Gi7R0xHiA+w0VIJfz5MQZiudAd54FL3NwJpMZn0 Vh8pScZYANDzOXjdKUPQQhDHXiOGPWMIBckQl+nbG/ZCvnmrrRm9NHpx28PWfwWsXDKn EL2w0wGo60lvM628aStBLPwbXuDtNapNt5TFFQaH9V8Ww4JxCevKrBxwC9VP0bUqzaMG YJE6Yyr06CncTpcDi79eDsHSDqSTTAdAJYq6To+l9smZTFJzVKKMLf5IKNP4Kz2J0PmW qBLg== X-Gm-Message-State: AODbwcB3fYM+F+iqPcX/Jx146TIdjHCd9KUPBNYpQlxxiaMs8zQCwTob FLmPPZXIljggzVzie0u/vpvmkVm2Lnd9 X-Received: by 10.176.25.26 with SMTP id v26mr21599184uag.81.1496926169907; Thu, 08 Jun 2017 05:49:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.69.213 with HTTP; Thu, 8 Jun 2017 05:49:29 -0700 (PDT) In-Reply-To: References: From: Vladimir Ozerov Date: Thu, 8 Jun 2017 15:49:29 +0300 Message-ID: Subject: Re: Problem with affinity key field To: dev@ignite.apache.org Content-Type: multipart/alternative; boundary="f4030437a8fc9dc833055172481b" archived-at: Thu, 08 Jun 2017 12:49:37 -0000 --f4030437a8fc9dc833055172481b Content-Type: text/plain; charset="UTF-8" Alex, Sergi suggested to deprecate this interface and it is already deprecated. However, internally it is still used and in particular we depend on it in IGFS inetrnals. It will require some time to refactor IGFS. Let's just throw an exception if both AffinityKeyMapper and affinity fields mappings are defined? On Thu, Jun 8, 2017 at 3:45 PM, Alexey Goncharuk wrote: > Vladimir, > > Your concerns sound reasonable to me. However, I have a feeling that there > was a specific reason why added CacheKeyConfiguration to the > IgniteConfiguration and not to the CacheConfiguration. Looks like indeed, > our original approach is not flexible enough anymore and I am +1 for the > suggested change. > > BTW, do we really want to keep the AffinityMapper concept? For me, it looks > like the interface makes it impossible for SQL to route requests to correct > nodes because we cannot tell in advance which fields were selected as an > affinity key. > > --AG > > 2017-06-08 15:16 GMT+03:00 Vladimir Ozerov : > > > Folks, > > > > (Yakov, this is partially about your problem with DML) > > > > I found one nasty problem with our "affinity key field" concept. > Currently > > it works as follows: > > 1) Affinity keys are stored in binary metadata > > 2) Metadata is populated when object get's serialized for the first time. > > 3) There is an exception to this rule - > > IgntieConfiguration.cacheKeyConfiguration - which effectively overrides > > affinity key globally for certain types. > > 4) And finally we have AffinityKeyMapper interface which could ignore > > everything and simply define it's own logic. > > > > All in all this simply doesn't work. For example, if I serialize the type > > thus triggering metadata update, and then create a cache, affinity key > will > > be resolved properly in both cache and indexing internals. But if I > create > > a cache *before* type is registered, then all internal structures will > > think that affinity key is null, which might be wrong desicion. > > > > IgntieConfiguration.cacheKeyConfiguration could potentially solve this > > problem, but it must be defined *before node start*, and this it defeats > > the whole idea of dynamic cache start. Something is really wrong here. > > > > I thought a bit on this, and here is my proposal: > > 1) There should be no global affinity key for type. Current approach to > add > > affinity key to metadata is simply a huge design flaw. We will remove it. > > 2) There should be no static affinity key mapping either - > > IgntieConfiguration.cacheKeyConfiguration must be deprecated. > > 3) Instead, affinity key must be defined for each [cache, type] pair. > > 4) These mappings should be defined before cache start and cannot change > - > > we will add CacheConfiguration.cacheKeyConfiguration property. > > 5) Mappings are shared through discovery during cache start. In case of > > conflict we throw an exception. > > 6) Finally, we should define consistent affinity key resolution if both > > AffinityKeyMapper interface and affinity key mapping are defined. E.g., > > throw an exception if both are defined. > > > > What we got: > > 1) Predictable behavior - we can always deduce proper affinity key from > > cache configuration. No race conditions between cache start and dynamic > > type registration. > > 2) No static config which cannot be changed in runtime. > > 3) Affinity key mappings will be part of CacheConfiguration, and thus > will > > survive restarts when persistence is enabled. > > > > Thoughts? > > > > Vladimir. > > > --f4030437a8fc9dc833055172481b--