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

Wrong block size #1451

Open
infnada opened this issue Jun 29, 2023 · 2 comments
Open

Wrong block size #1451

infnada opened this issue Jun 29, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@infnada
Copy link

infnada commented Jun 29, 2023

OS
Your OS:

Versions
The db-sync version: 13.1.1.2
PostgreSQL version: 15.3

Build/Install Method
inputoutput/cardano-db-sync:13.1.1.2-docker

Run method
Docker

Additional context
Snapshot: 13.1/db-sync-snapshot-schema-13.1-block-8883740-x86_64.tgz

  cardano-db-sync:
    image: inputoutput/cardano-db-sync:13.1.1.2-docker
    environment:
      - NETWORK=${NETWORK:-mainnet}
      - POSTGRES_HOST=postgres
      - POSTGRES_PORT=5432
      - RESTORE_SNAPSHOT=${RESTORE_SNAPSHOT:-https://update-cardano-mainnet.iohk.io/cardano-db-sync/13.1/db-sync-snapshot-schema-13.1-block-8883740-x86_64.tgz}
      - RESTORE_RECREATE_DB=N
      - EXTRA_DB_SYNC_ARGS=--consumed-tx-out

Problem Report
All blocks after 8883740 (last of loaded snapshot) contain a wrong block size. Don't know if its because incompatible PSQL version or db-sync issue.

SELECT block_no, time, size FROM block WHERE block_no > 8883735 LIMIT 10
block_no time size
8883736 2023-06-09 21:59:39.000000 87327
8883737 2023-06-09 21:59:48.000000 81026
8883738 2023-06-09 22:00:04.000000 87564
8883739 2023-06-09 22:00:24.000000 82681
8883740 2023-06-09 22:00:31.000000 88046
8883741 2023-06-09 22:02:38.000000 862
8883742 2023-06-09 22:02:51.000000 861
8883743 2023-06-09 22:03:38.000000 861
8883744 2023-06-09 22:03:47.000000 861
8883745 2023-06-09 22:03:58.000000 861
SELECT DISTINCT ON (size) size, block_no, time FROM block WHERE block_no > 8883735
size block_no time
857 8900808 2023-06-13 23:57:42.000000
858 8900756 2023-06-13 23:42:41.000000
859 8902968 2023-06-14 12:21:37.000000
860 8947720 2023-06-25 05:36:31.000000
861 8954598 2023-06-26 22:02:48.000000
862 8901147 2023-06-14 01:57:47.000000
863 8898702 2023-06-13 11:50:32.000000
865 8933454 2023-06-21 17:58:11.000000
81026 8883737 2023-06-09 21:59:48.000000
82681 8883739 2023-06-09 22:00:24.000000
87327 8883736 2023-06-09 21:59:39.000000
87564 8883738 2023-06-09 22:00:04.000000
88046 8883740 2023-06-09 22:00:31.000000
SELECT MAX(block_no) FROM block

8960666

Randomly they get a size from 857 to 865 (excluding 864 for some reason)

@infnada infnada added the bug Something isn't working label Jun 29, 2023
@infnada
Copy link
Author

infnada commented Jun 29, 2023

Extra info to make sure no other process is modifying this column data:

CREATE OR REPLACE FUNCTION trigger_function()
RETURNS TRIGGER AS $$
BEGIN
  RAISE WARNING 'Inserted row block number, size: % %', NEW.block_no, NEW.size;
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;

CREATE TRIGGER after_insert_trigger
AFTER INSERT ON block
FOR EACH ROW
EXECUTE FUNCTION trigger_function();

db-sync logs:

2023-06-29 04:47:16 WARNING:  Inserted row block number, size: 8960789 863
2023-06-29 04:47:17 WARNING:  Inserted row block number, size: 8960790 859
2023-06-29 04:47:17 WARNING:  Inserted row block number, size: 8960791 859
2023-06-29 04:47:17 WARNING:  Inserted row block number, size: 8960792 859
2023-06-29 04:47:18 WARNING:  Inserted row block number, size: 8960793 859
2023-06-29 04:47:19 WARNING:  Inserted row block number, size: 8960794 859
2023-06-29 04:47:19 WARNING:  Inserted row block number, size: 8960795 861
2023-06-29 04:47:20 WARNING:  Inserted row block number, size: 8960796 859
2023-06-29 04:47:20 WARNING:  Inserted row block number, size: 8960797 859
2023-06-29 04:47:21 WARNING:  Inserted row block number, size: 8960798 859
2023-06-29 04:47:21 WARNING:  Inserted row block number, size: 8960799 859
2023-06-29 04:47:21 WARNING:  Inserted row block number, size: 8960800 859

Same applies for BEFORE INSERT instead of AFTER

@kderme
Copy link
Contributor

kderme commented Jul 3, 2023

I think accidentally the header size was used instead of the block body size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants