Skip to content
Snippets Groups Projects
Commit 195ac023 authored by Egor Ivkov's avatar Egor Ivkov Committed by Yaroslav Dynnikov
Browse files

refactor: have separate params for raft_id and raft_gen in audit::init

(cherry picked from commit 466cecc5)
parent 2e355be1
No related branches found
No related tags found
No related merge requests found
......@@ -386,20 +386,13 @@ macro_rules! audit(
/// Initialize audit log.
/// Unique id generation depends on the raft machine's state.
/// Note: `config` will be parsed by tarantool's core (see `say.c`).
pub fn init(config: &str, raft_storage: &RaftSpaceAccess) {
// Raft-related stuff should be ready at this point.
let raft_id = raft_storage
.raft_id()
.expect("failed to get raft_id for audit log")
.expect("found zero raft_id during audit log init");
let gen = raft_storage.gen().expect("failed to get gen for audit log");
pub fn init(config: &str, raft_id: u64, raft_gen: u64) {
// Note: this'll only fail if the cell's already set (shouldn't be possible).
// SAFETY: this is the first time we access this variable, and it's
// always done from the main (TX) thread.
unsafe {
CLOCK
.set(LogicalClock::new(raft_id, gen))
.set(LogicalClock::new(raft_id, raft_gen))
.expect("failed to initialize global audit event id generator");
}
......
......@@ -811,7 +811,12 @@ fn postjoin(
config.validate_storage(&storage, &raft_storage)?;
if let Some(config) = &config.instance.audit {
audit::init(config, &raft_storage);
let raft_id = raft_storage
.raft_id()
.expect("failed to get raft_id for audit log")
.expect("found zero raft_id during audit log init");
let gen = raft_storage.gen().expect("failed to get gen for audit log");
audit::init(config, raft_id, gen);
}
if let Some(plugins) = &config.instance.plugins {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment