fix: swap and writer lock files differ when one store is opened under two letter cases

Đang mở
#365 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, macos
Lĩnh vực
backend, databases

Hướng nghiên cứu

Start with internal/graphstore/locks.go at lockBesideOnce and internal/graphstore/shared.go at resolveStorePath and sharedKey; compare how lock paths are formed with how the shared-handle table identifies a store. Read the locking changes in #339 and #324, then check the existing lock file tests for the required <store>.swap name. Done when handles opened through different letter cases on a case-insensitive macOS volume share exclusion for both lock files, with the existing lock name preserved.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area:indexer bug needs-triage
What happens

Not reproduced yet. This finding comes from reading the code, so the behavior below is derived, not observed.

lockBesideOnce (internal/graphstore/locks.go:47) builds the swap and writer lock path as resolveStorePath(dir) + suffix. resolveStorePath (internal/graphstore/shared.go) runs filepath.Abs and then realpath.Resolve. realpath.Resolve resolves symlinks but does not normalize letter case.

On a case-insensitive file system, which is the macOS default, /x/case/store and /x/CASE/store name one store. The lock paths become /x/case/store.swap and /x/CASE/store.swap. flock takes the lock on the file that the path opens. Whether the two spellings open one inode depends on the file system, so our code does not guarantee that the two handles exclude each other.

The shared-handle table does not have this gap. sharedKey (internal/graphstore/shared.go:119) keys on the device and inode of the resolved parent plus the base name. Commit a5ca60a9 fixed that for #324.

The gap comes from the fix for #339 in commit 990b6499. Related: #339, #324, #286.

What you expected instead

One store has one swap lock and one writer lock, whatever letter case opens it. While the first handle is open, a second open or a ReplaceStore through the other spelling waits or returns ErrStoreLocked.

The fix has a constraint. The lock file must keep the name <store>.swap beside the store, because older releases and existing tests look for it there. An inode-based name is not an option. The fix needs the canonical on-disk spelling of the path, for example F_GETPATH on macOS.

Steps to reproduce

Not run yet. The planned steps, on a case-insensitive volume:

  1. Build the binary from commit 990b6499.
  2. Open a store at /x/case/store with graphstore.Open (internal/graphstore/pebble_store.go:168) and keep the handle open.
  3. From a second process, open the same store through /x/CASE/store.
  4. Check whether the second open waits or returns ErrStoreLocked.
Version

Built from source at commit 990b6499. The output of codegraph version is not captured.

Platform

macOS, Darwin 27.2.0, on the default case-insensitive file system.

How did you install it?

Built from source.

Languages in the affected repository

Not applicable. The bug is in store path handling, not in language extraction.

Before submitting
  • I searched existing issues and this is not a duplicate
  • I checked the capability matrix and this is not a documented limitation
  • This is not a security vulnerability
Ngôn ngữ chính
Go
Star
0
Fork
0
Merge trung bình
7 giờ 42 phút
Pull request đã merge (30 ngày)
111

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của seanb4t/codegraph-go

Tất cả issue của seanb4t/codegraph-go

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.