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 6B97E200CCB for ; Thu, 20 Jul 2017 21:27:52 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 69EB016B2B8; Thu, 20 Jul 2017 19:27:52 +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 AF15716B2B6 for ; Thu, 20 Jul 2017 21:27:51 +0200 (CEST) Received: (qmail 85775 invoked by uid 500); 20 Jul 2017 19:27:50 -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 85763 invoked by uid 99); 20 Jul 2017 19:27:49 -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; Thu, 20 Jul 2017 19:27:49 +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 2CC14C02AA for ; Thu, 20 Jul 2017 19:27:49 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.379 X-Spam-Level: X-Spam-Status: No, score=0.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id fOx0Yc28E3F5 for ; Thu, 20 Jul 2017 19:27:48 +0000 (UTC) Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 66FDE5FC57 for ; Thu, 20 Jul 2017 19:27:47 +0000 (UTC) Received: by mail-oi0-f52.google.com with SMTP id e124so954522oig.2 for ; Thu, 20 Jul 2017 12:27:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=jLYRIFBa1OkwuDBq2RradL8ugpZenJLy4qaNqCtpTDc=; b=H3tuB6TkavOrbQSfoL5mGaFeMleUhd16P7qTXB4WBz14Z/kjJtfZvQ0T9ugx5JJ+77 Mah0AVKetHHfOeAZtZKsAKwJfSoDKRaRp9LbkNfYP8lorc+eXBh0NOl7Z1r+GQ5WqSg6 z5CFgdbDfosnZA8XlkQ71jcw92gbbgBNpzVwd8C9xxXDsvhS7fVyygfE3bsOCpcfzB/L xr4cu/NrNl4kYqr6eGqsEOXXpnpsVK3W24F2CWvT5gpotiR7+JVEcxi7RINrp5ksSNYD Zo5owAhRLCTL6f9SfurNGXVnJAtlJ/5Ba61fkwTVieo6n/HiAmEJ+5I+WaY2sIddklOw aibw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=jLYRIFBa1OkwuDBq2RradL8ugpZenJLy4qaNqCtpTDc=; b=GKSCoEvTHvo51Yk5UCyvk2jmPFLI8pyAEpPNc3UP+l7cgUoSHBAJx9xfkjOGD8tdHU UL67e9QVyNXCYdgdCLOurOK32TOcaKmIjwPMPlboPe4Bcvovhw2l+0s4QSlPyGaJvSgU PS1lizf0n4+iMNJHolDqfUn2Xl0vJtsegXhtwgoyFlye1otbJTLpsaFTOIrgF+3ir2LH 1L6aVvmfrUdEctnpW3GiXau22Y/KCz4KAP7OYjZlNceH4KvCySZwE9DkCRyDrhCpKhwq JR0sLNdoSosmy/9WtGtN/iZYQzHCMInH8ya/SNSCEYp+s0K/Sz7eQWLF8f35TA2ceigJ eYeg== X-Gm-Message-State: AIVw110VidvCc1kDDFFfDHCseJkg7fWxUhaw/fCZBGG6lL4iecMygBJe IakvO5fHYCp3MjyZF8tiVU7vYS1KCdhSPCM= X-Received: by 10.202.3.194 with SMTP id 185mr338843oid.156.1500578865809; Thu, 20 Jul 2017 12:27:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.139.34 with HTTP; Thu, 20 Jul 2017 12:27:45 -0700 (PDT) From: Sergey Kalashnikov Date: Thu, 20 Jul 2017 22:27:45 +0300 Message-ID: Subject: "not null" constraint support To: dev@ignite.apache.org Content-Type: text/plain; charset="UTF-8" archived-at: Thu, 20 Jul 2017 19:27:52 -0000 Hi Igniters, I am working on the ticket https://issues.apache.org/jira/browse/IGNITE-5648, which purpose is to add support for NOT NULL constraint for any fields of key or value stored in Ignite cache. I would appreciate your comments on the design approach I have described below. In my opinion, such checks should be enforced both by SQL DML and cache API to be consistent. Here is my analysis of what needs to be done. 1. First, the SQL CREATE table will not throw exception anymore whenever it encounters a column with "not null" modifier. Instead, the resulting QueryEntity will now indicate which fields have such modifier. The proposed way of doing this is the following: class QueryEntity { ... Set notNullFields; } Since QueryEntity is a part of public api, it becomes possible to configure this constraint not only via DDL CREATE TABLE. 2. Then we need a special method on GridQueryProcessor that for the given cacheName, key and value would perform the following things: - Get a GridQueryTypeDescriptor that corresponds to given value type; - Delegate that GridQueryTypeDescriptor a task to validate given key and value; - Type descriptor would itself delegate the validation to its GridQueryProperties that have "not null" constraint. 3. To enforce the constraints, the validation method should be called - In GridNearAtomicSingleUpdateFuture.mapSingleUpdate() and GridNearAtomicUpdateFuture.mapUpdate() when operation is CREATE or UPDATE. That would cover putIfAbsent(), getAndPut(), getAndPutIfAbsent(), replace(), getAndReplace(), putAll() operations on atomic cache. And in GridNearTxLocal.enlistWriteEntry() when operation is CREATE or UPDATE for the case of transactional cache. - Right after EntryProcessor.process() in GridCacheMapEntry.AtomicCacheUpdateClosure.runEntryProcessor() as part of invoke(), invokeAll() operations on atomic cache. And in GridDhtTxPrepareFuture.onEntriesLocked() for the case of transactional cache. 4. DML processor changes The DMLStatementProcessor methods doInsert(), doUpdate(), doMerge() must also incorporate such checks to avoid attempts to insert values that are known to be rejected by cache. Thoughts? -- Best regards, Sergey