summaryrefslogtreecommitdiffstats
path: root/sync/syncable/dir_open_result.h
Commit message (Collapse)AuthorAgeFilesLines
* Update next_id when loading sync DBrlarocque@chromium.org2012-08-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The directory code is smart enough to maintain a bit of extra slack in the next_id so we don't accidentally reuse IDs if we crash. However, it only works after we've saved changes to the directory at least once. This change ensures that we save changes immediately after we load the directory, so that we can recover from crashes that occur before we would otherwise save changes due to natural causes. This won't do anything to help users who've gotten into a bad state because next_id was corrupted by an early crash, but it will prevent us from corrupting databases in the future. BUG=142987 TEST=See below: Examine 'next_id' in sync DB. Open chrome and close it within two to ten seconds. Verify 'next_id' has been incremented. Review URL: https://chromiumcodereview.appspot.com/10832329 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152706 0039d316-1c4b-4281-b951-d872f2087c98
* Remove #pragma once from syncajwong@chromium.org2012-07-111-1/+0
| | | | | | Review URL: https://chromiumcodereview.appspot.com/10700154 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146074 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Move sync/{internal_api,syncable} into syncer namespaceakalin@chromium.org2012-07-021-0/+2
| | | | | | | | | | | | | | Add temporary aliases from syncable::* to syncer::syncable::* for ModelType and related classes until those are ported to syncer proper. Disambiguate names in MockConnectionManager. BUG=128060 TEST= Review URL: https://chromiumcodereview.appspot.com/10699044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145211 0039d316-1c4b-4281-b951-d872f2087c98
* Sync: Clear IS_UNSYNCED for deleted local itemsrlarocque@chromium.org2012-05-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this change, if we were to delete a newly-created item before informing the sync server of its existence, it would end up in an unusual state. We do not commit deleted items unless they were known to sync server. However, these items were still considered to be 'unsynced' (ie. waiting to be committed to the server) and therefore impossible to entirely remove from the sync directory. They remain forever both IS_DEL and IS_UNSYNCED. This had a few side-effects. The most serious is that this behaviour could cause directory corruption. If we created a folder and a bookmark within it, then deleted that bookmark before it had a chance to sync, the bookmark would remain in a zombie state. When we finally got around to committing its parent folder, the folder's ID will change. The zombie bookmark's PARENT_ID will not be updated, leaving us with a dangling reference that will be detected as directory corruption the next time sync is loaded. See crbug.com/125381 for details. Another effect is that locally deleted, never synced UNIQUE_CLIENT_TAG could have strange effects later on. If a foreign client were to create an item with the same UNIQUE_CLIENT_TAG and sync it, this client would conflict-resolve the update against the zombie entry. The zombie entry would win, the newly created item would be deleted, and the deletion synced back to the server. This may not be an entirely bad thing, but it is a behaviour that's changed following this patch. From now on, the deleted item will be overwritten (if it still exists, which it probably won't). Finally, we now have a mechanism for permanently deleting these items. With this patch applied, these items will no longer have the unsynced bit set, so they will be deleted on restart by DropDeletedEntries(). This patch changes PutIsDel() to clear the IS_UNSYNCED bit of entries which were never committed to the sync server. The remainder of the changes either add or update existing tests. BUG=125381 TEST=SyncerTest.ClientTagUncommittedTagMatchesUpdate, SyncableDirectoryTest.ChangeEntryIDAndUpdateChildren_DeletedAndUnsyncedChildren Review URL: https://chromiumcodereview.appspot.com/10389103 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137476 0039d316-1c4b-4281-b951-d872f2087c98
* Make SyncManagerTests use in-memory sqliterlarocque@chromium.org2012-03-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | Add a flag to the SyncManager to allow it to initialize an in-memory directory. This is to be used only in tests. This is an ugly change, but there's not much alternative available right now. We really ought to figure out a better way to test the SyncManager that doesn't require cluttering the main class with flag variables. That task is left to another day. Using an in-memory database results in significant speedups. The time taken to run sync_unit_tests on my desktop went from 13s to 6s. It seems to cut 10-20s off the runtime of unit_test --gtest_filter='*Sync*', too. BUG=116328, 117836 TEST= Review URL: http://codereview.chromium.org/9662019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127255 0039d316-1c4b-4281-b951-d872f2087c98
* [Sync] Move 'sync' target to sync/akalin@chromium.org2012-03-151-0/+20
Also move related test files. Move WriteNode::UpdateEntryWithEncryption to nigori_util.h. Clean up defines and dependencies. In particular, get rid of SYNC_ENGINE_VERSION_STRING and hard-code the string in the single place it's used. Rename data_encryption.* to data_encryption_win.* and add a pragma for crypt32.lib. Clean up exit-time constructor warnings in sync{able,er}_unittest.cc. Remove some unused files. BUG=117585 TEST= TBR=jhawkins@chromium.org Review URL: https://chromiumcodereview.appspot.com/9699057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126872 0039d316-1c4b-4281-b951-d872f2087c98