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

Hopefully the final merge ofthe pre-factored code! #119

Closed
wants to merge 23 commits into from
Closed

Conversation

tacketar
Copy link
Contributor

@tacketar tacketar commented Sep 1, 2016

No description provided.

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.
@PerilousApricot
Copy link
Member

@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 push origin feature/partyhouse with push me feature/partyhouse.

I can tidy it up manually, but it's much preferred in the future.

@tacketar
Copy link
Contributor Author

tacketar commented Sep 1, 2016

Will do. Sorry about that.

@PerilousApricot
Copy link
Member

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;
Copy link
Member

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 =?

Copy link
Contributor Author

@tacketar tacketar Sep 1, 2016 via email

Choose a reason for hiding this comment

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

Copy link
Member

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?

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 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)

Copy link
Member

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?

Copy link
Contributor Author

@tacketar tacketar Sep 2, 2016 via email

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;
Copy link
Member

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?

Copy link
Contributor Author

@tacketar tacketar Sep 2, 2016 via email

Choose a reason for hiding this comment

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

Copy link
Member

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.

Copy link
Contributor Author

@tacketar tacketar Sep 2, 2016 via email

Choose a reason for hiding this comment

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

Copy link
Member

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?)

Copy link
Contributor Author

@tacketar tacketar Sep 6, 2016 via email

Choose a reason for hiding this comment

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

Copy link
Member

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

Copy link
Contributor Author

@tacketar tacketar Sep 6, 2016 via email

Choose a reason for hiding this comment

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

Copy link
Member

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....

@PerilousApricot
Copy link
Member

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);
Copy link
Member

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.

Copy link
Contributor Author

@tacketar tacketar Sep 2, 2016 via email

Choose a reason for hiding this comment

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

@PerilousApricot
Copy link
Member

This build fails because it requires LevelDB, but LevelDB isn't shipped along with the docker builder images:

-- The following REQUIRED packages have not been found:

 * LevelDB

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
/tmp/lstore-package/src/lio/LEVELDB_INCLUDE_DIR

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.

@tacketar
Copy link
Contributor Author

tacketar commented Sep 6, 2016 via email

@tacketar
Copy link
Contributor Author

Superseeded by #129

@tacketar tacketar closed this Sep 30, 2016
@PerilousApricot PerilousApricot deleted the alan branch October 4, 2016 19:23
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.

2 participants