Skip to content

feat(store): custom hash table 기반 저장소로 교체#19

Merged
Soldbone merged 6 commits into
chore/devfrom
feature/store-hash-table
Mar 18, 2026
Merged

feat(store): custom hash table 기반 저장소로 교체#19
Soldbone merged 6 commits into
chore/devfrom
feature/store-hash-table

Conversation

@Soldbone
Copy link
Copy Markdown
Collaborator

What changed

  • Store 내부 data_map, expire_map을 Python dict에서 직접 구현한 HashTable로 교체했습니다.
  • open addressing + linear probing 기반 해시 테이블을 추가하고, FNV-1a 64-bit hash, tombstone 재사용, resize 동작을 구현했습니다.
  • GET/SET/DEL/EXPIRE/TTL/PERSIST의 기존 store semantics와 coarse lock 동작이 새 저장 구조에서도 유지되도록 연결했습니다.
  • 충돌 처리, tombstone 유지, resize, 랜덤 혼합 연산, 대량 workload를 검증하는 unit test를 추가했습니다.
  • AOF persistence 계약 관련 문서를 현재 기준(always-on, replay fail-fast, expires_at 기반)으로 정리했습니다.

Why

  • 제품 범위 문서의 “hash table 기반 저장소” 목표를 실제 구현에 반영하기 위해서입니다.
  • store public API와 command semantics를 바꾸지 않고 내부 자료구조만 교체해 이후 protocol/persistence 계층과의 결합을 낮추기 위해서입니다.
  • 해시 충돌, 삭제 후 재삽입, 리사이즈 같은 저장소 핵심 동작을 테스트로 고정해 store layer 안정성을 높이기 위해서입니다.

Tests

  • automated: $env:PYTHONPATH='.'; pytest tests/unit/test_hash_table.py tests/unit/test_store_core.py tests/unit/test_store_expiration.py (18 passed)
  • automated: mypy app/core/hash_table.py app/core/store.py 실행 시 현재 변경 파일이 아닌 app/core/lock.py의 기존 LockType 반환 타입 오류로 실패
  • automated: ruff는 현재 로컬 환경에 설치되어 있지 않아 실행하지 못했습니다
  • manual smoke: 미실행
  • manual smoke: 권장 확인 항목은 TTL 감소와 만료 후 조회 miss 여부입니다

Docs updated

  • docs/02-architecture.md: AOF persistence 계약을 optional이 아닌 always-on 기준으로 정리했습니다.
  • docs/04-development-guide.md: AOF/replay 검증 기준과 persistence 브랜치 초점을 업데이트했습니다.
  • docs/06-testing-playbook.md: recovery/replay 테스트 책임과 expires_at 기준 검증 규칙을 명시했습니다.

Known limitations

  • 이번 변경은 store 내부 자료구조 교체가 중심이라 HTTP 레벨 smoke는 아직 별도 확인이 필요합니다.
  • 성능 비교용 benchmark는 아직 포함하지 않았고, 단위 테스트 수준의 동작 검증까지 완료했습니다.

- FNV-1a open addressing hash table 구현
- Store API와 TTL semantics는 유지한 채 data_map, expire_map 교체
- collision, probing, tombstone, resize, stress, regression 테스트 추가
- replace Store data_map and expire_map initialization from dict to HashTable
- align store implementation with the hash table migration already reflected in tests
- fix failing store core tests caused by the dict/HashTable mismatch
@Soldbone Soldbone merged commit a6d3037 into chore/dev Mar 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant