Re: WC database corruption (1.7.1)
From: Philip Martin <philip.martin_at_wandisco.com>
Date: Thu, 10 Nov 2011 17:01:45 +0000
Neil Bird <neil_at_jibbyjobby.co.uk> writes:
> "*** in database main ***
Interesting! I've never seen a corrupt SQLite database before. It
It may be as simple as
sqlite .svn/wc.db "reindex nodes"
but I don't know if that will work. If it doesn't then it may be
sqlite3 .svn/wc.db "select sql from sqlite_master where name='NODES'"
will show you the SQL for the table and index that need to be recreated.
Make a backup copy of wc.db before going further!
Create a duplicate table NODES_COPY:
sqlite3 .svn/wc.db "CREATE TABLE NODES_COPY ( wc_id INTEGER NOT NULL REFERENCES WCROOT (id), local_relpath TEXT NOT NULL, op_depth INTEGER NOT NULL, parent_relpath TEXT, repos_id INTEGER REFERENCES REPOSITORY (id), repos_path TEXT, revision INTEGER, presence TEXT NOT NULL, moved_here INTEGER, moved_to TEXT, kind TEXT NOT NULL, properties BLOB, depth TEXT, checksum TEXT REFERENCES PRISTINE (checksum), symlink_target TEXT, changed_revision INTEGER, changed_date INTEGER, changed_author TEXT, translated_size INTEGER, last_mod_time INTEGER, dav_cache BLOB, file_external TEXT, PRIMARY KEY (wc_id, local_relpath, op_depth) )"
Copy NODES into NODES_COPY
sqlite3 .svn/wc.db "insert into NODES_COPY select * from NODES"
Drop and recreate NODES:
sqlite3 .svn/wc.db "drop table NODES"
sqlite3 .svn/wc.db "CREATE TABLE NODES ( wc_id INTEGER NOT NULL REFERENCES WCROOT (id), local_relpath TEXT NOT NULL, op_depth INTEGER NOT NULL, parent_relpath TEXT, repos_id INTEGER REFERENCES REPOSITORY (id), repos_path TEXT, revision INTEGER, presence TEXT NOT NULL, moved_here INTEGER, moved_to TEXT, kind TEXT NOT NULL, properties BLOB, depth TEXT, checksum TEXT REFERENCES PRISTINE (checksum), symlink_target TEXT, changed_revision INTEGER, changed_date INTEGER, changed_author TEXT, translated_size INTEGER, last_mod_time INTEGER, dav_cache BLOB, file_external TEXT, PRIMARY KEY (wc_id, local_relpath, op_depth) )"
sqlite3 .svn/wc.db "create index I_NODES_PARENT on NODES (wc_id, parent_relpath, op_depth)"
Copy NODES_COPY into NODES:
sqlite3 .svn/wc.db "insert into NODES select * from NODES_COPY"
Drop table NODES_COPY:
sqlite3 .svn/wc.db "drop table NODES_COPY"
Then you need to do something similar for PRISTINE, although this time
sqlite3 .svn/wc.db "select sql from sqlite_master where name='PRISTINE'"
Create PRISTINE_COPY
-- PhilipReceived on 2011-11-10 18:02:32 CET |
This is an archived mail posted to the Subversion Users mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.