-
-
Notifications
You must be signed in to change notification settings - Fork 256
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
Remove some internal use of API calls and H5E_BEGIN_TRY/H5E_END_TRY #4624
Changes from 2 commits
b8a6800
bfb055d
057e52d
10b1efc
5b3592e
733ef55
bd19731
54bc98a
9c0881c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3533,8 +3533,6 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in | |
H5P_genplist_t *fapl_plist; | ||
H5P_genplist_t *fapl_plist_copy; | ||
bool is_accessible = false; /* Whether file is accessible */ | ||
ssize_t num_errors = 0; | ||
herr_t status; | ||
hid_t connector_id = H5I_INVALID_HID; | ||
hid_t fapl_id = H5I_INVALID_HID; | ||
herr_t ret_value = H5_ITER_CONT; | ||
|
@@ -3572,30 +3570,10 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in | |
vol_cb_args.args.is_accessible.fapl_id = fapl_id; | ||
vol_cb_args.args.is_accessible.accessible = &is_accessible; | ||
|
||
/* Store current error stack size */ | ||
if ((num_errors = H5Eget_num(H5E_DEFAULT)) < 0) | ||
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, H5_ITER_ERROR, "can't get current error stack size"); | ||
if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like another case where we need this to be a 'try'. The previous code was treating it like a 'try' by popping any errors that occurred from the error stack if the is_accessible call failed, but trying to keep the error messages (if any) around in the case where the file isn't accessible. Now if the is_accessible call fails, it just fails the iteration, which is not quite the behavior wanted here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is effectively a 'try' already - it's returning the flag in a parameter. So, any failure means that the flag couldn't be determined, which is a real error. I think that a file not being accessible isn't an error, it's just not accessible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original intention (for better or worse) was to ignore errors that occur during the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that it would be more consistent to have this routine act like the rest of the library's 'try' routines, where it is an actual error to not be able to answer the question "is this file accessible?". That was the original intention of the 'is_accessible' callback. As you said, the native VOL connector was already discriminating between actual errors and 'false', so it's behaving correctly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not particularly stuck on the current implementation since this is functionality that is mostly unused outside of niche cases, but it would definitely be good to make sure that the distinction between There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, definitely, I'll add some blurbs for it in the morning. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jhendersonHDF - How's this look? |
||
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5_ITER_ERROR, "error when checking for accessible HDF5 file"); | ||
|
||
/* Check if file is accessible with given VOL connector */ | ||
H5E_BEGIN_TRY | ||
{ | ||
status = H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL); | ||
} | ||
H5E_END_TRY | ||
|
||
if (status < 0) { | ||
ssize_t new_num_errors = 0; | ||
|
||
/* Pop any errors generated by the above call */ | ||
if ((new_num_errors = H5Eget_num(H5E_DEFAULT)) < 0) | ||
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, H5_ITER_ERROR, "can't get current error stack size"); | ||
if (new_num_errors > num_errors) { | ||
new_num_errors -= num_errors; | ||
if (H5Epop(H5E_DEFAULT, (size_t)new_num_errors) < 0) | ||
HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, H5_ITER_ERROR, "can't sanitize error stack"); | ||
} | ||
} | ||
else if (status == SUCCEED && is_accessible) { | ||
if (is_accessible) { | ||
/* If the file was accessible with the current VOL connector, return | ||
* the FAPL with that VOL connector set on it. | ||
*/ | ||
|
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 would potentially modify the argument even in the case of failure.
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.
Yes, I considered that, but the previous behavior was aggregating FAIL with 'false' and it seemed best to continue that.
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 looks like H5VL__native_file_specific() previously would not touch the user's buffer if H5F__is_hdf5() failed, whereas with this change it would, since the user buffer is passed through directly to H5F__is_hdf5(). Also, since it wouldn't be hard to do I think we should just follow the normal pattern where output parameters aren't changed in case of failure. We would of course need another variable here to handle the error check in the close section.
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, I'll update the code.