You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by DE VITO Dominique <do...@thalesgroup.com> on 2013/04/09 17:26:33 UTC

RE: other questions about // RE: batch_mutate

When the coordinator node receives a batch_mutate for __one__ row key associated with different mutations for different CF :

Is it true the coordinator node treats them as __independent__ communications/requests to replicas (even if in that case, the replicas are the same for every request) ?

Thanks,
Dominique


De : aaron morton [mailto:aaron@thelastpickle.com]
Envoyé : vendredi 6 juillet 2012 01:21
À : user@cassandra.apache.org
Objet : Re: batch_mutate

Does it mean that the popular use case is when we need to update multiple column families using the same key?
Yes.

Shouldn't we design our space in such a way that those columns live in the same column family?
Design a model where the data for common queries is stored in one row+cf. You can also take into consideration the workload. e.g. things are are updated frequently often live together, things that are updated infrequently often live together.

cheers

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 6/07/2012, at 3:16 AM, Leonid Ilyevsky wrote:

I actually found an answer to my first question at http://wiki.apache.org/cassandra/API. So I got it wrong: actually the outer key is the key in the table, and the inner key is the table name (this was somewhat counter-intuitive). Does it mean that the popular use case is when we need to update multiple column families using the same key? Shouldn't we design our space in such a way that those columns live in the same column family?

From: Leonid Ilyevsky [mailto:lilyevsky@mooncapital.com]
Sent: Thursday, July 05, 2012 10:39 AM
To: 'user@cassandra.apache.org<ma...@cassandra.apache.org>'
Subject: batch_mutate

My current way of inserting rows one by one is too slow (I use cql3 prepared statements) , so I want to try batch_mutate.

Could anybody give me more details about the interface? In the javadoc it says:

public voidbatch_mutate(java.util.Map<java.nio.ByteBuffer,java.util.Map<java.lang.String,java.util.List<Mutation<file:///C:\Tools\apache-cassandra-1.1.1\javadoc\org\apache\cassandra\thrift\Mutation.html>>>> mutation_map,
                         ConsistencyLevel<file:///C:\Tools\apache-cassandra-1.1.1\javadoc\org\apache\cassandra\thrift\ConsistencyLevel.html> consistency_level)
                  throws InvalidRequestException<file:///C:\Tools\apache-cassandra-1.1.1\javadoc\org\apache\cassandra\thrift\InvalidRequestException.html>,
                         UnavailableException<file:///C:\Tools\apache-cassandra-1.1.1\javadoc\org\apache\cassandra\thrift\UnavailableException.html>,
                         TimedOutException<file:///C:\Tools\apache-cassandra-1.1.1\javadoc\org\apache\cassandra\thrift\TimedOutException.html>,
                         org.apache.thrift.TException
Description copied from interface: Cassandra.Iface<file:///C:\Tools\apache-cassandra-1.1.1\javadoc\org\apache\cassandra\thrift\Cassandra.Iface.html#batch_mutate%28java.util.Map,%20org.apache.cassandra.thrift.ConsistencyLevel%29>
Mutate many columns or super columns for many row keys. See also: Mutation. mutation_map maps key to column family to a list of Mutation objects to take place at that scope. *


I need to understand the meaning of the elements of mutation_map parameter.
My guess is, the key in the outer map is columnfamily name, is this correct?
The key in the inner map is, probably, a key to the columnfamily (it is somewhat confusing that it is String while the outer key is ByteBuffer, I wonder what is the rational). If this is correct, how should I do it if my key is a composite one. Does anybody have an example?

Thanks,

Leonid

________________________________
This email, along with any attachments, is confidential and may be legally privileged or otherwise protected from disclosure. Any unauthorized dissemination, copying or use of the contents of this email is strictly prohibited and may be in violation of law. If you are not the intended recipient, any disclosure, copying, forwarding or distribution of this email is strictly prohibited and this email and any attachments should be deleted immediately. This email and any attachments do not constitute an offer to sell or a solicitation of an offer to purchase any interest in any investment vehicle sponsored by Moon Capital Management LP ("Moon Capital"). Moon Capital does not provide legal, accounting or tax advice. Any statement regarding legal, accounting or tax matters was not intended or written to be relied upon by any person as advice. Moon Capital does not waive confidentiality or privilege as a result of this email.

________________________________
This email, along with any attachments, is confidential and may be legally privileged or otherwise protected from disclosure. Any unauthorized dissemination, copying or use of the contents of this email is strictly prohibited and may be in violation of law. If you are not the intended recipient, any disclosure, copying, forwarding or distribution of this email is strictly prohibited and this email and any attachments should be deleted immediately. This email and any attachments do not constitute an offer to sell or a solicitation of an offer to purchase any interest in any investment vehicle sponsored by Moon Capital Management LP ("Moon Capital"). Moon Capital does not provide legal, accounting or tax advice. Any statement regarding legal, accounting or tax matters was not intended or written to be relied upon by any person as advice. Moon Capital does not waive confidentiality or privilege as a result of this email.


Re: other questions about // RE: batch_mutate

Posted by aaron morton <aa...@thelastpickle.com>.
> Is it true the coordinator node treats them as __independent__ communications/requests to replicas (even if in that case, the replicas are the same for every request) ?
A row mutation is a request to store columns in one or more CF's using one row key. It is treated as indivisible by the commit log and a single message is sent to each replica that contains all the CF updates. When the mutation is applied it is applied to each CF in turn, and the row level isolation does not apply across CF's. 

I assume your "them" is the many CF's the row mutation updates, if so the answer is no. 

Cheers

-----------------
Aaron Morton
Freelance Cassandra Consultant
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 10/04/2013, at 3:26 AM, DE VITO Dominique <do...@thalesgroup.com> wrote:

> When the coordinator node receives a batch_mutate for __one__ row key associated with different mutations for different CF :
>  
> Is it true the coordinator node treats them as __independent__ communications/requests to replicas (even if in that case, the replicas are the same for every request) ?
>  
> Thanks,
> Dominique
>  
>  
> De : aaron morton [mailto:aaron@thelastpickle.com] 
> Envoyé : vendredi 6 juillet 2012 01:21
> À : user@cassandra.apache.org
> Objet : Re: batch_mutate
>  
> Does it mean that the popular use case is when we need to update multiple column families using the same key?
> Yes. 
>  
> Shouldn’t we design our space in such a way that those columns live in the same column family?
> Design a model where the data for common queries is stored in one row+cf. You can also take into consideration the workload. e.g. things are are updated frequently often live together, things that are updated infrequently often live together.
>  
> cheers
>  
> -----------------
> Aaron Morton
> Freelance Developer
> @aaronmorton
> http://www.thelastpickle.com
>  
> On 6/07/2012, at 3:16 AM, Leonid Ilyevsky wrote:
>  
> 
> I actually found an answer to my first question at http://wiki.apache.org/cassandra/API. So I got it wrong: actually the outer key is the key in the table, and the inner key is the table name (this was somewhat counter-intuitive). Does it mean that the popular use case is when we need to update multiple column families using the same key? Shouldn’t we design our space in such a way that those columns live in the same column family?
>  
> From: Leonid Ilyevsky [mailto:lilyevsky@mooncapital.com] 
> Sent: Thursday, July 05, 2012 10:39 AM
> To: 'user@cassandra.apache.org'
> Subject: batch_mutate
>  
> My current way of inserting rows one by one is too slow (I use cql3 prepared statements) , so I want to try batch_mutate.
>  
> Could anybody give me more details about the interface? In the javadoc it says:
>  
> public voidbatch_mutate(java.util.Map<java.nio.ByteBuffer,java.util.Map<java.lang.String,java.util.List<Mutation>>> mutation_map,
>                          ConsistencyLevel consistency_level)
>                   throws InvalidRequestException,
>                          UnavailableException,
>                          TimedOutException,
>                          org.apache.thrift.TException
> Description copied from interface: Cassandra.Iface
> Mutate many columns or super columns for many row keys. See also: Mutation. mutation_map maps key to column family to a list of Mutation objects to take place at that scope. *
>  
>  
> I need to understand the meaning of the elements of mutation_map parameter.
> My guess is, the key in the outer map is columnfamily name, is this correct?
> The key in the inner map is, probably, a key to the columnfamily (it is somewhat confusing that it is String while the outer key is ByteBuffer, I wonder what is the rational). If this is correct, how should I do it if my key is a composite one. Does anybody have an example?
>  
> Thanks,
>  
> Leonid
>  
> This email, along with any attachments, is confidential and may be legally privileged or otherwise protected from disclosure. Any unauthorized dissemination, copying or use of the contents of this email is strictly prohibited and may be in violation of law. If you are not the intended recipient, any disclosure, copying, forwarding or distribution of this email is strictly prohibited and this email and any attachments should be deleted immediately. This email and any attachments do not constitute an offer to sell or a solicitation of an offer to purchase any interest in any investment vehicle sponsored by Moon Capital Management LP (“Moon Capital”). Moon Capital does not provide legal, accounting or tax advice. Any statement regarding legal, accounting or tax matters was not intended or written to be relied upon by any person as advice. Moon Capital does not waive confidentiality or privilege as a result of this email.
>  
> This email, along with any attachments, is confidential and may be legally privileged or otherwise protected from disclosure. Any unauthorized dissemination, copying or use of the contents of this email is strictly prohibited and may be in violation of law. If you are not the intended recipient, any disclosure, copying, forwarding or distribution of this email is strictly prohibited and this email and any attachments should be deleted immediately. This email and any attachments do not constitute an offer to sell or a solicitation of an offer to purchase any interest in any investment vehicle sponsored by Moon Capital Management LP (“Moon Capital”). Moon Capital does not provide legal, accounting or tax advice. Any statement regarding legal, accounting or tax matters was not intended or written to be relied upon by any person as advice. Moon Capital does not waive confidentiality or privilege as a result of this email.