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

Diagnose Raft WAL via debug tool #3319

Merged
merged 9 commits into from
Apr 26, 2019
Merged

Diagnose Raft WAL via debug tool #3319

merged 9 commits into from
Apr 26, 2019

Conversation

manishrjain
Copy link
Contributor

@manishrjain manishrjain commented Apr 25, 2019

This PR adds a way to print out the Raft WAL so we can get a better understanding of how data is flowing through the system.


This change is Reviewable

@manishrjain manishrjain requested a review from a team as a code owner April 25, 2019 01:32
Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1.
Reviewable status: 1 of 2 files reviewed, 4 unresolved discussions (waiting on @manishrjain and @martinmr)


dgraph/cmd/debug/run.go, line 680 at r1 (raw file):

			gid := binary.BigEndian.Uint32(key[8:12])
			gids[gid] = true
		}

I would add a default case in case there are keys not of this size and either return an error or print the key for debugging. There shouldn't be but there could be in case of bugs I suppose.


dgraph/cmd/debug/run.go, line 697 at r1 (raw file):

		return err
	}
	fmt.Printf("rids: %v\n", rids)

How big are these maps usually? Will the output be readable if these maps are too big. Also, this will print the values, which I assume are all irrelevant since the map is acting as a set.


dgraph/cmd/debug/run.go, line 779 at r1 (raw file):

 64<<20)

what's this supposed to represent?


dgraph/cmd/debug/run.go, line 835 at r1 (raw file):

	}

	// WAL can't execute the following function.

maybe move this comment to the return above so its intent is clearer.

Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @manishrjain)

Copy link
Contributor Author

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @martinmr)


dgraph/cmd/debug/run.go, line 680 at r1 (raw file):

Previously, martinmr (Martin Martinez Rivera) wrote…

I would add a default case in case there are keys not of this size and either return an error or print the key for debugging. There shouldn't be but there could be in case of bugs I suppose.

Done. There are other keys, we just don't care. Have added a comment there to make it clear.


dgraph/cmd/debug/run.go, line 697 at r1 (raw file):

Previously, martinmr (Martin Martinez Rivera) wrote…

How big are these maps usually? Will the output be readable if these maps are too big. Also, this will print the values, which I assume are all irrelevant since the map is acting as a set.

We only expect one raft id and one group id. But, if this WAL was used for something else before, we'd get to know via this list.


dgraph/cmd/debug/run.go, line 779 at r1 (raw file):

Previously, martinmr (Martin Martinez Rivera) wrote…
 64<<20)

what's this supposed to represent?

Done. Added a comment.


dgraph/cmd/debug/run.go, line 835 at r1 (raw file):

Previously, martinmr (Martin Martinez Rivera) wrote…

maybe move this comment to the return above so its intent is clearer.

Done.

Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r4.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@manishrjain manishrjain merged commit 562a385 into master Apr 26, 2019
@manishrjain manishrjain deleted the mrjn/wal-debug branch April 26, 2019 00:55
dna2github pushed a commit to dna2fork/dgraph that referenced this pull request Jul 19, 2019
This PR adds a way to print out the Raft WAL for both Alpha and Zero, so we can get a better understanding of how data is flowing through the system and diagnose issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants