cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-9193) Facility to write dynamic code to selectively trigger trace or log for queries
Date Tue, 21 Apr 2015 08:34:00 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-9193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14504597#comment-14504597
] 

Sylvain Lebresne commented on CASSANDRA-9193:
---------------------------------------------

I don't know, I'm sorry to be difficult but I don't really like the idea of having people
write functions that manipulate internal data structures (like ReadCommand). Those stuffs
are way too volatile to make a user-facing API depend on it (please don't get me wrong, I'm
not saying we haven't done such things in the past, I'm saying that every single time we've
done it, we've come to regret it and it has been a bad user experience).

I also really agree that this should reuse stuffs from CASSANDRA-7526 as much as possible
rather than being JS specific.

Anyway, I'm going to go out on a limb here since I haven't though too much about this, but
the kind of interface I would prefer would be something along the lines of:
{noformat}
CREATE FUNCTION myFunction(r request) LANGUAGE JAVA AS
$$
    if (!r.isSelect())
        return;

    if (r.consistency().equals("ALL"))
        logger.warn("WHAT!?");

    if (r.size() > 500000)
        logger.warn("Ouch!");

    // If the request has 'c1 = 3' in the WHERE clause
    if (r.selects("c1", 3))
        r.trace();
$$;

INJECT myFunction ON REQUEST TO myKs.myCf;
{noformat}
I'm not attached to any of the specifics here, it's just to say that it would be ideal in
my book if 1) we could reuse UDFs and 2) having it directly doable from CQL.  I'm also her
implying we'd add some custom {{request}} object that we'd pass to the function and would
also to get the different parameters of a request.

> Facility to write dynamic code to selectively trigger trace or log for queries
> ------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-9193
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9193
>             Project: Cassandra
>          Issue Type: New Feature
>            Reporter: Matt Stump
>
> I want the equivalent of dtrace for Cassandra. I want the ability to intercept a query
with a dynamic script (assume JS) and based on logic in that script trigger the statement
for trace or logging. 
> Examples 
> - Trace only INSERT statements to a particular CF. 
> - Trace statements for a particular partition or consistency level.
> - Log statements that fail to reach the desired consistency for read or write.
> - Log If the request size for read or write exceeds some threshold
> At some point in the future it would be helpful to also do things such as log partitions
greater than X bytes or Z cells when performing compaction. Essentially be able to inject
custom code dynamically without a reboot to the different stages of C*. 
> The code should be executed synchronously as part of the monitored task, but we should
provide the ability to log or execute CQL asynchronously from the provided API.
> Further down the line we could use this functionality to modify/rewrite requests or tasks
dynamically.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message