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

guo Maxwell commented on CASSANDRA-20761:
-----------------------------------------

(1)how to deal with the secondary index and mv for those tables if the source 
table are truncated ,there may exist some data  inconsistent ?
However, this problem seems to be a bit divergent, because this problem exist 
when truncating a single table.

(2)I recommend change the TruncateRequest  to support a batch of tables not a 
single one . so that  we can only do one rpc to make more than one table's 
truncate. But there is a compatibility issue here if doing online upgrade .


{code:java}
public class TruncateRequest
{
    public static final IVersionedSerializer<TruncateRequest> serializer = new 
Serializer();

    public final String keyspace;
    public final String table; // here 

{code}


(2) is just a sudden idea, just for reference and will not affect the final 
implementation.



> Support TRUNCATE <keyspace> to truncate all tables in it
> --------------------------------------------------------
>
>                 Key: CASSANDRA-20761
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20761
>             Project: Apache Cassandra
>          Issue Type: New Feature
>          Components: CQL/Semantics, CQL/Syntax
>            Reporter: Stefan Miklosovic
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 5.x
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> If I want to truncate whole keyspace by one command, now I can not do that as 
> I need to enumerate all tables from that keyspace and truncate one by one.
> It might be probably possible to do 
> {code}
> TRUNCATE keyspace_name
> {code}
> which would internally iterate over all tables and truncate them all so user 
> is saved from doing that.
> However, I think that the usage of 
> {code}
> TRUNCATE keyspace_name
> {code}
> is a little bit risky because, for example, users might think that they are 
> using keyspace already by USE statement so "keyspace_name" is actually a 
> table name. If there is a keyspace of such name then it would truncate all 
> tables in it.
> It would be probably better to have a new statement like
> {code}
> TRUNCATE KEYSPACE abc;
> {code}
> That way, it is pretty obvious what we want to truncate. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to