rm.apply();
// test that the index query fetches this version
IndexExpression expr = new IndexExpression(colName, IndexOperator.EQ, val1);
List<IndexExpression> clause = Arrays.asList(expr);
IDiskAtomFilter filter = new IdentityQueryFilter();
Range<RowPosition> range = Util.range("", "");
List<Row> rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
assertEquals(1, rows.size());
// force a flush and retry the query, so our index isn't being read from a memtable
table.getColumnFamilyStore(cfName).forceBlockingFlush();
rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
assertEquals(1, rows.size());
// now apply another update, but force the index update to be skipped
rm = new RowMutation(keySpace, rowKey);
rm.add(new QueryPath(cfName, null, compositeName), val2, 1);
table.apply(rm, true, false);
// Now searching the index for either the old or new value should return 0 rows
// because the new value was not indexed and the old value should be ignored
// (and in fact purged from the index cf).
// first check for the old value
rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
assertEquals(0, rows.size());
// now check for the updated value
expr = new IndexExpression(colName, IndexOperator.EQ, val2);
clause = Arrays.asList(expr);
filter = new IdentityQueryFilter();
range = Util.range("", "");
rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
assertEquals(0, rows.size());
// now, reset back to the original value, still skipping the index update, to
// make sure the value was expunged from the index when it was discovered to be inconsistent
rm = new RowMutation(keySpace, rowKey);
rm.add(new QueryPath(cfName, null , compositeName), val1, 2);
table.apply(rm, true, false);
expr = new IndexExpression(colName, IndexOperator.EQ, val1);
clause = Arrays.asList(expr);
filter = new IdentityQueryFilter();
range = Util.range("", "");
rows = table.getColumnFamilyStore(cfName).search(clause, range, 100, filter);
assertEquals(0, rows.size());
}