Skip to content

Reduce amount of /transaction calls in MetadataTracker in system without change if /nextTransaction is available - #434

Open
AFaust wants to merge 1 commit into
Alfresco:masterfrom
AFaust:pr/stop-on-no-next-transaction
Open

Reduce amount of /transaction calls in MetadataTracker in system without change if /nextTransaction is available#434
AFaust wants to merge 1 commit into
Alfresco:masterfrom
AFaust:pr/stop-on-no-next-transaction

Conversation

@AFaust

@AFaust AFaust commented Nov 27, 2024

Copy link
Copy Markdown

This PR reduces the overhead in polling for new transactions to index when a system is mostly read-only / without changes for a long time. This is something I had already noticed myself in production systems, but came about as a result of a question in the Alfresco forum. In essence, the longer a system is without a change, the more calls the MetadataTracker executes against the /transactions (and /nextTransaction if available) endpoint of the Repository as it looks for any transaction to index.

This PR adds missing logic to stop the loop to incrementally scan the transaction table when the nextTransaction endpoint is available and returns a value indicating that no newer transaction exists at all. It also adjusts the startTime for the next iteration if a next transaction commit time is available but the transactions return in the subsequent call to the transactions endpoint where somehow already "found" before.

A similar issue exists with the ACL tracker. This also executes an increasing amount of calls to look for newer change sets in any system where no ACL changes are performed for a long time. Since there is no endpoint to find the next commit time for an ACL change set based on the last commit time, the overhead there cannot currently be improved in the same way as in the MetadataTracker.

- immediately stop if no newer transaction found (fewer pointless calls in systems without changes)
- advance startTime when using getNextTxCommitTime to potentially avoid repeated calls if alreadyFoundTransactions (unlikely, but feels wrong not to adjust after having queried that window of time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants