You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "sumitagrawl (via GitHub)" <gi...@apache.org> on 2025/08/08 16:23:03 UTC
[PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
sumitagrawl opened a new pull request, #8917:
URL: https://github.com/apache/ozone/pull/8917
## What changes were proposed in this pull request?
Recon staging db for container db during Full OM DB reprocess. And replace on finishing the reprocess activigty
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-13553
Parent JIRA: [HDDS-13552](https://issues.apache.org/jira/browse/HDDS-13552)
## How was this patch tested?
- TODO
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl commented on code in PR #8917:
URL: https://github.com/apache/ozone/pull/8917#discussion_r2267021134
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
Review Comment:
there, it should fail as if backup path is not able to operate, means some problem like permission issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl commented on code in PR #8917:
URL: https://github.com/apache/ozone/pull/8917#discussion_r2267049534
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
+ FileUtils.moveDirectory(dbPath, backupPath);
+ close();
+ FileUtils.moveDirectory(stagedDbPath, backupPath);
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl commented on code in PR #8917:
URL: https://github.com/apache/ozone/pull/8917#discussion_r2272547541
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
+ FileUtils.moveDirectory(dbPath, backupPath);
+ close();
+ FileUtils.moveDirectory(stagedDbPath, backupPath);
+ dbStore = initializeDBStore(configuration, dbPath.getName());
+ } catch (Exception e) {
Review Comment:
updated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl commented on code in PR #8917:
URL: https://github.com/apache/ozone/pull/8917#discussion_r2272548762
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -227,6 +265,32 @@ public synchronized void reInitializeTasks(ReconOMMetadataManager omMetadataMana
} catch (CancellationException ce) {
LOG.error("Some tasks were cancelled with exception", ce);
}
+
+ if (isRunSuccessful.get()) {
+ try {
+ reconDBProvider.replaceStagedDb(stagedReconDBProvider);
+ reconNamespaceSummaryManager.reinitialize(reconDBProvider);
+ reconContainerMetadataManager.reinitialize(reconDBProvider);
+ reprocessTaskStatus.setLastTaskRunStatus(0);
+ reprocessTaskStatus.recordRunCompletion();
Review Comment:
updated
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -227,6 +265,32 @@ public synchronized void reInitializeTasks(ReconOMMetadataManager omMetadataMana
} catch (CancellationException ce) {
LOG.error("Some tasks were cancelled with exception", ce);
}
+
+ if (isRunSuccessful.get()) {
+ try {
+ reconDBProvider.replaceStagedDb(stagedReconDBProvider);
+ reconNamespaceSummaryManager.reinitialize(reconDBProvider);
+ reconContainerMetadataManager.reinitialize(reconDBProvider);
+ reprocessTaskStatus.setLastTaskRunStatus(0);
+ reprocessTaskStatus.recordRunCompletion();
+ LOG.info("Re-initialization of tasks completed successfully.");
+ } catch (Exception e) {
+ LOG.error("Re-initialization of tasks failed.", e);
+ reprocessTaskStatus.setLastTaskRunStatus(-1);
+ reprocessTaskStatus.recordRunCompletion();
+ // reinitialize the Recon OM tasks with the original DB provider
+ try {
+ reconNamespaceSummaryManager.reinitialize(reconDBProvider);
+ reconContainerMetadataManager.reinitialize(reconDBProvider);
Review Comment:
updated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl merged PR #8917:
URL: https://github.com/apache/ozone/pull/8917
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "devmadhuu (via GitHub)" <gi...@apache.org>.
devmadhuu commented on code in PR #8917:
URL: https://github.com/apache/ozone/pull/8917#discussion_r2272145615
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -227,6 +265,32 @@ public synchronized void reInitializeTasks(ReconOMMetadataManager omMetadataMana
} catch (CancellationException ce) {
LOG.error("Some tasks were cancelled with exception", ce);
}
+
+ if (isRunSuccessful.get()) {
+ try {
+ reconDBProvider.replaceStagedDb(stagedReconDBProvider);
+ reconNamespaceSummaryManager.reinitialize(reconDBProvider);
+ reconContainerMetadataManager.reinitialize(reconDBProvider);
+ reprocessTaskStatus.setLastTaskRunStatus(0);
+ reprocessTaskStatus.recordRunCompletion();
Review Comment:
This need to be done carefully, because this is just switchover part and tasks already completed their reprocess logic above, so this whole operation/process should be either complete failed or complete success. In case of successful switchover only of STAGING DB to PROD DB, we can treat whole process as success and then only individual tasks status for reprocess should be updated as success else not. so need to refactor a code little bit for above `.thenAccept` code block.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -227,6 +265,32 @@ public synchronized void reInitializeTasks(ReconOMMetadataManager omMetadataMana
} catch (CancellationException ce) {
LOG.error("Some tasks were cancelled with exception", ce);
}
+
+ if (isRunSuccessful.get()) {
+ try {
+ reconDBProvider.replaceStagedDb(stagedReconDBProvider);
+ reconNamespaceSummaryManager.reinitialize(reconDBProvider);
+ reconContainerMetadataManager.reinitialize(reconDBProvider);
+ reprocessTaskStatus.setLastTaskRunStatus(0);
+ reprocessTaskStatus.recordRunCompletion();
+ LOG.info("Re-initialization of tasks completed successfully.");
+ } catch (Exception e) {
+ LOG.error("Re-initialization of tasks failed.", e);
+ reprocessTaskStatus.setLastTaskRunStatus(-1);
Review Comment:
So similarly as mentioned above, not just STAGING DB switchover task status to be updated here, but also need to update the status of individual task reprocess status as well.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -227,6 +265,32 @@ public synchronized void reInitializeTasks(ReconOMMetadataManager omMetadataMana
} catch (CancellationException ce) {
LOG.error("Some tasks were cancelled with exception", ce);
}
+
+ if (isRunSuccessful.get()) {
+ try {
+ reconDBProvider.replaceStagedDb(stagedReconDBProvider);
+ reconNamespaceSummaryManager.reinitialize(reconDBProvider);
+ reconContainerMetadataManager.reinitialize(reconDBProvider);
+ reprocessTaskStatus.setLastTaskRunStatus(0);
+ reprocessTaskStatus.recordRunCompletion();
+ LOG.info("Re-initialization of tasks completed successfully.");
+ } catch (Exception e) {
+ LOG.error("Re-initialization of tasks failed.", e);
+ reprocessTaskStatus.setLastTaskRunStatus(-1);
+ reprocessTaskStatus.recordRunCompletion();
+ // reinitialize the Recon OM tasks with the original DB provider
+ try {
+ reconNamespaceSummaryManager.reinitialize(reconDBProvider);
+ reconContainerMetadataManager.reinitialize(reconDBProvider);
+ } catch (IOException ex) {
+ LOG.error("Re-initialization of task manager failed.", e);
+ }
+ }
+ } else {
+ LOG.error("Reprocess of task has failed.");
+ reprocessTaskStatus.setLastTaskRunStatus(-1);
+ reprocessTaskStatus.recordRunCompletion();
Review Comment:
Sameway here also , not just STAGING DB switchover task status to be updated here, but also need to update the status of individual task reprocess status as well.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -178,12 +193,33 @@ public synchronized void reInitializeTasks(ReconOMMetadataManager omMetadataMana
}
ReconConstants.resetTableTruncatedFlags();
+ ReconTaskStatusUpdater reprocessTaskStatus = taskStatusUpdaterManager.getTaskStatusUpdater(REPROCESS_STAGING);
Review Comment:
I think, we need to rename this task or step for STAGING DB switchover success/failed because REPROCESS step for tasks will be success/failed on individual level, and that we need to still do at each task level as done currently already in .`thenAccept` block. so for STAGING DB switchover success/failed, we need to just track.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -227,6 +265,32 @@ public synchronized void reInitializeTasks(ReconOMMetadataManager omMetadataMana
} catch (CancellationException ce) {
LOG.error("Some tasks were cancelled with exception", ce);
}
+
+ if (isRunSuccessful.get()) {
+ try {
+ reconDBProvider.replaceStagedDb(stagedReconDBProvider);
+ reconNamespaceSummaryManager.reinitialize(reconDBProvider);
+ reconContainerMetadataManager.reinitialize(reconDBProvider);
+ reprocessTaskStatus.setLastTaskRunStatus(0);
+ reprocessTaskStatus.recordRunCompletion();
+ LOG.info("Re-initialization of tasks completed successfully.");
+ } catch (Exception e) {
+ LOG.error("Re-initialization of tasks failed.", e);
+ reprocessTaskStatus.setLastTaskRunStatus(-1);
+ reprocessTaskStatus.recordRunCompletion();
+ // reinitialize the Recon OM tasks with the original DB provider
+ try {
+ reconNamespaceSummaryManager.reinitialize(reconDBProvider);
+ reconContainerMetadataManager.reinitialize(reconDBProvider);
Review Comment:
Also pls try reducing code duplication.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl commented on code in PR #8917:
URL: https://github.com/apache/ozone/pull/8917#discussion_r2272549793
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -227,6 +265,32 @@ public synchronized void reInitializeTasks(ReconOMMetadataManager omMetadataMana
} catch (CancellationException ce) {
LOG.error("Some tasks were cancelled with exception", ce);
}
+
+ if (isRunSuccessful.get()) {
+ try {
+ reconDBProvider.replaceStagedDb(stagedReconDBProvider);
+ reconNamespaceSummaryManager.reinitialize(reconDBProvider);
+ reconContainerMetadataManager.reinitialize(reconDBProvider);
+ reprocessTaskStatus.setLastTaskRunStatus(0);
+ reprocessTaskStatus.recordRunCompletion();
+ LOG.info("Re-initialization of tasks completed successfully.");
+ } catch (Exception e) {
+ LOG.error("Re-initialization of tasks failed.", e);
+ reprocessTaskStatus.setLastTaskRunStatus(-1);
+ reprocessTaskStatus.recordRunCompletion();
+ // reinitialize the Recon OM tasks with the original DB provider
+ try {
+ reconNamespaceSummaryManager.reinitialize(reconDBProvider);
+ reconContainerMetadataManager.reinitialize(reconDBProvider);
+ } catch (IOException ex) {
+ LOG.error("Re-initialization of task manager failed.", e);
+ }
+ }
+ } else {
+ LOG.error("Reprocess of task has failed.");
+ reprocessTaskStatus.setLastTaskRunStatus(-1);
+ reprocessTaskStatus.recordRunCompletion();
Review Comment:
updated
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -227,6 +265,32 @@ public synchronized void reInitializeTasks(ReconOMMetadataManager omMetadataMana
} catch (CancellationException ce) {
LOG.error("Some tasks were cancelled with exception", ce);
}
+
+ if (isRunSuccessful.get()) {
+ try {
+ reconDBProvider.replaceStagedDb(stagedReconDBProvider);
+ reconNamespaceSummaryManager.reinitialize(reconDBProvider);
+ reconContainerMetadataManager.reinitialize(reconDBProvider);
+ reprocessTaskStatus.setLastTaskRunStatus(0);
+ reprocessTaskStatus.recordRunCompletion();
+ LOG.info("Re-initialization of tasks completed successfully.");
+ } catch (Exception e) {
+ LOG.error("Re-initialization of tasks failed.", e);
+ reprocessTaskStatus.setLastTaskRunStatus(-1);
Review Comment:
updated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "devmadhuu (via GitHub)" <gi...@apache.org>.
devmadhuu commented on code in PR #8917:
URL: https://github.com/apache/ozone/pull/8917#discussion_r2265835056
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
+ FileUtils.moveDirectory(dbPath, backupPath);
Review Comment:
Similar cleanup is needed for new backup also which was taken for production DB after successful swap.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
Review Comment:
`deleteQuietly` should be better option here.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
+ FileUtils.moveDirectory(dbPath, backupPath);
+ close();
+ FileUtils.moveDirectory(stagedDbPath, backupPath);
Review Comment:
Pls check if this is by mistake. here you are moving staged db to backup instead of to main production db path.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
+ FileUtils.moveDirectory(dbPath, backupPath);
+ close();
Review Comment:
Shouldn't we close first and then move ?
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
+ FileUtils.moveDirectory(dbPath, backupPath);
+ close();
+ FileUtils.moveDirectory(stagedDbPath, backupPath);
Review Comment:
Also use`Files.move(stagingDir, prodDB, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING);`
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
+ FileUtils.moveDirectory(dbPath, backupPath);
+ close();
+ FileUtils.moveDirectory(stagedDbPath, backupPath);
+ dbStore = initializeDBStore(configuration, dbPath.getName());
+ } catch (Exception e) {
+ if (dbStore == null) {
Review Comment:
Pls revisit this logic because `dbStore` may not always be null even when some exception due to movement of any dir, so restoring back the main production db from backup could be an issue here.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
+ FileUtils.moveDirectory(dbPath, backupPath);
+ close();
+ FileUtils.moveDirectory(stagedDbPath, backupPath);
+ dbStore = initializeDBStore(configuration, dbPath.getName());
+ } catch (Exception e) {
Review Comment:
This exception also should be used to record the lastRun reprocess of task as failure to reflect correct status and metrics.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
Review Comment:
Before doing below operations, pls keep track of STAGING states because in a live cluster, we don't know what could be various reasons which can just block these operations, so later those states can be used in metrics.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl commented on code in PR #8917:
URL: https://github.com/apache/ozone/pull/8917#discussion_r2267004475
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
+ FileUtils.moveDirectory(dbPath, backupPath);
+ close();
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl commented on code in PR #8917:
URL: https://github.com/apache/ozone/pull/8917#discussion_r2267001721
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
+ FileUtils.moveDirectory(dbPath, backupPath);
+ close();
+ FileUtils.moveDirectory(stagedDbPath, backupPath);
+ dbStore = initializeDBStore(configuration, dbPath.getName());
+ } catch (Exception e) {
+ if (dbStore == null) {
Review Comment:
when close() is done before reinitializeDBStore(), its updated to null. So if initializeDBStore() throw exception, it will be null and revert to older value.
if not null, means either previous DB path present and running fine OR new db path is initialized successfully.
Moved close() before rename of previous db.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl commented on code in PR #8917:
URL: https://github.com/apache/ozone/pull/8917#discussion_r2267010046
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
+ FileUtils.moveDirectory(dbPath, backupPath);
Review Comment:
I am thinking to keep one backup to be there, so avoided cleanup. For next backup, it will be cleaned.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "devmadhuu (via GitHub)" <gi...@apache.org>.
devmadhuu commented on code in PR #8917:
URL: https://github.com/apache/ozone/pull/8917#discussion_r2269711487
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
+ File dbPath = dbStore.getDbLocation();
+ File stagedDbPath = stagedReconDBProvider.getDbStore().getDbLocation();
+ File backupPath = new File(dbPath.getAbsolutePath() + ".backup");
+ stagedReconDBProvider.close();
+ try {
+ FileUtils.deleteDirectory(backupPath);
+ FileUtils.moveDirectory(dbPath, backupPath);
Review Comment:
ok
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-13553. Recon Staging DB for OM full db reprocess [ozone]
Posted by "sumitagrawl (via GitHub)" <gi...@apache.org>.
sumitagrawl commented on code in PR #8917:
URL: https://github.com/apache/ozone/pull/8917#discussion_r2272548097
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconDBProvider.java:
##########
@@ -115,4 +128,25 @@ public void close() throws Exception {
dbStore = null;
}
}
+
+ public void replaceStagedDb(ReconDBProvider stagedReconDBProvider) throws Exception {
Review Comment:
updated
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -178,12 +193,33 @@ public synchronized void reInitializeTasks(ReconOMMetadataManager omMetadataMana
}
ReconConstants.resetTableTruncatedFlags();
+ ReconTaskStatusUpdater reprocessTaskStatus = taskStatusUpdaterManager.getTaskStatusUpdater(REPROCESS_STAGING);
Review Comment:
updated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org