-
Notifications
You must be signed in to change notification settings - Fork 4.6k
AccountsDb plugin account updates have no in-slot ordering #20910
Comments
Good finding. Yes -- I was aware of this issue and was planning address in a future PR. There are two ways to solve the issue:
Need to do some comparison and see which is more efficient. |
Write version would be excellent! That'd need changes in the accountsdb-plugin api though. I assume that is still fine? |
Regarding #1, we still want to queue the next update if there is already an update in the queue. The second update is more important than the first if the second is newer. We assume that multiple account updates per slot will arrive out of order. So, #2 write_version is the preferred solution because we can easily ignore the older updates when updating the DB. The DB schema might look like this:
The SQL upsert statement might look like: "INSERT INTO account (pubkey, slot, owner, lamports, executable, rent_epoch, data, updated_on, write_version) Unfortunately, this Postgres plugin will not be ready for production until the order of account updates can be assured. #blocker |
Yes. This will be addressed ASAP! |
This issue has been addressed and solution merged into v1.8 |
This issue has been automatically locked since there has not been any activity in past 7 days after it was closed. Please open a new issue for related bugs. |
Problem
Currently the accountsdb plugin can be notified about multiple updates for the same account in one slot. When messages are sent to a database asynchronously the order of the updates in the same slot cannot be reconstructed.
So if an account receives two updates in a slot, the update message could arrive in postgres in reverse order or true order. There's no way to know which account state is the right one at the end of the slot.
Proposed Solution
The example postgres plugin could track the number of updates sent per slot and capture the current number (and also the updated_on time!) before sending the
DbWorkItem
through the channel to be processed asynchronously.I'd be up for making this change if you agree it makes sense, @lijunwangs
The text was updated successfully, but these errors were encountered: