private static void appendRegionEvent(Writer w, String region) throws IOException {
    WALProtos.RegionEventDescriptor regionOpenDesc = ProtobufUtil.toRegionEventDescriptor(
      WALProtos.RegionEventDescriptor.EventType.REGION_OPEN, TABLE_NAME.toBytes(),
      Bytes.toBytes(region), Bytes.toBytes(String.valueOf(region.hashCode())), 1,
      ServerName.parseServerName("ServerName:9099"), ImmutableMap.<byte[], List<Path>> of());
    final long time = EnvironmentEdgeManager.currentTime();
    final WALKeyImpl walKey =
      new WALKeyImpl(Bytes.toBytes(region), TABLE_NAME, 1, time, HConstants.DEFAULT_CLUSTER_ID);
    WALEdit we = WALEdit.createRegionEventWALEdit(Bytes.toBytes(region), regionOpenDesc);
    w.append(new Entry(walKey, we));
    w.sync(false);
  }
@param leaveOpen index to leave un-closed. -1 to close all.
@return the writer that's still open, or null if all were closed.
hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALSplit.java