CLI: SQLite import fails on graphs larger than 512MB (V8 string limit)

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

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
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, ocaml, sqlite
Lĩnh vực
backend, cli

Hướng nghiên cứu

Start by reading cli/lib/platform/node/cli_unix.ml, especially read_binary_file and its use of Node.Fs.readFileSync path latin1`. Trace how that data reaches the worker import API and identify a binary transport that avoids the V8 string limit. Reproduce with a SQLite file larger than 512 MiB and confirm import succeeds while small imports still work.

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

Mô tả

What happened

Importing a valid SQLite database larger than ~512 MiB into the Melange/OCaml CLI fails with an exception before reaching the graph worker:

{
  "status": "error",
  "error": {
    "code": "exception",
    "message": "Cli_unix.Cli_unix_error/1(4readCannot create a string longer than 0x1fffffe8 characters)"
  }
}

Environment

  • Logseq 2.0.2 beta (Melange CLI)
  • Revision: 533ac4382a7b69baa98de3a973bff90305b212dc
  • Platform: macOS (installed native bundle)

Cause

In cli/lib/platform/node/cli_unix.ml, read_binary_file is implemented using Node.Fs.readFileSync path latin1. This wraps the binary data in a V8 string, which hits the 0x1fffffe8` character limit (~512MB) for the Latin-1 representation before the bytes can be passed to the worker import API.

Reproduction

Reproduced using a synthetic, valid sparse SQLite database:

  • Size: 536,875,008 bytes (131,073 pages).
  • Validated with sqlite3 PRAGMA quick_check (returns ok) before import.
  • CLI command: ELECTRON_RUN_AS_NODE=1 logseq .../logseq-cli.js graph import --type sqlite --path ...

A normal small SQLite import succeeds on the same build.

Suggested Fix

Pass the SQLite binary data to the worker without wrapping the full file in a V8 string, or use a more efficient transport for large binary files in the CLI.

Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
29
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 logseq/db-test

Tất cả issue của logseq/db-test

Issue tương tự

Thêm issue về Backend & API Design

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.