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

order: Mark missing orders as failed in the client db #360

Merged
merged 1 commit into from
May 3, 2022

Conversation

positiveblue
Copy link
Contributor

@positiveblue positiveblue commented Apr 19, 2022

The client and server db can get out of sync if some orders are not recorded properly in the server. This becomes problematic because the deamon won't start until all the bad invoices have been cleaned out. Right now the clients need to fix these edge cases manually.

The idea is to simply mark those invoices as failed and let the client continue with the start up.

@guggero guggero changed the title [WIP] order: Mark missing invoices in the client db [WIP] order: Mark missing orders in the client db Apr 20, 2022
@positiveblue positiveblue changed the title [WIP] order: Mark missing orders in the client db order: Mark missing orders in the client db Apr 20, 2022
@@ -65,6 +66,13 @@ var (
orderTlvKey = []byte("order-tlv")
)

// IsNotFoundErr tries to match the given error with ErrNoOrder.
func IsOrderNotFoundErr(err error) bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we are not using grpc error codes. I am not sure if there is any other way to check for what type of error we are receiving from the server that string matching here...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we currently don't use any custom codes on the server side. String matching is okay here. Though I'm not sure if this function better fits into the auctioneer package?

@positiveblue positiveblue force-pushed the missing-order-state branch 2 times, most recently from 409ffdb to ba88b16 Compare April 21, 2022 04:04
@positiveblue positiveblue changed the title order: Mark missing orders in the client db order: Mark missing orders as failed in the client db Apr 21, 2022
@positiveblue positiveblue requested a review from guggero April 21, 2022 04:05
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, LGTM 🎉

@@ -65,6 +66,13 @@ var (
orderTlvKey = []byte("order-tlv")
)

// IsNotFoundErr tries to match the given error with ErrNoOrder.
func IsOrderNotFoundErr(err error) bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we currently don't use any custom codes on the server side. String matching is okay here. Though I'm not sure if this function better fits into the auctioneer package?

server.go Outdated
// rest of valid orders.
//
// NOTE: This should never happen.
case clientdb.IsOrderNotFoundErr(err):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, reading this I first thought this meant "the local DB didn't find the order". So moving the function to the auctioneer package should make that more clear.

server.go Outdated
// as failed and allow the client start up with the
// rest of valid orders.
//
// NOTE: This should never happen.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "This should never happen under normal conditions. This was added to handle a specific failure that's being investigated"?

@positiveblue positiveblue marked this pull request as ready for review April 22, 2022 07:08
@lightninglabs-deploy
Copy link
Collaborator

@bhandras: review reminder
@jharveyb: review reminder

Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, sorry for the late review, was buried under my other notifications 👍

@guggero guggero merged commit 0d92b40 into master May 3, 2022
@guggero guggero deleted the missing-order-state branch May 3, 2022 18:13
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.

4 participants