@TestOnly
  public void setBufferSize(int size) {
    int capacity = size / 3;
    buffersLock.lock();
    try {
      MmapUtil.clean(workingBuffer);
      MmapUtil.clean(idleBuffer);
      MmapUtil.clean(syncingBuffer);
      MmapUtil.clean(compressedByteBuffer);
      workingBuffer = ByteBuffer.allocateDirect(capacity);
      idleBuffer = ByteBuffer.allocateDirect(capacity);
      syncingBuffer = null;
      compressedByteBuffer = ByteBuffer.allocateDirect(getCompressedByteBufferSize(capacity));
      currentWALFileWriter.setCompressedByteBuffer(compressedByteBuffer);
    } catch (OutOfMemoryError e) {
      logger.error("Fail to allocate wal node-{}'s buffer because out of memory.", identifier, e);
      close();
      throw e;
    } finally {
      buffersLock.unlock();
    }
  }
two buffers switch between three statuses (there is always 1 buffer working).
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/buffer/WALBuffer.java