NOTE
This article was machine-translated and may contain translation errors. Please use the feedback button to report any issues.
Issue
- Liferay's database transaction counter function seems to increase by 100 after each system restart.
Environment
- DXP 7.0+
Resolution
- When Liferay stores data in the database, the counter function automatically retrieves its numbering. To prevent overloading the database, this numbering is pre-assigned in batches according to the configured counter.increment value (100 by default).
- At startup, Liferay obtains the current counter value and reserves the next counter batch. Each write operation consumes the reserved quota until the allocation runs out and the next batch is reserved. If Liferay restarts before all reserved IDs are used, those unused IDs are skipped. Since the next batch starts after these reserved values, a gap appears in the numbering to account for those unused IDs.
Additional Information
- While you can reduce the counter.increment value to 1 to ensure missing numbers never appear even after a restart, this is not recommended as it reduces performance by requiring additional database transactions for every new ID.
- For additional discussion about the Counter Service increasing by 100 after server restarts, see the attached HistoricMBThread-UnderstandingCounterServiceIncrement.pdf.
- Why are User-ID counters decreasing in a cluster system?