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

clean up prepared transactions in (*DB).Close #1128

Merged
merged 4 commits into from
Dec 6, 2024

Conversation

jchappelow
Copy link
Member

Not just regular transactions. This avoids annoying orphaned prepared transactions in the case where a bug results in closing the DB when there is an active transaction.

@jchappelow
Copy link
Member Author

Verification:

2024-12-06 14:38:12.228 [INF] NODE: Node stopped.
2024-12-06 14:38:12.228 [INF] KWILD: Closing server resources...
2024-12-06 14:38:12.228 [INF] KWILD: Closing Eventstore DB
2024-12-06 14:38:12.228 [INF] KWILD: closing blockstore
2024-12-06 14:38:12.282 [INF] KWILD: closing main DB
2024-12-06 14:38:12.283 [WRN] PG: Rolling back PREPARED transaction XW6P1Sk1z8
panic: Closed the DB with an active transaction!

goroutine 1 [running]:
github.com/kwilteam/kwil-db/node/pg.(*DB).Close(0xc0003bc3c0)
	/home/jon/kwil/git/kwil-db/node/pg/db.go:296 +0x278
github.com/kwilteam/kwil-db/app/node.(*closeFuncs).addCloser.func1()
	/home/jon/kwil/git/kwil-db/app/node/deps.go:94 +0x43
github.com/kwilteam/kwil-db/app/node.(*closeFuncs).closeAll(0xc000016e58?)
	/home/jon/kwil/git/kwil-db/app/node/deps.go:102 +0x6b
github.com/kwilteam/kwil-db/app/node.(*server).Start.func1()
	/home/jon/kwil/git/kwil-db/app/node/node.go:120 +0xe7
github.com/kwilteam/kwil-db/app/node.(*server).Start(0xc000778180, {0x1f668e0, 0xc0006228c0})
	/home/jon/kwil/git/kwil-db/app/node/node.go:183 +0x41c
github.com/kwilteam/kwil-db/app/node.runNode({0x1f668e0, 0xc0006228c0}, {0x7ffcd92b10b0, 0xe}, 0xc0000e5340)
	/home/jon/kwil/git/kwil-db/app/node/node.go:110 +0xd5c
github.com/kwilteam/kwil-db/app/node.StartCmd.func1(0xc00023ec08, {0xc000150740?, 0x0?, 0x2?})
	/home/jon/kwil/git/kwil-db/app/node/start.go:43 +0xfc

@jchappelow jchappelow force-pushed the db-close-rollback-all branch 2 times, most recently from c177e59 to 99dcde2 Compare December 6, 2024 21:35
@jchappelow jchappelow force-pushed the db-close-rollback-all branch from 718001c to c48257f Compare December 6, 2024 22:57
@jchappelow jchappelow merged commit e1c7b3a into kwilteam:main Dec 6, 2024
2 checks passed
@jchappelow jchappelow deleted the db-close-rollback-all branch December 6, 2024 23:01
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

Successfully merging this pull request may close these issues.

2 participants