Re: Customize Cassandra to execute a query multiple times

2017-07-27 Thread Marco Massenzio
Why not simply have a microservice that does this for you?

It may expose an API that allows to either store queries and/or conditions
that trigger the queries (maybe time elapsed, an alert generated,
whatever...) and it would then connect to Cassandra and execute the stored
query(ies).

Given that there is no client waiting for a response, then latency is not
even a (major) issue, so the extra network hop is probably of little
consequence.

Why would you want this to be an integral part of Cassandra?
(like Jeff I also am struggling to come up with a concrete use case where
this would be desirable)

-- 
*Marco Massenzio*
http://codetrips.com

On Wed, Jul 26, 2017 at 11:06 PM, Ke Wang <klwan...@gmail.com> wrote:

> Hi Jeff,
>
> Thanks for the prompt reply.
>
> I'm sorry I wasn't clear about my use case. Let's say I just want the
> server to execute writes that are not directly generated from clients. It
> can be previously stored queries (the case in my last email), or it can be
> arbitrarily made-up write requests by the server itself.
>
> Can you describe a little bit more on how to implement serializing the
> mutation into the table?
>
> Best,
> Ke
>
> 2017-07-26 22:57 GMT-07:00 Jeff Jirsa <jji...@apache.org>:
>
> >
> >
> > On 2017-07-26 22:19 (-0700), Ke Wang <klwan...@gmail.com> wrote:
> > > Hello all,
> > >
> > > Is there a way to customize Cassandra to execute a query multiple
> times?
> > >
> >
> > There's always a way...
> >
> > > My use case is the following. When the Cassandra server receives
> queries
> > > from remote clients, besides executing those queries, the server also
> > > stores the queries. In the future, the server can re-execute stored
> > queries
> > > under certain circumstances.
> > >
> >
> > Seems like an unusual request. Where are you storing the queries? Are
> > these reads or writes? For writes you could just serialize the resulting
> > partitionupdate/mutation into a table a la pre-3.0 hints, and then
> re-play
> > as needed (though tbh I don't really get the use case)?
> >
> >
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@cassandra.apache.org
> > For additional commands, e-mail: dev-h...@cassandra.apache.org
> >
> >
>


Re: Customize Cassandra to execute a query multiple times

2017-07-27 Thread Ke Wang
Hi Jeff,

Thanks for the prompt reply.

I'm sorry I wasn't clear about my use case. Let's say I just want the
server to execute writes that are not directly generated from clients. It
can be previously stored queries (the case in my last email), or it can be
arbitrarily made-up write requests by the server itself.

Can you describe a little bit more on how to implement serializing the
mutation into the table?

Best,
Ke

2017-07-26 22:57 GMT-07:00 Jeff Jirsa <jji...@apache.org>:

>
>
> On 2017-07-26 22:19 (-0700), Ke Wang <klwan...@gmail.com> wrote:
> > Hello all,
> >
> > Is there a way to customize Cassandra to execute a query multiple times?
> >
>
> There's always a way...
>
> > My use case is the following. When the Cassandra server receives queries
> > from remote clients, besides executing those queries, the server also
> > stores the queries. In the future, the server can re-execute stored
> queries
> > under certain circumstances.
> >
>
> Seems like an unusual request. Where are you storing the queries? Are
> these reads or writes? For writes you could just serialize the resulting
> partitionupdate/mutation into a table a la pre-3.0 hints, and then re-play
> as needed (though tbh I don't really get the use case)?
>
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@cassandra.apache.org
> For additional commands, e-mail: dev-h...@cassandra.apache.org
>
>


Re: Customize Cassandra to execute a query multiple times

2017-07-26 Thread Jeff Jirsa


On 2017-07-26 22:19 (-0700), Ke Wang <klwan...@gmail.com> wrote: 
> Hello all,
> 
> Is there a way to customize Cassandra to execute a query multiple times?
> 

There's always a way...

> My use case is the following. When the Cassandra server receives queries
> from remote clients, besides executing those queries, the server also
> stores the queries. In the future, the server can re-execute stored queries
> under certain circumstances.
> 

Seems like an unusual request. Where are you storing the queries? Are these 
reads or writes? For writes you could just serialize the resulting 
partitionupdate/mutation into a table a la pre-3.0 hints, and then re-play as 
needed (though tbh I don't really get the use case)? 



-
To unsubscribe, e-mail: dev-unsubscr...@cassandra.apache.org
For additional commands, e-mail: dev-h...@cassandra.apache.org



Customize Cassandra to execute a query multiple times

2017-07-26 Thread Ke Wang
Hello all,

Is there a way to customize Cassandra to execute a query multiple times?

My use case is the following. When the Cassandra server receives queries
from remote clients, besides executing those queries, the server also
stores the queries. In the future, the server can re-execute stored queries
under certain circumstances.

Currently, when I re-execute a query, I create an internal QueryState
object using: qstate = QueryState forInternalCalls(), and then calls the
request.execute(qstate, queryStartNanoTime); However, the execution seems
to have no effect on the database. There is also no exception message. Does
anyone have a clue on this? Great thanks!

Best,
Ke