-
Notifications
You must be signed in to change notification settings - Fork 5
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
Hopefully the final merge ofthe pre-factored code! #119
Conversation
The final log statement uses the segment ID which could be invalid because once the flushing_count is decremented the segment_destroy call could complete and destroy the actual segment.
This is not ideal there area couple of options 1) add a string helper function 2) just make the cap a printable string. I don't think there is much an issue doing this.
@tacketar In the future, please push your branches to your own fork then issue the PR from your fork to the main one. It's not a huge deal, but it kinda busts things up with Jenkins a bit to have the origin branch be from the same remote. The change in procedure is effectively I can tidy it up manually, but it's much preferred in the future. |
Will do. Sorry about that. |
No biggie. You're just now seeing all the bits that I've been slamming on for a few months. Notice the nice "pending check"? :) |
@@ -194,13 +197,15 @@ int main(int argc, char **argv) | |||
} else { | |||
info_printf(lio_ifd, 0, "ERROR: Multiple paths selected but the dest(%s) isn't a directory!\n", dtuple.path); | |||
} | |||
n_errors = 1; |
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.
Is n_errors
supposed the be the number of errors? Should this be +=
and not =
?
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.
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.
OK. But what is n_errors
supposed to be? Up top, it's the counter of the errors that happened. At lines 289 and 300, you add up the error codes for any child GOPs, then you return it to the caller. Is it the number of errors? Is it "Sum of error codes" + "number of errors"? What does that number mean? Are there some sort of semantics to the exit code a user is supposed to interpret?
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.
It's really more of a binary value. 0=Success and anything else means a
failure. You could change the final return to:
return((n_errors == 0) ? 0 : EIO)
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.
That's probably best. If that change happens, then there's no need to even walk all the gop error codes, right?
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.
@@ -1128,7 +1128,7 @@ int va_timestamp_set_attr(lio_os_virtual_attr_t *va, lio_object_service_fn_t *os | |||
n = (int)(long)va->priv; //** HACKERY ** to get the attribute prefix length | |||
key = &(fullkey[n+1]); | |||
|
|||
if (strlen(fullkey) < n) { //** Nothing to do so return; | |||
if ((int)strlen(fullkey) < n) { //** Nothing to do so return; |
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.
This diff is a ton of signed->unsigned casts. What is the justification? Does that break C's UB guarantees?
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.
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.
That's true. But blindly casting away the error is not always correct,
hence my question. Signedness has strange spec-defined behavior that you
could be papering over.
It's dark in this basement.
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.
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.
The C behavior around signed and unsigned comparisons and implicit conversions is damned bonkers.
unsigned int x = 1;
int y = -1;
// Surprisingly false
return (x > y);
On the other hand, this gets the conversions right
return (x - y > 0);
... go figure. In this case, though, it probably makes sense to have n
be defined as unsigned int
, right? I wasn't able to sort out what n = (int)(long)va->priv;
actually resolved to, but if it's a length, changing the type is both more clear to the humans and sidesteps the compiler being truly surprising.
(I'm also curious about what the double conversion does at the end of the day. Does the compiler treat (int)(long)
differently than (int)
? Or does it optimize it all away?)
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.
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.
Another name that would work is count
, I'd suppose
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.
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.
Well, the name is probably the smallest thing. Tiem for the ole thesaurus!
To be clear, I also agree that unsigned variables are the worst. Unfortunately the comparison rules between mixed-signedness values is even worser, so we're kinda stuck. Especially since a lot of the static analysis/sanitization stuff will trip all over it.
Anyway, time to find dinner....
s/merge ofthe pre-factored/merge of the pre-factored/ |
@@ -76,7 +76,7 @@ gop_op_status_t mv_fn(void *arg, int id) | |||
// tweak = (strcmp(mv->dest_tuple.path, "/") == 0) ? 1 : 0; //** Tweak things for the root path | |||
while ((ftype = lio_next_object(mv->src_tuple.lc, it, &src_fname[slot], &prefix_len)) > 0) { | |||
snprintf(dname, OS_PATH_MAX, "%s/%s", mv->dest_tuple.path, &(src_fname[slot][prefix_len+1])); | |||
gop = lio_move_op(mv->src_tuple.lc, mv->src_tuple.creds, src_fname[slot], dname); | |||
gop = gop_lio_move_object(mv->src_tuple.lc, mv->src_tuple.creds, src_fname[slot], dname); |
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.
Do you really want gop_lio_*? That might not fit the naming scheme.
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.
This build fails because it requires LevelDB, but LevelDB isn't shipped along with the docker builder images:
You'll need to add the appropriate statements to https://github.com/accre/lstore/blob/master/scripts/generate-docker-base.sh#L78, https://github.com/accre/lstore/blob/master/scripts/generate-docker-base.sh#L99 to instruct the build system about the new dependencies. Additionally, please update the documentation at https://github.com/accre/lstore/blob/master/README.md to tell humans of the new dep. |
Good catch. I completely forgot about the docker builder.
|
Superseeded by #129 |
No description provided.