본문으로 건너뛰기

Recovery Validation 실측 결과

§2 단위 테스트

pytest -xvs tests/v1/storage_backend/test_raw_block_core.py

13 passed ✅ (2026-06-23)

핵심 항목:

  • test_read_slot_headers_batched_decodes_valid_headers
  • test_read_slot_headers_batched_falls_back_to_per_slot_on_error
  • test_validate_loaded_entries_iouring_uses_batched_read
  • test_validate_loaded_entries_uring_cmd_uses_batched_read
  • test_raw_block_core_drops_checkpoint_entry_with_stale_slot_header

§3 벤치 실측

환경

항목내용
DeviceSAMSUNG BM1743 /dev/nvme6n1 (30.73 TB, BDF 0000:02:00.0)
Char device/dev/ng6n1
Kernel6.8.12-dmabuf
cache-space-gb8192 (8 TiB)
slot-bytes16777216 (16 MiB)
N (entries)524,272

결과

posix/threads=1: median=70.732621s mean=70.816665s samples=[71.158485, 70.732621, 70.709085, 70.688545, 70.79459]
posix/threads=8: median=16.268142s mean=16.273046s samples=[16.354451, 16.268142, 16.368519, 16.173227, 16.200889]
io_uring/batched: median=11.630458s mean=11.584213s samples=[10.833241, 12.038278, 11.534929, 11.630458, 11.884159]
io_uring_cmd/batched: median=0.122135s — ❌ indexed=0 (버그)

speedup median posix/threads=1/posix/threads=8: 4.35x
speedup median posix/threads=1/io_uring/batched: 6.08x
speedup median posix/threads=1/io_uring_cmd/batched: 579.14x ← 무효 (indexed=0)

정확성 판정

엔진indexed판정
posix/threads=1524,272
posix/threads=8524,272
io_uring/batched524,272
io_uring_cmd/batched0❌ 버그 — 재측정 필요

참고: 타 디바이스 결과 (Samsung BM1743 61TB, 8TiB 동일 조건)

posix/threads=1: median=62.063691s
posix/threads=8: median=10.888474s
speedup: 5.70x

io_uring은 미측정.


발견된 버그: io_uring_cmd checkpoint load 실패

증상

RawBlockCore: _load_meta_payload read failed at offset 4096: [Errno 22] io_uring I/O error
RawBlockCore: _load_meta_payload read failed at offset 134221824: [Errno 22] io_uring I/O error
RawBlockCore: no valid on-device metadata checkpoint found
io_uring_cmd/batched: indexed=0

재현 조건

  • prepare: block device (/dev/nvme6n1)
  • measure io_uring_cmd: char device (/dev/ng6n1)
  • N=524,272 entries → checkpoint payload ≈ 75 MiB

원인

_load_meta_payload에서 payload를 읽을 때 _read_buffers_read_uring_cmd_buffers 경로를 탄다. _read_uring_cmd_buffersmax_data_transfer_size(2 MiB) 단위로 chunk 쪼개는 loop을 가지고 있는데, EINVAL(errno 22) 이 발생한다.

Rust read_uring 호출 시 memoryview slice(target[cursor:cursor+chunk_len])를 buffer로 넘기는데, 이 경로에서 [Errno 22] io_uring I/O error가 발생하는 정확한 원인은 추가 분석 필요.

후보:

  1. memoryview slice가 Rust PyO3 buffer protocol에서 제대로 처리 안 됨
  2. char device(/dev/ng6n1)에서 payload offset(4096+)이 특정 alignment 요건 불충족
  3. Rust io_uring_cmd 경로의 buffer registration 문제

수정 방향

_read_uring_cmd_buffers에서 read_uring 대신 batched_read + wait_iouring 패턴으로 교체하면 write path(_write_uring_cmd_buffers)와 대칭이 맞고, memoryview slice 문제도 우회됨.

현재 core.py 진단 로그 상태

디버깅용으로 추가된 logger.warning 3곳은 수정 완료 후 제거 또는 logger.debug로 격하 필요:

  • _read_meta_header except: warning → debug
  • _read_meta_header magic/version mismatch: warning → debug
  • _read_meta_header payload_len range: warning → debug
  • _load_meta_payload read failed: warning → debug (또는 유지)
  • _load_meta_payload CRC mismatch: warning → debug
  • _select_latest_checkpoint offsets 출력: 제거

다음 액션

  1. _read_uring_cmd_buffers 에서 read_uringbatched_read + wait_iouring 교체
  2. 진단 로그 정리 (임시 warning → debug 또는 제거)
  3. 단위 테스트 추가: use_uring_cmd=True로 checkpoint load (_load_checkpoint_from_device) 검증
  4. nvme6n1 re-prepare 후 재측정 → io_uring_cmd/batched: indexed=524272 확인

PM1753 추가 실험 (2026-06-25) — 원인 확정

BM1743 권한 부재 상황에서 PM1753(/dev/nvme10n1, /dev/ng10n1)로 가설을 분리 검증.

요약:

  • PM1753 auto 세팅(max_hw_sectors_kb=256 → chunk 256 KiB)에서는 EINVAL 재현 안 됨 (정상 indexed=511,744).
  • bench가 RawBlockCoreConfigmax_data_transfer_size=2 MiB를 강제 주입하니 BM1743과 동일 EINVAL 재현.
  • 직교 실험 A(내부 chunk=4096) → ✅ EINVAL 해소
  • 직교 실험 B(aligned buf 단독) → ❌ EINVAL 그대로
  • 결합 실험 C(A+B) → ✅ EINVAL 해소 (A가 dominant)

→ 결론: multi-page chunk(=PRP entry 수, MDTS 초과 가능) 가 EINVAL의 직접 원인. 시작 ptr 정렬만으로는 해결 안 됨.

상세 매트릭스·해석·fix 방향은 followup 문서로 흡수: uring_cmd_recovery_followup.md §확정 검증 결과 (PM1753, 2026-06-25).

진단·실험 패치는 모두 working tree only로 적용 후 revert. 평가 베이스 브랜치 (perf/iouring-recovery-batched-read-with-uring-cmd tip=cfda5823)에 추가 커밋 없음.