@Test public void testFindMemstoresWithEditsEqualOrOlderThan() throws IOException { Map<byte [], Long> regionsToSeqids = new HashMap<byte [], Long>(); for (int i = 0; i < 10; i++) { Long l = Long.valueOf(i); regionsToSeqids.put(l.toString().getBytes(), l); } byte [][] regions = HLog.findMemstoresWithEditsEqualOrOlderThan(1, regionsToSeqids); assertEquals(2, regions.length); assertTrue(Bytes.equals(regions[0], "0".getBytes()) || Bytes.equals(regions[0], "1".getBytes())); regions = HLog.findMemstoresWithEditsEqualOrOlderThan(3, regionsToSeqids); int count = 4; assertEquals(count, regions.length); for (int i = 0; i < count; i++) { assertTrue(Bytes.equals(regions[i], "0".getBytes()) || Bytes.equals(regions[i], "1".getBytes()) || Bytes.equals(regions[i], "2".getBytes()) || Bytes.equals(regions[i], "3".getBytes())); } }
static byte [][] findMemstoresWithEditsEqualOrOlderThan(final long oldestWALseqid, final Map<byte [], Long> regionsToSeqids) { List<byte []> regions = null; for (Map.Entry<byte [], Long> e: regionsToSeqids.entrySet()) { if (e.getValue().longValue() <= oldestWALseqid) { if (regions == null) regions = new ArrayList<byte []>(); regions.add(e.getKey()); } } return regions == null? null: regions.toArray(new byte [][] {HConstants.EMPTY_BYTE_ARRAY}); }
HLog implements Syncable { static byte [][] findMemstoresWithEditsEqualOrOlderThan(final long oldestWALseqid, final Map<byte [], Long> regionsToSeqids) { List<byte []> regions = null; for (Map.Entry<byte [], Long> e: regionsToSeqids.entrySet()) { if (e.getValue().longValue() <= oldestWALseqid) { if (regions == null) regions = new ArrayList<byte []>(); regions.add(e.getKey()); } } return regions == null? null: regions.toArray(new byte [][] {HConstants.EMPTY_BYTE_ARRAY}); } }
HLog implements Syncable { static byte [][] findMemstoresWithEditsEqualOrOlderThan(final long oldestWALseqid, final Map<byte [], Long> regionsToSeqids) { List<byte []> regions = null; for (Map.Entry<byte [], Long> e: regionsToSeqids.entrySet()) { if (e.getValue().longValue() <= oldestWALseqid) { if (regions == null) regions = new ArrayList<byte []>(); regions.add(e.getKey()); } } return regions == null? null: regions.toArray(new byte [][] {HConstants.EMPTY_BYTE_ARRAY}); } HLog(final FileSystem fs, final Path dir, final Path oldLogDir,
              final Configuration conf);  HLog(final FileSystem fs, final Path dir, final Path oldLogDir,
      final Configuration conf, final List<WALObserver> listeners,
      final String prefix);  HLog(final FileSystem fs, final Path dir, final Path oldLogDir,
      final Configuration conf, final List<WALObserver> listeners,
      final boolean failIfLogDirExists, final String prefix); }
HLog implements Syncable { static byte [][] findMemstoresWithEditsEqualOrOlderThan(final long oldestWALseqid, final Map<byte [], Long> regionsToSeqids) { List<byte []> regions = null; for (Map.Entry<byte [], Long> e: regionsToSeqids.entrySet()) { if (e.getValue().longValue() <= oldestWALseqid) { if (regions == null) regions = new ArrayList<byte []>(); regions.add(e.getKey()); } } return regions == null? null: regions.toArray(new byte [][] {HConstants.EMPTY_BYTE_ARRAY}); } HLog(final FileSystem fs, final Path dir, final Path oldLogDir,
              final Configuration conf);  HLog(final FileSystem fs, final Path dir, final Path oldLogDir,
      final Configuration conf, final List<WALObserver> listeners,
      final String prefix);  HLog(final FileSystem fs, final Path dir, final Path oldLogDir,
      final Configuration conf, final List<WALObserver> listeners,
      final boolean failIfLogDirExists, final String prefix); static long getWriteOps(); static long getWriteTime(); static long getSyncOps(); static long getSyncTime(); void registerWALActionsListener(final WALObserver listener); boolean unregisterWALActionsListener(final WALObserver listener); long getFilenum(); void setSequenceNumber(final long newvalue); long getSequenceNumber(); byte [][] rollWriter(); static Reader getReader(final FileSystem fs,
    final Path path, Configuration conf); static Writer createWriter(final FileSystem fs,
      final Path path, Configuration conf); void closeAndDelete(); void close(); void append(HRegionInfo regionInfo, WALEdit logEdit,
    final long now,
    final boolean isMetaRegion); void append(HRegionInfo regionInfo, HLogKey logKey, WALEdit logEdit); void append(HRegionInfo info, byte [] tableName, WALEdit edits,
    final long now); void sync(); void hsync(); long startCacheFlush(); void completeCacheFlush(final byte [] encodedRegionName,
      final byte [] tableName, final long logSeqId, final boolean isMetaRegion); void abortCacheFlush(); static boolean isMetaFamily(byte [] family); @SuppressWarnings("unchecked") static Class<? extends HLogKey> getKeyClass(Configuration conf); static HLogKey newKey(Configuration conf); static String getHLogDirectoryName(HServerInfo info); static String getHLogDirectoryName(String serverAddress,
      long startCode); static String getHLogDirectoryName(String serverName); static boolean validateHLogFilename(String filename); static NavigableSet<Path> getSplitEditFilesSorted(final FileSystem fs,
      final Path regiondir); static Path moveAsideBadEditsFile(final FileSystem fs,
      final Path edits); static Path getRegionDirRecoveredEditsDir(final Path regiondir); static void main(String[] args); }
HLog implements Syncable { static byte [][] findMemstoresWithEditsEqualOrOlderThan(final long oldestWALseqid, final Map<byte [], Long> regionsToSeqids) { List<byte []> regions = null; for (Map.Entry<byte [], Long> e: regionsToSeqids.entrySet()) { if (e.getValue().longValue() <= oldestWALseqid) { if (regions == null) regions = new ArrayList<byte []>(); regions.add(e.getKey()); } } return regions == null? null: regions.toArray(new byte [][] {HConstants.EMPTY_BYTE_ARRAY}); } HLog(final FileSystem fs, final Path dir, final Path oldLogDir,
              final Configuration conf);  HLog(final FileSystem fs, final Path dir, final Path oldLogDir,
      final Configuration conf, final List<WALObserver> listeners,
      final String prefix);  HLog(final FileSystem fs, final Path dir, final Path oldLogDir,
      final Configuration conf, final List<WALObserver> listeners,
      final boolean failIfLogDirExists, final String prefix); static long getWriteOps(); static long getWriteTime(); static long getSyncOps(); static long getSyncTime(); void registerWALActionsListener(final WALObserver listener); boolean unregisterWALActionsListener(final WALObserver listener); long getFilenum(); void setSequenceNumber(final long newvalue); long getSequenceNumber(); byte [][] rollWriter(); static Reader getReader(final FileSystem fs,
    final Path path, Configuration conf); static Writer createWriter(final FileSystem fs,
      final Path path, Configuration conf); void closeAndDelete(); void close(); void append(HRegionInfo regionInfo, WALEdit logEdit,
    final long now,
    final boolean isMetaRegion); void append(HRegionInfo regionInfo, HLogKey logKey, WALEdit logEdit); void append(HRegionInfo info, byte [] tableName, WALEdit edits,
    final long now); void sync(); void hsync(); long startCacheFlush(); void completeCacheFlush(final byte [] encodedRegionName,
      final byte [] tableName, final long logSeqId, final boolean isMetaRegion); void abortCacheFlush(); static boolean isMetaFamily(byte [] family); @SuppressWarnings("unchecked") static Class<? extends HLogKey> getKeyClass(Configuration conf); static HLogKey newKey(Configuration conf); static String getHLogDirectoryName(HServerInfo info); static String getHLogDirectoryName(String serverAddress,
      long startCode); static String getHLogDirectoryName(String serverName); static boolean validateHLogFilename(String filename); static NavigableSet<Path> getSplitEditFilesSorted(final FileSystem fs,
      final Path regiondir); static Path moveAsideBadEditsFile(final FileSystem fs,
      final Path edits); static Path getRegionDirRecoveredEditsDir(final Path regiondir); static void main(String[] args); static final byte [] METAFAMILY; static final long FIXED_OVERHEAD; }