From 2f12473398bd7a3fdd83b1ed9848b6086d9f5eab Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Sat, 10 May 2025 10:02:08 +0200 Subject: [PATCH 1/3] Added missing index on remotevolume name --- .../Scripts/Local/16. Remove index from remotevolume.sql | 2 ++ .../Database/Database schema/16. Add RemoteVolume index.sql | 2 ++ Duplicati/Library/Main/Database/Database schema/Schema.sql | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 Duplicati/CommandLine/DatabaseTool/Scripts/Local/16. Remove index from remotevolume.sql create mode 100644 Duplicati/Library/Main/Database/Database schema/16. Add RemoteVolume index.sql diff --git a/Duplicati/CommandLine/DatabaseTool/Scripts/Local/16. Remove index from remotevolume.sql b/Duplicati/CommandLine/DatabaseTool/Scripts/Local/16. Remove index from remotevolume.sql new file mode 100644 index 000000000..867223617 --- /dev/null +++ b/Duplicati/CommandLine/DatabaseTool/Scripts/Local/16. Remove index from remotevolume.sql @@ -0,0 +1,2 @@ +DROP INDEX IF EXISTS "RemotevolumeNameOnly" ON "Remotevolume" ("Name"); + diff --git a/Duplicati/Library/Main/Database/Database schema/16. Add RemoteVolume index.sql b/Duplicati/Library/Main/Database/Database schema/16. Add RemoteVolume index.sql new file mode 100644 index 000000000..cc84a6002 --- /dev/null +++ b/Duplicati/Library/Main/Database/Database schema/16. Add RemoteVolume index.sql @@ -0,0 +1,2 @@ +CREATE UNIQUE INDEX IF NOT EXISTS "RemotevolumeNameOnly" ON "Remotevolume" ("Name"); +UPDATE "Version" SET "Version" = 16; \ No newline at end of file diff --git a/Duplicati/Library/Main/Database/Database schema/Schema.sql b/Duplicati/Library/Main/Database/Database schema/Schema.sql index 45b296a6e..99038885a 100644 --- a/Duplicati/Library/Main/Database/Database schema/Schema.sql +++ b/Duplicati/Library/Main/Database/Database schema/Schema.sql @@ -38,6 +38,7 @@ CREATE TABLE "Remotevolume" ( ); /* Index for detecting broken states */ +CREATE UNIQUE INDEX IF NOT EXISTS "RemotevolumeNameOnly" ON "Remotevolume" ("Name"); CREATE UNIQUE INDEX "RemotevolumeName" ON "Remotevolume" ("Name", "State"); /* @@ -294,4 +295,4 @@ CREATE TABLE "ChangeJournalData" ( "ConfigHash" TEXT NOT NULL ); -INSERT INTO "Version" ("Version") VALUES (15); +INSERT INTO "Version" ("Version") VALUES (16); From c3b082e9f575ae1e2f529a1e48c77bb74ac3c1f3 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Sat, 10 May 2025 22:13:41 +0200 Subject: [PATCH 2/3] Fixed rollback script --- .../Scripts/Local/16. Remove index from remotevolume.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Duplicati/CommandLine/DatabaseTool/Scripts/Local/16. Remove index from remotevolume.sql b/Duplicati/CommandLine/DatabaseTool/Scripts/Local/16. Remove index from remotevolume.sql index 867223617..4c7d21801 100644 --- a/Duplicati/CommandLine/DatabaseTool/Scripts/Local/16. Remove index from remotevolume.sql +++ b/Duplicati/CommandLine/DatabaseTool/Scripts/Local/16. Remove index from remotevolume.sql @@ -1,2 +1 @@ -DROP INDEX IF EXISTS "RemotevolumeNameOnly" ON "Remotevolume" ("Name"); - +DROP INDEX IF EXISTS "RemotevolumeNameOnly"; From 424ef6c5bfa52eb754bacf0478defb6db593bf09 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Sat, 10 May 2025 22:30:05 +0200 Subject: [PATCH 3/3] Rolled in index from #4706 This closes #4706 --- .../Scripts/Local/16. Remove index from remotevolume.sql | 1 + .../Database/Database schema/16. Add RemoteVolume index.sql | 1 + Duplicati/Library/Main/Database/Database schema/Schema.sql | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Duplicati/CommandLine/DatabaseTool/Scripts/Local/16. Remove index from remotevolume.sql b/Duplicati/CommandLine/DatabaseTool/Scripts/Local/16. Remove index from remotevolume.sql index 4c7d21801..e5fa5c5ce 100644 --- a/Duplicati/CommandLine/DatabaseTool/Scripts/Local/16. Remove index from remotevolume.sql +++ b/Duplicati/CommandLine/DatabaseTool/Scripts/Local/16. Remove index from remotevolume.sql @@ -1 +1,2 @@ DROP INDEX IF EXISTS "RemotevolumeNameOnly"; +DROP INDEX IF EXISTS "FileLookupMetadataID"; \ No newline at end of file diff --git a/Duplicati/Library/Main/Database/Database schema/16. Add RemoteVolume index.sql b/Duplicati/Library/Main/Database/Database schema/16. Add RemoteVolume index.sql index cc84a6002..1c512a5d8 100644 --- a/Duplicati/Library/Main/Database/Database schema/16. Add RemoteVolume index.sql +++ b/Duplicati/Library/Main/Database/Database schema/16. Add RemoteVolume index.sql @@ -1,2 +1,3 @@ CREATE UNIQUE INDEX IF NOT EXISTS "RemotevolumeNameOnly" ON "Remotevolume" ("Name"); +CREATE INDEX IF NOT EXISTS "FileLookupMetadataID" ON "FileLookup" ("MetadataID"); UPDATE "Version" SET "Version" = 16; \ No newline at end of file diff --git a/Duplicati/Library/Main/Database/Database schema/Schema.sql b/Duplicati/Library/Main/Database/Database schema/Schema.sql index 99038885a..c93179b10 100644 --- a/Duplicati/Library/Main/Database/Database schema/Schema.sql +++ b/Duplicati/Library/Main/Database/Database schema/Schema.sql @@ -114,7 +114,7 @@ CREATE TABLE "FileLookup" ( /* Fast path based lookup, single properties are auto-indexed */ CREATE UNIQUE INDEX "FileLookupPath" ON "FileLookup" ("PrefixID", "Path", "BlocksetID", "MetadataID"); CREATE INDEX "nn_FileLookup_BlockMeta" ON FileLookup ("BlocksetID", "MetadataID"); - +CREATE INDEX "FileLookupMetadataID" ON "FileLookup" ("MetadataID"); /*