1. Problem description
In the production environment, sometimes the user‘s income can be paid normally, sometimes it can’t be.
User’s fund involves account module, and fund change mainly involves freezing request, request event, transfer record and operating user’s Fund. The freezing request mainly records the parameters of the request record. The simple point is recharge and withdrawal. The event represents the actual amount of operation. The financial transfer record is equivalent to the log processing of fund changes. Finally, the user’s fund record is actually operated.
2. The problem
The maximum number of decimal places of the defined amount value is 16 digits, while the amount record field of the freezing request table is 9 digits. If the transferred value is greater than 9 digits, the database will perform rounding processing. In the case of rounding, if the amount queried from the frozen table is greater than the actual amount, an error will be reported and an exception will be thrown, which will result in the failure of revenue distribution.
It is OK to improve the accuracy of the account table field in the frozen table to 16 bits, which solves the problem.