Skip to content

Commit 22dba5d

Browse files
committed
Recover the Replicated Database forcefully after restoring database metadata in Keeper
1 parent a054bdf commit 22dba5d

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/Databases/DatabaseReplicated.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,6 +1811,10 @@ void DatabaseReplicated::restoreDatabaseMetadataInKeeper(ContextPtr)
18111811
LOG_DEBUG(log, "It seems that the metadata was restored previously: {}.", e.what());
18121812
}
18131813

1814+
/// Force the database to recover to update the restored metadata
1815+
auto current_zookeeper = getContext()->getZooKeeper();
1816+
current_zookeeper->set(replica_path + "/digest", DatabaseReplicatedDDLWorker::FORCE_AUTO_RECOVERY_DIGEST);
1817+
18141818
reinitializeDDLWorker();
18151819
}
18161820

src/Databases/DatabaseReplicatedWorker.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ namespace FailPoints
4949
extern const char database_replicated_delay_entry_execution[];
5050
}
5151

52-
static constexpr const char * FORCE_AUTO_RECOVERY_DIGEST = "42";
5352

5453
DatabaseReplicatedDDLWorker::DatabaseReplicatedDDLWorker(DatabaseReplicated * db, ContextPtr context_)
5554
: DDLWorker(

src/Databases/DatabaseReplicatedWorker.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class DatabaseReplicatedDDLWorker : public DDLWorker
4242

4343
bool isUnsyncedAfterRecovery() const { return unsynced_after_recovery; }
4444

45+
static constexpr const char * FORCE_AUTO_RECOVERY_DIGEST = "42";
46+
4547
private:
4648
bool initializeMainThread() override;
4749
void initializeReplication() override;

0 commit comments

Comments
 (0)