String colName = data.getColumn();
int rowCounter = 0;
int changedCounter = 0;
while(indexView2.next()) {
IndexPoint pt = indexView2.getCurrent();
KeyValue<TypedRow> row = keyToRow.get(pt.getKey());
if(row.getException() != null) {
System.out.println("Entity with rowkey="+pt.getKeyAsString()+" does not exist, WILL remove from index");
s.removeIndexPoint(pt, data.getPartitionBy(), data.getPartitionBy());
changedCounter++;
} else {
TypedRow val = row.getValue();
TypedColumn column = val.getColumn(colName);
Object value = column.getValue();
if(!valuesEqual(pt.getIndexedValue(), value)) {
System.out.println("Entity with rowkey="+pt.getKeyAsString()+" has extra incorrect index point with value="+pt.getIndexedValueAsString()+" correct value should be="+column.getValueAsString());
s.removeIndexPoint(pt, data.getPartitionBy(), data.getPartitionId());
IndexColumn col = new IndexColumn();
col.setColumnName(colName);
col.setPrimaryKey(pt.getRawKey());
byte[] indValue = column.getValueRaw();
col.setIndexedValue(indValue);
IndexPoint newPoint = new IndexPoint(pt.getRowKeyMeta(), col , data.getColumnMeta());
s.addIndexPoint(newPoint, data.getPartitionBy(), data.getPartitionId());
changedCounter++;
}
}
rowCounter++;