tmvlad opened a new pull request, #3309: URL: https://github.com/apache/jackrabbit-oak/pull/3309
[OAK-12458](https://issues.apache.org/jira/browse/OAK-12458): Audit trail for index definition changes Records changes of index definitions in the repository, in the same commit, so that it is possible to find out when, by whom and how an index definition was changed, also when old revisions are no longer available. Adds an "Index Manager" MBean to read the audit trail, and to disable, enable and delete index definitions (with the change recorded), as an alternative to changing them with regular JCR writes. Documentation: `oak-doc/src/site/markdown/query/index-definition-audit.md` ### Recording - Runs in the synchronous index update (`IndexUpdate` → `IndexDefinitionAudit`), before Oak's own changes in the same commit (for example resetting the `reindex` flag). - Disabled by default: feature toggle `FT_OAK-12458`, or system property `oak.indexDefinitionAudit=true` (for oak-run and other tools). Index imports through `IndexerMBean` follow the toggle. - Operations: `CREATED`, `MERGED`, `CHANGED`, `DISABLED`, `ENABLED`, `REINDEX`, `DELETED`. Entries contain user, reason, origin (commit session id), thread, and a JSOP diff; a new version is compared with the index it is based on. - Stored in the hidden node `/oak:index/:audit` (last 1000 entries per index; histories of removed indexes under `:deleted`, last 1000). - Commit origins for the index importer (`IndexImporter`) and the oak-run purge of old index versions (`PurgeOldIndexVersion`). - A failure to record a change is logged, and does not fail the commit. ### Index Manager MBean - `Indexes`, `getAuditTrail(indexPath)` - `disableIndex(indexPath, by, reason, force)`, `enableIndex(indexPath, by, force)` (sets `reindex`), `deleteIndex(indexPath, by, reason, force)` (disabled indexes only; index data removed in batches first; fails if the index is enabled meanwhile). - Changes are committed with the index update of the repository, so that for example the node type index stays consistent, and a synchronous index is reindexed in the same commit. - Only available when the audit is enabled; only for index definitions directly below `/oak:index`; synchronous indexes (for example `uuid`, `nodetype`) require `force`. `by` and `reason` are optional (`by` defaults to the JMX caller, if known). ### Other changes - `RootIndexesListService` skips hidden child nodes of `/oak:index`. - `IndexImporter.setIndexDefinitionAuditEnabled` (package `org.apache.jackrabbit.oak.plugins.index.importer` 0.6.0 → 0.7.0). ### Tests `IndexDefinitionAuditTest`, `IndexManagerMBeanImplTest`, `IndexDefinitionAuditClusterTest` (memory and MongoDB), and additions to `IndexImporterTest`, `DiffIndexTest`, `LucenePurgeOldIndexVersionTest`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
