basho / riak

Riak is a decentralized datastore from Basho Technologies.
http://docs.basho.com
Apache License 2.0
3.92k stars 534 forks source link

Riak-Debug fix #1040

Closed Bob-The-Marauder closed 3 years ago

Bob-The-Marauder commented 3 years ago

This fix addresses https://github.com/basho/riak/issues/1037 by doing the following:

The symlinks are only a temporary work-around. Once I have worked out why riak debug executes riak-debug -s and fixed it, I'll submit another pull request to update for that and remove the symlinks.

martinsumner commented 3 years ago

I have no objections to this - no reason why it should impact anything else.

martincox commented 3 years ago

@Bob-The-Marauder does riak-debug need to be symlinked to /usr/sbin? Or can it work in the same way as admin and repl via script extensions? I can't remember whether the script extensions do a node check before execution.

martincox commented 3 years ago

Sorry, I'm asking questions that have already been answered (I should read the comments first). I'm curious as to why it doesn't work in the same way as admin and repl still, though. I can't say as I've ever used debug tbh - do we run it against a running node (in which case the node up check should be fine)?

martinsumner commented 3 years ago

riaknostic is missing as a dependency (it got stripped out for 3.0). so this needs to be added back in for riak admin diag to work. Otherwise:

RPC to 'riak@127.0.0.1' failed: {'EXIT',
                                 {undef,
                                  [{riaknostic,main,[["--etc","--base"]],[]},
                                   {rpc,'-handle_call_call/6-fun-0-',5,
                                    [{file,"rpc.erl"},{line,197}]}]}}
martinsumner commented 3 years ago

The riaknostic repo has dialyzer/xref failures on the develop-3.0 branch so this needs some work before it can be added in.

martinsumner commented 3 years ago

https://github.com/basho/riaknostic/commit/723c73dc877e1d1bb4e69f893255eb7c4ba2fdf3

martinsumner commented 3 years ago

So there appear to be problems with the symbolic link:

martin_sumner@riak-ubuntu18:~/dbroot/riak$ sudo dpkg -i rel/pkg/packages/riak_3.0.2diag1-OTP22.3_amd64.deb 
Selecting previously unselected package riak.
(Reading database ... 202026 files and directories currently installed.)
Preparing to unpack .../riak_3.0.2diag1-OTP22.3_amd64.deb ...
Unpacking riak (3.0.2diag1-OTP22.3) ...
Setting up riak (3.0.2diag1-OTP22.3) ...
Installing new version of config file /etc/riak/riak.conf ...
ln: failed to create symbolic link '/usr/sbin/riak-debug': File exists
dpkg: error processing package riak (--install):
 installed riak package post-installation script subprocess returned error exit status 1
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for systemd (237-3ubuntu10.42) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Errors were encountered while processing:
 riak
martinsumner commented 3 years ago

I suspect dpkg -r isn't removing the link, and so when I reinstall the install package fails on hitting the link

martinsumner commented 3 years ago

There's more work to be done here.

I've managed to get riaknostic loading, without crashing riak. However, not it can't load the vm.args:

RPC to 'riak@127.0.0.1' failed: {'EXIT',
                                 {function_clause,
                                  [{string,substr,
                                    ["/var/lib/riak/sys.config",1,-1],
                                    [{file,"string.erl"},{line,1909}]},
                                   {riaknostic_config,load_vm_args,0,
...

Presumably the AppIndex - 1 is < 1.

This is caused by the fact that this is now a sys.config not an app.config file. I will hack away for a bit longer to see if I can make this work.

martinsumner commented 3 years ago

@Bob-The-Marauder Are you OK if we use this PR instead:

https://github.com/basho/riak/pull/1047

It contains modifications to this PR to get it to work on my machine. I didn't find the symlink was necessary, and made some changes so that riaknostic would load and the 'riak admin diag' would run as expected.

I can now dpkg -i ... sudo service riak start then sudo riak debug. Works on Ubuntu 18.

martinsumner commented 3 years ago

Replaced by #1047