private void writeMetadata(ByteBuffer buffer) throws IOException {
    buffer.flip();
    logChannel.write(buffer);
  }
Writes buffer and update its' metadata.

@throws IOException when failing to write
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/io/WALWriter.java