public void updateColumnCount(Key key) {
if (isDefaultLG && columnFamilies == null) {
if (previousColumnFamilies.size() > 0) {
// only do this check when there are previous column families
ByteSequence cf = key.getColumnFamilyData();
if (previousColumnFamilies.contains(cf)) {
throw new IllegalArgumentException("Added column family \"" + cf + "\" to default locality group that was in previous locality group");
}
}
// no longer keeping track of column families, so return
return;
}
ByteSequence cf = key.getColumnFamilyData();
MutableLong count = columnFamilies.get(cf);
if (count == null) {
if (!isDefaultLG) {
throw new IllegalArgumentException("invalid column family : " + cf);
}
if (previousColumnFamilies.contains(cf)) {
throw new IllegalArgumentException("Added column family \"" + cf + "\" to default locality group that was in previous locality group");
}
if (columnFamilies.size() > Writer.MAX_CF_IN_DLG) {
// stop keeping track, there are too many
columnFamilies = null;
return;
}
count = new MutableLong(0);
columnFamilies.put(new ArrayByteSequence(cf.getBackingArray(), cf.offset(), cf.length()), count);
}
count.increment();