-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
ui, server, storage: add command queue debug report #18344
ui, server, storage: add command queue debug report #18344
Conversation
Working on:
|
pkg/storage/command_queue.go
Outdated
var result []*CommandQueueCommand | ||
it := tree.Iterator() | ||
for { | ||
// TODO: is there a more idiomatic way to iterate? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cockroach/pkg/util/interval/interval.go
Lines 175 to 180 in bddd7c1
// Do performs fn on all intervals stored in the tree. The traversal is done | |
// in the nondecreasing order of interval start. A boolean is returned | |
// indicating whether the traversal was interrupted by an Operation returning | |
// true. If fn alters stored intervals' sort relationships, future tree | |
// operation behaviors are undefined. | |
Do(fn Operation) bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thx
I find it super helpful in these PRs when there's an included screen shot for the UI changes. |
Yeah, I'm a fan of those as well. Will add one when the UI is a little more built out (currently it's just dumping raw JSON response from endpoint). |
@nvanbenschoten The basic endpoint is working. Let's go over this at some point to make sure it's on track, since I'm still not very familiar with these data structures and am probably making some silly mistakes! Haven't gotten to the flattening out parent & child stuff yet. Let's also talk a little more about what would be useful for the UI. Maybe something pretty similar to the query plan visualizer would be good; I don't know. |
I think something like this might be pretty easy to do: Since we already are using d3. |
Used dagre-layout; this is what it looks like now: (hover over a node for details) |
@vilterp That is looking very cool. Keep in mind how this will look/work when there are large numbers of commands in the queue. I suspect the current layout might get overly wide. |
Just a random comment on the timestamp field: I think most usable would be |
5daac7e
to
2c8865d
Compare
Reviewed 1 of 12 files at r1, 4 of 12 files at r4, 1 of 3 files at r5, 1 of 3 files at r6, 2 of 9 files at r7, 1 of 6 files at r8, 2 of 3 files at r11, 1 of 8 files at r15, 12 of 12 files at r18. pkg/roachpb/data.go, line 1190 at r18 (raw file):
I'd just put this local to your code that needs it. pkg/server/status.go, line 1109 at r18 (raw file):
Always put a (in this case your?) name into TODOs. pkg/storage/command_queue.proto, line 38 at r18 (raw file):
You could name this pkg/storage/replica.go, line 828 at r18 (raw file):
You seem to have picked up unwanted diff during your rebase. pkg/storage/replica.go, line 851 at r18 (raw file):
You seem to have picked up unwanted diff during your rebase. pkg/storage/replica.go, line 3252 at r18 (raw file):
You seem to have picked up unwanted diff during your rebase. pkg/storage/replica.go, line 3335 at r18 (raw file):
You seem to have picked up unwanted diff during your rebase. pkg/storage/replica.go, line 3429 at r18 (raw file):
You seem to have picked up unwanted diff during your rebase. pkg/storage/replica.go, line 3456 at r18 (raw file):
You seem to have picked up unwanted diff during your rebase. pkg/storage/replica.go, line 3460 at r18 (raw file):
You seem to have picked up unwanted diff during your rebase. pkg/storage/replica.go, line 3464 at r18 (raw file):
You seem to have picked up unwanted diff during your rebase. Comments from Reviewable |
Reviewed 1 of 12 files at r1, 4 of 12 files at r4, 1 of 3 files at r5, 1 of 3 files at r6, 2 of 9 files at r7, 1 of 6 files at r8, 2 of 3 files at r11, 1 of 8 files at r15, 12 of 12 files at r18. pkg/roachpb/data.go, line 1190 at r18 (raw file):
I'm fine putting it here next to pkg/storage/command_queue.proto, line 32 at r18 (raw file):
Can this comment be removed now that you're referencing this proto from the pkg/storage/replica.go, line 678 at r18 (raw file):
This constant was just introduced recently (by @nvanbenschoten ). I don't feel strongly about whether we use a named constant or a bare zero (I have a slight preference for the bare zero), but we shouldn't flip back and forth on this. pkg/ui/src/redux/cachedDataReducer.ts, line 110 at r18 (raw file):
Did you mean to leave this in? pkg/ui/src/views/reports/containers/commandQueue/index.tsx, line 20 at r18 (raw file):
Remove this or uncomment and use it. Comments from Reviewable |
Review status: 15 of 25 files reviewed at latest revision, 17 unresolved discussions, some commit checks failed. pkg/storage/command_queue.proto, line 32 at r18 (raw file): Previously, bdarnell (Ben Darnell) wrote…
was wondering if I should use a proto here instead of the pkg/storage/command_queue.proto, line 38 at r18 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
not sure if that's different enough than pkg/roachpb/data.go, line 1190 at r18 (raw file): Previously, bdarnell (Ben Darnell) wrote…
ended up not using it; removing in next commit Comments from Reviewable |
Review status: 15 of 25 files reviewed at latest revision, 17 unresolved discussions, some commit checks failed. pkg/storage/command_queue.proto, line 32 at r18 (raw file): Previously, vilterp (Pete Vilter) wrote…
I don't understand. There's a lot more in Comments from Reviewable |
Mainly reviewed the front-end changes. Good work on the whole. I left lots of little comments. Reviewed 1 of 12 files at r1, 2 of 12 files at r4, 1 of 3 files at r5, 1 of 3 files at r6, 3 of 12 files at r18, 3 of 4 files at r21, 1 of 4 files at r23, 3 of 5 files at r24. pkg/ui/webpack.config.js, line 42 at r26 (raw file):
If this change is necessary, it would seem to be wise to update the comment. However, reading the comment seems to indicate that it would be a good idea to keep the original. What motivated the change? pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 7 at r26 (raw file):
Please sort your imports, and group them as external first and internal second. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 54 at r26 (raw file):
might be nice to prefix this method with "render" pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 59 at r26 (raw file):
Maybe these should be pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 60 at r26 (raw file):
The backtick string isn't needed here. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 64 at r26 (raw file):
ditto. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 87 at r26 (raw file):
Looks like this is only used on the line below, maybe inline it? pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 88 at r26 (raw file):
These functions would probably read nicer one-lined. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 109 at r26 (raw file):
Is this for debugging? pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 117 at r26 (raw file):
Seems odd to call it "hoveredNode", then. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 131 at r26 (raw file):
This cast might read nicer if you did it up above the pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 138 at r26 (raw file):
Ugh, multi-line ternary! Maybe there's a way to avoid that? pkg/ui/src/views/reports/containers/commandQueue/index.tsx, line 51 at r26 (raw file):
Oh no, another multi-line ternary! In this case, there's definitely an improvement to be made by showing just one pkg/ui/src/views/reports/containers/commandQueue/index.tsx, line 54 at r26 (raw file):
Maybe use pkg/ui/src/views/reports/containers/range/rangeTable.tsx, line 341 at r26 (raw file):
Another multi-line ternary! pkg/ui/styl/pages/command_queue.styl, line 15 at r26 (raw file):
I'm wondering if we want to be using colors from the palette for these? It would probably also be nice to apply the same classes to the nodes so that the coloring isn't in two different places. Comments from Reviewable |
Reviewed 5 of 12 files at r1, 12 of 12 files at r4, 3 of 3 files at r5, 3 of 3 files at r6, 9 of 9 files at r7, 6 of 6 files at r8, 2 of 2 files at r9, 2 of 2 files at r10, 3 of 3 files at r11, 1 of 1 files at r12, 4 of 5 files at r13, 2 of 3 files at r14, 7 of 8 files at r15, 1 of 1 files at r16, 1 of 1 files at r17, 12 of 12 files at r18, 1 of 1 files at r19, 3 of 3 files at r20, 4 of 4 files at r21, 2 of 2 files at r22, 4 of 4 files at r23, 5 of 5 files at r24, 2 of 2 files at r25, 1 of 1 files at r26, 2 of 2 files at r27. pkg/server/status.go, line 1109 at r18 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. pkg/storage/command_queue.proto, line 32 at r18 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Discussed in person: we'll stick with having separate Go structs ( pkg/storage/replica.go, line 678 at r18 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Had no intention to change this; somehow messed up rebase. Reverted my change so it'll be left as is. pkg/storage/replica.go, line 828 at r18 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. pkg/storage/replica.go, line 851 at r18 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. pkg/storage/replica.go, line 3252 at r18 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. pkg/storage/replica.go, line 3335 at r18 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. pkg/storage/replica.go, line 3429 at r18 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. pkg/storage/replica.go, line 3456 at r18 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. pkg/storage/replica.go, line 3460 at r18 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. pkg/storage/replica.go, line 3464 at r18 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. pkg/ui/webpack.config.js, line 42 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
This change was so that graphlib, a dependency of dagre (DAG layout lib added in this change) could use Lodash 3 (installed in @mrtracy and I came up with this fix but forgot to update the comment. I think node's behavior is what we want — i.e. don't think it's a problem that it looks at parent directories. Will just update it to reflect that we're using relative path for one and absolute for other. pkg/ui/src/redux/cachedDataReducer.ts, line 110 at r18 (raw file): Previously, bdarnell (Ben Darnell) wrote…
removed pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 7 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. Wish we had a tool which did this automatically! pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 54 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 59 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 60 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. Derp! pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 64 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 87 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 88 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 109 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Yeah. Seemed to be a case where there was no command and stuff below exploded will take it out; hopefully I fixed that elsewhere. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 117 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Indeed! Used to be on hover. Will change it. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 131 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 138 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. pkg/ui/src/views/reports/containers/commandQueue/index.tsx, line 20 at r18 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Done. pkg/ui/src/views/reports/containers/commandQueue/index.tsx, line 51 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Agreed; done pkg/ui/src/views/reports/containers/commandQueue/index.tsx, line 54 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. pkg/ui/src/views/reports/containers/range/rangeTable.tsx, line 341 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. pkg/ui/styl/pages/command_queue.styl, line 15 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. pkg/roachpb/data.go, line 1190 at r18 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
removed it Comments from Reviewable |
Reviewed 1 of 12 files at r1, 3 of 12 files at r4, 1 of 6 files at r8, 2 of 4 files at r23, 1 of 5 files at r24, 1 of 2 files at r25, 1 of 1 files at r26, 2 of 2 files at r27, 1 of 3 files at r29. pkg/server/status.go, line 1104 at r29 (raw file):
Add a comment on this handler method. pkg/server/status.go, line 1114 at r29 (raw file):
nit: Just inline this variable pkg/server/serverpb/status.proto, line 25 at r29 (raw file):
Keep this sorted. pkg/storage/command_queue.go, line 568 at r29 (raw file):
Add a comment about what this does. Also, let's move this up to right after pkg/storage/command_queue.go, line 811 at r29 (raw file):
You should read over https://github.com/golang/go/wiki/CodeReviewComments. Specifically here, we always use full sentences and proper punctuation in comments. pkg/storage/command_queue.go, line 813 at r29 (raw file):
We know the sizes of Try If you ever know roughly how many elements will be appended to a slice, allocate the capacity ahead of time. But if you don't, don't even allocate the slice at all ahead of time, like pkg/storage/command_queue.go, line 824 at r29 (raw file):
Here and below, is pkg/storage/command_queue.go, line 833 at r29 (raw file):
Add a comment since this isn't trivial. Also, is pkg/storage/command_queue.go, line 839 at r29 (raw file):
This is going to allocate because we're taking the address of a local iterator variable. But
won't. You'll get a feel for this as you go, but the general rule of thumb is that "taking the address of something on the stack forces it onto the heap, but taking the address of something already on the heap is fine". pkg/storage/command_queue.go, line 854 at r29 (raw file):
return pkg/storage/command_queue.proto, line 38 at r18 (raw file): Previously, vilterp (Pete Vilter) wrote…
What about pkg/storage/command_queue.proto, line 1 at r29 (raw file):
2017 pkg/storage/command_queue.proto, line 22 at r29 (raw file):
I don't love that a pkg/storage/command_queue.proto, line 27 at r29 (raw file):
Take a look at gogoproto. Specifically how it can be used to avoid pointer elements by using pkg/storage/command_queue.proto, line 37 at r29 (raw file):
Why not pkg/storage/command_queue_test.go, line 739 at r29 (raw file):
We should test more than just the length. pkg/storage/replica.go, line 5626 at r29 (raw file):
I think you want the timestamp from the pkg/storage/stores.go, line 142 at r29 (raw file):
Check out the pkg/storage/stores.go, line 143 at r29 (raw file):
Why are we ignoring this error? Comments from Reviewable |
Review status: 22 of 26 files reviewed at latest revision, 51 unresolved discussions, some commit checks failed. pkg/ui/webpack.config.js, line 42 at r26 (raw file): Previously, vilterp (Pete Vilter) wrote…
Okay, this has a complicated story behind it. But tldr; What you see here, the version in this commit, is how it always should have been, the old version has problems. Webpack's default value for this is What we wanted to do was modify this resolution to check the project root directory first. This lets us reference our own local files using non-relative paths (e.g. "src/redux/nodes.ts" instead of "../../redux/nodes.ts"), which is great for refactoring, grepping, etc. We do this by adding the absolute path of the root directory (
...etc. However, why did we make "node_modules" also an absolute path? This breaks dependency management, so there must have been a reason. Well, the reason is that this mirrors the resolution strategy specified in tsconfig.json, which is used by things like command-line tsc and IDEs. Tsconfig has more limited resolution flexibility than webpack, and can't mix absolute-path resolution with node-style resolution. So, in order to match these strategies exactly, we made webpack's resolution more strict than it needed to be. However, I now believe that to have been a mistake, for the reason highlighted in this PR (breaking node's dependency management). Instead, we are just going to have to live with the slight difference in resolution strategy between the two files. Although, since our typescript has no need for multi-version dependency management, there should currently be no issue. pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 7 at r26 (raw file): Previously, vilterp (Pete Vilter) wrote…
I've filed an issue for this. tslint can enforce the sorting, but we're on our own in terms of grouping, and it's not automatic like gofmt. Comments from Reviewable |
Reviewed 1 of 12 files at r18, 5 of 5 files at r28, 2 of 3 files at r29. pkg/server/status.go, line 1104 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/server/status.go, line 1114 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/server/serverpb/status.proto, line 25 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. Ended up removing the new import. pkg/storage/command_queue.go, line 568 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/command_queue.go, line 811 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/command_queue.go, line 813 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/command_queue.go, line 824 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/command_queue.go, line 833 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/command_queue.go, line 839 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/command_queue.go, line 854 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/command_queue_test.go, line 739 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/replica.go, line 5626 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/stores.go, line 142 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/stores.go, line 143 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/command_queue.proto, line 38 at r18 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
How about getting rid of it and having just two messages, pkg/storage/command_queue.proto, line 1 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. (moved these to existing file) pkg/storage/command_queue.proto, line 22 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
After in-person discussion, moved it to pkg/storage/command_queue.proto, line 27 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/command_queue.proto, line 37 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. Comments from Reviewable |
pkg/storage/command_queue_test.go
Outdated
t.Fatalf("expected commands[2].Prereqs to be [1]; got %v", snapshotCommands[2].Prereqs) | ||
} | ||
if len(snapshotCommands[3].Prereqs) != 0 { | ||
t.Fatalf("expected commands[3].Prereqs to be []; got %v", snapshotCommands[3].Prereqs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nvanbenschoten I'm surprised that this command has no prereqs. Shouldn't it have a prereq on the command with id 1? (It's one of the leaf commands generated when a command with two spans is added, with a prereq)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Planning to give all these changes a more thorough review tomorrow. For now, double check what snapshotCommands[3]
is giving you. snapshotCommands
is indexed by the command id, not the index of the command in the snapshot slice. I don't think there is a command with id 0 or 3 so I think you're seeing default values for some of these. I'd expect ids [1, 2, 4, 5]
(gap because of covering span).
Also, these tests should assert as much as possible. Try something like:
if expPrereqs := []int64{1}; !reflect.DeepEqual(expPrereqs, snapshotCommands[5].Prereqs) {
...
}
ad77976
to
29145a6
Compare
Reviewed 7 of 18 files at r31, 2 of 2 files at r32, 1 of 3 files at r33. pkg/server/status.go, line 1104 at r29 (raw file): Previously, vilterp (Pete Vilter) wrote…
Double check that :) pkg/storage/command_queue.go, line 817 at r33 (raw file):
Using a pkg/storage/command_queue.go, line 870 at r33 (raw file):
nit: pkg/storage/command_queue_test.go, line 749 at r33 (raw file):
Yeah, let's use the pkg/storage/replica.go, line 5652 at r33 (raw file):
Having two different methods called
pkg/storage/storagebase/state.proto, line 114 at r33 (raw file):
Add a comment to this type. pkg/storage/storagebase/state.proto, line 115 at r33 (raw file):
pkg/storage/command_queue.proto, line 38 at r18 (raw file): Previously, vilterp (Pete Vilter) wrote…
Much better. Comments from Reviewable |
Reviewed 1 of 12 files at r18, 1 of 5 files at r28, 2 of 7 files at r30, 1 of 18 files at r31, 1 of 3 files at r33. pkg/ui/webpack.config.js, line 42 at r26 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Ok, looking at this again that makes historical sense. There are still two things I don't like:
pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 7 at r26 (raw file): Previously, mrtracy (Matt Tracy) wrote…
pkg/ui/src/views/reports/containers/commandQueue/index.tsx, line 6 at r33 (raw file):
Please combine the two imports from pkg/ui/src/views/reports/containers/commandQueue/index.tsx, line 80 at r33 (raw file):
This would probably read nicer as just Comments from Reviewable |
Review status: 23 of 26 files reviewed at latest revision, 32 unresolved discussions, some commit checks failed. pkg/ui/webpack.config.js, line 42 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Why is it bad to have two versions of lodash in the bundle? Lodash is a pure utility library, having two versions in the bundle should cause no problems as long as everything gets the version it expects. If you're just concerned about bundle size, we should file an issue to do an explicit pruning sweep. Without seeing numbers, we can't be certain that Dagre would be major contributor to bloat, and I wouldn't want to derail this PR further without more evidence. Comments from Reviewable |
pkg/ui/webpack.config.js, line 42 at r26 (raw file): Previously, mrtracy (Matt Tracy) wrote…
Lodash is our third-biggest dependency, and after NVD3 is gone it will be the second-biggest. I've created an issue as you suggested (#18789), but I also think our standard practice should be to try to make use of the libraries we're already including before reaching for a new one. I'm not sure it really counts as "derailing" - it's entirely part of the responsibility of a PR to justify any new dependency. Comments from Reviewable |
Reviewed 1 of 12 files at r18, 2 of 7 files at r30, 10 of 18 files at r31, 2 of 2 files at r32, 3 of 3 files at r33. pkg/server/status.go, line 1104 at r29 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. Whoops! haha. pkg/storage/command_queue.go, line 817 at r33 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/command_queue.go, line 870 at r33 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/command_queue_test.go, line 790 at r32 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. Yeah you were totally right. Didn't occur to me that the nil value of a struct is the struct where all of its members are their nil values. Also didn't know pkg/storage/command_queue_test.go, line 749 at r33 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. Made a helper pkg/storage/replica.go, line 5652 at r33 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Changed the one in pkg/storage/storagebase/state.proto, line 114 at r33 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/storagebase/state.proto, line 115 at r33 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/ui/webpack.config.js, line 42 at r26 (raw file): Previously, mrtracy (Matt Tracy) wrote…
The only option D3 has for layout of DAGs is force-directed layout which isn't as good as Dagre's (distracting animation at the beginning. Re: lodash, there's a fork of Dagre called pkg/ui/src/views/reports/containers/commandQueue/commandQueueViz.tsx, line 109 at r26 (raw file): Previously, vilterp (Pete Vilter) wrote…
(Turned out to be an issue on the Go side; fixed) pkg/ui/src/views/reports/containers/commandQueue/index.tsx, line 6 at r33 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. pkg/ui/src/views/reports/containers/commandQueue/index.tsx, line 80 at r33 (raw file): Previously, couchand (Andrew Couch) wrote…
Done. Comments from Reviewable |
Review status: 16 of 26 files reviewed at latest revision, 30 unresolved discussions, some commit checks failed. pkg/ui/webpack.config.js, line 42 at r26 (raw file): Previously, vilterp (Pete Vilter) wrote…
You're right that a force layout wouldn't be appropriate. (though there are some techniques for avoiding the initial springing, but that's irrelevant since it still wouldn't look right here). I think what you're looking for is either cluster (https://github.com/d3/d3-3.x-api-reference/blob/master/Cluster-Layout.md) or tree (https://github.com/d3/d3-3.x-api-reference/blob/master/Tree-Layout.md). Comments from Reviewable |
Review status: 16 of 26 files reviewed at latest revision, 30 unresolved discussions, some commit checks failed. pkg/ui/webpack.config.js, line 42 at r26 (raw file): Previously, couchand (Andrew Couch) wrote…
Those both only work for trees; this is a graph. (just realized all of the screenshots so far show trees) Comments from Reviewable |
Review status: 13 of 27 files reviewed at latest revision, 28 unresolved discussions, some commit checks failed. Comments from Reviewable |
@vilterp This looks like it's just about ready to merge. Can you squash it into one or two commits? It also looks like you need to rebase against master again. It also looks like you've got a few more linter errors. |
43b75a1
to
cbe1237
Compare
Review status: 7 of 27 files reviewed at latest revision, 28 unresolved discussions, some commit checks failed. pkg/storage/command_queue.go, line 836 at r34 (raw file):
One thing to remember throughout this change is that the Likewise, "snapshot" is an extremely overloaded term at this level, as we already have Raft snapshots. Is there a better name for this that could avoid future confusion. pkg/storage/command_queue_test.go, line 742 at r34 (raw file):
You can pull these length assertions into Comments from Reviewable |
Reviewed 1 of 12 files at r1, 1 of 12 files at r4, 1 of 3 files at r5, 3 of 12 files at r18, 1 of 2 files at r22, 1 of 3 files at r29, 4 of 18 files at r31, 20 of 20 files at r34. pkg/storage/command_queue.go, line 833 at r34 (raw file):
This is not very clear. I see what you're trying to say, but it's quite clumsy. Perhaps start with How large can the tree of commands get? Is recursion the correct choice here? pkg/storage/command_queue.go, line 858 at r34 (raw file):
Having both pkg/storage/stores.go, line 137 at r34 (raw file):
In status.go, take a look at But if you still are going to add this function, it might be nice to replace those many other instances with this. Not in this PR, but as a follow up. Also, this will return an error if not found. Perhaps that should be mentioned in the description. Or, you could remove the error and rely on the nil alone. I'm not sure what having the error add here. I'm not sure if roachpb.RangeNotFoundError is the only error than can be returned, but if not, you're swallowing the other errors. Seems to me, if it's the case that the only error could be rangenotfounderror, than the resulting error isn't needed. Also, please add a test for this. pkg/storage/storagebase/state.proto, line 95 at r34 (raw file):
I must say, I'm not of can of the name. Is this used outside of the command queues snapshot? If not, perhaps an embedded message would be better. (and could just be called pkg/ui/webpack.config.js, line 42 at r26 (raw file): Previously, vilterp (Pete Vilter) wrote…
This specific change to webpack's config seems like it should exist in it's own pr. How about pulling it out and submitting it own it's own? Comments from Reviewable |
pkg/storage/storagebase/state.proto, line 95 at r34 (raw file): Previously, BramGruneir (Bram Gruneir) wrote…
Bah, fan of. Comments from Reviewable |
Reviewed 1 of 12 files at r35. pkg/storage/command_queue.go, line 833 at r34 (raw file): Previously, BramGruneir (Bram Gruneir) wrote…
Done. I think recursion should be fine. Otherwise we would have a single stack frame with a stack data structure, right? Not sure how much that would save us. cc @nvanbenschoten pkg/storage/command_queue.go, line 836 at r34 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. Defined pkg/storage/command_queue.go, line 858 at r34 (raw file): Previously, BramGruneir (Bram Gruneir) wrote…
Done. pkg/storage/command_queue_test.go, line 742 at r34 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/storage/stores.go, line 137 at r34 (raw file): Previously, BramGruneir (Bram Gruneir) wrote…
Done. pkg/storage/storagebase/state.proto, line 95 at r34 (raw file): Previously, BramGruneir (Bram Gruneir) wrote…
Done. pkg/ui/webpack.config.js, line 42 at r26 (raw file): Previously, BramGruneir (Bram Gruneir) wrote…
Done. Needed it for Comments from Reviewable |
Just get @nvanbenschoten to give it a green light. Reviewed 1 of 3 files at r6, 12 of 12 files at r35. pkg/storage/stores.go, line 137 at r34 (raw file): Previously, vilterp (Pete Vilter) wrote…
I'm guessing, from this, you've only added a test and fixed the implementation? pkg/storage/storagebase/state.proto, line 110 at r35 (raw file):
What is the int64 in this case? The command id? Would be nice to have a comment here. Also, just as fair warning, int64 keys for maps is slightly annoying to work with on the javascript side, as you have to convert them into a Long. Comments from Reviewable |
Just remember to squash again before merging. Review status: all files reviewed at latest revision, 30 unresolved discussions, some commit checks failed. Comments from Reviewable |
689750e
to
2a860b7
Compare
It's accessible at /reports/range/[range-id]/cmdqueue. * Add CommandQueue rpc to the Status server * Add dependency on dagre-layout, a JS library which does directed graph layout (like graphviz's `dot`) * Add new debug report page which visualizes the command queue using dagre-layout for layout and React for rendering to SVG * Add link from the Range debug report to the new command queue visualizer
2a860b7
to
8cbe74c
Compare
Fixes #9797