code: private synchronized void resetCurrentSegment() {
      Segment lastSegment = lastSegment();
      if (lastSegment != null) {
        currentSegment = lastSegment;
      } else {
        SegmentDescriptor descriptor = SegmentDescriptor.builder()
          .withId(1)
          .withVersion(1)
          .withIndex(1)
          .withMaxSegmentSize(storage.maxSegmentSize())
          .withMaxEntries(storage.maxEntriesPerSegment())
          .build();
        descriptor.lock();
  
        currentSegment = createSegment(descriptor);
  
        segments.put(1L, currentSegment);
      }
    }
docs: Resets the current segment, creating a new segment if necessary.