feat: switch SQLite to WAL mode and disable Btrfs CoW for data directory
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 2s
CLI Tests / test-cli (push) Successful in 4s
Integration Tests / test-service-integration (push) Failing after 12s
P2P Network Verification / p2p-verification (push) Successful in 3s
Python Tests / test-python (push) Successful in 11s
Security Scanning / security-scan (push) Successful in 1m11s
Multi-Node Blockchain Health Monitoring / health-check (push) Has been cancelled

- Change SQLite journal mode from DELETE to WAL for better concurrency
- Add chattr +C to /var/lib/aitbc in setup.sh to disable Btrfs Copy-on-Write
- Add fallback logging when chattr is unavailable or fails
- Prevent SQLite corruption on Btrfs filesystems by ensuring overwrite-in-place behavior
This commit is contained in:
aitbc
2026-04-21 22:00:47 +02:00
parent be48ec8a1b
commit 054adaf7be
3 changed files with 77 additions and 1 deletions

View File

@@ -114,6 +114,13 @@ setup_runtime_directories() {
chown root:root /var/log/aitbc
chown root:root /etc/aitbc
# Disable Btrfs CoW on data directory to prevent SQLite corruption
# SQLite expects overwrite-in-place behavior, which conflicts with CoW
if command -v chattr >/dev/null 2>&1; then
chattr +C /var/lib/aitbc 2>/dev/null || log "Could not disable CoW (not Btrfs or no permissions)"
log "Disabled Btrfs CoW on /var/lib/aitbc to prevent SQLite corruption"
fi
# Create README files
echo "# AITBC Runtime Data Directory" > /var/lib/aitbc/README.md
echo "# Keystore for blockchain keys (SECURE)" > /var/lib/aitbc/keystore/README.md