exit codes and no bootstrapping of >1 store#3581
Conversation
|
Reviewed 1 of 1 files at r1, 11 of 11 files at r2. cli/sql.go, line 93 [r2] (raw file): cli/start.go, line 234 [r2] (raw file): util/stop/stopper.go, line 199 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: all files reviewed at latest revision, 3 unresolved discussions. cli/sql.go, line 93 [r2] (raw file): cli/start.go, line 234 [r2] (raw file): util/stop/stopper.go, line 199 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: all files reviewed at latest revision, 3 unresolved discussions. cli/sql.go, line 93 [r2] (raw file): cli/start.go, line 234 [r2] (raw file): util/stop/stopper.go, line 199 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: 9 of 12 files reviewed at latest revision, 3 unresolved discussions. cli/sql.go, line 93 [r2] (raw file): cli/start.go, line 234 [r2] (raw file): util/stop/stopper.go, line 199 [r1] (raw file): Comments from the review on Reviewable.io |
|
Reviewed 3 of 3 files at r3. cli/sql.go, line 82 [r3] (raw file): cli/sql.go, line 124 [r3] (raw file): cli/sql.go, line 126 [r3] (raw file): Comments from the review on Reviewable.io |
this is going to be necessary with the next commits which will use panic() for the cli commands.
|
Review status: 11 of 12 files reviewed at latest revision, 1 unresolved discussion. cli/sql.go, line 126 [r3] (raw file): Comments from the review on Reviewable.io |
|
Reviewed 1 of 1 files at r4. Comments from the review on Reviewable.io |
exit codes and no bootstrapping of >1 store
Before this patch, Stopper.Stop() would do a "best-effort" shutdown when called while a panic is unwinding: it would signal quiescence, and then run all closer async while swallowing their panics, then wait a bit, then re-panic. If the stopper is to do any shutdown on panics, this shutdown has to be somewhat involved, since some closers are known to panic easily when closed in an unclean state (e.g. memory accounts with bytes taken out of them panic), and tasks can fail to respond to quiescence, etc. This is all too complicated, and pretty unsound, for little, if any, gain, so this patch gets rid of it all in favor of not doing any shutdown and re-panicking immediately. This best-effort shutdown was added in cockroachdb#3581, for the purported benefit of CLI tests that wanted to trigger panic code-paths. The respective code is long gone - as far as I can dig up, it had to do with ancient, per-SQL cli kv-client commands. Over time, this panic recovery became load-bearing in cockroachdb#45983, when leaktest was modified to not crash the package binary on panics, and instead continue with further tests. If we are to continue with other tests after a panicking one, we'd better try to cleanup the panicking TestServer as best we can. The leaktest panic behavior is reverted in the prior commit. Release note: None
Before this patch, Stopper.Stop() would do a "best-effort" shutdown when called while a panic is unwinding: it would signal quiescence, and then run all closer async while swallowing their panics, then wait a bit, then re-panic. If the stopper is to do any shutdown on panics, this shutdown has to be somewhat involved, since some closers are known to panic easily when closed in an unclean state (e.g. memory accounts with bytes taken out of them panic), and tasks can fail to respond to quiescence, etc. This is all too complicated, and pretty unsound, for little, if any, gain, so this patch gets rid of it all in favor of not doing any shutdown and re-panicking immediately. This best-effort shutdown was added in cockroachdb#3581, for the purported benefit of CLI tests that wanted to trigger panic code-paths. The respective code is long gone - as far as I can dig up, it had to do with ancient, per-SQL cli kv-client commands. Over time, this panic recovery became load-bearing in cockroachdb#45983, when leaktest was modified to not crash the package binary on panics, and instead continue with further tests. If we are to continue with other tests after a panicking one, we'd better try to cleanup the panicking TestServer as best we can. The leaktest panic behavior is reverted in the prior commit. Release note: None
this makes it a little more sane to work with the
cli. In particular, a failedinit,start, ... now returns an error. Also changed./cockroach sqlso that it returns the error of the last failing command, which makes something likeecho "SELECTTTT 1;" | ./cockroach sqlreturn a nonzero exit code.