Restoring corrupted H2 database
Problem
If you’re working with Automatic Data Lineage R42.0 - R42.7, embedded H2 databases might become irreversibly corrupted for the following services:
- Keycloak
- DataFlow Server
- Manta Admin UI
If you want to work with these services, you must restore the corrupted databases.
Keycloak
Symptoms
If the H2 databases are corrupted, Keycloak is down and you can find entries similar to the following one in the logs.
Example:
2024-09-10 08:28:21,147 WARN [io.agroal.pool] (agroal-11) Datasource '<default>': IO Exception: "/apps/mantaflow/keycloak/data/h2/keycloakdb.mv.db" [90028-230]
2024-09-10 08:28:21,151 WARN [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator] (JPA Startup Thread) HHH000342: Could not obtain connection to query metadata: java.lang.NullPointerException: Cannot invoke "org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(java.sql.SQLException, String)" because the return value of "org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.sqlExceptionHelper()" is null
Solution
-
Stop and restart Keycloack.
If you can still the error message in the logs, procced to step 2.
-
Stop all Automatic Data Lineage services.
- Linux: Use your service management scripts or commands.
- Windows: Use the Windows Services Manager or relevant scripts.
-
Change directories to the
keycloack.-
Linux:
cd $MANTA_HOME/keycloak -
Windows:
cd %MANTA_HOME%\keycloak
-
-
Create a back up version of the
datafolder.-
Linux:
cp -r data data_backup -
Windows:
xcopy data data_backup /E /I
-
-
Delete the old
datafolder.-
Linux:
rm -rf data -
Windows:
rmdir /S /Q data
-
-
Create a new
datafolder.-
Linux:
mkdir data -
Windows:
mkdir data
-
-
Copy the contents from
data_backuptodata.
The working environment from which you copy thedatafolder must be compatible with the environment you're restoring.-
Linux:
cp -r /path/to/working/keycloak/data/* data/ -
Windows:
xcopy C:\path\to\working\keycloak\data\* data\ /E /I
-
-
Copy
clientsecretfrom the same working environment and replace it in all of the availableoidc.propertiesfiles in the following directories.-
Linux:
$MANTA_HOME/configurationservice/manta-configuration-service-dir/conf/oidc.properties$MANTA_HOME/serviceutility/manta-admin-ui-dir/conf/oidc.properties$MANTA_HOME/openmantadesigner/manta-openmantadesigner-dir/conf/oidc.properties$MANTA_HOME/server/manta-dataflow-server-dir/conf/oidc.properties$MANTA_HOME/cli/platform/conf/oidc.properties
-
Windows:
%MANTA_HOME%\configurationservice\manta-configuration-service-dir\conf\oidc.properties%MANTA_HOME%\serviceutility\manta-admin-ui-dir\conf\oidc.properties%MANTA_HOME%\openmantadesigner\manta-openmantadesigner-dir\conf\oidc.properties%MANTA_HOME%\server\manta-dataflow-server-dir\conf\oidc.properties%MANTA_HOME%\cli\platform\conf\oidc.properties
-
-
Start all Automatic Data Lineage services and verify that Keycloack service works by running a diagnostic scenario in Manta Admin UI Process Manager.
DataFlow server
Symptoms
If the H2 databases such as usageStatsDb or scriptMetadataDb are corrupted, DataFlow Server is down and you can find error messages in the logs.
Solution
-
Stop and restart DataFlow Server.
If you can still the error message in the logs, procced to step 2.
-
Stop all Automatic Data Lineage services.
- Linux: Use your service management scripts or commands.
- Windows: Use the Windows Services Manager or relevant scripts.
-
Change directories to the
manta-dataflow-server-dir.-
Linux:
cd $MANTA_HOME/server/manta-dataflow-server-dir/data -
Windows:
cd %MANTA_HOME%\server\manta-dataflow-server-dir\data
-
-
Back up the corresponding corrupted database.
In this example, file names that start withusageStatsDBandscriptMetadataDb.-
Linux:
mv usageStatsDb usageStatsDb_backup mv scriptMetadataDb scriptMetadataDb_backup -
Windows:
rename usageStatsDb usageStatsDb_backup rename scriptMetadataDb scriptMetadataDb_backup
-
-
Delete the corresponding corrupted database.
In this example, file names that start withusageStatsDBandscriptMetadataDb.Delete only the corrupted database folders. If you delete the entire
datafolder, you might lose of all the previously scanned lineage data. -
Start all Automatic Data Lineage services and verify that DataFlow Server works by running a diagnostic scenario in Manta Admin UI Process Manager.
Manta Admin GUI
Symptoms
If the H2 databases are corrupted, Manta Admin UI is down and you can find entries similar to the following one in the logs.
Example:
Cause: org.h2.jdbc.JdbcSQLNonTransientException: General error: "org.h2.mvstore.MVStoreException: Reading from file split:30:/opt/mantaflow/serviceutility/manta-admin-ui-dir/data/manta_logs.mv.db failed at 7374124993 (length 28695310336), read 0, remaining 1536 [2.2.224/1]"; SQL statement:
In the example, manta_logs.mv.db is the corrupted database . Dropping logs doesn’t affect the repository. You can no longer extract the logs from the Log Viewer, but you can retrieve them manually by accessing the log folders.
For other corrupted databases, such as process-monitor-h2.mv.trace.db, if you drop the Process Manager, you mightt lose all workflows.
Solution
-
Stop and restart Manta Admin UI.
If you can still the error message in the logs, procced to step 2.
-
Stop all Automatic Data Lineage services.
- Linux: Use your service management scripts or commands.
- Windows: Use the Windows Services Manager or relevant scripts.
-
Change directories to
serviceutility/manta-admin-ui-dir/data.-
Linux:
cd $MANTA_HOME/serviceutility/manta-admin-ui-dir/data -
Windows:
cd %MANTA_HOME%\serviceutility\manta-admin-ui-dir\data
-
-
Back up the corrupted database.
In the example, it'smanta_logs.mv.db.- Linux:
mv manta_logs.mv.db manta_logs.mv.db_backup
- Windows:
rename manta_logs.mv.db manta_logs.mv.db_backup
- Linux:
-
Delete the corresponding corrupted database files.
In the example, it'smanta_logs.mv.db.Delete only the corrupted database folders. If you delete the entire
datafolder, you might lose data.Depending on which database you delete, different features might be affected. Before you delete a database, assess the potential impact. For example, if you delete
manta_logs.mv.db, you can't export logs directly from the Manta Admin UI Log Viewer anymore. Instead, you can extract them manually from$MANTA_HOME/cli/log/on Linux or%MANTA_HOME%\cli\log\on Windows.-
Linux:
rm manta_logs.mv.db -
Windows:
del manta_logs.mv.db
-
-
Start all Automatic Data Lineage services and verify that Manta Admin UI service works by running a diagnostic scenario in Manta Admin UI Process Manager.