Skip to content

ZOOKEEPER-5107: Audit log omits the create mode of sequential and TTL nodes created in a multi - #2480

Open
CCCLL wants to merge 1 commit into
apache:masterfrom
CCCLL:audit-multi-create-mode
Open

CCCLL wants to merge 1 commit into
apache:masterfrom
CCCLL:audit-multi-create-mode

Conversation

@CCCLL

@CCCLL CCCLL commented Oct 19, 2026

Copy link
Copy Markdown

For the creates inside a multi, AuditHelper looked up the create mode in a map keyed by the requested path. The lookup missed in two cases, so those audit entries were written without znode_type:

  • sequential nodes, because the result carries the actual path (/node-0000000005) rather than the requested one (/node-);
  • TTL nodes, because createTTL ops were never put into the map.

The same creates outside a multi are logged with znode_type=persistent_sequential and znode_type=persistent_with_ttl (the latter since ZOOKEEPER-4725). The path lookup dates back to the introduction of the audit log in ZOOKEEPER-1260.

A multi yields exactly one result per op, in order (PrepRequestProcessor builds one txn per op and DataTree appends one result per txn), so the create mode is now taken from the op at the same position. That covers both cases, and the path map is removed.

Testing

  • New Slf4JAuditLoggerTest#testMultiOperationCreateModeAuditLogs creates a sequential node and a TTL node in one multi and checks that both entries carry znode_type; it fails without the fix and passes with it.
  • Slf4JAuditLoggerTest, AuditEventTest, StandaloneServerAuditTest, MultiOperationTest and MultiAsyncTransactionTest pass; checkstyle and spotbugs report no issues.
  • Manually against a standalone server with zookeeper.audit.enable=true: a multi creating a persistent, a sequential, a TTL and an ephemeral node now logs znode_type for all four entries; before the fix the sequential and TTL entries had none.

@CCCLL CCCLL changed the title Audit log omits the create mode of sequential and TTL nodes created in a multi ZOOKEEPER-5107: Audit log omits the create mode of sequential and TTL nodes created in a multi Oct 20, 2026

@kezhuw kezhuw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kezhuw
kezhuw requested review from arshadmohammad and ztzg October 22, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants