If u ask conceptually, it is possible but not recommended.
If u really want to do it use the initial token setting and provide the
broad range to the nodes where u want more data. But u need to understand
about the replication factor consideration, if u keep rf as 3 on a 3 node
cluster that means
Hi,
Thanks all for your valuable suggestion.
Thanks and Regards
A.SathishKumar
On Sat, Nov 12, 2016 at 2:59 PM, Ben Bromhead wrote:
> +1 w/ Benjamin.
>
> However if you wish to make use of spare hardware capacity, look to
> something like mesos DC/OS or kubernetes. You
Hi,
Instead of using a collection, consider making label a clustered column.
With this each request will essentially append a column (label) to the
partition.
To get all labels would be a simple query
select label from table where partitionkey = "value".
In general , read + update of a
+1 w/ Benjamin.
However if you wish to make use of spare hardware capacity, look to
something like mesos DC/OS or kubernetes. You can run multiple services
across a fleet of hardware, but provision equal resources to Cassandra and
have somewhat reliable hardware sharing mechanisms.
On Sat, 12
Agreed w/ Benjamin. Trying to diagnose issues in prod will be a nightmare.
Keep your DB servers homogeneous.
> On Nov 12, 2016, at 1:52 PM, Benjamin Roth wrote:
>
> 1. From a 15 year experience of running distributed Services: dont Mix
> Services on machines if
1. From a 15 year experience of running distributed Services: dont Mix
Services on machines if you don't have to. Dedicate each server to a single
task if you can afford it. It is easier to manage and reduces risks in case
of overload or failure
2. You can assign a different number of tokens for
Hi,
We are planning to install 3 node cluster in production environment. Is it
possible to provide weightage or priority to the nodes in cluster.
Eg., We want more more records to be written to first 2 nodes and less to
the 3rd node. We are thinking of this approach because we want to install
"doing mapper.save() will do an insert rather than an update? " --> Yes
The java driver mapper has no update method. To do an update you need to
use the Accessor and roll out your own update statement
On Sat, Nov 12, 2016 at 5:37 PM, Ali Akhtar wrote:
> Just to be clear,
Just to be clear, doing mapper.save() will do an insert rather than an
update?
On Sat, Nov 12, 2016 at 9:36 PM, Andrew Tolbert wrote:
> I believe you are correct that the implementation taking the Set is the
> right one to use.
>
> On Sat, Nov 12, 2016 at 9:44 AM
I believe you are correct that the implementation taking the Set is the
right one to use.
On Sat, Nov 12, 2016 at 9:44 AM Ali Akhtar wrote:
> Or it could even take Set as the first bound var:
>
> void addLabel(Set label, String id);
>
>
> On Sat, Nov 12, 2016 at 8:41 PM,
Or it could even take Set as the first bound var:
void addLabel(Set label, String id);
On Sat, Nov 12, 2016 at 8:41 PM, Ali Akhtar wrote:
> Andrew,
>
> I was thinking about setting up an accessor with that query and a bound
> variable ? which binds to the instance being
Andrew,
I was thinking about setting up an accessor with that query and a bound
variable ? which binds to the instance being added, e.g:
@Query("UPDATE my_table SET labels = labels + ? WHERE id = ?")
void addLabel(Label label, String id);
Will that work?
On Sat, Nov 12, 2016 at 8:38 PM,
You can do it in a SimpleStatement assuming you provide the CQL exactly as
you provided, but in a PreparedStatement it will not work because cql
prohibits provide bind values in collection literals. For it to work you
could provide a List of UDT values in a bound prepared statement, i.e.:
>
> Will the above example work if instead of session.execute, it was doing
> session.executeAsync()?
>
It will work as executeAsync will not block waiting on behavior in a I/O
thread (that may also happen to be the calling thread), so it is not
susceptible to deadlock.
To be extra safe, you
Looks like the trick was to use [] around the udt value literal.
Any way to do this using the java driver?
On Sat, Nov 12, 2016 at 7:58 PM, Ali Akhtar wrote:
> Changing the double quotes to single quotes gives:
>
> UPDATE my_table SET labels = labels + {id: 'foo'} where
Changing the double quotes to single quotes gives:
UPDATE my_table SET labels = labels + {id: 'foo'} where id = '';
InvalidRequest: Error from server: code=2200 [Invalid query]
message="Invalid user type literal for labels of type list"
On Sat, Nov 12, 2016 at 7:50 PM, Ali Akhtar
The question is about appending to a set of frozen and how to do that
while avoiding the race condition.
If I run:
UPDATE my_table SET labels = labels + {id: "foo"} where id = 'xx';
I get:
SyntaxException: line 1:57 no viable alternative at input '}' (...= labels
+ {id: ["fo]o"}...)
Here
If I used consistency = ALL both when getting the record, and when saving the
record, will that avoid the race condition?
If I use consistency level = all, will that cause it to end up with [1,2]?
No. Even if you have only one host it's possible that two threads first both
read data and than
The labels collection is of the type set , where label is a
udt containing: id, name, description , all text fields.
On Sat, Nov 12, 2016 at 5:54 PM, Ali Akhtar wrote:
> The problem isn't just the update / insert though, right? Don't frozen
> entities get
The problem isn't just the update / insert though, right? Don't frozen
entities get overwritten completely? So if I had [1] [2] being written as
updates, won't each update overwrite the set completely, so i'll end up
with either one of them instead of [1,2]?
On Sat, Nov 12, 2016 at 5:50 PM,
Maybe you should use my Achilles mapper, which does generates UPDATE
statements on collections and not only INSERT
Le 12 nov. 2016 13:08, "Ali Akhtar" a écrit :
> I am using the Java Cassandra mapper for all of these cases, so my code
> looks like this:
>
> Item myItem =
At https://datastax.github.io/java-driver/manual/async/ the docs say to not
do any blocking operations within the callback of an async operation. This
example is given as one that can cause a deadlock:
ListenableFuture resultSet = Futures.transform(session,
new Function()
I am using the Java Cassandra mapper for all of these cases, so my code
looks like this:
Item myItem = myaccessor.get( itemId );
Mapper mapper = mappingManager.create( Item.class );
myItem.labels.add( newLabel );
mapper.save( myItem );
On Sat, Nov 12, 2016 at 5:06 PM, Ali Akhtar
Thanks DuyHai, I will switch to using a set.
But I'm still not sure how to resolve the original question.
- Original labels = []
- Request 1 arrives with label = 1, and request 2 arrives with label = 2
- Updates are sent to c* with labels = [1] and labels = [2] simultaneously.
What will happen
Don't use list, use set instead. If you need ordering of insertion, use a
map where timeuuid is generated by the client to guarantee
insertion order
When setting a new value to a list, C* will do a read-delete-write
internally e.g. read the current list, remove all its value (by a
If I used consistency = ALL both when getting the record, and when saving
the record, will that avoid the race condition?
On Sat, Nov 12, 2016 at 4:26 PM, Ali Akhtar wrote:
> I'm responding to a 3rd party API, so I have no control over sending the
> labels together instead
I'm responding to a 3rd party API, so I have no control over sending the
labels together instead of one by one. In this case, the API will send them
one by one.
The list is actually of a list and not a text (I used text
for simplification, apologies).
In that case, will updates still
Could you not send both labels in one request? Race conditions should still be
handled as Vladimir suggests. But in this specific case the client could send
both as 1 request thus simplifying the solution.
/Oskar
> On 12 nov. 2016, at 12:05, Vladimir Yudovin wrote:
>
>
Hi Ali,
What can I do so I end up with [1, 2] instead of either [1] or [2] after
both requests have been processed?
Use UPDATE, not INSERT. Thus new labels will be added to list, without
overwriting old ones. Also consider usage of SET instead of LIST to avoid
duplicates.
Best regards,
I have a table where each record contains a list of labels.
I have an endpoint which responds to new labels being added to a record by
the user.
Consider the following scenario:
- Record X, labels = []
- User selects 2 labels, clicks a button, and 2 http requests are generated.
- The server
30 matches
Mail list logo