Re: Repair has now effect

2012-09-04 Thread Patricio Echagüe
embarrassing.

Chef somehow ran in that box and updated the schema with a version of it
that had RF=1.

Sorry about that.

On Mon, Sep 3, 2012 at 1:45 AM, Radim Kolar h...@filez.com wrote:


   INFO [AntiEntropySessions:6] 2012-09-02 15:46:23,022
 AntiEntropyService.java (line 663) [repair #%s] No neighbors to repair with
 on range %s: session completed

 you have RF=1, or too many nodes are down.



Repair has now effect

2012-09-02 Thread Patricio Echagüe
Hey folks, perhaps a dumb question but I ran into this situation and it's a
bit unclear what's going on.

We are running a 3 nodes cluster with RF 3 (cass 1.0.11). We had one issue
with one node and it was down for like 1 hour.

I brought the node up again as soon as I realized it was down (and ganglia
+ nagios triggered some alerts). But when running repair to make sure it
had all the data, I get this message:

 INFO [AntiEntropySessions:6] 2012-09-02 15:46:23,022
AntiEntropyService.java (line 663) [repair #%s] No neighbors to repair with
on range %s: session completed

Am I missing something ?

thanks


Re: Hector Problem Basic one

2011-10-13 Thread Patricio Echagüe
Hi, Hector does not retry on a down server. In the unit tests where you have
just one server, Hector will pass the exception to the client.

Can you tell us please what your test looks like ?

2011/10/12 Wangpei (Peter) peter.wang...@huawei.com

  I only saw this error message when all Cassandra nodes are down.

 How you get the Cluster and how you set the hosts?

 ** **

 *发件人:* CASSANDRA learner [mailto:cassandralear...@gmail.com]
 *发送时间:* 2011年10月12日 14:30
 *收件人:* user@cassandra.apache.org
 *主题:* Re: Hector Problem Basic one

 ** **

 Thanks for the reply ben.

 Actually The problem is, I could not able to run a basic hector example
 from eclipse. Its throwing me.prettyprint.hector.api.

 exceptions.HectorException: All host pools marked
  down. Retry burden pushed out to client

 
 Can you please let me know why i am getting this

 

 On Tue, Oct 11, 2011 at 3:54 PM, Ben Ashton b...@bossastudios.com wrote:*
 ***

 Hey,

 We had this one, even tho in the hector documentation it says that it
 retry s failed servers even 30 by default, it doesn't.

 Once we explicitly set it to X seconds, when ever there is a failure,
 ie with network (AWS), it will retry and add it back into the pool.

 Ben


 On 11 October 2011 11:09, CASSANDRA learner cassandralear...@gmail.com
 wrote:
  Hi Every One,
 
  Actually I was using cassandra long time back and when i tried today, I
 am
  getting a problem from eclipse. When i am trying to run a basic hector
  (java) example, I am getting an exception
  me.prettyprint.hector.api.exceptions.HectorException: All host pools
 marked
  down. Retry burden pushed out to client. . But My server is up. Node tool
  also whows that it is up. I donno what happens..
 
  1.)Is it any thing to do with JMX port.
  2.) What is the storage port in casandra.yaml and jmx port in
  cassandra-env.sh
 
 
 

 ** **



Re: Efficiency of hector's setRowCount

2011-10-13 Thread Patricio Echagüe
Hi Don. No it will not. IndexedSlicesQuery will read just the amount of rows
specified by RowCount and will go to the DB to get the new page when needed.

SetRowCount is doing indexClause.setCount(rowCount);

On Mon, Oct 10, 2011 at 3:52 PM, Don Smith dsm...@likewise.com wrote:

 Hector's IndexedSlicesQuery has a setRowCount method that you can use to
 page through the results, as described in https://github.com/rantav/**
 hector/wiki/User-Guide https://github.com/rantav/hector/wiki/User-Guide.

 rangeSlicesQuery.setRowCount(**1001);
  .
 rangeSlicesQuery.setKeys(**lastRow.getKey(),  );

 Is it efficient?  Specifically, suppose my query returns 100,000 results
 and I page through batches of 1000 at a time (making 100 executes of the
 query). Will it internally retrieve all the results each time (but pass only
 the desired set of 1000 or so to me)? Or will it optimize queries to avoid
 the duplication?  I presume the latter. :)

 Can IndexedSlicesQuery's setStartKey method be used for the same effect?

   Thanks,  Don



Re: Efficiency of hector's setRowCount (and setStartKey!)

2011-10-13 Thread Patricio Echagüe
On Thu, Oct 13, 2011 at 9:39 AM, Don Smith dsm...@likewise.com wrote:

 **
 It's actually setStartKey that's the important method call (in combination
 with setRowCount). So I should have been clearer.

 The following code performs as expected, as far as returning the expected
 data in the expected order.  I believe that the use of IndexedSliceQuery's
 setStartKey will support efficient queries -- avoiding repulling the entire
 data set from cassandra. Correct?


correct



 void demoPaging() {
 String lastKey = processPage(don,);  // get first
 batch, starting with  (smallest key)
 lastKey = processPage(don,lastKey);// get second
 batch starting with previous last key
 lastKey = processPage(don,lastKey);// get third batch
 starting with previous last key
//
 }

 // return last key processed, null when no records left
 String processPage(String username, String startKey) {
 String lastKey=null;
 IndexedSlicesQueryString, String, String
 indexedSlicesQuery =
 HFactory.createIndexedSlicesQuery(keyspace,
 stringSerializer, stringSerializer, stringSerializer);

 indexedSlicesQuery.addEqualsExpression(user, username);

 indexedSlicesQuery.setColumnNames(source,ip);

 indexedSlicesQuery.setColumnFamily(ourColumnFamilyName);
 indexedSlicesQuery.setStartKey(startKey);
 //
 
 indexedSlicesQuery.setRowCount(batchSize);
 QueryResultOrderedRowsString, String,
 String result =indexedSlicesQuery.execute();
 OrderedRowsString,String,String rows =
 result.get();
 for(RowString,String,String row:rows ){
 if (row==null) { continue; }
 totalCount++;
 String key = row.getKey();

 if (!startKey.equals(key))
 {lastKey=key;}
 }
 totalCount--;
 return lastKey;
 }






 On 10/13/2011 09:15 AM, Patricio Echagüe wrote:

 Hi Don. No it will not. IndexedSlicesQuery will read just the amount of
 rows specified by RowCount and will go to the DB to get the new page when
 needed.

  SetRowCount is doing indexClause.setCount(rowCount);

 On Mon, Oct 10, 2011 at 3:52 PM, Don Smith dsm...@likewise.com wrote:

 Hector's IndexedSlicesQuery has a setRowCount method that you can use to
 page through the results, as described in
 https://github.com/rantav/hector/wiki/User-Guide .

 rangeSlicesQuery.setRowCount(1001);
  .
 rangeSlicesQuery.setKeys(lastRow.getKey(),  );

 Is it efficient?  Specifically, suppose my query returns 100,000 results
 and I page through batches of 1000 at a time (making 100 executes of the
 query). Will it internally retrieve all the results each time (but pass only
 the desired set of 1000 or so to me)? Or will it optimize queries to avoid
 the duplication?  I presume the latter. :)

 Can IndexedSlicesQuery's setStartKey method be used for the same effect?

   Thanks,  Don






Re: Write everywhere, read anywhere

2011-08-03 Thread Patricio Echagüe
On Wed, Aug 3, 2011 at 4:00 PM, Philippe watche...@gmail.com wrote:

 Hello,
 I have a 3-node, RF=3, cluster configured to write at CL.ALL and read at
 CL.ONE. When I take one of the nodes down, writes fail which is what I
 expect.
 When I run a repair, I see data being streamed from those column
 families... that I didn't expect. How can the nodes diverge ? Does this mean
 that reading at CL.ONE may return inconsistent data ?


we abort the mutation before hand when there are enough replicas alive. If a
mutation went through and in the middle of it a replica goes down, in that
case you can write to some nodes and the request will Timeout.
In that case the CL.ONE may return inconsistence data.


 Question 2 : I've doing this rather than CL.QUORUM because I've been
 expecting CL.ONE to return data faster than CL.QUORUM. Is that a good
 assumption ? Yes, it's ok for writes to be down for a while.


When you hit a node that own the piece of data, CL.ONE will be faster as you
don't have to wait for a read across the network to reach another node.
For CL.QUORUM we fire reads in parallel to all the replicas and wait until
completing quorum. If I'm not wrong, in some cases the difference may be
negligible for CL.ONE and CL.QUORUM when you hit a coordinator that doesn't
own the data since you are going  over the network anyway (assuming all
nodes take the same time to reply)


 Thanks



Re: Counter Column in Cassandra

2011-06-13 Thread Patricio Echagüe
It's a column whose content represents a distributed counter.

http://wiki.apache.org/cassandra/Counters

On Mon, Jun 13, 2011 at 8:29 AM, Sijie YANG iyan...@gmail.com wrote:

 Hi, All

 I am newbie to cassandra. I have a simple question but don't find any clear
 answer by searching google:
 What's the meaning of counter column in Cassandra?

 Best





Re: Site Not Surviving a Single Cassandra Node Crash

2011-04-09 Thread Patricio Echagüe
What is the consistency level you are using ?

And as Ed said, if you can provide the stacktrace that would help too.

