Hey there,
I'm in the process of migrating our applications to Hector. We did quite some testing/profiling with our app, and we noticed that, while iterating over a collection of results, removing the item from the collection significantly reduces the memory pressure.
Some pseudo-code might be more meaningful here:
Iterator<Column> it = cassandra.getColumns(....).iterator();
while(it.hasNext()){
Column c = it.next;
it.remove(); <----- this helps a lot
// mess with the column....
}
I noticed that this not always possible with Hector. For instance OrderedSuperRows.getList returns an unmodifiable list, so does HSuperColumnImpl#getColumns.
I don't see why the user will be forbidden to alter the returned collections.
I found only 4 valid occurences, so the change seems small.
HSuperColumnImpl.java
(112: 23) return Collections.unmodifiableList(columns);
OrderedRowsImpl.java
(40: 23) return Collections.unmodifiableList(new ArrayList<Row<K, N, V>>(rowsList));
OrderedSuperRowsImpl.java
(38: 23) return Collections.unmodifiableList(rowsList);
SuperSliceImpl.java
(47: 23) return Collections.unmodifiableList(columnsList);
Would you guys agree to drop this constraint?
Alexis
ps: as of today the immutability constraint is not always applied. For instance SuperRowsImpl#iterator is mutable.