Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8B7C218234 for ; Mon, 19 Oct 2015 12:16:08 +0000 (UTC) Received: (qmail 99504 invoked by uid 500); 19 Oct 2015 12:16:05 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 99469 invoked by uid 500); 19 Oct 2015 12:16:05 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 99247 invoked by uid 99); 19 Oct 2015 12:16:05 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Oct 2015 12:16:05 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 293072C1F71 for ; Mon, 19 Oct 2015 12:16:05 +0000 (UTC) Date: Mon, 19 Oct 2015 12:16:05 +0000 (UTC) From: "Sam Tunnicliffe (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CASSANDRA-10092) Generalize PerRowSecondaryIndex validation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CASSANDRA-10092?page=3Dcom.atl= assian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sam Tunnicliffe updated CASSANDRA-10092: ---------------------------------------- Assignee: Andr=C3=A9s de la Pe=C3=B1a > Generalize PerRowSecondaryIndex validation > ------------------------------------------ > > Key: CASSANDRA-10092 > URL: https://issues.apache.org/jira/browse/CASSANDRA-1009= 2 > Project: Cassandra > Issue Type: Improvement > Components: Core > Reporter: Andr=C3=A9s de la Pe=C3=B1a > Assignee: Andr=C3=A9s de la Pe=C3=B1a > Priority: Minor > Labels: 2i, secondary_index, validation > Fix For: 2.1.x, 2.2.x > > Attachments: improve_2i_validation.patch > > > Index validation is currently done in a per-cell basis. However, per-row = secondary index developers can be interested in validating all the written = columns at once, because some implementations need to check the validity of= a row write by comparing some column values against others. For example, a= per row 2i implementation indexing time ranges (composed by a start date c= olumn and an end date column) should check that the start date is before th= e stop date. > I'm attaching a patch adding a new method to {{PerRowSecondaryIndex}}: > {code:java} > public void validate(ByteBuffer key, ColumnFamily cf) throws InvalidReque= stException {} > {code} > and a new method to {{SecondaryIndexManager}}: > {code:java} > public void validateRowLevelIndexes(ByteBuffer key, ColumnFamily cf) thro= ws InvalidRequestException > { > for (SecondaryIndex index : rowLevelIndexMap.values()) > { > ((PerRowSecondaryIndex) index).validate(key, cf); > } > } > {code} > This method is invoked in CQL {{UpdateStatement#validateIndexedColumns}}.= This way, {{PerRowSecondaryIndex}} could perform complex write validation. > I have tried to do the patch in the least invasive way possible. Maybe th= e current method {{SecondaryIndex#validate(ByteBuffer, Cell)}} should be mo= ved to {{PerColumnSecondaryIndex}}, and the {{InvalidRequestException}} tha= t informs about the particular 64k limitation should be thrown by {{Abstrac= tSimplePerColumnSecondaryIndex}}. However, given the incoming [CASSANDRA-9= 459|https://issues.apache.org/jira/browse/CASSANDRA-9459], I think that the= proposed patch is more than enough to provide rich validation features to = 2i implementations based on 2.1.x and 2.2.x. -- This message was sent by Atlassian JIRA (v6.3.4#6332)