summaryrefslogtreecommitdiffstats
path: root/components/test/data/history/thumbnail_wild
diff options
context:
space:
mode:
Diffstat (limited to 'components/test/data/history/thumbnail_wild')
-rw-r--r--components/test/data/history/thumbnail_wild/Favicons.corrupt_meta.disable28
-rw-r--r--components/test/data/history/thumbnail_wild/Favicons.v2.init.sql27
-rw-r--r--components/test/data/history/thumbnail_wild/Favicons.v3.init.sql36
-rw-r--r--components/test/data/history/thumbnail_wild/Favicons.v4.init.sql32
-rw-r--r--components/test/data/history/thumbnail_wild/Favicons.v5.icon_type.sql24
-rw-r--r--components/test/data/history/thumbnail_wild/Favicons.v5.icon_type2.sql25
-rw-r--r--components/test/data/history/thumbnail_wild/Favicons.v5.init.sql35
-rw-r--r--components/test/data/history/thumbnail_wild/Favicons.v5.sizes.sql24
-rw-r--r--components/test/data/history/thumbnail_wild/Favicons.v6.init.sql36
-rw-r--r--components/test/data/history/thumbnail_wild/README2
10 files changed, 269 insertions, 0 deletions
diff --git a/components/test/data/history/thumbnail_wild/Favicons.corrupt_meta.disable b/components/test/data/history/thumbnail_wild/Favicons.corrupt_meta.disable
new file mode 100644
index 0000000..05e46ef
--- /dev/null
+++ b/components/test/data/history/thumbnail_wild/Favicons.corrupt_meta.disable
@@ -0,0 +1,28 @@
+-- unit_tests --gtest_filter=ThumbnailDatabaseTest.WildSchema
+--
+-- [meta] table has first column [oey] instead of [key] (single-bit
+-- error). Database consistent with v6, but that may just mean that
+-- v6 code was when attempting to work with an empty database with a
+-- broken [meta] table. Multiple reports from the same clientid have
+-- seen this, so the broken [meta] is almost certainly on disk.
+--
+-- TODO(shess): This is clearly low-priority BUT the general class of
+-- problem where the schema is wrong should be handled. I suspect the
+-- final solution will be to Raze() if the database contains [meta]
+-- but the version cannot be fetched from it, or failing some other
+-- validity metric.
+BEGIN TRANSACTION;
+
+CREATE TABLE meta(oey LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
+
+CREATE TABLE "favicons" (id INTEGER PRIMARY KEY,url LONGVARCHAR NOT NULL,icon_type INTEGER DEFAULT 1,sizes LONGVARCHAR);
+CREATE INDEX favicons_url ON favicons(url);
+
+CREATE TABLE icon_mapping(id INTEGER PRIMARY KEY,page_url LONGVARCHAR NOT NULL,icon_id INTEGER);
+CREATE INDEX icon_mapping_icon_id_idx ON icon_mapping(icon_id);
+CREATE INDEX icon_mapping_page_url_idx ON icon_mapping(page_url);
+
+CREATE TABLE favicon_bitmaps(id INTEGER PRIMARY KEY,icon_id INTEGER NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB,width INTEGER DEFAULT 0,height INTEGER DEFAULT 0);
+CREATE INDEX favicon_bitmaps_icon_id ON favicon_bitmaps(icon_id);
+
+COMMIT;
diff --git a/components/test/data/history/thumbnail_wild/Favicons.v2.init.sql b/components/test/data/history/thumbnail_wild/Favicons.v2.init.sql
new file mode 100644
index 0000000..53b6b73
--- /dev/null
+++ b/components/test/data/history/thumbnail_wild/Favicons.v2.init.sql
@@ -0,0 +1,27 @@
+-- unit_tests --gtest_filter=ThumbnailDatabaseTest.WildSchema
+--
+-- Based on version 2 schema found in the wild by error diagnostics.
+-- The schema was failing to migrate because the current-version
+-- tables were being created before the migration code was called,
+-- resulting in the migration code attempting to add columns which
+-- already existed (see http://crbug.com/273203 ).
+--
+-- Should be razed by the deprecation code.
+BEGIN TRANSACTION;
+
+-- [meta] and [thumbnails] are expected tables.
+CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
+INSERT INTO "meta" VALUES('version','2');
+INSERT INTO "meta" VALUES('last_compatible_version','2');
+CREATE TABLE thumbnails (url LONGVARCHAR PRIMARY KEY,url_rank INTEGER ,title LONGVARCHAR,thumbnail BLOB,redirects LONGVARCHAR,boring_score DOUBLE DEFAULT 1.0, good_clipping INTEGER DEFAULT 0, at_top INTEGER DEFAULT 0, last_updated INTEGER DEFAULT 0, load_completed INTEGER DEFAULT 0);
+
+-- Tables optimistically created by Init().
+CREATE TABLE favicon_bitmaps(id INTEGER PRIMARY KEY,icon_id INTEGER NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB,width INTEGER DEFAULT 0,height INTEGER DEFAULT 0);
+CREATE TABLE favicons(id INTEGER PRIMARY KEY,url LONGVARCHAR NOT NULL,icon_type INTEGER DEFAULT 1);
+CREATE TABLE icon_mapping(id INTEGER PRIMARY KEY,page_url LONGVARCHAR NOT NULL,icon_id INTEGER);
+CREATE INDEX favicon_bitmaps_icon_id ON favicon_bitmaps(icon_id);
+CREATE INDEX favicons_url ON favicons(url);
+CREATE INDEX icon_mapping_icon_id_idx ON icon_mapping(icon_id);
+CREATE INDEX icon_mapping_page_url_idx ON icon_mapping(page_url);
+
+COMMIT;
diff --git a/components/test/data/history/thumbnail_wild/Favicons.v3.init.sql b/components/test/data/history/thumbnail_wild/Favicons.v3.init.sql
new file mode 100644
index 0000000..3453860
--- /dev/null
+++ b/components/test/data/history/thumbnail_wild/Favicons.v3.init.sql
@@ -0,0 +1,36 @@
+-- unit_tests --gtest_filter=ThumbnailDatabaseTest.WildSchema
+--
+-- Based on version 3 schema found in the wild by error diagnostics.
+-- The schema was failing to migrate because the current-version
+-- tables were being created before the migration code was called,
+-- resulting in the migration code attempting to add columns which
+-- already existed (see http://crbug.com/273203 ).
+--
+-- Should be razed by the deprecation code.
+BEGIN TRANSACTION;
+
+-- [meta] is expected.
+CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
+INSERT INTO "meta" VALUES('version','3');
+INSERT INTO "meta" VALUES('last_compatible_version','3');
+
+-- [thumbnails] is optional for v3, but was not seen in any diagnostic
+-- results.
+
+-- [favicons] was present in v3, but [icon_type] is a v4 column.
+CREATE TABLE favicons(id INTEGER PRIMARY KEY,url LONGVARCHAR NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB,icon_type INTEGER DEFAULT 1);
+CREATE INDEX favicons_url ON favicons(url);
+
+-- [icon_mapping] is a v4 table. Some cases didn't have the indices,
+-- possibly because the migration code didn't create indices (they
+-- were created optimistically on next run).
+CREATE TABLE icon_mapping(id INTEGER PRIMARY KEY,page_url LONGVARCHAR NOT NULL,icon_id INTEGER);
+CREATE INDEX icon_mapping_icon_id_idx ON icon_mapping(icon_id);
+CREATE INDEX icon_mapping_page_url_idx ON icon_mapping(page_url);
+
+-- [favicon_bitmaps] is a v6 table. Some diagnostic results did not
+-- contain this table.
+CREATE TABLE favicon_bitmaps(id INTEGER PRIMARY KEY,icon_id INTEGER NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB,width INTEGER DEFAULT 0,height INTEGER DEFAULT 0);
+CREATE INDEX favicon_bitmaps_icon_id ON favicon_bitmaps(icon_id);
+
+COMMIT;
diff --git a/components/test/data/history/thumbnail_wild/Favicons.v4.init.sql b/components/test/data/history/thumbnail_wild/Favicons.v4.init.sql
new file mode 100644
index 0000000..6c5738e
--- /dev/null
+++ b/components/test/data/history/thumbnail_wild/Favicons.v4.init.sql
@@ -0,0 +1,32 @@
+-- unit_tests --gtest_filter=ThumbnailDatabaseTest.WildSchema
+--
+-- Based on version 3 and 4 schema found in the wild by error
+-- diagnostics. Combined because they were the same except for
+-- version. The schema was failing to migrate because the migration
+-- code encountered a table which appeared to already be migrated.
+--
+-- Should be razed by the deprecation code.
+BEGIN TRANSACTION;
+
+-- [meta] is expected.
+CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
+INSERT INTO "meta" VALUES('version','4');
+INSERT INTO "meta" VALUES('last_compatible_version','4');
+
+-- This version of [favicons] implies v6 code. Other versions are
+-- missing [size], implying v7. Either way, since v4 had the table,
+-- migration must have run, but the atomic update of version somehow
+-- failed.
+CREATE TABLE "favicons"(id INTEGER PRIMARY KEY,url LONGVARCHAR NOT NULL,icon_type INTEGER DEFAULT 1,sizes LONGVARCHAR);
+CREATE INDEX favicons_url ON favicons(url);
+
+-- [icon_mapping] is a v4 table.
+CREATE TABLE icon_mapping(id INTEGER PRIMARY KEY,page_url LONGVARCHAR NOT NULL,icon_id INTEGER);
+CREATE INDEX icon_mapping_icon_id_idx ON icon_mapping(icon_id);
+CREATE INDEX icon_mapping_page_url_idx ON icon_mapping(page_url);
+
+-- [favicon_bitmaps] is a v6 table.
+CREATE TABLE favicon_bitmaps(id INTEGER PRIMARY KEY,icon_id INTEGER NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB,width INTEGER DEFAULT 0,height INTEGER DEFAULT 0);
+CREATE INDEX favicon_bitmaps_icon_id ON favicon_bitmaps(icon_id);
+
+COMMIT;
diff --git a/components/test/data/history/thumbnail_wild/Favicons.v5.icon_type.sql b/components/test/data/history/thumbnail_wild/Favicons.v5.icon_type.sql
new file mode 100644
index 0000000..a00a439
--- /dev/null
+++ b/components/test/data/history/thumbnail_wild/Favicons.v5.icon_type.sql
@@ -0,0 +1,24 @@
+-- unit_tests --gtest_filter=ThumbnailDatabaseTest.WildSchema
+--
+-- Based on version 5 schema found in the wild by error diagnostics.
+-- The schema failed to open because the v3 [favicons] table is
+-- missing [icon_type].
+--
+-- Init() should clean up with RazeAndClose().
+BEGIN TRANSACTION;
+
+-- [meta] is expected.
+CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
+INSERT INTO "meta" VALUES('version','5');
+INSERT INTO "meta" VALUES('last_compatible_version','5');
+
+-- v3 [favicons] (missing [icon_type]), but v5 database.
+CREATE TABLE "favicons"(id INTEGER PRIMARY KEY,url LONGVARCHAR NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB);
+CREATE INDEX favicons_url ON favicons(url);
+
+-- [icon_mapping] consistent with v5.
+CREATE TABLE icon_mapping(id INTEGER PRIMARY KEY,page_url LONGVARCHAR NOT NULL,icon_id INTEGER);
+CREATE INDEX icon_mapping_icon_id_idx ON icon_mapping(icon_id);
+CREATE INDEX icon_mapping_page_url_idx ON icon_mapping(page_url);
+
+COMMIT;
diff --git a/components/test/data/history/thumbnail_wild/Favicons.v5.icon_type2.sql b/components/test/data/history/thumbnail_wild/Favicons.v5.icon_type2.sql
new file mode 100644
index 0000000..25ceded
--- /dev/null
+++ b/components/test/data/history/thumbnail_wild/Favicons.v5.icon_type2.sql
@@ -0,0 +1,25 @@
+-- unit_tests --gtest_filter=ThumbnailDatabaseTest.WildSchema
+--
+-- Based on version 5 schema found in the wild by error diagnostics.
+-- The schema failed to open because the v3 [favicons] table is
+-- missing [icon_type]. How this schema formed is unclear, as it has
+-- evidence of a migration from after version 5.
+--
+-- Init() should clean up with RazeAndClose().
+BEGIN TRANSACTION;
+
+-- [meta] is expected.
+CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
+INSERT INTO "meta" VALUES('version','5');
+INSERT INTO "meta" VALUES('last_compatible_version','5');
+
+-- v3 [favicons] (has [image_data]), but with v5 attributes (has [sizes]).
+CREATE TABLE "favicons"(id INTEGER PRIMARY KEY,url LONGVARCHAR NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB, sizes LONGVARCHAR);
+CREATE INDEX favicons_url ON favicons(url);
+
+-- [icon_mapping] consistent with v5.
+CREATE TABLE icon_mapping(id INTEGER PRIMARY KEY,page_url LONGVARCHAR NOT NULL,icon_id INTEGER);
+CREATE INDEX icon_mapping_icon_id_idx ON icon_mapping(icon_id);
+CREATE INDEX icon_mapping_page_url_idx ON icon_mapping(page_url);
+
+COMMIT;
diff --git a/components/test/data/history/thumbnail_wild/Favicons.v5.init.sql b/components/test/data/history/thumbnail_wild/Favicons.v5.init.sql
new file mode 100644
index 0000000..c92a110
--- /dev/null
+++ b/components/test/data/history/thumbnail_wild/Favicons.v5.init.sql
@@ -0,0 +1,35 @@
+-- unit_tests --gtest_filter=ThumbnailDatabaseTest.WildSchema
+--
+-- Based on version 5 schema found in the wild by error diagnostics.
+-- The schema failed migrations because of an unexpected
+-- [temp_favicons] table (see http://crbug.com/272519 ).
+--
+-- Init() has been modified to drop these tables before migration.
+BEGIN TRANSACTION;
+
+-- [meta] is expected.
+CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
+INSERT INTO "meta" VALUES('version','5');
+INSERT INTO "meta" VALUES('last_compatible_version','5');
+
+-- This version of [favicons] is consistent with v5.
+CREATE TABLE "favicons"(id INTEGER PRIMARY KEY,url LONGVARCHAR NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB,icon_type INTEGER DEFAULT 1,sizes LONGVARCHAR);
+CREATE INDEX favicons_url ON favicons(url);
+
+-- [icon_mapping] consistent with v5.
+CREATE TABLE icon_mapping(id INTEGER PRIMARY KEY,page_url LONGVARCHAR NOT NULL,icon_id INTEGER);
+CREATE INDEX icon_mapping_icon_id_idx ON icon_mapping(icon_id);
+CREATE INDEX icon_mapping_page_url_idx ON icon_mapping(page_url);
+
+-- [favicon_bitmaps] is a v6 table created by Init() before version
+-- check. This probably is only in memory (not committed).
+CREATE TABLE favicon_bitmaps(id INTEGER PRIMARY KEY,icon_id INTEGER NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB,width INTEGER DEFAULT 0,height INTEGER DEFAULT 0);
+CREATE INDEX favicon_bitmaps_icon_id ON favicon_bitmaps(icon_id);
+
+-- Presence of these tables is consistent with an aborted attempt to
+-- clear history. Prior to r217993, that code was not contained in a
+-- transaction (or possibly there was a non-atomic update).
+CREATE TABLE temp_favicons(id INTEGER PRIMARY KEY,url LONGVARCHAR NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB,icon_type INTEGER DEFAULT 1,sizes LONGVARCHAR);
+CREATE TABLE temp_icon_mapping(id INTEGER PRIMARY KEY,page_url LONGVARCHAR NOT NULL,icon_id INTEGER);
+
+COMMIT;
diff --git a/components/test/data/history/thumbnail_wild/Favicons.v5.sizes.sql b/components/test/data/history/thumbnail_wild/Favicons.v5.sizes.sql
new file mode 100644
index 0000000..6dfa9e9
--- /dev/null
+++ b/components/test/data/history/thumbnail_wild/Favicons.v5.sizes.sql
@@ -0,0 +1,24 @@
+-- unit_tests --gtest_filter=ThumbnailDatabaseTest.WildSchema
+--
+-- Based on version 5 schema found in the wild by error diagnostics.
+-- The schema failed to open because the v3 [favicons] table is
+-- missing [sizes].
+--
+-- Init() should clean up with RazeAndClose().
+BEGIN TRANSACTION;
+
+-- [meta] is expected.
+CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
+INSERT INTO "meta" VALUES('version','5');
+INSERT INTO "meta" VALUES('last_compatible_version','5');
+
+-- v4 [favicons] (missing [sizes]), but v5 database.
+CREATE TABLE "favicons"(id INTEGER PRIMARY KEY,url LONGVARCHAR NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB,icon_type INTEGER DEFAULT 1);
+CREATE INDEX favicons_url ON favicons(url);
+
+-- [icon_mapping] consistent with v5.
+CREATE TABLE icon_mapping(id INTEGER PRIMARY KEY,page_url LONGVARCHAR NOT NULL,icon_id INTEGER);
+CREATE INDEX icon_mapping_icon_id_idx ON icon_mapping(icon_id);
+CREATE INDEX icon_mapping_page_url_idx ON icon_mapping(page_url);
+
+COMMIT;
diff --git a/components/test/data/history/thumbnail_wild/Favicons.v6.init.sql b/components/test/data/history/thumbnail_wild/Favicons.v6.init.sql
new file mode 100644
index 0000000..3014c37
--- /dev/null
+++ b/components/test/data/history/thumbnail_wild/Favicons.v6.init.sql
@@ -0,0 +1,36 @@
+-- unit_tests --gtest_filter=ThumbnailDatabaseTest.WildSchema
+--
+-- Based on version 6 schema found in the wild by error diagnostics.
+-- The schema failed migrations because of unexpected
+-- [temp_favicons] table (see http://crbug.com/272519 ).
+--
+-- Init() has been modified to drop these tables.
+-- TODO(shess): Should this case contain data?
+BEGIN TRANSACTION;
+
+-- [meta] is expected.
+CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY,value LONGVARCHAR);
+INSERT INTO "meta" VALUES('version','6');
+INSERT INTO "meta" VALUES('last_compatible_version','6');
+
+-- This version of [favicons] is consistent with v6.
+CREATE TABLE "favicons"(id INTEGER PRIMARY KEY,url LONGVARCHAR NOT NULL,icon_type INTEGER DEFAULT 1,sizes LONGVARCHAR);
+CREATE INDEX favicons_url ON favicons(url);
+
+-- [icon_mapping] consistent with v6.
+CREATE TABLE icon_mapping(id INTEGER PRIMARY KEY,page_url LONGVARCHAR NOT NULL,icon_id INTEGER);
+CREATE INDEX icon_mapping_icon_id_idx ON icon_mapping(icon_id);
+CREATE INDEX icon_mapping_page_url_idx ON icon_mapping(page_url);
+
+-- [favicon_bitmaps] consistent with v6.
+CREATE TABLE favicon_bitmaps(id INTEGER PRIMARY KEY,icon_id INTEGER NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB,width INTEGER DEFAULT 0,height INTEGER DEFAULT 0);
+CREATE INDEX favicon_bitmaps_icon_id ON favicon_bitmaps(icon_id);
+
+-- Presence of these tables is consistent with an aborted attempt to
+-- clear history. Prior to r217993, that code was not contained in a
+-- transaction (or possibly there was a non-atomic update).
+CREATE TABLE temp_favicons(id INTEGER PRIMARY KEY,url LONGVARCHAR NOT NULL,icon_type INTEGER DEFAULT 1,sizes LONGVARCHAR);
+CREATE TABLE temp_icon_mapping(id INTEGER PRIMARY KEY,page_url LONGVARCHAR NOT NULL,icon_id INTEGER);
+CREATE TABLE temp_favicon_bitmaps(id INTEGER PRIMARY KEY,icon_id INTEGER NOT NULL,last_updated INTEGER DEFAULT 0,image_data BLOB,width INTEGER DEFAULT 0,height INTEGER DEFAULT 0);
+
+COMMIT;
diff --git a/components/test/data/history/thumbnail_wild/README b/components/test/data/history/thumbnail_wild/README
new file mode 100644
index 0000000..efe0e53
--- /dev/null
+++ b/components/test/data/history/thumbnail_wild/README
@@ -0,0 +1,2 @@
+These files represent actual schema found in problem databases in the
+wild.