Skip to content

[Improvement] Complete v2 audit operation mapping coverage#10553

Open
FANNG1 wants to merge 1 commit intoapache:mainfrom
FANNG1:issue_10537
Open

[Improvement] Complete v2 audit operation mapping coverage#10553
FANNG1 wants to merge 1 commit intoapache:mainfrom
FANNG1:issue_10537

Conversation

@FANNG1
Copy link
Contributor

@FANNG1 FANNG1 commented Mar 26, 2026

What changed

  • Added explicit v2 audit mappings for all known OperationType values in CompatibilityUtils
  • Expanded AuditLog.Operation with the concrete audit operation values needed by v2
  • Added tests to verify:
    • concrete mappings for newly covered operation types
    • all known OperationType values map to a non-unknown audit operation

Why

The previous v2 compatibility mapping only covered part of the listener operation space.
Many supported operations still fell back to UNKNOWN_OPERATION, which made audit output incomplete and inconsistent.

This change makes v2 audit mapping complete for all known operation types and keeps UNKNOWN_OPERATION reserved for truly unknown inputs only.

How it was tested

IT_SPARK_HOME=/Users/fanng/deploy/demo/spark-3.5.3-bin-hadoop3 
IT_SPARK_ARGS='--conf spark.jars=/Users/fanng/deploy/demo/jars/iceberg-spark-runtime-3.5_2.12-1.9.2.jar,/Users/fanng/deploy/demo/jars/iceberg-aws-bundle-1.9.2.jar --conf spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions --conf spark.sql.catalog.rest=org.apache.iceberg.spark.SparkCatalog --conf spark.sql.catalog.rest.type=rest --conf spark.sql.catalog.rest.uri=http://127.0.0.1:9001/iceberg/ --conf spark.sql.catalog.rest.header.X-Iceberg-Access-Delegation=vended-credentials' \
IT_TABLE_IDENTIFIER=rest.ab.a1 \
GRAVITINO_ENV_IT=true \
./gradlew :core:test -PskipIT=true --tests 'org.apache.gravitino.audit.v2.TestCompatibilityUtils'

Risks / follow-ups

  • AuditLog.Operation is still shared with legacy audit code, so this change expands the enum surface beyond the legacy formatter coverage.
  • If new OperationType values are added later, the new guard test should fail until the mapping is updated.

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.

1 participant