Server should not be ready during snapshot pull + load.

This commit is contained in:
Kishore Nallan 2021-05-07 17:05:26 +05:30
parent 6065463a53
commit 2f56c1aa5a
4 changed files with 11 additions and 3 deletions

View File

@ -162,7 +162,7 @@ Option<bool> CollectionManager::load(const size_t collection_batch_size, const s
size_t progress_modulo = std::max<size_t>(1, (num_collections / 10)); // every 10%
if(num_processed % progress_modulo == 0) {
LOG(INFO) << "Loaded " << num_processed << " collection(s)";
LOG(INFO) << "Loaded " << num_processed << " collection(s) so far";
}
});
}
@ -184,7 +184,7 @@ Option<bool> CollectionManager::load(const size_t collection_batch_size, const s
delete iter;
LOG(INFO) << "Done loading all " << num_collections << " collection(s).";
LOG(INFO) << "Loaded " << num_collections << " collection(s).";
loading_pool.shutdown();

View File

@ -94,6 +94,7 @@ void HttpClient::init(const std::string &api_key) {
"/etc/pki/tls/cacert.pem", // OpenELEC
"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem", // CentOS/RHEL 7
"/usr/local/etc/openssl/cert.pem", // OSX
"/usr/local/etc/openssl@1.1/cert.pem", // OSX
};
HttpClient::ca_cert_path = "";

View File

@ -561,6 +561,13 @@ void ReplicationState::refresh_catchup_status(bool log_msg) {
node->get_status(&n_status);
lock.unlock();
// `known_applied_index` guaranteed to be atleast 1 if raft log is available (after snapshot loading etc.)
if(n_status.known_applied_index == 0) {
LOG_IF(ERROR, log_msg) << "Node not ready yet (known_applied_index is 0).";
read_caught_up = write_caught_up = false;
return ;
}
// work around for: https://github.com/baidu/braft/issues/277#issuecomment-823080171
int64_t current_index = (n_status.applying_index == 0) ? n_status.known_applied_index : n_status.applying_index;
int64_t apply_lag = n_status.last_index - current_index;

View File

@ -158,7 +158,7 @@ TEST(StringUtilsTest, ShouldParseQueryString) {
ASSERT_EQ("points :> 100", qmap["filter_by"]);
ASSERT_EQ("", qmap["enable_typos"]);
qs = "foo=" + StringUtils::randstring(2000);
qs = "foo=" + StringUtils::randstring(4000);
qmap = StringUtils::parse_query_string(qs);
ASSERT_EQ(0, qmap.size());