Java 类org.apache.hadoop.hbase.regionserver.MemStoreSnapshot 实例源码

项目:pbase    文件:TestWALReplay.java   
@Override
public List<Path> flushSnapshot(MemStoreSnapshot snapshot, long cacheFlushId,
    MonitoredTask status) throws IOException {
  if (throwExceptionWhenFlushing.get()) {
    throw new IOException("Simulated exception by tests");
  }
  return super.flushSnapshot(snapshot, cacheFlushId, status);
}
项目:hbase    文件:AbstractTestWALReplay.java   
@Override
public List<Path> flushSnapshot(MemStoreSnapshot snapshot, long cacheFlushId,
    MonitoredTask status, ThroughputController throughputController,
    FlushLifeCycleTracker tracker) throws IOException {
  if (throwExceptionWhenFlushing.get()) {
    throw new IOException("Simulated exception by tests");
  }
  return super.flushSnapshot(snapshot, cacheFlushId, status, throughputController, tracker);
}
项目:PyroDB    文件:TestWALReplay.java   
@Override
public List<Path> flushSnapshot(MemStoreSnapshot snapshot, long cacheFlushId,
    MonitoredTask status) throws IOException {
  if (throwExceptionWhenFlushing.get()) {
    throw new IOException("Simulated exception by tests");
  }
  return super.flushSnapshot(snapshot, cacheFlushId, status);
}
项目:hbase    文件:DefaultMobStoreFlusher.java   
/**
 * Flushes the snapshot of the MemStore.
 * If this store is not a mob store, flush the cells in the snapshot to store files of HBase.
 * If the store is a mob one, the flusher flushes the MemStore into two places.
 * One is the store files of HBase, the other is the mob files.
 * <ol>
 * <li>Cells that are not PUT type or have the delete mark will be directly flushed to
 * HBase.</li>
 * <li>If the size of a cell value is larger than a threshold, it'll be
 * flushed to a mob file, another cell with the path of this file will be flushed to HBase.</li>
 * <li>If the size of a cell value is smaller than or equal with a threshold, it'll be flushed to
 * HBase directly.</li>
 * </ol>
 */
@Override
public List<Path> flushSnapshot(MemStoreSnapshot snapshot, long cacheFlushId,
    MonitoredTask status, ThroughputController throughputController,
    FlushLifeCycleTracker tracker) throws IOException {
  ArrayList<Path> result = new ArrayList<>();
  long cellsCount = snapshot.getCellsCount();
  if (cellsCount == 0) return result; // don't flush if there are no entries

  // Use a store scanner to find which rows to flush.
  long smallestReadPoint = store.getSmallestReadPoint();
  InternalScanner scanner = createScanner(snapshot.getScanners(), smallestReadPoint, tracker);
  StoreFileWriter writer;
  try {
    // TODO: We can fail in the below block before we complete adding this flush to
    // list of store files. Add cleanup of anything put on filesystem if we fail.
    synchronized (flushLock) {
      status.setStatus("Flushing " + store + ": creating writer");
      // Write the map out to the disk
      writer = store.createWriterInTmp(cellsCount, store.getColumnFamilyDescriptor().getCompressionType(),
          false, true, true, false);
      IOException e = null;
      try {
        // It's a mob store, flush the cells in a mob way. This is the difference of flushing
        // between a normal and a mob store.
        performMobFlush(snapshot, cacheFlushId, scanner, writer, status, throughputController);
      } catch (IOException ioe) {
        e = ioe;
        // throw the exception out
        throw ioe;
      } finally {
        if (e != null) {
          writer.close();
        } else {
          finalizeWriter(writer, cacheFlushId, status);
        }
      }
    }
  } finally {
    scanner.close();
  }
  LOG.info("Mob store is flushed, sequenceid=" + cacheFlushId + ", memsize="
      + StringUtils.TraditionalBinaryPrefix.long2String(snapshot.getDataSize(), "", 1) +
      ", hasBloomFilter=" + writer.hasGeneralBloom() +
      ", into tmp file " + writer.getPath());
  result.add(writer.getPath());
  return result;
}