Skip to content

fix: repos with very large entries (e.g. Brave) fail to sync with "Error parsing index"#1338

Open
Victor-root wants to merge 1 commit into
Droid-ify:mainfrom
Victor-root:fix-cursorwindow-large-rows
Open

fix: repos with very large entries (e.g. Brave) fail to sync with "Error parsing index"#1338
Victor-root wants to merge 1 commit into
Droid-ify:mainfrom
Victor-root:fix-cursorwindow-large-rows

Conversation

@Victor-root

Copy link
Copy Markdown

🐛 What's broken

Adding a repository that contains a single very large entry — like the
Brave Browser repos, which bundle hundreds of releases for one package —
fails to sync. The repo shows as added, but you get an Error parsing index
notification and never receive its apps.

Root cause: that entry serializes to a > 2 MB blob, and SQLite's per-row
CursorWindow is capped at ~2 MB. Reading the row throws
SQLiteBlobTooBigException — both while merging the downloaded index
(IndexMerger) and when reading the full product from the database
(ProductAdapter).

🔧 The fix

Gzip-compress the large serialized blobs before storing them, and decompress
on read. JSON shrinks ~5–10×, which keeps these rows comfortably under the limit.
This can affect any repo with an oversized entry, not just Brave, so the fix
is global.

  • 📦 New ByteArray.gzip() / gunzipIfNeeded() helpers
  • 🗃️ Compress product & release blobs in IndexMerger (sync/merge path)
  • 🗄️ Compress ROW_DATA in ProductAdapter (app-detail path)

♻️ Backward compatible

Reads auto-detect the gzip header, so rows written before this change still
parse — no DB migration and no forced re-sync.

🧪 Testing

  • ✅ Unit tests for the compress/decompress round-trip + legacy passthrough
  • ✅ Built and tested on a physical device (Oppo Reno 13 Pro, Android 16):
    both Brave Beta repos now sync cleanly

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