Commit ae308113 authored by tzik@chromium.org's avatar tzik@chromium.org

Sync FileSystem: disable etag match on duplication recovery.

This causes a PRECONDITION error when two clients try to delete duplicated files.
The conflict is ignorable on this case, so we can just drop the etag matching. 

(notry, since most of try jobs are passed, and failed try looks not related to the patch)

BUG=175682
NOTRY=true

Review URL: https://chromiumcodereview.appspot.com/12209115

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182174 0039d316-1c4b-4281-b951-d872f2087c98
parent 55ebd52f
......@@ -824,9 +824,9 @@ void DriveFileSyncClient::DidListEntriesToEnsureUniqueness(
entries.back() = NULL;
entries.get().pop_back();
DeleteEntries(entries.Pass(),
base::Bind(&EntryAdapter, base::Passed(&earliest_entry),
callback));
DeleteEntriesForEnsuringTitleUniqueness(
entries.Pass(),
base::Bind(&EntryAdapter, base::Passed(&earliest_entry), callback));
return;
}
......@@ -837,7 +837,7 @@ void DriveFileSyncClient::DidListEntriesToEnsureUniqueness(
callback.Run(google_apis::HTTP_FOUND, entry.Pass());
}
void DriveFileSyncClient::DeleteEntries(
void DriveFileSyncClient::DeleteEntriesForEnsuringTitleUniqueness(
ScopedVector<google_apis::ResourceEntry> entries,
const GDataErrorCallback& callback) {
DCHECK(CalledOnValidThread());
......@@ -852,14 +852,17 @@ void DriveFileSyncClient::DeleteEntries(
entries.back() = NULL;
entries.get().pop_back();
// We don't care conflicts here as other clients may be also deleting this
// file, so passing an empty etag.
drive_service_->DeleteResource(
entry->resource_id(),
entry->etag(),
base::Bind(&DriveFileSyncClient::DidDeleteEntry, AsWeakPtr(),
base::Passed(&entries), callback));
std::string(), // empty etag
base::Bind(
&DriveFileSyncClient::DidDeleteEntriesForEnsuringTitleUniqueness,
AsWeakPtr(), base::Passed(&entries), callback));
}
void DriveFileSyncClient::DidDeleteEntry(
void DriveFileSyncClient::DidDeleteEntriesForEnsuringTitleUniqueness(
ScopedVector<google_apis::ResourceEntry> entries,
const GDataErrorCallback& callback,
google_apis::GDataErrorCode error) {
......@@ -873,7 +876,7 @@ void DriveFileSyncClient::DidDeleteEntry(
}
DVLOG(2) << "Deletion completed";
DeleteEntries(entries.Pass(), callback);
DeleteEntriesForEnsuringTitleUniqueness(entries.Pass(), callback);
}
} // namespace sync_file_system
......@@ -291,11 +291,13 @@ class DriveFileSyncClient
const ResourceEntryCallback& callback,
google_apis::GDataErrorCode error,
scoped_ptr<google_apis::ResourceList> feed);
void DeleteEntries(ScopedVector<google_apis::ResourceEntry> entries,
const GDataErrorCallback& callback);
void DidDeleteEntry(ScopedVector<google_apis::ResourceEntry> entries,
const GDataErrorCallback& callback,
google_apis::GDataErrorCode error);
void DeleteEntriesForEnsuringTitleUniqueness(
ScopedVector<google_apis::ResourceEntry> entries,
const GDataErrorCallback& callback);
void DidDeleteEntriesForEnsuringTitleUniqueness(
ScopedVector<google_apis::ResourceEntry> entries,
const GDataErrorCallback& callback,
google_apis::GDataErrorCode error);
static std::string FormatTitleQuery(const std::string& title);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment