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

[errors] return errors instead of exiting process #79

Merged
merged 14 commits into from
Jun 18, 2018
Merged

Conversation

tmc
Copy link
Contributor

@tmc tmc commented Jun 13, 2018

This opts to return error values instead of allowing sybil.Error to shut the process down via log.Fatalln.

I think the most likely way this change will introduce a regression is that it will not allow any errors in a set of records to go ignored. I would say it carries moderate risk.

Fixes #74

@codecov-io
Copy link

codecov-io commented Jun 13, 2018

Codecov Report

Merging #79 into master will decrease coverage by 0.66%.
The diff coverage is 22.98%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
- Coverage   45.34%   44.67%   -0.67%     
==========================================
  Files          47       48       +1     
  Lines        4241     4407     +166     
==========================================
+ Hits         1923     1969      +46     
- Misses       2130     2211      +81     
- Partials      188      227      +39
Flag Coverage Δ
#fuzztests 0.58% <0%> (-0.03%) ⬇️
#unittests 52.36% <38.52%> (+0.09%) ⬆️
Impacted Files Coverage Δ
src/sybil/debug.go 14.28% <ø> (+3.17%) ⬆️
src/cmd/cmd_query.go 0% <0%> (ø) ⬆️
src/sybil/printer.go 0% <0%> (ø) ⬆️
src/sybil/table_trim.go 0% <0%> (ø) ⬆️
src/cmd/cmd_ingest.go 0% <0%> (ø) ⬆️
src/cmd/cmd_index.go 0% <0%> (ø) ⬆️
src/sybil/config.go 55.55% <0%> (+3.83%) ⬆️
src/sybil/errors.go 0% <0%> (ø)
src/cmd/cmd_trim.go 0% <0%> (ø) ⬆️
src/sybil/node_aggregator.go 0% <0%> (ø) ⬆️
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5df8c89...f5b7a0e. Read the comment docs.

@tmc tmc force-pushed the errors branch 2 times, most recently from 0f2c062 to 92c870a Compare June 14, 2018 00:24
@@ -231,9 +235,13 @@ func runQueryCmdLine(flags *sybil.FlagDefs) error {
for _, v := range allGroups {
switch t.GetColumnType(v) {
case sybil.STR_VAL:
loadSpec.Str(v)
if err := loadSpec.Str(v); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

i don't get the two statements on one line in an if

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's a way to shorten LOC slightly but comes at a slight readability cost.. I can declare the err outside of the switch and deal with it afterwords.

@tmc tmc force-pushed the errors branch 3 times, most recently from 713397b to c3b01eb Compare June 16, 2018 01:36
@tmc tmc changed the title WIP: [errors] begin threading errors through instead of exiting process [errors] begin threading errors through instead of exiting process Jun 16, 2018
@tmc tmc force-pushed the errors branch 6 times, most recently from 800b607 to baa9274 Compare June 16, 2018 18:16
@tmc tmc changed the title [errors] begin threading errors through instead of exiting process [errors] return errors instead of exiting process Jun 17, 2018
@tmc tmc force-pushed the errors branch 3 times, most recently from df08e65 to baa9274 Compare June 18, 2018 01:11
Copy link
Collaborator

@okayzed okayzed left a comment

Choose a reason for hiding this comment

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

from offline discussion: mostly looks good (if you don't mind multiplying every call site by 3x), but ship it on your grpc branch, i think. i'm tired of looking at this diff (so much codes), i think you should keep exercising the code paths before we push in master

val, err := strconv.ParseInt(iv, 10, 64)
if err == nil {
r.AddIntField(keyName, int64(val))
val, cerr := strconv.ParseInt(iv, 10, 64)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is it called cerr? to help with nesting errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if I shadow "err" then I can't populate err from line 33

@tmc tmc changed the base branch from master to grpc June 18, 2018 18:18
@tmc
Copy link
Contributor Author

tmc commented Jun 18, 2018

ok changed integration target to newly cut grpc branch

@tmc tmc merged commit 1273e26 into logv:grpc Jun 18, 2018
@tmc tmc deleted the errors branch June 18, 2018 18:19
tmc added a commit to tmc/sybil that referenced this pull request Jun 25, 2018
* [errors] begin threading errors through instead of having sybil.Error exit the process

* [errors] use errors package more extensively

* [errors] add error checking to cmds

* [errors] check for errors in more places

* [errors] simplify returning err

* [errors] add error handling to ingest, trim

* [errors] add more errors.Wrap usage

* [errors] add error handling to trim, inspect

* [errors] add more checking to aggregate, ingest

* [errors] add error checking to column unpacking

* [errors] add more error coverage

* [errors] relax error handling in ingestion

* [errors] address a few todos

* [tests] exercise BuildFilters in test
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.

3 participants