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 338D9200BBE for ; Fri, 11 Nov 2016 19:39:41 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 3201D160AF6; Fri, 11 Nov 2016 18:39:41 +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 2BD9C160AEE for ; Fri, 11 Nov 2016 19:39:40 +0100 (CET) Received: (qmail 17979 invoked by uid 500); 11 Nov 2016 18:39:38 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 17969 invoked by uid 99); 11 Nov 2016 18:39:38 -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; Fri, 11 Nov 2016 18:39:38 +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 C4A78C0744 for ; Fri, 11 Nov 2016 18:39:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.48 X-Spam-Level: ** X-Spam-Status: No, score=2.48 tagged_above=-999 required=6.31 tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.001, 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 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 JeunT8FBvQzO for ; Fri, 11 Nov 2016 18:39:35 +0000 (UTC) Received: from mail-ua0-f174.google.com (mail-ua0-f174.google.com [209.85.217.174]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 39C7160E08 for ; Fri, 11 Nov 2016 18:39:35 +0000 (UTC) Received: by mail-ua0-f174.google.com with SMTP id 51so19881013uai.1 for ; Fri, 11 Nov 2016 10:39:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=k8nigCzKjPzFaWydTerkZysVX3e/geTO/Lx7GsBj9kw=; b=azvW5ovNrUJ7Vhi/ih8/rxU7r8tzLDNRUhfzMe62dNKxdaLrbBRJ+RpUgoa5ucwhgn PGo7xxqq66/ud4S9K6YgWy588UbRGbduxHghNUMaBk1lPkrKv5I564XRy3hAs6vhsTwA RzKSvRFVgI5Ce9SSPt4nbw27wnvVUJLDgjTUuqhQ/N+u7iFzSKWVAacmMXrKpgD7T5te UOtSXnFPd5pf0gmuR60i4Aw1MHJCjKCpNeo59IqhtY3UTXhT/ZFbKbKEN5s4XMLld4/H YwksMc3IVefnrhCRx2OUK6twC69mhPVtrOhJLowRETrFaK8NIjZ8Yx74bUWOujdf0RNh I2cg== X-Gm-Message-State: ABUngvdlP0Y6dSzb0bFrgSuaN0VMtmaxULRJ1MrGXMdRL9OtqJhZph3VAIbHdzGN3OnMnZ5y3jsuKhbTBQqYNA== X-Received: by 10.176.83.100 with SMTP id y33mr2787678uay.130.1478889514089; Fri, 11 Nov 2016 10:38:34 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Haddad Date: Fri, 11 Nov 2016 18:38:23 +0000 Message-ID: Subject: Re: ITrigger - Help To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=94eb2c19248026433805410acc81 archived-at: Fri, 11 Nov 2016 18:39:41 -0000 --94eb2c19248026433805410acc81 Content-Type: text/plain; charset=UTF-8 Using CDC is going to be... difficult. First off (to my knowledge) all you get is a CommitLogReader. If you take a look at the Mutation class (everything is serialized and deserialized there), there's no user reference. You only get a keyspace, key, and a PartitionUpdate, which don't include any user information. Next, you may need to dedupe your messages, since you will get RF messages for every mutation. CDC is per-node, vs triggers which are executed at the coordinator level. This may not apply to you as you only want queries that came through cqlsh, but I don't see a reasonable way to differentiate all the mutations anyway so I think this is a bust. I haven't spent a lot of time in this code, happy to be corrected if I'm wrong. Jon On Fri, Nov 11, 2016 at 10:14 AM siddharth verma < sidd.verma29.list@gmail.com> wrote: > Hi Sathish, > You could look into, Change Data Capture (CDC) ( > https://issues.apache.org/jira/browse/CASSANDRA-8844 . > It might help you for some of your requirements. > > Regards > Siddharth Verma > > On Fri, Nov 11, 2016 at 11:34 PM, Jonathan Haddad > wrote: > > cqlsh uses the Python driver, I don't see how there would be any way to > differentiate where the request came from unless you stuck an extra field > in the table that you always write when you're not in cqlsh, or you > modified cqlsh to include that field whenever it did an insert. > > Checking iTrigger source, all you get is a reference to the ColumnFamily > and some metadata. At a glance of trunk, it doesn't look like you get the > user that initiated the query. > > To be honest, I wouldn't do any of this, it feels like it's going to > become an error prone mess. Your best bet is to layer something on top of > the driver yourself. The cleanest way I think think of, long term, is to > submit a JIRA / patch to enable some class loading & listener hooks in > cqlsh itself. Without a patch and a really good use case I don't know who > would want to maintain that though, as it would lock the team into using > Python for cqlsh. > > Jon > > On Fri, Nov 11, 2016 at 9:52 AM sat wrote: > > Hi, > > We are planning to use ITrigger to notify changes, when we execute scripts > or run commands in cqlsh prompt. If the operation is performed through our > application CRUD API, we are planning to handle notification in our CRUD > API itself, however if user performs some operation(like write operation in > cqlsh prompt) we want to handle those changes and update modules that are > listening to those changes. > > Could you please let us know whether it is possible to differentiate > updates done through cqlsh prompt and through application. > > We also thought about creating multiple users in cassandra and using > different user for cqlsh and for the application. If we go with this > approach, do we get the user who modified the table in ITrigger > implementation (ie., augment method) > > > Basically we are trying to limit/restrict usage of ITrigger just for cqlsh > prompt as it is little complex and risky (came to know it will impact > cassandra running in that node). > > Thanks and Regards > A.SathishKumar > > > > > -- > Siddharth Verma > (Visit https://github.com/siddv29/cfs for a high speed cassandra full > table scan) > --94eb2c19248026433805410acc81 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Using CDC is going to be... difficult.=C2=A0 First off (to= my knowledge) all you get is a=C2=A0CommitLogReader.=C2=A0 If you take a l= ook at the Mutation class (everything is serialized and deserialized there)= , there's no user reference.=C2=A0 You only get a keyspace, key, and a = PartitionUpdate, which don't include any user information. =C2=A0
<= br>
Next, you may need to dedupe your messages, since you will ge= t RF messages for every mutation.=C2=A0 CDC is per-node, vs triggers which = are executed at the coordinator level.=C2=A0 This may not apply to you as y= ou only want queries that came through cqlsh, but I don't see a reasona= ble way to differentiate all the mutations anyway so I think this is a bust= .

I haven't spent a lot of time in this code, ha= ppy to be corrected if I'm wrong.

Jon

<= div class=3D"gmail_quote">
On Fri, Nov 11, 2016 at 10:14 AM= siddharth verma <sidd.ve= rma29.list@gmail.com> wrote:
Hi=C2=A0Sathish,
You could l= ook into, Change Data Capture (CDC) (=C2=A0http= s://issues.apache.org/jira/browse/CASSANDRA-8844 .
It might help you for some of your requirements.

Regards
Siddharth Verma

O= n Fri, Nov 11, 2016 at 11:34 PM, Jonathan Haddad <jon@jonhaddad.com> wrote:
cqlsh uses the Python driver, I don't see how there would be any= way to differentiate where the request came from unless you stuck an extra= field in the table that you always write when you're not in cqlsh, or = you modified cqlsh to include that field whenever it did an insert. =C2=A0<= div class=3D"gmail_msg">
Checking iTrigger source, all you get is a reference to the ColumnFamil= y and some metadata.=C2=A0 At a glance of trunk, it doesn't look like y= ou get the user that initiated the query.
To be honest, I wouldn&= #39;t do any of this, it feels like it's going to become an error prone= mess.=C2=A0 Your best bet is to layer something on top of the driver yours= elf.=C2=A0 The cleanest way I think think of, long term, is to submit a JIR= A / patch to enable some class loading & listener hooks in cqlsh itself= .=C2=A0 Without a patch and a really good use case I don't know who wou= ld want to maintain that though, as it would lock the team into using Pytho= n for cqlsh.

Jon

On Fri, Nov 11, 2016 at 9:52 AM sat <sathish.alwar@= gmail.com> wrote:
Hi,

We are planning to = use ITrigger to notify changes, when we execute scripts or run commands in = cqlsh prompt. If the operation is performed through our application CRUD AP= I, we are planning to handle notification in our CRUD API itself, however i= f user performs some operation(like write operation in cqlsh prompt) we wan= t to handle those changes and update modules that are listening to those ch= anges. =C2=A0

Could you please let us know whether it= is possible to differentiate updates done through cqlsh prompt and through= application.

We also thought about creating multiple= users in cassandra and using different user for cqlsh and for the applicat= ion. If we go with this approach, do we get the user who modified the table= in ITrigger implementation (ie., augment method)

=
Basically we are trying to limit/restrict usage of ITrigger just = for cqlsh prompt as it is little complex and risky (came to know it will im= pact cassandra running in that node).

Thanks a= nd Regards
A.SathishKumar=



--
Siddharth Verma
(Visit https://github.com/siddv29/cfs for a h= igh speed cassandra full table scan)
--94eb2c19248026433805410acc81--