diff --git a/deploy/deploy-core/scripts/derby/createfullhddb.sql b/deploy/deploy-core/scripts/derby/createfullhddb.sql index b38104062a..f5b1530342 100644 --- a/deploy/deploy-core/scripts/derby/createfullhddb.sql +++ b/deploy/deploy-core/scripts/derby/createfullhddb.sql @@ -90,9 +90,9 @@ insert into schemaversions (tablename, version ) insert into schemaversions (tablename, version ) values ( 'global_crawler_trap_expressions', 1); insert into schemaversions ( tablename, version ) - values ( 'runningjobshistory', 2); + values ( 'runningjobshistory', 3); insert into schemaversions ( tablename, version ) - values ( 'runningjobsmonitor', 2); + values ( 'runningjobsmonitor', 3); insert into schemaversions ( tablename, version ) values ( 'frontierreportmonitor', 1); @@ -540,6 +540,7 @@ CREATE TABLE runningJobsHistory ( activeToeCount integer NOT NULL, status int NOT NULL, tstamp timestamp NOT NULL, + totalbyteswritten bigint NOT NULL DEFAULT 0, PRIMARY KEY (jobId, harvestName, elapsedSeconds, tstamp) ); @@ -569,6 +570,7 @@ CREATE TABLE runningJobsMonitor ( activeToeCount integer NOT NULL, status integer NOT NULL, tstamp timestamp NOT NULL, + totalbyteswritten bigint NOT NULL DEFAULT 0, PRIMARY KEY (jobId, harvestName) ); diff --git a/deploy/deploy-core/scripts/mysql/createfullhddb.mysql b/deploy/deploy-core/scripts/mysql/createfullhddb.mysql index d05720275e..89bd823291 100644 --- a/deploy/deploy-core/scripts/mysql/createfullhddb.mysql +++ b/deploy/deploy-core/scripts/mysql/createfullhddb.mysql @@ -76,9 +76,9 @@ insert into schemaversions (tablename, version ) insert into schemaversions (tablename, version ) values ( 'global_crawler_trap_expressions', 1); INSERT INTO schemaversions ( tablename, version ) - VALUES ( 'runningjobshistory', 2); + VALUES ( 'runningjobshistory', 3); INSERT INTO schemaversions ( tablename, version ) - VALUES ( 'runningjobsmonitor', 2); + VALUES ( 'runningjobsmonitor', 3); INSERT INTO schemaversions ( tablename, version ) VALUES ( 'frontierreportmonitor', 1); @@ -358,6 +358,7 @@ CREATE TABLE runningJobsHistory ( activeToeCount integer NOT NULL, status integer NOT NULL, tstamp timestamp NOT NULL, + totalbyteswritten bigint NOT NULL DEFAULT 0, PRIMARY KEY (jobId, harvestName, elapsedSeconds, tstamp) ); @@ -389,6 +390,7 @@ CREATE TABLE runningJobsMonitor ( activeToeCount integer NOT NULL, status integer NOT NULL, tstamp timestamp NOT NULL, + totalbyteswritten bigint NOT NULL DEFAULT 0, PRIMARY KEY (jobId, harvestName) ); diff --git a/deploy/deploy-core/scripts/postgresql/netarchivesuite_init.sql b/deploy/deploy-core/scripts/postgresql/netarchivesuite_init.sql index 205961f35f..0fb3a2eb4b 100644 --- a/deploy/deploy-core/scripts/postgresql/netarchivesuite_init.sql +++ b/deploy/deploy-core/scripts/postgresql/netarchivesuite_init.sql @@ -88,9 +88,9 @@ INSERT INTO schemaversions (tablename, version ) INSERT INTO schemaversions (tablename, version ) VALUES ( 'global_crawler_trap_expressions', 1); INSERT INTO schemaversions ( tablename, version ) - VALUES ( 'runningjobshistory', 2); + VALUES ( 'runningjobshistory', 3); INSERT INTO schemaversions ( tablename, version ) - VALUES ( 'runningjobsmonitor', 2); + VALUES ( 'runningjobsmonitor', 3); INSERT INTO schemaversions ( tablename, version ) VALUES ( 'frontierreportmonitor', 1); INSERT INTO schemaversions ( tablename, version ) @@ -472,6 +472,7 @@ CREATE TABLE runningJobsHistory ( processedDocsPerSec numeric NOT NULL, activeToeCount integer NOT NULL, status integer NOT NULL, + totalbyteswritten bigint NOT NULL DEFAULT 0, tstamp timestamp NOT NULL, CONSTRAINT pkRunningJobsHistory PRIMARY KEY (jobId, harvestName, elapsedSeconds, tstamp) ); @@ -503,6 +504,7 @@ CREATE TABLE runningJobsMonitor ( processedDocsPerSec numeric NOT NULL, activeToeCount integer NOT NULL, status integer NOT NULL, + totalbyteswritten bigint NOT NULL DEFAULT 0, tstamp timestamp NOT NULL, CONSTRAINT pkRunningJobsMonitor PRIMARY KEY (jobId, harvestName) ); diff --git a/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/DBSpecifics.java b/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/DBSpecifics.java index 9cb8a75153..48503d0169 100644 --- a/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/DBSpecifics.java +++ b/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/DBSpecifics.java @@ -282,6 +282,10 @@ private void upgradeRunningjobsmonitor(int currentVersion, int toVersion) { migrateRunningJobsMonitorTableV1ToV2(); currentVersion = 2; } + if (currentVersion == 2 && toVersion >= 3) { + migrateRunningJobsMonitorTableV2ToV3(); + currentVersion = 3; + } if (currentVersion > HarvesterDatabaseTables.RUNNINGJOBSMONITOR.getRequiredVersion()) { throw new NotImplementedException("No method exists for migrating table '" + HarvesterDatabaseTables.RUNNINGJOBSMONITOR.getTablename() + "' from version " + currentVersion @@ -304,6 +308,11 @@ private void upgradeRunningjobshistoryTable(int currentVersion, int toVersion) { migrateRunningJobsHistoryTableV1ToV2(); currentVersion = 2; } + if (currentVersion == 2 && toVersion >= 3) { + migrateRunningJobsHistoryTableV2ToV3(); + currentVersion = 3; + } + // insert new migrations here if (currentVersion > HarvesterDatabaseTables.RUNNINGJOBSHISTORY.getRequiredVersion()) { throw new NotImplementedException("No method exists for migrating table '" @@ -507,6 +516,18 @@ private void upgradeHarvestchannelTable(int currentVersion, int toVersion) { protected abstract void createHarvestChannelTable(); + /** + * Migrates the 'runningjobshistory' table from version 2 to version 3. This consists of adding the new column + * 'totalbyteswritten'. + */ + protected abstract void migrateRunningJobsHistoryTableV2ToV3(); + + /** + * Migrates the 'runningjobsmonitor' table from version 2 to version 3. This consists of adding the new column + * 'totalbyteswritten'. + */ + protected abstract void migrateRunningJobsMonitorTableV2ToV3(); + /** * Migrates the 'jobs' table from version 3 to version 4 consisting of a change of the field forcemaxbytes from int * to bigint and setting its default to -1. Furthermore the default value for field num_configs is set to 0. diff --git a/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/DerbySpecifics.java b/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/DerbySpecifics.java index 858a9956c9..146316f2a5 100644 --- a/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/DerbySpecifics.java +++ b/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/DerbySpecifics.java @@ -219,6 +219,27 @@ public void createRunningJobsMonitorTable() { } } + /** + * Migrates the 'runningjobshistory' table from version 2 to version 3. This consists of adding the new column + * 'totalbyteswritten'. + */ + @Override + protected void migrateRunningJobsHistoryTableV2ToV3() { + String[] sqlStatements = {"ALTER TABLE runningjobshistory ADD COLUMN totalbyteswritten BIGINT NOT NULL DEFAULT 0"}; + HarvestDBConnection.updateTable("runningjobshistory", 3, sqlStatements); + } + + /** + * Migrates the 'runningjobsmonitor' table from version 2 to version 3. This consists of adding the new column + * 'totalbyteswritten'. + */ + @Override + protected void migrateRunningJobsMonitorTableV2ToV3() { + String[] sqlStatements = {"ALTER TABLE runningjobsmonitor ADD COLUMN totalbyteswritten BIGINT NOT NULL DEFAULT 0"}; + HarvestDBConnection.updateTable("runningjobsmonitor", 3, sqlStatements); + } + + // Below DB changes introduced with development release 3.15 // with changes to tables 'runningjobshistory', 'runningjobsmonitor', // 'configurations', 'fullharvests', and 'jobs'. diff --git a/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/MySQLSpecifics.java b/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/MySQLSpecifics.java index 0712dab819..7998eed56d 100644 --- a/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/MySQLSpecifics.java +++ b/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/MySQLSpecifics.java @@ -235,6 +235,26 @@ public void createRunningJobsMonitorTable() { } } + /** + * Migrates the 'runningjobshistory' table from version 2 to version 3. This consists of adding the new column + * 'totalbyteswritten'. + */ + @Override + protected void migrateRunningJobsHistoryTableV2ToV3() { + String[] sqlStatements = {"ALTER TABLE runningjobshistory ADD COLUMN totalbyteswritten BIGINT NOT NULL DEFAULT 0"}; + HarvestDBConnection.updateTable("runningjobshistory", 3, sqlStatements); + } + + /** + * Migrates the 'runningjobsmonitor' table from version 2 to version 3. This consists of adding the new column + * 'totalbyteswritten'. + */ + @Override + protected void migrateRunningJobsMonitorTableV2ToV3() { + String[] sqlStatements = {"ALTER TABLE runningjobsmonitor ADD COLUMN totalbyteswritten BIGINT NOT NULL DEFAULT 0"}; + HarvestDBConnection.updateTable("runningjobsmonitor", 3, sqlStatements); + } + // Below DB changes introduced with development release 3.15 // with changes to tables 'runningjobshistory', 'runningjobsmonitor', // 'configurations', 'fullharvests', and 'jobs'. diff --git a/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/PostgreSQLSpecifics.java b/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/PostgreSQLSpecifics.java index f6ff67de11..db80c415f1 100644 --- a/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/PostgreSQLSpecifics.java +++ b/harvester/harvester-core/src/main/java/dk/netarkivet/harvester/datamodel/PostgreSQLSpecifics.java @@ -176,6 +176,26 @@ public void createRunningJobsMonitorTable() { HarvestDBConnection.updateTable("runningjobsmonitor", 1); } + /** + * Migrates the 'runningjobshistory' table from version 2 to version 3. This consists of adding the new column + * 'totalbyteswritten'. + */ + @Override + protected void migrateRunningJobsHistoryTableV2ToV3() { + String[] sqlStatements = {"ALTER TABLE runningjobshistory ADD COLUMN totalbyteswritten BIGINT NOT NULL DEFAULT 0"}; + HarvestDBConnection.updateTable("runningjobshistory", 3, sqlStatements); + } + + /** + * Migrates the 'runningjobsmonitor' table from version 2 to version 3. This consists of adding the new column + * 'totalbyteswritten'. + */ + @Override + protected void migrateRunningJobsMonitorTableV2ToV3() { + String[] sqlStatements = {"ALTER TABLE runningjobsmonitor ADD COLUMN totalbyteswritten BIGINT NOT NULL DEFAULT 0"}; + HarvestDBConnection.updateTable("runningjobsmonitor", 3, sqlStatements); + } + // Below DB changes introduced with development release 3.15 // with changes to tables 'runningjobshistory', 'runningjobsmonitor', // 'configurations', 'fullharvests', and 'jobs'.