On Sat, Apr 9, 2011 at 7:02 PM, aaron morton aa...@thelastpickle.comwrote:

 btw, the nodes are a tad out of balance was that deliberate ?

 http://wiki.apache.org/cassandra/Operations#Token_selection
 http://wiki.apache.org/cassandra/Operations#Load_balancing


 Aaron

 On 10 Apr 2011, at 08:44, Ed Anuff wrote:

 Sounds like the problem might be on the hector side.  Lots of hector
 users on this list, but usually not a bad idea to ask on
 hector-us...@googlegroups.com (cc'd).

 The jetty servers stopping responding is a bit vague, somewhere in
 your logs is an error message that should shed some light on where
 things are going awry.  If you can find the exception that's being
 thrown in hector and post that, it'd make it much easier to help you
 out.

 Ed

 On Sat, Apr 9, 2011 at 12:11 PM, Vram Kouramajian
 vram.kouramaj...@gmail.com wrote:

 The hector clients are used as part of our jetty servers. And, the

 jetty servers stop responding when one of the Cassandra nodes go down.


 Vram


 On Sat, Apr 9, 2011 at 11:54 AM, Joe Stump j...@joestump.net wrote:

 Did the Cassandra cluster go down or did you start getting failures from
 the client when it routed queries to the downed node? The key in the client
 is to keep working around the ring if the initial node is down.


 --Joe


 On Apr 9, 2011, at 12:52 PM, Vram Kouramajian wrote:


 We have a 5 Cassandra nodes with the following configuration:


 Casandra Version: 0.6.11

 Number of Nodes: 5

 Replication Factor: 3

 Client: Hector 0.6.0-14

 Write Consistency Level: Quorum

 Read Consistency Level: Quorum

 Ring Topology:

   OwnsRange  Ring


 132756707369141912386052673276321963528

 192.168.89.153Up 4.15 GB   33.87%

 20237398133070283622632741498697119875 |--|

 192.168.89.155Up 5.17 GB   18.29%

 51358066040236348437506517944084891398 |   ^

 192.168.89.154Up 7.41 GB   33.97%

 109158969152851862753910401160326064203v   |

 192.168.89.152Up 5.07 GB   6.34%

 119944993359936402983569623214763193674|   ^

 192.168.89.151Up 4.22 GB   7.53%

 132756707369141912386052673276321963528|--|


 We believe that our setup should survive the crash of one of the

 Cassandra nodes. But, we had few crashes and the system stopped

 functioning until we brought back the Cassandra nodes.


 Any clues?


 Vram








Re: Re: Quorum, Hector, and datacenter preference

2011-03-24 Thread Patricio Echagüe
Doesn't CL=LOCAL_QUORUM solve your problem?

On Thu, Mar 24, 2011 at 9:33 AM, jonathan.co...@gmail.com wrote:

 Hi Nate -

 That sounds really promising and I'm looking forward to trying that out.

 My original question came up while thinking how to achieve quorum (with
 rf=3) with a loss of 1 of 2 data centers. My logic was that if you had 2
 replicas in the same data center where the client originally written to,
 then that client is guaranteed to be able to satisfy quorum, even if the
 other data center is unreachable.

 But I think there is no way to guarantee where the first write is written
 to. That would be based on the token range, which could very well be in any
 data center.

 Jon




 On Mar 24, 2011 3:05pm, Nate McCall n...@datastax.com wrote:
  We have a load balancing policy which selects the host best on latency
 
  and uses a Phi convict algorithm in a method similar to DynamicSnitch.
 
  Using this policy, you would inherently get the closest replica
 
  whenever possible as that would most likely be the best performing.
 
 
 
  This policy is still in trunk and 0.7.0 tip. We should have a new
 
  release out containing the above in the next few days.
 
 
 
  On Thu, Mar 24, 2011 at 8:46 AM, Jonathan Colby
 
  jonathan.co...@gmail.com wrote:
 
   Indeed I found the big flaw in my own logic.   Even writing to the
 local cassandra nodes does not guarantee where the replicas will end up.
 The decision where to write the first replica is based on the token ring,
 which is spread out on all nodes regardless of datacenter.   right ?
 
  
 
   On Mar 24, 2011, at 2:02 PM, Jonathan Colby wrote:
 
  
 
   Hi -
 
  
 
   Our cluster is spread between 2 datacenters.   We have a
 straight-forward IP assignment so that OldNetworkTopology (rackinferring
 snitch) works well.We have cassandra clients written in Hector in each
 of those data centers.   The Hector clients all have a list of all cassandra
 nodes across both data centers.  RF=3.
 
  
 
   Is there an order as to which data center gets the first write?In
 other words, would (or can) the Hector client do its first write to the
 cassandra nodes in its own data center?
 
  
 
   It would be ideal it Hector chose the local cassandra nodes.  That
 way, if one data center is unreachable, the Quorum of replicas in cassandra
 is still reached (because it was written to the working data center first).
 
  
 
   Otherwise, if the cassandra writes are really random from the Hector
 client point-of-view, a data center outage would result in a read failure
 for any data that has 2 replicas in the lost data center.
 
  
 
   Is anyone doing this?  Is there a flaw in my logic?
 
  
 
  
 
  
 
  
 



is it possible to mutate Columns and CounterColumn in the same batch mutation?

2011-03-24 Thread Patricio Echagüe
Hi folks, I'm modeling the partitioned counters into Hector and given the
non-inheritance of Thrift, I don't see how to add a ColumnCounter and a
Column in the same batch mutation.

Is it possible do achieve? or are both in fact different mutations?

Thanks


Re: TSocket timing out

2011-01-29 Thread Patricio Echagüe
The recommendation is to wait few milliseconds and retry.

For Example if you use Hector ( I don't think it is your case), Hector will
retry to different nodes in your cluster and the retry mechanisms is tunable
as well.

On Sat, Jan 29, 2011 at 2:20 PM, buddhasystem potek...@bnl.gov wrote:


 When I do a lot of inserts into my cluster (10k at a time) I get timeouts
 from Thrift, the TScoket.py module.

 What do I do?

 Thanks,

 Maxim

 --
 View this message in context:
 http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/TSocket-timing-out-tp5973548p5973548.html
 Sent from the cassandra-u...@incubator.apache.org mailing list archive at
 Nabble.com.



Re: Basic question on a write operation immediately followed by a read

2011-01-24 Thread Patricio Echagüe
Roshan, when a client invoke a write, the write goes first to commit log and
later to memtable. After that it returns to the client.

After it reaches the memtable, that data is ready to be read.

The reads consolidates de data from the memtables and sstables unless there
is a hit in the row cache.

does it help?

On Mon, Jan 24, 2011 at 8:57 PM, Roshan Dawrani roshandawr...@gmail.comwrote:

 Thanks for your inputs, Victor.

 In my app, it's a bit event driven.

 We do writes and fire events and listeners then read - so we can't predict
 how soon the reads will come. Sometimes they came too fast, which is better
 for our app, if we can have a Cassandra DB level understanding that they
 won't miss the writes, if they come too fast :-)

 Or, if there is anything we should do to make sure that reads happen in an
 assured manner.


 On Tue, Jan 25, 2011 at 10:22 AM, Victor Kabdebon 
 victor.kabde...@gmail.com wrote:

 Again don't take it as a 100% sure answer because it is not an area that I
 have really explored.

 So yes I think that reads are made from Memtables.
 Theoretically yes, however it is very unlikely : your get must be build
 and send before the commitlog updates the Memtable (which is like inserting
 in a Memtable, a matter of microseconds).
 Possible configuration : Just wait a second or so to do your get query
 (I imagine that it works after one second because you don't report this
 problem)... Other than that no not really. I have not done any application
 with those time constraints.

 Best regards,
 Victor Kabdebon

 2011/1/24 Roshan Dawrani roshandawr...@gmail.com

 On Tue, Jan 25, 2011 at 9:57 AM, Victor Kabdebon 
 victor.kabde...@gmail.com wrote:

  As far as I remember, please correct me if I am wrong, on a one node
 cluster :
 First Commitlog is updated then almost immediatly after order is send to
 the memtable to add this new insert. You might have a very short delay
 between the two. I don't know your configuration but especially if you
 insert from a distant server to a node you should look at their sync..
 Otherwise if it doesn't appear I can offer no explanation for this
 behavior...


 As of now, I am on an app server with an embedded cassandra server, so no
 possibility of clocks out-of-sync.

 So, I understand from you that client call returns after updating the
 commit log and updates to memtables are async after that - with
 how-much-ever short a delay tried by Cassandra?

 And the reads are always off memtables?

 So, theoretically, there is a possibility of a read missing a write
 because it has not come to memtables from the commit log yet?

 Is there anything that I can tell about my configuration that would help?






Re: Converting a TimeUUID to a long (timestamp) and vice-versa

2011-01-05 Thread Patricio Echagüe
Roshan, just a comment in your solution. The time returned is not a simple
long. It also contains some bits indicating the version.
On the other hand, you are assuming that the same machine is processing your
request and recreating a UUID base on a long you provide. The
clockseqAndNode id will vary if another machine takes care of the request
(referring to your use case) .

Is it possible for you to send the UUID to the view? I think that would be
the correct behavior as a simple long does not contain enough information to
recreate the original UUID.

Does it make sense?

On Wed, Jan 5, 2011 at 8:36 AM, Nate McCall n...@riptano.com wrote:

 It was our original intention on discussing this feature was to have
 back-and-forth conversion from timestamps (we were modelling similar
 functionality in Pycassa). It's lack of inclusion may have just been
 an oversight. We will add this in Hector trunk shortly - thanks for
 the complete code sample.



 On Tue, Jan 4, 2011 at 10:06 PM, Roshan Dawrani roshandawr...@gmail.com
 wrote:
  Ok, found the solution - finally ! - by applying opposite of what
  createTime() does in TimeUUIDUtils. Ideally I would have preferred for
 this
  solution to come from Hector API, so I didn't have to be tied to the
 private
  createTime() implementation.
 
  
  import java.util.UUID;
  import me.prettyprint.cassandra.utils.TimeUUIDUtils;
 
  public class TryHector {
  public static void main(String[] args) throws Exception {
  final long NUM_100NS_INTERVALS_SINCE_UUID_EPOCH =
  0x01b21dd213814000L;
 
  UUID u1 = TimeUUIDUtils.getUniqueTimeUUIDinMillis();
  final long t1 = u1.timestamp();
 
  long tmp = (t1 - NUM_100NS_INTERVALS_SINCE_UUID_EPOCH) / 1;
 
  UUID u2 = TimeUUIDUtils.getTimeUUID(tmp);
  long t2 = u2.timestamp();
 
  System.out.println(u2.equals(u1));
  System.out.println(t2 == t1);
  }
 
  }
   
 
 
  On Wed, Jan 5, 2011 at 8:15 AM, Roshan Dawrani roshandawr...@gmail.com
  wrote:
 
  If I use com.eaio.uuid.UUID directly, then I am able to do what I need
  (attached a Java program for the same), but unfortunately I need to deal
  with java.util.UUID in my application and I don't have its equivalent
  com.eaio.uuid.UUID at the point where I need the timestamp value.
 
  Any suggestion on how I can achieve the equivalent using Hector
 library's
  TimeUUIDUtils?
 
  On Wed, Jan 5, 2011 at 7:21 AM, Roshan Dawrani roshandawr...@gmail.com
 
  wrote:
 
  Hi Victor / Patricio,
 
  I have been using Hector library's TimeUUIDUtils. I also just looked at
  TimeUUIDUtilsTest also but didn't find anything similar being tested
 there.
 
  Here is what I am trying and it's not working - I am creating a Time
  UUID, extracting its timestamp value and with that I create another
 Time
  UUID and I am expecting both time UUIDs to have the same timestamp()
 value -
  am I doing / expecting something wrong here?:
 
  ===
  import java.util.UUID;
  import me.prettyprint.cassandra.utils.TimeUUIDUtils;
 
  public class TryHector {
  public static void main(String[] args) throws Exception {
  UUID someUUID = TimeUUIDUtils.getUniqueTimeUUIDinMillis();
  long timestamp1 = someUUID.timestamp();
 
  UUID otherUUID = TimeUUIDUtils.getTimeUUID(timestamp1);
  long timestamp2 = otherUUID.timestamp();
 
  System.out.println(timestamp1);
  System.out.println(timestamp2);
  }
  }
  ===
 
  I have to create the timestamp() equivalent of my time UUIDs so I can
  send it to my UI client, for which it will be simpler to compare long
  timestamp than comparing UUIDs. Then for the long timestamp chosen by
 the
  client, I need to re-create the equivalent time UUID and go and filter
 the
  data from Cassandra database.
 
  --
  Roshan
  Blog: http://roshandawrani.wordpress.com/
  Twitter: @roshandawrani
  Skype: roshandawrani
 
  On Wed, Jan 5, 2011 at 1:32 AM, Victor Kabdebon
  victor.kabde...@gmail.com wrote:
 
  Hi Roshan,
  Sorry I misunderstood your problem.It is weird that it doesn't work,
 it
  works for me...
  As Patricio pointed out use hector standard way of creating TimeUUID
  and tell us if it still doesn't work.
  Maybe you can paste here some of the code you use to query your
 columns
  too.
 
  Victor K.
  http://www.voxnucleus.fr
 
  2011/1/4 Patricio Echagüe patric...@gmail.com
 
  In Hector framework, take a look at TimeUUIDUtils.java
 
  You can create a UUID using   TimeUUIDUtils.getTimeUUID(long time);
 or
  TimeUUIDUtils.getTimeUUID(ClockResolution clock)
 
  and later on, TimeUUIDUtils.getTimeFromUUID(..) or just
  UUID.timestamp();
 
  There are some example in TimeUUIDUtilsTest.java
 
  Let me know if it helps.
 
 
 
  On Tue, Jan 4

Re: Converting a TimeUUID to a long (timestamp) and vice-versa

2011-01-05 Thread Patricio Echagüe
Roshan, the first 64 bits does contain the version. The method
UUID.timestamp() indeed takes it out before returning. You are right in that
point. I based my comment on the UUID spec.

What I am not convinced is that the framework should provide support to
create an almost identical UUID where only the timestamp is the same
(between the two UUIDs).

UUID.equals() and UUID.compareTo() does compare the whole bit set to say
that two objects are the same. It does compare the first 64 bits to avoid
comparing the rest in case the most significant bits already show a
difference.

But coming to your point, should Hector provide that kind of support or do
you feel that the problem you have is specific to your application ?

I feel like UUID is as it says an Unique Identifier and creating a sort-of
UUID based on a previous timestamp disregarding the least significant bits
is not the right support Hector should expose.

Thoughts?

On Wed, Jan 5, 2011 at 6:30 PM, Roshan Dawrani roshandawr...@gmail.comwrote:

 Hi Patricio,

 Thanks for your comment. Replying inline.

 2011/1/5 Patricio Echagüe patric...@gmail.com

 Roshan, just a comment in your solution. The time returned is not a simple
 long. It also contains some bits indicating the version.


 I don't think so. The version bits from the most significant 64 bits of the
 UUID are not used in creating timestamp() value. It uses only time_low,
 time_mid and time_hi fields of the UUID and not version, as documented here:

 http://download.oracle.com/javase/1.5.0/docs/api/java/util/UUID.html#timestamp%28%29.


 When the same timestamp comes back and I call
 TimeUUIDUtils.getTimeUUID(tmp), it internally puts the version back in it
 and makes it a Time UUID.


 On the other hand, you are assuming that the same machine is processing
 your request and recreating a UUID base on a long you provide. The
 clockseqAndNode id will vary if another machine takes care of the request
 (referring to your use case) .


 When I recreate my UUID using the timestamp() value, my requirement is not
 to arrive at the exactly same UUID from which timestamp() was derived in the
 first place. I need a recreated UUID *that should be equivalent in terms
 of its time value* - so that filtering the time-sorted columns using this
 time UUID works fine. So, if the lower order 64 bits (clockseq + node)
 become different, I don't think it is of any concern because the UUID
 comparison first goes by most significant 64 bits, i.e. the time value and
 that should settle the time comparison in my use case.


 Is it possible for you to send the UUID to the view? I think that would be
 the correct behavior as a simple long does not contain enough information to
 recreate the original UUID.


 In my use case, the non-Java clients will be receiving a number of such
 UUIDs then and they will have to sort them chronologically. I wanted to
 avoid bits based UUID comparison in these clients. Long timestamp() value is
 perfect for such ordering of data elements and I send much lesser amount of
 data over the wire.


  Does it make sense?


 Nearly everything makes sense to me :-)

 --
 Roshan
 Blog: http://roshandawrani.wordpress.com/
 Twitter: @roshandawrani http://twitter.com/roshandawrani
 Skype: roshandawrani




-- 
Patricio.-


Re: Converting a TimeUUID to a long (timestamp) and vice-versa

2011-01-04 Thread Patricio Echagüe
In Hector framework, take a look at TimeUUIDUtils.java

You can create a UUID using   TimeUUIDUtils.getTimeUUID(long time); or
TimeUUIDUtils.getTimeUUID(ClockResolution clock)

and later on, TimeUUIDUtils.getTimeFromUUID(..) or just UUID.timestamp();

There are some example in TimeUUIDUtilsTest.java

Let me know if it helps.



On Tue, Jan 4, 2011 at 10:27 AM, Roshan Dawrani roshandawr...@gmail.comwrote:

 Hello Victor,

 It is actually not that I need the 2 UUIDs to be exactly same - they need
 to be same timestamp wise.

 So, what I need is to extract the timestamp portion from a time UUID (say,
 U1) and then later in the cycle, use the same long timestamp value to
 re-create a UUID (say, U2) that is equivalent of the previous one in terms
 of its timestamp portion - i.e., I should be able to give this U2 and filter
 the data from a column family - and it should be same as if I had used the
 original UUID U1.

 Does it make any more sense than before? Any way I can do that?

 rgds,
 Roshan


 On Tue, Jan 4, 2011 at 11:46 PM, Victor Kabdebon 
 victor.kabde...@gmail.com wrote:

 Hello Roshan,

 Well it is normal to do not be able to get the exact same UUID from a
 timestamp, it is its purpose.
 When you create an UUID you have in fact two information : random 64 bits
 number - 64 bits timestamp. You put that together and you have your uuid.
 .
 So unless you save your random number two UUID for the same milli( or
 micro) second are different.

 Best regards,
 Victor K.
 http://www.voxnucleus.fr

 2011/1/4 Roshan Dawrani roshandawr...@gmail.com

 Hi,
 I am having a little difficulty converting a time UUID to its timestamp
 equivalent and back. Can someone please help?

 Here is what I am trying. Is it not the right way to do it?

 ===
 UUID someUUID = TimeUUIDUtils.getUniqueTimeUUIDinMillis();

 long time = someUUID.timestamp(); /* convery from UUID to a long
 timestamp */
 UUID otherUUID = TimeUUIDUtils.getTimeUUID(time); /* do the
 reverse and get back the UUID from timestamp */

 System.out.println(someUUID); /* someUUID and otherUUID should be
 same, but are different */
 System.out.println(otherUUID);
 ===

 --
 Roshan
 Blog: http://roshandawrani.wordpress.com/
 Twitter: @roshandawrani http://twitter.com/roshandawrani
 Skype: roshandawrani





 --
 Roshan
 Blog: http://roshandawrani.wordpress.com/
 Twitter: @roshandawrani http://twitter.com/roshandawrani
 Skype: roshandawrani




-- 
Patricio.-


Re: Any GUI for Cassandra database on Windows?

2010-12-29 Thread Patricio Echagüe
The error you mentioned sounds like one of the server/client is using
TFramedTransport and the other one TSocket. I saw the same error when that
happened.

On Mon, Dec 27, 2010 at 9:15 PM, Roshan Dawrani roshandawr...@gmail.comwrote:

 Sorry. Will do that.

 I am using Cassandra 0.7.0-rc2.

 I will try this DB client. Thanks.


 On Tue, Dec 28, 2010 at 10:41 AM, Narendra Sharma 
 narendra.sha...@gmail.com wrote:

 Please do mention the Cassandra version you are using in all ur queries.
 It helps.

 Try https://github.com/driftx/chiton

 Thanks,
 Naren


 On Mon, Dec 27, 2010 at 7:37 PM, Roshan Dawrani 
 roshandawr...@gmail.comwrote:

 Hi,

 Is there a GUI client for a Cassandra database for a Windows based setup?

 I tried the one available at http://code.google.com/p/cassandra-gui/,
 but it always fails to connect with error: Cannot read. Remote site has
 closed. Tried to read 4 bytes, but only got 0 bytes.

 --
 Roshan
 Blog: http://roshandawrani.wordpress.com/
 Twitter: @roshandawrani http://twitter.com/roshandawrani
 Skype: roshandawrani






-- 
Patricio.-


Re: Is it possible to read from one row, several SuperColumns with all their Columns in one call?

2010-07-22 Thread Patricio Echagüe
Hi Aaron, the problem I have is that those UUIDs are random numbers.
2,3,4 are not sequential unfortunately. I don't think there is an API
like mutiget_slice for key but for Super Column names.

Is there any other way to specify a list of super column names to read
where those names are not sequential?

thanks


On Wed, Jul 21, 2010 at 5:58 PM, Aaron Morton aa...@thelastpickle.com wrote:
 Take a look at the  get_slice  function http://wiki.apache.org/cassandra/API

 You could send one with a ColumnParent that only specifies the ColumnFamily
 and a SlicePredicate with a SliceRange where the start and finish values are
 empty strings. Set the count to an appropriate level to get them all (e.g.
 1000) or make multiple calls.


 Aaron


 On 22 Jul, 2010,at 12:05 PM, Patricio Echagüe patric...@gmail.com wrote:

 Hi all, apologize before hand if this question sounds a bit dumb but I
 don't see what API I should use (if there is any)

 this is my model:

 row key A:
 SC_UUID_1:
 Col1, Col2, Col3
 SC_UUID_2:
 Col1, Col2, Col3
 SC_UUID_3:
 Col1, Col2, Col3
 SC_UUID_4:
 Col1, Col2, Col3
 SC_UUID_5:
 Col1, Col2, Col3

 SC_UUID(i) are random UUIDs.

 Is there any way to read in one call from row A, the SC 2,3,4 with all
 their columns? The amount of columns in every SuperColumn is not big
 at all. normally less than 20.

 Thanks
 --
 Patricio-




-- 
Patricio.-


Re: Is it possible to read from one row, several SuperColumns with all their Columns in one call?

2010-07-22 Thread Patricio Echagüe
Hey thanks Aaron. It finally worked. The API reference looked a bit
confusing to me.

I used (as you suggested):
ColumnParent parent = new ColumnParent(
ColumnFamily name);
SlicePredicate sp = new SlicePredicate();
sp.setColumn_names( list of super column names);

after calling get_slice() as result, i got the super columns I
passed in the list with ALLl their columns in one call.

so now, just IF I WANTED TO, would it be possible to get just a subset
of columns contained in those supercolumns instead of all of them
assuming that the amount of columns are lot and for performance issues
i want to avoid moving a lot of data over the network?

2010/7/22 Patricio Echagüe patric...@gmail.com:
 Hi Aaron, the problem I have is that those UUIDs are random numbers.
 2,3,4 are not sequential unfortunately. I don't think there is an API
 like mutiget_slice for key but for Super Column names.

 Is there any other way to specify a list of super column names to read
 where those names are not sequential?

 thanks


 On Wed, Jul 21, 2010 at 5:58 PM, Aaron Morton aa...@thelastpickle.com wrote:
 Take a look at the  get_slice  function http://wiki.apache.org/cassandra/API

 You could send one with a ColumnParent that only specifies the ColumnFamily
 and a SlicePredicate with a SliceRange where the start and finish values are
 empty strings. Set the count to an appropriate level to get them all (e.g.
 1000) or make multiple calls.


 Aaron


 On 22 Jul, 2010,at 12:05 PM, Patricio Echagüe patric...@gmail.com wrote:

 Hi all, apologize before hand if this question sounds a bit dumb but I
 don't see what API I should use (if there is any)

 this is my model:

 row key A:
 SC_UUID_1:
 Col1, Col2, Col3
 SC_UUID_2:
 Col1, Col2, Col3
 SC_UUID_3:
 Col1, Col2, Col3
 SC_UUID_4:
 Col1, Col2, Col3
 SC_UUID_5:
 Col1, Col2, Col3

 SC_UUID(i) are random UUIDs.

 Is there any way to read in one call from row A, the SC 2,3,4 with all
 their columns? The amount of columns in every SuperColumn is not big
 at all. normally less than 20.

 Thanks
 --
 Patricio-




 --
 Patricio.-




-- 
Patricio.-


Re: Understanding atomicity in Cassandra

2010-07-20 Thread Patricio Echagüe
Hi, regarding the retrying strategy, I understand that it might make
sense assuming that the client can actually perform a retry.

We are trying to build a fault tolerance solution based on Cassandra.
In some scenarios, the client machine can go down during a
transaction.

Would it be bad design to store all the data that need to be
consistent under one big key? In this case the batch_mutate operations
will not be big since just a small part is updated/add at a time. But
at least we know that the operation either succeeded or failed.

We basically have:

CF: usernames (similar to Twitter model)
SCF: User_tree (it has all the information related to the user)

Thanks

On Mon, Jul 19, 2010 at 9:40 PM, Alex Yiu bigcontentf...@gmail.com wrote:

 Hi, Stuart,
 If I may paraphrase what Jonathan said, typically your batch_mutate
 operation is idempotent.
 That is, you can replay / retry the same operation within a short timeframe
 without any undesirable side effect.
 The assumption behind the short timeframe here refers to: there is no
 other concurrent writer trying to write anything conflicting in an
 interleaving fashion.
 Imagine that if there was another writer trying to write:
  some-uuid-1: {
    path: /foo/bar,
    size: 10
  },
 ...
 {
  /foo/bar: {
    uuid: some-uuid-1
  },
 Then, there is a chance of 4 write operations (two writes for /a/b/c into
 2 CFs and two writes for /foo/bar into 2) would interleave each other and
 create an undesirable result.
 I guess that is not a likely situation in your case.
 Hopefully, my email helps.
 See also:
 http://wiki.apache.org/cassandra/FAQ#batch_mutate_atomic

 Regards,
 Alex Yiu


 On Fri, Jul 9, 2010 at 11:50 AM, Jonathan Ellis jbel...@gmail.com wrote:

 typically you will update both as part of a batch_mutate, and if it
 fails, retry the operation.  re-writing any part that succeeded will
 be harmless.

 On Thu, Jul 8, 2010 at 11:13 AM, Stuart Langridge
 stuart.langri...@canonical.com wrote:
  Hi, Cassandra people!
 
  We're looking at Cassandra as a possible replacement for some parts of
  our database structures, and on an early look I'm a bit confused about
  atomicity guarantees and rollbacks and such, so I wanted to ask what
  standard practice is for dealing with the sorts of situation I outline
  below.
 
  Imagine that we're storing information about files. Each file has a path
  and a uuid, and sometimes we need to look up stuff about a file by its
  path and sometimes by its uuid. The best way to do this, as I understand
  it, is to store the data in Cassandra twice: once indexed by nodeid and
  once by path. So, I have two ColumnFamilies, one indexed by uuid:
 
  {
   some-uuid-1: {
     path: /a/b/c,
     size: 10
   },
   some-uuid-2 {
     ...
   },
   ...
  }
 
  and one indexed by path
 
  {
   /a/b/c: {
     uuid: some-uuid-1,
     size: 10
   },
   /d/e/f {
     ...
   },
   ...
  }
 
  So, first, do please correct me if I've misunderstood the terminology
  here (and I've shown a short form of ColumnFamily here, as per
  http://arin.me/blog/wtf-is-a-supercolumn-cassandra-data-model).
 
  The thing I don't quite get is: what happens when I want to add a new
  file? I need to add it to both these ColumnFamilies, but there's no add
  it to both atomic operation. What's the way that people handle the
  situation where I add to the first CF and then my program crashes, so I
  never added to the second? (Assume that there is lots more data than
  I've outlined above, so that put it all in one SuperColumnFamily,
  because that can be updated atomically won't work because it would end
  up with our entire database in one SCF). Should we add to one, and then
  if we fail to add to the other for some reason continually retry until
  it works? Have a garbage collection procedure which finds
  discrepancies between indexes like this and fixes them up and run it
  from cron? We'd love to hear some advice on how to do this, or if we're
  modelling the data in the wrong way and there's a better way which
  avoids these problems!
 
  sil
 
 
 



 --
 Jonathan Ellis
 Project Chair, Apache Cassandra
 co-founder of Riptano, the source for professional Cassandra support
 http://riptano.com





-- 
Patricio.-


Re: Is there any way to detect when a node is down so I can failover more effectively?

2010-06-04 Thread Patricio Echagüe
Thanks Johathan

On Wed, Jun 2, 2010 at 11:17 PM, Jonathan Ellis jbel...@gmail.com wrote:

 you're overcomplicating things.

 just connect to *a* node, and if it happens to be down, try a different
 one.

 nodes being down should be a rare event, not a normal condition.  no
 need to optimize for it so much.

 also see http://wiki.apache.org/cassandra/FAQ#node_clients_connect_to

 2010/6/1 Patricio Echagüe patric...@gmail.com:
  Hi all, I'm using Hector framework to interact with Cassandra and at
 trying
  to handle failover more effectively I found it a bit complicated to fetch
  all cassandra nodes that are up and running.
 
  My goal is to keep an up-to-date list of active/up Cassandra servers to
  provide HEctor every time I need to execute against the db.
 
  I've seen this Thrift  method: get_string_property(token map) but it
  returns the nodes in the ring no matter is the node is down.
 
 
 
  Any advice?
 
  --
  Patricio.-
 



 --
 Jonathan Ellis
 Project Chair, Apache Cassandra
 co-founder of Riptano, the source for professional Cassandra support
 http://riptano.com




-- 
Patricio.-


Is there any way to detect when a node is down so I can failover more effectively?

2010-06-01 Thread Patricio Echagüe
Hi all, I'm using Hector framework to interact with Cassandra and at trying
to handle failover more effectively I found it a bit complicated to fetch
all cassandra nodes that are up and running.

My goal is to keep an up-to-date list of active/up Cassandra servers to
provide HEctor every time I need to execute against the db.

I've seen this Thrift  method: get_string_property(token map) but it
returns the nodes in the ring no matter is the node is down.



Any advice?

-- 
Patricio.-


Help to understand a strange behavior with DCQUORUM

2010-05-28 Thread Patricio Echagüe
Hi all, I need to help to understand how DCQUORUM works.

This is my setup:

- Cluster with 3 Cassandra Nodes
- RF = 3
- ReplicatePlacementStrategy = RackUnawareStrategy

My test:
- I write/read with DCQUORUM

Results:
- While the 3 nodes are UP, all my writes and read succeed. (the nodes are
reached, and the third one -to complete the RF=3- is done my replication,
right?)
- When I killed one node, the test FAILED with UnavailableException
- When I performed the same test but with QUORUM instead of DCQUORUM, It
succeeded.

Could someone explain please why reads and writes with DCQUORUM worked fine
while the 3 nodes were up and running but failed when 1 was down even thouch
I have only one Data Center?

Thanks in advance

-- 
Patricio.-


Re: Basic Architecture Question

2010-05-01 Thread Patricio Echagüe
Roger, if you include the last read key as the start key for the next API
call, will that retrieve the same key/row twice?

The documentation says that both keys (start, finish) are included.
Thanks

On Thu, Apr 29, 2010 at 1:31 PM, Brandon Williams dri...@gmail.com wrote:

 On Thu, Apr 29, 2010 at 10:19 AM, David Boxenhorn da...@lookin2.comwrote:

 So now we can do any kind of range queries, not just for getting all
 keys as Jesse said?


 With RP, the key ranges are based on the MD5 sum of the key, so it's really
 only useful for getting all keys, or obtaining a semi-random row.

 -Brandon




-- 
Patricio.-