public void recoverFileSize() {
        if (fileSegmentTable.isEmpty() || FileSegmentType.INDEX.equals(fileType)) {
            return;
        }
        FileSegment fileSegment = fileSegmentTable.get(fileSegmentTable.size() - 1);
        long fileSize = fileSegment.getSize();
        if (fileSize == GET_FILE_SIZE_ERROR) {
            log.warn("FlatAppendFile get last file size error, filePath: {}", this.filePath);
            return;
        }
        if (fileSegment.getCommitPosition() != fileSize) {
            fileSegment.initPosition(fileSize);
            flushFileSegmentMeta(fileSegment);
            log.warn("FlatAppendFile last file size not correct, filePath: {}", this.filePath);
        }
    }
@Test
    public void recoverFileSizeTest() {
        String filePath = MessageStoreUtil.toFilePath(queue);
        FlatAppendFile flatFile = flatFileFactory.createFlatFileForConsumeQueue(filePath);
        flatFile.rollingNewFile(500L);

        FileSegment fileSegment = flatFile.getFileToWrite();
        flatFile.append(allocateBuffer(1000), 1L);
        flatFile.commitAsync().join();
        flatFile.flushFileSegmentMeta(fileSegment);
    }