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

Robert Stupp commented on CASSANDRA-12478:
------------------------------------------

Hint: before you rebase, check CASSANDRA-12550 - the new methods in {{Config}} 
are moved to {{DatabaseDescriptor}} and the existing {{set/isClientMode()}} are 
deprecated. The cleanest way would be to use client mode - i.e. call 
{{DatabaseDescriptor.clientInitialization()}} (Config.setClientMode(true) is 
not sufficient). 

Want to note, that using {{QueryProcessor}} class is not the right way IMO 
since QP itself has some implicit dependencies (in the static initializer and 
via class dependencies). However, if the reason is just to get the keyspace and 
table name, you can directly use 
{{CQLFragmentParser.parseAnyUnhandled(CqlParser::query, queryStr);}} as in 
{{QueryProcessor.parseStatement}} - that's much cleaner and should have no 
"evil" dependencies (i.e. threads, file system, etc).

To clarify the different init modes in DD: client just gets an empty {{Config}} 
object, tools gets most of the stuff and is intended for stuff like sstable 
tools, daemon is, well, for the daemon.

If you want to ensure, that stress does not start threads or initializes stuff 
like commit-log-handling, you could add a new utest for stress using the 
{{ToolsTester}} class and do something like in the following code snippet (not 
tested). This helps to ensure that no unwanted stuff ist initialized/started.
{code}
@RunWith(OrderedJUnit4ClassRunner.class)
public class StressToolTest extends ToolsTester
{
    @Test
    public void testSSTableExpiredBlockers_NoArgs()
    {
        runTool(1, "org.apache.cassandra.stress.Stress",  <add command line 
parameters here>);
        assertNoUnexpectedThreadsStarted(null, null); // may need to add some 
thread name regex, if stress starts threads depending on cl args
        assertSchemaNotLoaded();
        assertCLSMNotLoaded();
        assertSystemKSNotLoaded();
        assertKeyspaceNotLoaded();
        assertServerNotLoaded();
    }
{code}


> cassandra stress still uses CFMetaData.compile()
> ------------------------------------------------
>
>                 Key: CASSANDRA-12478
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12478
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tools
>            Reporter: Denis Ranger
>              Labels: stress
>             Fix For: 3.0.x
>
>         Attachments: 
> 0001-Replaced-using-CFMetaData.compile-in-cassandra-stres.patch
>
>
> Using CFMetaData.compile() on a client tool causes permission problems. To 
> reproduce:
> * Start cassandra under user _cassandra_
> * Run {{chmod -R go-rwx /var/lib/cassandra}} to deny access to other users.
> * Use a non-root user to run {{cassandra-stress}} 
> This produces an access denied message on {{/var/lib/cassandra/commitlog}}.
> The attached fix uses client-mode functionality.



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

Reply via email to