Projects >> accumulo >>8312b0740ecdfaff7afd963e8bab91a0bfdeafd1

Chunk
Conflicting content
    void print(String line);
  }
  
<<<<<<< HEAD
  public static void printDiskUsage(AccumuloConfiguration acuConf, Collection tables, FileSystem fs, Connector conn, boolean humanReadable) 
      throws TableNotFoundException,
      IOException {
=======
  public static void printDiskUsage(AccumuloConfiguration acuConf, Collection tables, FileSystem fs, Connector conn, boolean humanReadable)
      throws TableNotFoundException, IOException {
>>>>>>> a11934dbc7777ddb0f9d46c50dfdb69e5ed653a1
    printDiskUsage(acuConf, tables, fs, conn, new Printer() {
      @Override
      public void print(String line) {
Solution content
    void print(String line);
  }
  
  public static void printDiskUsage(AccumuloConfiguration acuConf, Collection tables, FileSystem fs, Connector conn, boolean humanReadable) 
      throws TableNotFoundException,
      IOException {
    printDiskUsage(acuConf, tables, fs, conn, new Printer() {
      @Override
      public void print(String line) {
File
TableDiskUsage.java
Developer's decision
Version 1
Kind of conflict
Method signature
Chunk
Conflicting content
    }, humanReadable);
  }
  
<<<<<<< HEAD
  public static Map,Long> getDiskUsage(AccumuloConfiguration acuConf, Collection tables, FileSystem fs, Connector conn, boolean humanReadable)
      throws TableNotFoundException, IOException {
=======
  public static void printDiskUsage(AccumuloConfiguration acuConf, Collection tables, FileSystem fs, Connector conn, Printer printer,
      boolean humanReadable) throws TableNotFoundException, IOException {
    
>>>>>>> a11934dbc7777ddb0f9d46c50dfdb69e5ed653a1
    TableDiskUsage tdu = new TableDiskUsage();
    
    HashSet tableIds = new HashSet();
Solution content
    }, humanReadable);
  }
  
  public static Map,Long> getDiskUsage(AccumuloConfiguration acuConf, Collection tables, FileSystem fs, Connector conn, boolean humanReadable)
      throws TableNotFoundException, IOException {
    TableDiskUsage tdu = new TableDiskUsage();
    
    HashSet tableIds = new HashSet();
File
TableDiskUsage.java
Developer's decision
Version 1
Kind of conflict
Method signature
Chunk
Conflicting content
      usage.put(tableNames, entry.getValue());
    }
    
<<<<<<< HEAD
    if (!emptyTableIds.isEmpty()) {
=======
    if(!emptyTableIds.isEmpty()) {
>>>>>>> a11934dbc7777ddb0f9d46c50dfdb69e5ed653a1
      TreeSet emptyTables = new TreeSet();
      for (String tableId : emptyTableIds) {
        emptyTables.add(reverseTableIdMap.get(tableId));
Solution content
      usage.put(tableNames, entry.getValue());
    }
    
    if (!emptyTableIds.isEmpty()) {
      TreeSet emptyTables = new TreeSet();
      for (String tableId : emptyTableIds) {
        emptyTables.add(reverseTableIdMap.get(tableId));
File
TableDiskUsage.java
Developer's decision
Version 1
Kind of conflict
If statement
Chunk
Conflicting content
      usage.put(emptyTables, 0L);
    }
    
<<<<<<< HEAD
    return usage;
  }
  
  public static void printDiskUsage(AccumuloConfiguration acuConf, Collection tables, FileSystem fs, Connector conn, Printer printer, boolean humanReadable)
      throws TableNotFoundException, IOException {
    
    Map,Long> usage = getDiskUsage(acuConf, tables, fs, conn, humanReadable);

    String valueFormat = humanReadable ? "%9s" : "%,24d";
    for (Entry,Long> entry : usage.entrySet()) {
      Object value = humanReadable ? NumUtil.bigNumberForSize(entry.getValue()) : entry.getValue();
      printer.print(String.format(valueFormat + " %s", value, entry.getKey()));
    }
=======
    for (Entry,Long> entry : usage.entrySet()) {
      String valueFormat = humanReadable ? "%s" : "%,24d";
      Object value = humanReadable ? humanReadableBytes(entry.getValue()) : entry.getValue();
      printer.print(String.format(valueFormat + " %s", value, entry.getKey()));
    }
  }
  
  static final String[] SUFFIXES = {"K", "M", "G", "T", "P", "E", "Z"};
  
  public static String humanReadableBytes(long bytes) {
    if (bytes < 1024) return String.format("%4dB", bytes);
    int exp = (int) (Math.log(bytes) / Math.log(1024));
    String suffix = SUFFIXES[exp-1];
    double val = bytes / Math.pow(1024, exp);
    return String.format(val >= 1000 ? "%4.0f%s" : " %3.1f%s", val, suffix);
>>>>>>> a11934dbc7777ddb0f9d46c50dfdb69e5ed653a1
  }
}
Solution content
      usage.put(emptyTables, 0L);
    }
    
    return usage;
  }
  
  public static void printDiskUsage(AccumuloConfiguration acuConf, Collection tables, FileSystem fs, Connector conn, Printer printer, boolean humanReadable)
      throws TableNotFoundException, IOException {
    
    Map,Long> usage = getDiskUsage(acuConf, tables, fs, conn, humanReadable);

    String valueFormat = humanReadable ? "%9s" : "%,24d";
    for (Entry,Long> entry : usage.entrySet()) {
      Object value = humanReadable ? NumUtil.bigNumberForSize(entry.getValue()) : entry.getValue();
      printer.print(String.format(valueFormat + " %s", value, entry.getKey()));
    }
  }
}
File
TableDiskUsage.java
Developer's decision
Version 1
Kind of conflict
Array access
Array initializer
Attribute
Cast expression
For statement
If statement
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
public class DUCommand extends Command {
  
  private Option optTablePattern, optHumanReadble;
<<<<<<< HEAD

=======
  
>>>>>>> a11934dbc7777ddb0f9d46c50dfdb69e5ed653a1
  public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException, TableNotFoundException {

    final SortedSet tablesToFlush = new TreeSet(Arrays.asList(cl.getArgs()));
Solution content
public class DUCommand extends Command {
  
  private Option optTablePattern, optHumanReadble;

  public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException, TableNotFoundException {

    final SortedSet tablesToFlush = new TreeSet(Arrays.asList(cl.getArgs()));
File
DUCommand.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
    
    optTablePattern = new Option("p", "pattern", true, "regex pattern of table names");
    optTablePattern.setArgName("pattern");
<<<<<<< HEAD

=======
    
>>>>>>> a11934dbc7777ddb0f9d46c50dfdb69e5ed653a1
    optHumanReadble = new Option("h", "human-readable", false, "format large sizes to human readable units");
    optHumanReadble.setArgName("human readable output");
Solution content
    
    optTablePattern = new Option("p", "pattern", true, "regex pattern of table names");
    optTablePattern.setArgName("pattern");

    optHumanReadble = new Option("h", "human-readable", false, "format large sizes to human readable units");
    optHumanReadble.setArgName("human readable output");
File
DUCommand.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
    Shell.log.debug(output.get());
    assertEquals(0, shell.getExitCode());

<<<<<<< HEAD
  if (s.length() > 0)
  assertEquals(s + " present in " + output.get() + " was not " + stringPresent, stringPresent, output.get().contains(s));
}

=======
    if (s.length() > 0)
      assertEquals(s + " present in " + output.get() + " was not " + stringPresent, stringPresent, output.get().contains(s));
  }
  
>>>>>>> a11934dbc7777ddb0f9d46c50dfdb69e5ed653a1
  static void assertBadExit(String s, boolean stringPresent) {
    Shell.log.debug(output.get());
    assertTrue(shell.getExitCode() > 0);
Solution content
    Shell.log.debug(output.get());
    assertEquals(0, shell.getExitCode());

    if (s.length() > 0)
      assertEquals(s + " present in " + output.get() + " was not " + stringPresent, stringPresent, output.get().contains(s));
  }
  
  static void assertBadExit(String s, boolean stringPresent) {
    Shell.log.debug(output.get());
    assertTrue(shell.getExitCode() > 0);
File
ShellServerTest.java
Developer's decision
Version 1
Kind of conflict
If statement
Chunk
Conflicting content
    output.clear();
    shell.execCommand("du -h", false, false);
    String o = output.get();
<<<<<<< HEAD
    assertTrue(o.matches(".*26[0-9]\\s\\[t\\]\\n"));  // for some reason, there's 1-2 bytes of fluctuation
=======
    assertTrue(o.matches(".*s26[0-9]B\\s\\[t\\]\\n"));  // for some reason, there's 1-2 bytes of fluctuation
>>>>>>> a11934dbc7777ddb0f9d46c50dfdb69e5ed653a1
    exec("deletetable -f t");
  }
  
Solution content
    output.clear();
    shell.execCommand("du -h", false, false);
    String o = output.get();
    assertTrue(o.matches(".*26[0-9]\\s\\[t\\]\\n"));  // for some reason, there's 1-2 bytes of fluctuation
    exec("deletetable -f t");
  }
  
File
ShellServerTest.java
Developer's decision
Version 1
Kind of conflict
Comment
Method invocation