Repository navigation
feat(storage): locate and explicitly export one Seafile library offline - #40
servicememeai wants to merge 14 commits into
Conversation
…ine without CloudFile services
… order os.walk descends in filesystem readdir order, so the same logical export hashed differently after a copy/re-export, which makes tree_sha256 useless for comparison. Sort each directory list before recursing and cover it with a deterministic regression test.
|
Independent review fix pushed in b966489 (review-only commit on top of the PR head):
Review verdict unchanged: KEEP DRAFT until one real CE14 |
2026-10-24 targeted recovery export correctnessThe native CE14 This Draft PR now reads the native export output log streamingly and refuses publication on native This makes the explicit |
seaf-fsck's export_file()/create_file() are void: CE can skip one file, a whole
directory subtree (unreadable FS dir object) or an uncreatable destination file,
still print "Finish exporting files" and exit 0. The previous guard only matched
three per-file messages, so a missing subdir/root dir object or a g_open()
failure (e.g. ENOSPC) was published as EXPORTED_UNVERIFIED.
Treat any native [WARNING]/[ERROR] record plus the known INFO failure signatures
("Failed to export file", "Failed to mkdir", "... is missing.") as failure: no
destination is published, exit code is 2, and the matched native log lines are
surfaced for diagnosis. The scan stays incremental.
Also mirror the shipped seaf-fsck.sh: prepend the seafile/lib and seafile/lib64
siblings of the given binary to LD_LIBRARY_PATH (keeping any inherited value).
A direct call into 14.0.8 images otherwise dies with "libevent-2.1.so.7: cannot
open shared object file". No-op when that install layout is absent.
Six regression tests use log lines captured verbatim from real CE14
seaf-fsck --export runs plus the library-path handoff; a benign INFO-only
progress log still publishes.
README states the precise publish conditions, the direct-binary invocation and
its library-path handling, and that log-based detection cannot prove content
completeness.
Verified against real 14.0 images: valid export publishes; missing block,
missing subdir object and missing root dir object are refused; the 14.0.8 image
now exports without any caller LD_LIBRARY_PATH.
|
Second-round review: independent fix pushed in e05a7f2 (review-only commit on top of the PR head, no history rewrite). The delta
The pushed fix:
Verification: 15/15 tests (6 new; 4 use log lines captured verbatim from the real binary), Verdict after this fix: MERGE AFTER ① one end-to-end export on a server-created CE14 library in the target deployed image, then |
Implements a bounded offline maintenance slice of #33. This is not a new backup engine.
Why
V2 per-library local storage keeps Seafile's
storage/{commits,fs,blocks}/<repo_uuid>object layout beneath a stablerepo_key. The original Seafileseaf-fsck --export ... <repo-id>reads that layout without Seafile DB, but default native-dcannot find the extra root when CloudFile is unavailable.Changes
tools/ops/seafile-library-offline.py:inspect --repo-id UUID --seafile-data ABS --library-root ABS: read-only single-library physical locator; no database, API, full filesystem scan, or copy. Identifies either original CE or one managed per-key layout, rejects ambiguous/missing/symlink routes.export --repo-id UUID --seafile-data ABS --library-root ABS --seaf-fsck ABS --output-dir NEW_ABS: explicit potentially heavy copy of only the requested library's logical files, reusing unmodified native Seafileseaf-fsck --export. A temporary standard Seafile config/object view uses read-only source path links so the compiled Seafile binary works without CloudFile DB/Hub. Never overwrites existing output.verify-export --repo-id UUID --output-dir ABS [--hash]: explicit export file inventory / optional byte hashing. Reports that this is not a proof of source completeness.Non-goals / safety
No default bulk backup, no scheduling, no DDL, no archive format, no new CF table, no custom Commit/Block decoder, no file writing into Seafile object storage, no implicit all-library operation. S3 not supported by this filesystem-only tool. This is separate from whole-instance disaster recovery.
Validation
5 isolated synthetic tests passed locally, including the native-binary invocation contract via a simulated
seaf-fsck. Real CE14 binary export and encrypted/corrupted library cases remain to be tested before release; the quick source CI is not runtime E2E. No deployment or data changes.