dcrpg: Remove duplicates for votes, misses and treasury table#1979
Open
ukane-philemon wants to merge 2 commits intodecred:masterfrom
Open
dcrpg: Remove duplicates for votes, misses and treasury table#1979ukane-philemon wants to merge 2 commits intodecred:masterfrom
votes, misses and treasury table#1979ukane-philemon wants to merge 2 commits intodecred:masterfrom
Conversation
votes, misses and treasury table
ec0431d to
8770786
Compare
ukane-philemon
commented
Aug 22, 2024
Comment on lines
+413
to
+425
| // DeleteVotesDuplicateRows removes rows that would violate the unique | ||
| // index uix_votes_hashes_index. This should be run prior to creating the index. | ||
| DeleteVotesDuplicateRows = `DELETE FROM votes | ||
| WHERE id IN (SELECT id FROM ( | ||
| SELECT id, | ||
| row_number() OVER (PARTITION BY tx_hash, block_hash ORDER BY id DESC) AS rnum | ||
| FROM votes) t | ||
| WHERE t.rnum > 1);` | ||
|
|
Collaborator
Author
There was a problem hiding this comment.
I've been hitting this more often cuz I've had to drop my testnet dcrdata database and resync for both mainnet and testnet.
Got this log from mainnet dcrdata.
2024-08-22 21:27:40.740 [INF] PSQL: Indexing votes table on candidate block...
2024-08-22 21:28:01.216 [INF] PSQL: Indexing votes table on block hash...
2024-08-22 21:28:12.322 [INF] PSQL: Indexing votes table on block+tx hash...
2024-08-22 21:28:15.537 [ERR] DATD: dcrpg.SyncChainDB failed at height 898277.
2024-08-22 21:28:15.537 [INF] DATD: Shutdown requested. Shutting down...
2024-08-22 21:28:15.538 [DBG] JAPI: Got quit signal. Exiting block connected handler for STATUS monitor.
2024-08-22 21:28:15.539 [WRN] EXPR: ExchangeBot has quit.
2024-08-22 21:28:15.539 [DBG] DATD: Block prefetcher hits = 108, misses = 2.
2024-08-22 21:28:15.539 [INF] DATD: Gracefully shutting down web server...
2024-08-22 21:28:15.541 [INF] PUBS: Stopping websocket hub.
2024-08-22 21:28:15.541 [DBG] PUBS: Unregistered and killed 0 clients.
2024-08-22 21:28:15.541 [INF] EXPR: Stopping websocket hub.
2024-08-22 21:28:15.540 [ERR] XBOT: dcrdex websocket error: read tcp 192.168.1.243:58607->45.77.164.152:7232: use of closed network connection
2024-08-22 21:28:15.677 [DBG] SKDB: badger: Got compaction priority: {level:0 score:1.73 dropPrefixes:[]}
2024-08-22 21:28:16.381 [DBG] SKDB: badger: LOG Compact. Added 898280 keys. Skipped 1 keys. Iteration took: 701.425775ms
2024-08-22 21:28:16.836 [DBG] SKDB: badger: Discard stats: map[]
2024-08-22 21:28:16.859 [INF] SKDB: badger: LOG Compact 0->1, del 2 tables, add 1 tables, took 1.180893312s
2024-08-22 21:28:16.859 [DBG] SKDB: badger: Compaction for level: 0 DONE
2024-08-22 21:28:16.951 [INF] DATD: Closing connection to dcrd.
2024-08-22 21:28:16.952 [INF] DATD: Bye!
2024-08-22 21:28:17.203 [ERR] DATD: IndexAll failed: pq: could not create unique index "uix_votes_hashes_index"
Collaborator
Author
|
Turns out we also need to remove duplicates for |
Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
8770786 to
3b96c2d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1978
votesremoved successfully:Details
missesremoved successfully:Details
treasuryremoved successfully:Details