Skip to content

HistoryDrop Error on DB #3

@AnimaTow

Description

@AnimaTow

[05-10|10:21:49.331] ERROR flare-system-c-chain-indexer/main.go:78 DropHistory error: Failed to delete historic data in the DB: Error 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (flare_ftso_indexer.logs, CONSTRAINT fk_logs_transaction FOREIGN KEY (transaction_id) REFERENCES transactions (id) ON UPDATE CASCADE). Will retry after 8.447102185s
main.run.func3
/home/flare/flare-system-c-chain-indexer/main.go:78
github.com/cenkalti/backoff/v4.doRetryNotify[...]
/home/flare/go_projects/pkg/mod/github.com/cenkalti/backoff/v4@v4.2.1/retry.go:107
github.com/cenkalti/backoff/v4.RetryNotifyWithTimer
/home/flare/go_projects/pkg/mod/github.com/cenkalti/backoff/v4@v4.2.1/retry.go:61
github.com/cenkalti/backoff/v4.RetryNotify
/home/flare/go_projects/pkg/mod/github.com/cenkalti/backoff/v4@v4.2.1/retry.go:49
main.run
/home/flare/flare-system-c-chain-indexer/main.go:67
main.main
/home/flare/flare-system-c-chain-indexer/main.go:24
runtime.main
/home/flare/go_projects/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.4.linux-amd64/src/runtime/proc.go:271

[05-10|10:20:19.900] ERROR build/main.go:63 DropHistory error: Failed to delete historic data in the DB: Error 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (flare_ftso_indexer.logs, CONSTRAINT fk_logs_transaction FOREIGN KEY (transaction_id) REFERENCES transactions (id) ON UPDATE CASCADE). Will retry after 1m15.022010931s

main.run.func2

/build/main.go:63

github.com/cenkalti/backoff/v4.doRetryNotify[...]

/go/pkg/mod/github.com/cenkalti/backoff/v4@v4.2.1/retry.go:107

github.com/cenkalti/backoff/v4.RetryNotifyWithTimer

/go/pkg/mod/github.com/cenkalti/backoff/v4@v4.2.1/retry.go:61

github.com/cenkalti/backoff/v4.RetryNotify

/go/pkg/mod/github.com/cenkalti/backoff/v4@v4.2.1/retry.go:49

main.run

/build/main.go:52

n

/build/main.go:19


runtime.main

/usr/local/go/src/runtime/proc.go:267

My FIX

ALTER TABLE logs
DROP FOREIGN KEY fk_logs_transaction,
ADD CONSTRAINT fk_logs_transaction
FOREIGN KEY (transaction_id)
REFERENCES transactions(id)
ON DELETE CASCADE;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions