From b2798269590d5e87912badff9900dc98e8de2531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Ar=C3=A8s?= Date: Tue, 25 Apr 2017 09:10:03 +0200 Subject: [PATCH] Fix file_name column size in H2AccountPatchReviewStore file_name store the path to the file within the repository. Absolute file path on Linux have a maximum of 4096 characters so increase file_name column size to 4096. This fixes only apply to installations that did not yet migrate to 2.13, for existing ones, a manual db migration is required. Manual migration can be done by using H2 web console, Gerrit must be stopped before otherwise H2 console will not be able to connect to database: java -jar /path/to/h2.jar -url jdbc:h2:path/to/review_site/db/account_patch_reviews then execute the following statement: ALTER TABLE account_patch_reviews ALTER COLUMN file_name VARCHAR(4096) DEFAULT '' NOT NULL Depending on the number or rows, this statement can take long time, for example, one million row can take up to 1 minute. Change-Id: I83ab98acb1581c2a7f6c65a9c2159873421f39ea --- .../google/gerrit/server/schema/H2AccountPatchReviewStore.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/schema/H2AccountPatchReviewStore.java b/gerrit-server/src/main/java/com/google/gerrit/server/schema/H2AccountPatchReviewStore.java index b5862f2717..6dbe916768 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/schema/H2AccountPatchReviewStore.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/schema/H2AccountPatchReviewStore.java @@ -143,7 +143,7 @@ public class H2AccountPatchReviewStore + "account_id INTEGER DEFAULT 0 NOT NULL, " + "change_id INTEGER DEFAULT 0 NOT NULL, " + "patch_set_id INTEGER DEFAULT 0 NOT NULL, " - + "file_name VARCHAR(255) DEFAULT '' NOT NULL, " + + "file_name VARCHAR(4096) DEFAULT '' NOT NULL, " + "CONSTRAINT primary_key_account_patch_reviews " + "PRIMARY KEY (account_id, change_id, patch_set_id, file_name)" + ")");