From b00c1c1575e438032c186b229ed96d337facebc0 Mon Sep 17 00:00:00 2001 From: CalDescent Date: Sun, 3 Oct 2021 15:16:36 +0100 Subject: [PATCH] Update splash frame statuses when reshaping, pruning, or building the block archive --- .../qortal/repository/hsqldb/HSQLDBDatabaseArchiving.java | 2 ++ .../org/qortal/repository/hsqldb/HSQLDBDatabasePruning.java | 3 ++- .../org/qortal/repository/hsqldb/HSQLDBDatabaseUpdates.java | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabaseArchiving.java b/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabaseArchiving.java index 0ad315e3..3c24edbb 100644 --- a/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabaseArchiving.java +++ b/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabaseArchiving.java @@ -3,6 +3,7 @@ package org.qortal.repository.hsqldb; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.qortal.controller.Controller; +import org.qortal.gui.SplashFrame; import org.qortal.repository.BlockArchiveWriter; import org.qortal.repository.DataException; import org.qortal.repository.Repository; @@ -40,6 +41,7 @@ public class HSQLDBDatabaseArchiving { } LOGGER.info("Building block archive - this process could take a while... (approx. 15 mins on high spec)"); + SplashFrame.getInstance().updateStatus("Building block archive, please wait..."); final int maximumArchiveHeight = BlockArchiveWriter.getMaxArchiveHeight(repository); int startHeight = 0; diff --git a/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabasePruning.java b/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabasePruning.java index 232f7058..cf2e93eb 100644 --- a/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabasePruning.java +++ b/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabasePruning.java @@ -4,10 +4,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.qortal.controller.Controller; import org.qortal.data.block.BlockData; +import org.qortal.gui.SplashFrame; import org.qortal.repository.BlockArchiveWriter; import org.qortal.repository.DataException; import org.qortal.repository.Repository; -import org.qortal.repository.RepositoryManager; import org.qortal.settings.Settings; import java.sql.ResultSet; @@ -61,6 +61,7 @@ public class HSQLDBDatabasePruning { LOGGER.info("Starting bulk prune of AT states - this process could take a while... " + "(approx. 2 mins on high spec, or upwards of 30 mins in some cases)"); + SplashFrame.getInstance().updateStatus("Pruning database, please wait..."); // Create new AT-states table to hold smaller dataset repository.executeCheckedUpdate("DROP TABLE IF EXISTS ATStatesNew"); diff --git a/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabaseUpdates.java b/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabaseUpdates.java index 66fe9029..62f75a7e 100644 --- a/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabaseUpdates.java +++ b/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabaseUpdates.java @@ -10,6 +10,7 @@ import java.util.stream.Collectors; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.qortal.controller.tradebot.BitcoinACCTv1TradeBot; +import org.qortal.gui.SplashFrame; public class HSQLDBDatabaseUpdates { @@ -27,9 +28,13 @@ public class HSQLDBDatabaseUpdates { public static boolean updateDatabase(Connection connection) throws SQLException { final boolean wasPristine = fetchDatabaseVersion(connection) == 0; + SplashFrame.getInstance().updateStatus("Upgrading database, please wait..."); + while (databaseUpdating(connection, wasPristine)) incrementDatabaseVersion(connection); + SplashFrame.getInstance().updateStatus("Starting Qortal Core..."); + return wasPristine; }