This commit is contained in:
Antonio Andelic 2024-10-24 09:31:51 +02:00
parent ab05f8b6e8
commit b32e1939e5
9 changed files with 17 additions and 3 deletions

View File

@ -99,9 +99,12 @@ void ZooKeeperArgs::initFromKeeperServerSection(const Poco::Util::AbstractConfig
if (auto session_timeout_key = coordination_key + ".session_timeout_ms";
config.has(session_timeout_key))
session_timeout_ms = config.getInt(session_timeout_key);
}
use_xid_64 = config.getBool(std::string{config_name} + ".use_xid_64", false);
if (auto use_xid_64_key = coordination_key + ".use_xid_64";
config.has(use_xid_64_key))
use_xid_64 = config.getBool(use_xid_64_key);
}
Poco::Util::AbstractConfiguration::Keys keys;
std::string raft_configuration_key = std::string{config_name} + ".raft_configuration";

View File

@ -1226,6 +1226,9 @@ void ZooKeeper::pushRequest(RequestInfo && info)
if (!info.request->xid)
{
info.request->xid = next_xid.fetch_add(1);
if (!use_xid_64)
info.request->xid = static_cast<int32_t>(info.request->xid);
if (info.request->xid == close_xid)
throw Exception::fromMessage(Error::ZSESSIONEXPIRED, "xid equal to close_xid");
if (info.request->xid < 0)

View File

@ -924,6 +924,8 @@ nuraft::cb_func::ReturnCode KeeperServer::callbackFunc(nuraft::cb_func::Type typ
if (request_for_session->digest->version != KeeperStorageBase::NO_DIGEST)
writeIntBinary(request_for_session->digest->value, write_buf);
/// when we extend an entry from old Keeper, we write 0 for MSB of XID just in case so newer version don't
/// read random garbage from it
if (serialization_version < IKeeperStateMachine::ZooKeeperLogSerializationVersion::WITH_XID_64)
writeIntBinary(static_cast<uint32_t>(0), write_buf);

View File

@ -27,6 +27,8 @@
<latest_logs_cache_size_threshold>1073741824</latest_logs_cache_size_threshold>
<commit_logs_cache_size_threshold>524288000</commit_logs_cache_size_threshold>
<use_xid_64>1</use_xid_64>
</coordination_settings>
<raft_configuration>

View File

@ -70,6 +70,7 @@ if [[ -n "$BUGFIX_VALIDATE_CHECK" ]] && [[ "$BUGFIX_VALIDATE_CHECK" -eq 1 ]]; th
}
remove_keeper_config "remove_recursive" "[[:digit:]]\+"
remove_keeper_config "use_xid_64" "[[:digit:]]\+"
fi
export IS_FLAKY_CHECK=0

View File

@ -27,6 +27,7 @@
<election_timeout_upper_bound_ms>4000</election_timeout_upper_bound_ms>
<async_replication>1</async_replication>
<use_xid_64>1</use_xid_64>
</coordination_settings>
<raft_configuration>

View File

@ -27,6 +27,7 @@
<election_timeout_upper_bound_ms>4000</election_timeout_upper_bound_ms>
<async_replication>1</async_replication>
<use_xid_64>1</use_xid_64>
</coordination_settings>
<raft_configuration>

View File

@ -22,6 +22,7 @@
<election_timeout_upper_bound_ms>4000</election_timeout_upper_bound_ms>
<async_replication>1</async_replication>
<use_xid_64>1</use_xid_64>
</coordination_settings>
<raft_configuration>

View File

@ -34,7 +34,6 @@
<tcp_port>9181</tcp_port>
<server_id>{id}</server_id>
<digest_enabled>1</digest_enabled>
<use_xid_64>1</use_xid_64>
<coordination_settings>
<operation_timeout_ms>10000</operation_timeout_ms>
@ -50,6 +49,7 @@
<stale_log_gap>{stale_log_gap}</stale_log_gap>
<reserved_log_items>{reserved_log_items}</reserved_log_items>
<async_replication>1</async_replication>
<use_xid_64>1</use_xid_64>
</coordination_settings>
<raft_configuration>