-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Running the unit tests results in sqlite3.OperationalError: object name reserved for internal use: event_search_content #8996
Comments
I am unsure whether this leans towards developer problem or support request which is better handled in |
Note that since the SQL in question is in Looking online a bit it seems that Can you run Python in your virtualenv and do the following: >>> import sqlite3
>>> sqlite3.sqlite_version
'3.28.0' |
I think |
Thanks for the correct shout on The $ python
Python 3.8.6 (default, Dec 29 2020, 03:21:26)
[Clang 12.0.0 (clang-1200.0.32.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.32.3' $ sqlite3 --version
3.32.3 2020-06-18 14:16:19 02c344aceaea0d177dd42e62c8541e3cab4a26c757ba33b3a31a43ccc7d4aapl |
If I remove these tables, the tests seem to run well 🤷. Need to look at those lines closer. diff --git a/synapse/storage/databases/main/schema/full_schemas/54/full.sql.sqlite b/synapse/storage/databases/main/schema/full_schemas/54/full.sql.sqlite
index a0411ede7..308124e53 100644
--- a/synapse/storage/databases/main/schema/full_schemas/54/full.sql.sqlite
+++ b/synapse/storage/databases/main/schema/full_schemas/54/full.sql.sqlite
@@ -67,11 +67,6 @@ CREATE TABLE IF NOT EXISTS "user_threepids" ( user_id TEXT NOT NULL, medium TEXT
CREATE INDEX user_threepids_user_id ON user_threepids(user_id);
CREATE VIRTUAL TABLE event_search USING fts4 ( event_id, room_id, sender, key, value )
/* event_search(event_id,room_id,sender,"key",value) */;
-CREATE TABLE IF NOT EXISTS 'event_search_content'(docid INTEGER PRIMARY KEY, 'c0event_id', 'c1room_id', 'c2sender', 'c3key', 'c4value');
-CREATE TABLE IF NOT EXISTS 'event_search_segments'(blockid INTEGER PRIMARY KEY, block BLOB);
-CREATE TABLE IF NOT EXISTS 'event_search_segdir'(level INTEGER,idx INTEGER,start_block INTEGER,leaves_end_block INTEGER,end_block INTEGER,root BLOB,PRIMARY KEY(level, idx));
-CREATE TABLE IF NOT EXISTS 'event_search_docsize'(docid INTEGER PRIMARY KEY, size BLOB);
-CREATE TABLE IF NOT EXISTS 'event_search_stat'(id INTEGER PRIMARY KEY, value BLOB);
CREATE TABLE guest_access( event_id TEXT NOT NULL, room_id TEXT NOT NULL, guest_access TEXT NOT NULL, UNIQUE (event_id) );
CREATE TABLE history_visibility( event_id TEXT NOT NULL, room_id TEXT NOT NULL, history_visibility TEXT NOT NULL, UNIQUE (event_id) );
CREATE TABLE room_tags( user_id TEXT NOT NULL, room_id TEXT NOT NULL, tag TEXT NOT NULL, content TEXT NOT NULL, CONSTRAINT room_tag_uniqueness UNIQUE (user_id, room_id, tag) );
@@ -149,11 +144,6 @@ CREATE INDEX device_lists_outbound_last_success_idx ON device_lists_outbound_las
CREATE TABLE user_directory_stream_pos ( Lock CHAR(1) NOT NULL DEFAULT 'X' UNIQUE, stream_id BIGINT, CHECK (Lock='X') );
CREATE VIRTUAL TABLE user_directory_search USING fts4 ( user_id, value )
/* user_directory_search(user_id,value) */;
-CREATE TABLE IF NOT EXISTS 'user_directory_search_content'(docid INTEGER PRIMARY KEY, 'c0user_id', 'c1value');
-CREATE TABLE IF NOT EXISTS 'user_directory_search_segments'(blockid INTEGER PRIMARY KEY, block BLOB);
-CREATE TABLE IF NOT EXISTS 'user_directory_search_segdir'(level INTEGER,idx INTEGER,start_block INTEGER,leaves_end_block INTEGER,end_block INTEGER,root BLOB,PRIMARY KEY(level, idx));
-CREATE TABLE IF NOT EXISTS 'user_directory_search_docsize'(docid INTEGER PRIMARY KEY, size BLOB);
-CREATE TABLE IF NOT EXISTS 'user_directory_search_stat'(id INTEGER PRIMARY KEY, value BLOB);
CREATE TABLE blocked_rooms ( room_id TEXT NOT NULL, user_id TEXT NOT NULL );
CREATE UNIQUE INDEX blocked_rooms_idx ON blocked_rooms(room_id);
CREATE TABLE IF NOT EXISTS "local_media_repository_url_cache"( url TEXT, response_code INTEGER, etag TEXT, expires_ts BIGINT, og TEXT, media_id TEXT, download_ts BIGINT ); $ python -m twisted.trial tests
...
Ran 1412 tests in 704.890s
PASSED (skips=20, successes=1392) |
hrm. These tables ( Arguably these tables shouldn't be listed in the full schema, but before we remove them I'd like us to understand why the |
Good info @richvdh! The
Anything I can test on my local machine? It looks like it works as expected(skips the table) when trying it out manually:
I'm unable to find anyone else from Google running into this problem except for |
For reference, do the twisted unit tests work for you when it dumps the full schema into the database? |
yeah, I've never had this problem with the unit tests. |
I'm still a bit mystified by this. I wonder if there is anything odd about the compile-time flags used to build your sqlite. Please could you run:
|
ok, new theory. somehow the
|
|
possibly the defensive bit is set by default. It's clear that this stuff is changing in sqlite - the relevant change seems to be https://www.sqlite.org/src/info/bae76a5c40703871. I don't understand how to translate that into sqlite version numbers, but it's clear that it post-dates 3.28.0. so... after all that, #9003 probably is the right solution. |
Fantastic find @richvdh! The docs you linked align so well as well with what I'm seeing:
Thanks for linking the direct change! Not sure about it being exactly For my own reference, this post is talking about previous versions of SQLite but talks about |
When trying to run the unit tests, I see
sqlite3.OperationalError: object name reserved for internal use: event_search_content
which fails a bunch of the tests.Looking at
synapse/storage/databases/main/schema/full_schemas/54/full.sql.sqlite#L70
, it has the following code which is the only reference toevent_search_content
.Trying this syntax out directly in the postgres command line (not sqlite):
And the last piece seems to be missing the types for the columns, https://stackoverflow.com/a/14950544/796832
This is from a fresh clone and install on a new machine.
The text was updated successfully, but these errors were encountered: