Search code examples
cassandrahector

Hector BatchInserts and BatchSizeHint


I am currently doing a batch insert of 2000 columns across a few rowkeys to cassandra. The way i do this is by using addinsertion

while( cond... ){
myMutator.addInsertion(keyId, columnfamilyName,compositeColumn);
totalCount++;

    if(totalCount % 2000 == 0){
       myMutator.execute();
    }
}

Is there any way to get the number of columns added to the batch without using the totalCount variable. BatchMutation.getSize() returns the number of keys for which the updation are added in the batch. I am wondering what is the use of sizeHint while creating the mutator. I am unable to get much details by looking at the source code of hector. All i can see is it is creating the internal mutationMap and mutList to the number of rows and number of columns respectively.


Solution

  • Looks like hector doesn't keep track of the number of columns. So i am going with the totalcount approach i was using earlier.