@Test public void testMergomatic() throws Exception { int i; MergeTester test = new MergeTester(10, 20, 30); test.mergomatic(null, "table", null, null, 1000, false); assertEquals(1, test.merges.size()); assertArrayEquals(new int[] {10, 20, 30}, sizes(test.merges.get(i = 0))); test = new MergeTester(1, 2, 100, 1000, 17, 1000, 4, 5, 6, 900); test.mergomatic(null, "table", null, null, 1000, false); assertEquals(2, test.merges.size()); assertArrayEquals(new int[] {1, 2, 100}, sizes(test.merges.get(i = 0))); assertArrayEquals(new int[] {4, 5, 6, 900}, sizes(test.merges.get(++i))); test = new MergeTester(1, 2, 100, 1000, 17, 1000, 4, 5, 6, 900); test.mergomatic(null, "table", null, null, 1000, true); assertEquals(3, test.merges.size()); assertArrayEquals(new int[] {1, 2, 100}, sizes(test.merges.get(i = 0))); assertArrayEquals(new int[] {17, 1000}, sizes(test.merges.get(++i))); assertArrayEquals(new int[] {4, 5, 6, 900}, sizes(test.merges.get(++i))); test = new MergeTester(1, 2, 1000, 17, 1000, 4, 5, 6, 900); test.mergomatic(null, "table", new Text("00004"), null, 1000, false); assertEquals(1, test.merges.size()); assertArrayEquals(new int[] {4, 5, 6, 900}, sizes(test.merges.get(i = 0))); test = new MergeTester(1, 2, 1000, 17, 1000, 4, 5, 6, 900); test.mergomatic(null, "table", null, new Text("00004"), 1000, false); assertEquals(1, test.merges.size()); assertArrayEquals(new int[] {1, 2}, sizes(test.merges.get(i = 0))); test = new MergeTester(1, 2, 1000, 17, 1000, 4, 5, 6, 900); test.mergomatic(null, "table", new Text("00002"), new Text("00004"), 1000, true); assertEquals(1, test.merges.size()); assertArrayEquals(new int[] {17, 1000}, sizes(test.merges.get(i = 0))); test = new MergeTester(100, 250, 500, 600, 100, 200, 500, 200); test.mergomatic(null, "table", null, null, 1000, false); assertEquals(3, test.merges.size()); assertArrayEquals(new int[] {100, 250, 500}, sizes(test.merges.get(i = 0))); assertArrayEquals(new int[] {600, 100, 200}, sizes(test.merges.get(++i))); assertArrayEquals(new int[] {500, 200}, sizes(test.merges.get(++i))); }
public void mergomatic(AccumuloClient client, String table, Text start, Text end, long goalSize, boolean force) throws MergeException { try { if (table.equals(MetadataTable.NAME)) { throw new IllegalArgumentException("cannot merge tablets on the metadata table"); } List<Size> sizes = new ArrayList<>(); long totalSize = 0; Iterator<Size> sizeIterator = getSizeIterator(client, table, start, end); while (sizeIterator.hasNext()) { Size next = sizeIterator.next(); totalSize += next.size; sizes.add(next); if (totalSize > goalSize) { totalSize = mergeMany(client, table, sizes, goalSize, force, false); } } if (sizes.size() > 1) mergeMany(client, table, sizes, goalSize, force, true); } catch (Exception ex) { throw new MergeException(ex); } }
Merge { public void mergomatic(AccumuloClient client, String table, Text start, Text end, long goalSize, boolean force) throws MergeException { try { if (table.equals(MetadataTable.NAME)) { throw new IllegalArgumentException("cannot merge tablets on the metadata table"); } List<Size> sizes = new ArrayList<>(); long totalSize = 0; Iterator<Size> sizeIterator = getSizeIterator(client, table, start, end); while (sizeIterator.hasNext()) { Size next = sizeIterator.next(); totalSize += next.size; sizes.add(next); if (totalSize > goalSize) { totalSize = mergeMany(client, table, sizes, goalSize, force, false); } } if (sizes.size() > 1) mergeMany(client, table, sizes, goalSize, force, true); } catch (Exception ex) { throw new MergeException(ex); } } }
Merge { public void mergomatic(AccumuloClient client, String table, Text start, Text end, long goalSize, boolean force) throws MergeException { try { if (table.equals(MetadataTable.NAME)) { throw new IllegalArgumentException("cannot merge tablets on the metadata table"); } List<Size> sizes = new ArrayList<>(); long totalSize = 0; Iterator<Size> sizeIterator = getSizeIterator(client, table, start, end); while (sizeIterator.hasNext()) { Size next = sizeIterator.next(); totalSize += next.size; sizes.add(next); if (totalSize > goalSize) { totalSize = mergeMany(client, table, sizes, goalSize, force, false); } } if (sizes.size() > 1) mergeMany(client, table, sizes, goalSize, force, true); } catch (Exception ex) { throw new MergeException(ex); } }  }
Merge { public void mergomatic(AccumuloClient client, String table, Text start, Text end, long goalSize, boolean force) throws MergeException { try { if (table.equals(MetadataTable.NAME)) { throw new IllegalArgumentException("cannot merge tablets on the metadata table"); } List<Size> sizes = new ArrayList<>(); long totalSize = 0; Iterator<Size> sizeIterator = getSizeIterator(client, table, start, end); while (sizeIterator.hasNext()) { Size next = sizeIterator.next(); totalSize += next.size; sizes.add(next); if (totalSize > goalSize) { totalSize = mergeMany(client, table, sizes, goalSize, force, false); } } if (sizes.size() > 1) mergeMany(client, table, sizes, goalSize, force, true); } catch (Exception ex) { throw new MergeException(ex); } }  void start(String[] args); static void main(String[] args); void mergomatic(AccumuloClient client, String table, Text start, Text end, long goalSize,
      boolean force); }
Merge { public void mergomatic(AccumuloClient client, String table, Text start, Text end, long goalSize, boolean force) throws MergeException { try { if (table.equals(MetadataTable.NAME)) { throw new IllegalArgumentException("cannot merge tablets on the metadata table"); } List<Size> sizes = new ArrayList<>(); long totalSize = 0; Iterator<Size> sizeIterator = getSizeIterator(client, table, start, end); while (sizeIterator.hasNext()) { Size next = sizeIterator.next(); totalSize += next.size; sizes.add(next); if (totalSize > goalSize) { totalSize = mergeMany(client, table, sizes, goalSize, force, false); } } if (sizes.size() > 1) mergeMany(client, table, sizes, goalSize, force, true); } catch (Exception ex) { throw new MergeException(ex); } }  void start(String[] args); static void main(String[] args); void mergomatic(AccumuloClient client, String table, Text start, Text end, long goalSize,
      boolean force);  }