@Test public void testCancelingUpdates() throws Exception { IndexUpdateManager manager = new IndexUpdateManager(); long ts1 = 10, ts2 = 11; Delete d = new Delete(row, ts1); Put p = new Put(row, ts2); manager.addIndexUpdate(table, d); manager.addIndexUpdate(table, p); List<Mutation> pending = new ArrayList<Mutation>(); pending.add(p); pending.add(d); validate(manager, pending); Delete d2 = new Delete(row, ts2); manager.addIndexUpdate(table, d2); pending.add(d); validate(manager, pending); Delete d3 = new Delete(row, ts2); manager.addIndexUpdate(table, d3); pending.add(d); validate(manager, pending); manager = new IndexUpdateManager(); manager.addIndexUpdate(table, d2); manager.addIndexUpdate(table, p); validate(manager, Collections.<Mutation> emptyList()); manager = new IndexUpdateManager(); manager.addIndexUpdate(table, p); byte[] row1 = Bytes.toBytes("row1"); Put p1 = new Put(row1, ts1); manager.addIndexUpdate(table, p1); Delete d4 = new Delete(row1, ts1); manager.addIndexUpdate(table, d4); pending.clear(); pending.add(p); validate(manager, pending); }
public void addIndexUpdate(byte[] tableName, Mutation m) { ImmutableBytesPtr key = new ImmutableBytesPtr(tableName); Collection<Mutation> updates = map.get(key); if (updates == null) { updates = new SortedCollection<Mutation>(COMPARATOR); map.put(key, updates); } fixUpCurrentUpdates(updates, m); }
IndexUpdateManager { public void addIndexUpdate(byte[] tableName, Mutation m) { ImmutableBytesPtr key = new ImmutableBytesPtr(tableName); Collection<Mutation> updates = map.get(key); if (updates == null) { updates = new SortedCollection<Mutation>(COMPARATOR); map.put(key, updates); } fixUpCurrentUpdates(updates, m); } }
IndexUpdateManager { public void addIndexUpdate(byte[] tableName, Mutation m) { ImmutableBytesPtr key = new ImmutableBytesPtr(tableName); Collection<Mutation> updates = map.get(key); if (updates == null) { updates = new SortedCollection<Mutation>(COMPARATOR); map.put(key, updates); } fixUpCurrentUpdates(updates, m); }  }
IndexUpdateManager { public void addIndexUpdate(byte[] tableName, Mutation m) { ImmutableBytesPtr key = new ImmutableBytesPtr(tableName); Collection<Mutation> updates = map.get(key); if (updates == null) { updates = new SortedCollection<Mutation>(COMPARATOR); map.put(key, updates); } fixUpCurrentUpdates(updates, m); }  void addIndexUpdate(byte[] tableName, Mutation m); List<Pair<Mutation, byte[]>> toMap(); void addAll(Collection<Pair<Mutation, String>> updates); @Override String toString(); }
IndexUpdateManager { public void addIndexUpdate(byte[] tableName, Mutation m) { ImmutableBytesPtr key = new ImmutableBytesPtr(tableName); Collection<Mutation> updates = map.get(key); if (updates == null) { updates = new SortedCollection<Mutation>(COMPARATOR); map.put(key, updates); } fixUpCurrentUpdates(updates, m); }  void addIndexUpdate(byte[] tableName, Mutation m); List<Pair<Mutation, byte[]>> toMap(); void addAll(Collection<Pair<Mutation, String>> updates); @Override String toString(); public Comparator<Mutation> COMPARATOR; }