Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(950)

Unified Diff: sync/syncable/directory_backing_store_unittest.cc

Issue 1016563005: Increase page size for SyncData DB from 4K to maximum supported 32K (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sync/syncable/directory_backing_store_unittest.cc
diff --git a/sync/syncable/directory_backing_store_unittest.cc b/sync/syncable/directory_backing_store_unittest.cc
index 8f679f170d17f3dfbfcc9517d2ef0871561f5c31..56828b4ca55e2f55abd774a4020ed2485821553f 100644
--- a/sync/syncable/directory_backing_store_unittest.cc
+++ b/sync/syncable/directory_backing_store_unittest.cc
@@ -18,6 +18,7 @@
#include "sync/internal_api/public/base/node_ordinal.h"
#include "sync/protocol/bookmark_specifics.pb.h"
#include "sync/protocol/sync.pb.h"
+#include "sync/syncable/directory.h"
#include "sync/syncable/directory_backing_store.h"
#include "sync/syncable/on_disk_directory_backing_store.h"
#include "sync/syncable/syncable-inl.h"
@@ -3953,5 +3954,44 @@ TEST_F(DirectoryBackingStoreTest, GenerateCacheGUID) {
EXPECT_NE(guid1, guid2);
}
+TEST_F(DirectoryBackingStoreTest, IncreaseDatabasePageSizeFrom4KTo32K) {
+ sql::Connection connection;
+ ASSERT_TRUE(connection.Open(GetDatabasePath()));
+
+ SetUpCurrentDatabaseAndCheckVersion(&connection);
+ scoped_ptr<TestDirectoryBackingStore> dbs(
+ new TestDirectoryBackingStore(GetUsername(), &connection));
+ Directory::MetahandlesMap handles_map;
+ JournalIndex delete_journals;
+ Directory::KernelLoadInfo kernel_load_info;
+ STLValueDeleter<Directory::MetahandlesMap> index_deleter(&handles_map);
+
+ DirOpenResult open_result =
+ dbs->Load(&handles_map, &delete_journals, &kernel_load_info);
+ EXPECT_EQ(open_result, OPENED);
+
+ // Check if update is successful.
+ int pageSize = 0;
+ dbs->GetDatabasePageSize(&pageSize);
+ EXPECT_EQ(1024, pageSize);
+ dbs->db_->set_page_size(32768);
+ dbs->IncreasePageSizeTo32K();
+ pageSize = 0;
+ dbs->GetDatabasePageSize(&pageSize);
+ EXPECT_EQ(32768, pageSize);
+
+ // Snapshot and save.
+ Directory::SaveChangesSnapshot snapshot;
+ dbs->SaveChanges(snapshot);
+
+ // Load the directory again.
+ dbs.reset(new TestDirectoryBackingStore(GetUsername(), &connection));
+ pageSize = 0;
+ dbs->GetDatabasePageSize(&pageSize);
+ EXPECT_EQ(32768, pageSize);
+ open_result = dbs->Load(&handles_map, &delete_journals, &kernel_load_info);
+ EXPECT_EQ(open_result, OPENED);
+}
+
} // namespace syncable
} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698