-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dcrpg: Remove duplicates for votes
, misses
and treasury
table
#1979
Open
ukane-philemon
wants to merge
1
commit into
decred:master
Choose a base branch
from
ukane-philemon:remove-duplicates
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
ukane-philemon
changed the title
dcrpg:remove duplicates for votes, misses and treasury table
dcrpg: Remove duplicates for Jan 5, 2024
votes
, misses
and treasury
table
Signed-off-by: Philemon Ukane <[email protected]>
ukane-philemon
force-pushed
the
remove-duplicates
branch
from
June 6, 2024 02:00
ec0431d
to
8770786
Compare
ukane-philemon
commented
Aug 22, 2024
Comment on lines
+413
to
+421
// 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);` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"
Turns out we also need to remove duplicates for
|
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
votes
removed successfully:misses
removed successfully:treasury
removed successfully: