From 2a7dc44081fc2971b5388c2e209b87119294aa0c Mon Sep 17 00:00:00 2001 From: Grigory Kruglov Date: Wed, 15 Mar 2017 14:12:13 -0700 Subject: [PATCH] Bug 1343726 - Ensure that bookmark folders are processed first by the uploader r=rnewman Since we're uploading records atomically, order in which they're processed by the uploader only matters if we want to do sanity checks on certain types of records. Server might still preserve some of the order, but for our purposes here it shouldn't matter. We'd like to ensure that we process the "mobile root" bookmark record along with other folder records first, so that we increase our chances of avoiding making a failing network request if that those records' payload is too large. Sorting by bookmark type achieves this. MozReview-Commit-ID: KrAs3zepaOk --HG-- extra : rebase_source : 24f1d3d6aa2ee3b6777dc38abdd1e01aba5213c2 --- .../android/AndroidBrowserBookmarksDataAccessor.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/AndroidBrowserBookmarksDataAccessor.java b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/AndroidBrowserBookmarksDataAccessor.java index fd3c35da0131..061bf42137b8 100644 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/AndroidBrowserBookmarksDataAccessor.java +++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/AndroidBrowserBookmarksDataAccessor.java @@ -75,6 +75,18 @@ public class AndroidBrowserBookmarksDataAccessor extends AndroidBrowserRepositor return BrowserContractHelpers.BOOKMARKS_CONTENT_URI; } + /** + * Order bookmarks by type, ensuring that folders will be processed before other records during + * an upload. This is in support of payload-size validation. See Bug 1343726. + */ + @Override + public Cursor fetchSince(long timestamp) throws NullCursorException { + return queryHelper.safeQuery(".fetchSince", + getAllColumns(), + dateModifiedWhere(timestamp), + null, BrowserContract.Bookmarks.TYPE + " ASC"); + } + protected static Uri getPositionsUri() { return BrowserContractHelpers.BOOKMARKS_POSITIONS_CONTENT_URI; }