Skip to content
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

Some ids are missing from pool_hashes table #325

Closed
rcmorano opened this issue Oct 8, 2020 · 7 comments
Closed

Some ids are missing from pool_hashes table #325

rcmorano opened this issue Oct 8, 2020 · 7 comments

Comments

@rcmorano
Copy link

rcmorano commented Oct 8, 2020

Brief description

Digging into my testnet deploy, I found there is a gap in the pool_hashes table for ids between 175-206 (both included).

Given that I also tried official explorer while debugging this issue for cardano-graphql and the pool count is exactly the same for that deploy, I guess this is a bug and not some fault/problem-during-sync on my deployment.

Environment

I'm using these official docker images:

  • inputoutput/cardano-node:1.20.0
  • inputoutput/cardano-db-sync:5.0.1

Steps to reproduce the bug

cdbs=# select id from pool_hash where id >=170 and id <= 210;
 id  
-----
 170
 171
 172
 173
 174
 207
 208
 209
 210
(9 rows)

cdbs=# select count(id) from pool_hash;
 count 
-------
   198
(1 row)

cdbs=# select count(id) from pool_retire;
 count 
-------
    20
(1 row)

cdbs=# 

What is the expected behavior?

Not sure, but I'd say that gap shouldn't be there or if those pools were deleted because they were retired, pool_retire count should match the gap row count and currently is not.

@erikd
Copy link
Contributor

erikd commented Oct 8, 2020

Is this possibly #315 which was fixed after the 5.0.1 release?

@rcmorano
Copy link
Author

rcmorano commented Oct 8, 2020

I'll do a sync from the scratch using master and let you know. Thanks for reviewing it!

@dmitrystas
Copy link

I'll do a sync from the scratch using master and let you know. Thanks for reviewing it!

I did, yesterday. It looks a bit different now, but a gap still is

# select id from pool_hash where id >=175 and id <= 235;
 id
-----
 175
 176
 177
 178
 179
 180
 181
 231
 232
 233
 234
 235
(12 rows)

@erikd
Copy link
Contributor

erikd commented Oct 8, 2020

Ok, why do you think these missing ids should even be there? The ids are generated by Postgres, and in the presence of rollbacks, Postgres may end up skipping some.

Is there any other evidence of something being wrong?

@dmitrystas
Copy link

No issue for me, I just noted that a gap is still present. I'll check but at the mometn all the pools look good

@erikd
Copy link
Contributor

erikd commented Oct 10, 2020

@rcmorano I do not think this is incorrect. Yes, the id field does not just increment by one, but that is a Postgres generated field and when rollbacks occur previously created id numbers (which are removed during the rollback) are not reused. This is standard Postgres behavior.

@rcmorano
Copy link
Author

ACK! I wasn't sure if we were missing some pools because daedalus-testnet showed an amount, db count another and graphql a different one (now clarified by this bug), but it seems it's not the case, so I think we can close the issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants