mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
rm metadata_version znode creation from restarting thread
This commit is contained in:
parent
97c0087084
commit
52fe2f18b0
@ -31,6 +31,7 @@ namespace ErrorCodes
|
|||||||
extern const int REPLICA_IS_ALREADY_ACTIVE;
|
extern const int REPLICA_IS_ALREADY_ACTIVE;
|
||||||
extern const int REPLICA_STATUS_CHANGED;
|
extern const int REPLICA_STATUS_CHANGED;
|
||||||
extern const int LOGICAL_ERROR;
|
extern const int LOGICAL_ERROR;
|
||||||
|
extern const int SUPPORT_IS_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace FailPoints
|
namespace FailPoints
|
||||||
@ -217,26 +218,10 @@ bool ReplicatedMergeTreeRestartingThread::tryStartup()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/// Table was created before 20.4 and was never altered,
|
throw Exception(ErrorCodes::SUPPORT_IS_DISABLED,
|
||||||
/// let's initialize replica metadata version from global metadata version.
|
"It seems you have upgraded from a version earlier than 20.4 straight to one later than 24.10. "
|
||||||
|
"ClickHouse does not support upgrades that span more than a year. "
|
||||||
const String & zookeeper_path = storage.zookeeper_path, & replica_path = storage.replica_path;
|
"Please update gradually (through intermediate versions).");
|
||||||
|
|
||||||
Coordination::Stat table_metadata_version_stat;
|
|
||||||
zookeeper->get(zookeeper_path + "/metadata", &table_metadata_version_stat);
|
|
||||||
|
|
||||||
Coordination::Requests ops;
|
|
||||||
ops.emplace_back(zkutil::makeCheckRequest(zookeeper_path + "/metadata", table_metadata_version_stat.version));
|
|
||||||
ops.emplace_back(zkutil::makeCreateRequest(replica_path + "/metadata_version", toString(table_metadata_version_stat.version), zkutil::CreateMode::Persistent));
|
|
||||||
|
|
||||||
Coordination::Responses res;
|
|
||||||
auto code = zookeeper->tryMulti(ops, res);
|
|
||||||
|
|
||||||
if (code == Coordination::Error::ZBADVERSION)
|
|
||||||
throw Exception(ErrorCodes::REPLICA_STATUS_CHANGED, "Failed to initialize metadata_version "
|
|
||||||
"because table was concurrently altered, will retry");
|
|
||||||
|
|
||||||
zkutil::KeeperMultiException::check(code, ops, res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.queue.removeCurrentPartsFromMutations();
|
storage.queue.removeCurrentPartsFromMutations();
|
||||||
|
Loading…
Reference in New Issue
Block a user