When orders are created at high speed (e.g. by a script, that imports customer orders from another e-commerce system), then some of orders are not created because of duplicate order number being assigned to them.
This happens because during next order number generation:
- no tables are locked
- the cached value (not from DB) of last created order is used
and this results in identical order numbers being returned to easy process, that requested it.
- use same approach as in
- don't rely on system setting cache in the process