First we don't actually care about the SQL formatting directives (i.e. the '(5)' in 'INT(5)'), and these have no impact on the allowed range. They are changed anyway only for consistency with the TestBot ORM declarations. However the TestBot ORM enforces the declared maximum number of digits. So increase those to allow the full range of the underlying database type, which in this case is 0..2^31-1.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- This patch requires updating the database and then restarting the TestBot Engine and web server.
What would increase the range would be switching the autoincrement fields from signed to unsigned. It would also make sense since these start at zero and never wrap. However they are used as foreign keys so changing their type is more trouble than it's worth. At the current rate 2 billion jobs / Wine patches should be enough for over 150000 years. Enough I guess. The RecordGroupId field may be more troublesome: I don't know what its value is on the official TestBot but here is seems to be 10x the job id (it sort of scales with the number of VM operations, and thus the number of tasks). So it may only have another 1500 to 15000 years in it. That should still be enough. Maybe we should have a Munin graph to monitor the 'wear' on these. --- testbot/ddl/update45.sql | 24 ++++++++++++++++++++++++ testbot/ddl/winetestbot.sql | 18 +++++++++--------- testbot/lib/WineTestBot/Jobs.pm | 2 +- testbot/lib/WineTestBot/Patches.pm | 4 ++-- testbot/lib/WineTestBot/RecordGroups.pm | 2 +- testbot/lib/WineTestBot/Records.pm | 2 +- testbot/lib/WineTestBot/Steps.pm | 2 +- testbot/lib/WineTestBot/StepsTasks.pm | 2 +- testbot/lib/WineTestBot/Tasks.pm | 2 +- 9 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 testbot/ddl/update45.sql
diff --git a/testbot/ddl/update45.sql b/testbot/ddl/update45.sql new file mode 100644 index 000000000..a04dba1e8 --- /dev/null +++ b/testbot/ddl/update45.sql @@ -0,0 +1,24 @@ +USE winetestbot; + +ALTER TABLE Patches + MODIFY Id INT NOT NULL AUTO_INCREMENT, + MODIFY WebPatchId INT NULL; + +ALTER TABLE PendingPatches + MODIFY PatchId INT NOT NULL; + +ALTER TABLE Jobs + MODIFY Id INT NOT NULL AUTO_INCREMENT, + MODIFY PatchId INT NULL; + +ALTER TABLE Steps + MODIFY JobId INT NOT NULL; + +ALTER TABLE Tasks + MODIFY JobId INT NOT NULL; + +ALTER TABLE RecordGroups + MODIFY Id INT NOT NULL AUTO_INCREMENT; + +ALTER TABLE Records + MODIFY RecordGroupId INT NOT NULL; diff --git a/testbot/ddl/winetestbot.sql b/testbot/ddl/winetestbot.sql index 1794b2508..3b5cda757 100644 --- a/testbot/ddl/winetestbot.sql +++ b/testbot/ddl/winetestbot.sql @@ -66,8 +66,8 @@ ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE Patches ( - Id INT(7) NOT NULL AUTO_INCREMENT, - WebPatchId INT(7) NULL, + Id INT NOT NULL AUTO_INCREMENT, + WebPatchId INT NULL, Received DATETIME NOT NULL, Disposition VARCHAR(40) NOT NULL, FromName VARCHAR(40) NULL, @@ -94,7 +94,7 @@ CREATE TABLE PendingPatches PendingPatchSetVersion INT(2) NOT NULL, PendingPatchSetTotalParts INT(2) NOT NULL, No INT(2) NOT NULL, - PatchId INT(7) NOT NULL, + PatchId INT NOT NULL, FOREIGN KEY (PendingPatchSetEMail, PendingPatchSetVersion, PendingPatchSetTotalParts) REFERENCES PendingPatchSets(EMail, Version, TotalParts), FOREIGN KEY (PatchId) REFERENCES Patches(Id), @@ -112,7 +112,7 @@ ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE Jobs ( - Id INT(5) NOT NULL AUTO_INCREMENT, + Id INT NOT NULL AUTO_INCREMENT, BranchName VARCHAR(20) NOT NULL, UserName VARCHAR(40) NOT NULL, Priority INT(1) NOT NULL, @@ -120,7 +120,7 @@ CREATE TABLE Jobs Remarks VARCHAR(128) NULL, Submitted DATETIME NOT NULL, Ended DATETIME NULL, - PatchId INT(7) NULL, + PatchId INT NULL, FOREIGN KEY (BranchName) REFERENCES Branches(Name), FOREIGN KEY (UserName) REFERENCES Users(Name), FOREIGN KEY (PatchId) REFERENCES Patches(Id), @@ -130,7 +130,7 @@ ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE Steps ( - JobId INT(5) NOT NULL, + JobId INT NOT NULL, No INT(2) NOT NULL, PreviousNo INT(2) NULL, Type ENUM('suite', 'single', 'build', 'reconfig') NOT NULL, @@ -148,7 +148,7 @@ ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE Tasks ( - JobId INT(5) NOT NULL, + JobId INT NOT NULL, StepNo INT(2) NOT NULL, No INT(2) NOT NULL, Status ENUM('queued', 'running', 'completed', 'badpatch', 'badbuild', 'boterror', 'canceled', 'skipped') NOT NULL, @@ -166,7 +166,7 @@ ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE RecordGroups ( - Id INT(6) NOT NULL AUTO_INCREMENT, + Id INT NOT NULL AUTO_INCREMENT, Timestamp DATETIME NOT NULL, PRIMARY KEY (Id) ) @@ -174,7 +174,7 @@ ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE Records ( - RecordGroupId INT(6) NOT NULL, + RecordGroupId INT NOT NULL, Type ENUM('engine', 'tasks', 'vmresult', 'vmstatus') NOT NULL, Name VARCHAR(96) NOT NULL, Value VARCHAR(64) NULL, diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm index aeecea0c1..5dbc1a7f4 100644 --- a/testbot/lib/WineTestBot/Jobs.pm +++ b/testbot/lib/WineTestBot/Jobs.pm @@ -446,7 +446,7 @@ sub CreateItem($) }
my @PropertyDescriptors = ( - CreateBasicPropertyDescriptor("Id", "Job", 1, 1, "S", 5), + CreateBasicPropertyDescriptor("Id", "Job", 1, 1, "S", 10), CreateItemrefPropertyDescriptor("Branch", "Branch", !1, 1, &CreateBranches, ["BranchName"]), CreateItemrefPropertyDescriptor("User", "Author", !1, 1, &CreateUsers, ["UserName"]), CreateBasicPropertyDescriptor("Priority", "Priority", !1, 1, "N", 1), diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm index cb8c78cb5..b6a8af4c4 100644 --- a/testbot/lib/WineTestBot/Patches.pm +++ b/testbot/lib/WineTestBot/Patches.pm @@ -453,8 +453,8 @@ sub CreateItem($) }
my @PropertyDescriptors = ( - CreateBasicPropertyDescriptor("Id", "Patch id", 1, 1, "S", 7), - CreateBasicPropertyDescriptor("WebPatchId", "Wine Web Patch id", !1, !1, "N", 7), + CreateBasicPropertyDescriptor("Id", "Patch id", 1, 1, "S", 10), + CreateBasicPropertyDescriptor("WebPatchId", "Wine Web Patch id", !1, !1, "N", 10), CreateBasicPropertyDescriptor("Received", "Received", !1, 1, "DT", 19), CreateBasicPropertyDescriptor("FromName", "Author", !1, !1, "A", 40), CreateBasicPropertyDescriptor("FromEMail", "Author's email address", !1, !1, "A", 40), diff --git a/testbot/lib/WineTestBot/RecordGroups.pm b/testbot/lib/WineTestBot/RecordGroups.pm index 27cedfe32..f0945434c 100644 --- a/testbot/lib/WineTestBot/RecordGroups.pm +++ b/testbot/lib/WineTestBot/RecordGroups.pm @@ -73,7 +73,7 @@ sub CreateItem($) }
my @PropertyDescriptors = ( - CreateBasicPropertyDescriptor("Id", "Group id", 1, 1, "S", 6), + CreateBasicPropertyDescriptor("Id", "Group id", 1, 1, "S", 10), CreateBasicPropertyDescriptor("Timestamp", "Timestamp", !1, 1, "DT", 19), CreateDetailrefPropertyDescriptor("Records", "Records", !1, !1, &CreateRecords), ); diff --git a/testbot/lib/WineTestBot/Records.pm b/testbot/lib/WineTestBot/Records.pm index 00364f292..fd8e574ea 100644 --- a/testbot/lib/WineTestBot/Records.pm +++ b/testbot/lib/WineTestBot/Records.pm @@ -83,7 +83,7 @@ my @PropertyDescriptors = ( CreateBasicPropertyDescriptor("Value", "Value", !1, !1, "A", 64), ); my @FlatPropertyDescriptors = ( - CreateBasicPropertyDescriptor("RecordGroupId", "Group id", 1, 1, "S", 6), + CreateBasicPropertyDescriptor("RecordGroupId", "Group id", 1, 1, "S", 10), @PropertyDescriptors );
diff --git a/testbot/lib/WineTestBot/Steps.pm b/testbot/lib/WineTestBot/Steps.pm index 921077b48..0f65d631c 100644 --- a/testbot/lib/WineTestBot/Steps.pm +++ b/testbot/lib/WineTestBot/Steps.pm @@ -247,7 +247,7 @@ my @PropertyDescriptors = ( ); SetDetailrefKeyPrefix("Step", @PropertyDescriptors); my @FlatPropertyDescriptors = ( - CreateBasicPropertyDescriptor("JobId", "Job id", 1, 1, "S", 5), + CreateBasicPropertyDescriptor("JobId", "Job id", 1, 1, "S", 10), @PropertyDescriptors );
diff --git a/testbot/lib/WineTestBot/StepsTasks.pm b/testbot/lib/WineTestBot/StepsTasks.pm index a9326bec9..0b1655a37 100644 --- a/testbot/lib/WineTestBot/StepsTasks.pm +++ b/testbot/lib/WineTestBot/StepsTasks.pm @@ -177,7 +177,7 @@ sub CreateItem($)
# Note: To simplify maintenance replace enums with simple string fields. my @PropertyDescriptors = ( - CreateBasicPropertyDescriptor("Id", "Id", 1, 1, "N", 4), + CreateBasicPropertyDescriptor("Id", "Id", 1, 1, "N", 10), CreateBasicPropertyDescriptor("StepNo", "Step", !1, 1, "N", 2), CreateBasicPropertyDescriptor("PreviousNo", "Previous step", !1, !1, "N", 2), CreateBasicPropertyDescriptor("TaskNo", "Task", !1, 1, "N", 2), diff --git a/testbot/lib/WineTestBot/Tasks.pm b/testbot/lib/WineTestBot/Tasks.pm index 141fee07b..5cc2cc667 100644 --- a/testbot/lib/WineTestBot/Tasks.pm +++ b/testbot/lib/WineTestBot/Tasks.pm @@ -368,7 +368,7 @@ my @PropertyDescriptors = ( CreateBasicPropertyDescriptor("TestFailures", "Failures", !1, !1, "N", 6), ); my @FlatPropertyDescriptors = ( - CreateBasicPropertyDescriptor("JobId", "Job id", 1, 1, "S", 5), + CreateBasicPropertyDescriptor("JobId", "Job id", 1, 1, "S", 10), CreateBasicPropertyDescriptor("StepNo", "Step no", 1, 1, "N", 2), @PropertyDescriptors );