-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Add plain_table_db_test to ASSERT_STATUS_CHECKED list #7482
Conversation
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.
@zhichao-cao has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
db/db_iter.h
Outdated
@@ -132,6 +132,7 @@ class DBIter final : public Iterator { | |||
ResetInternalKeysSkippedCounter(); | |||
local_stats_.BumpGlobalStatistics(statistics_); | |||
iter_.DeleteIter(arena_mode_); | |||
status_.PermitUncheckedError(); |
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.
If we call status_.PermitUncheckedError()
here, we won't benefit from the enforcement of status check, 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.
Yes. But status_ is mostly used as a "carrier" of the status and return it to the user, when status() is called. So, it is reasonable to call PermitUncheckedError()
in the destructor
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.
iiuc, if it's not returned to the user, adding PermitUncheckedError()
will bypass the check. I am not sure if this is what we would like to achieve.
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.
iiuc, if it's not returned to the user, adding
PermitUncheckedError()
will bypass the check. I am not sure if this is what we would like to achieve.
It is a little problematic. We have some classes that use Status or IOStatus as member. In most case, they are just used to carry the status through the life time of the class instance. And usually, user call a function to get the status when they want. In those cases, we are not able to know if user get the status or 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.
I agree with @riversand963 that, this thing will defeat the whole purpose of the status check for iterators.
I would rather fix those unit tests than do it here.
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.
If you want to remove the PermitUncheckedErrors in destructors, you need a means of telling if the Status was ever checked or set. I see two potential solutions to this. One is that an "empty Status" (e.g. Status s;) always passes the check. Another is that Status::OK() always passes. If choosing the latter, you would need to explicitly initialize the Status to OK and to change OK to be a static Status (rather than one created every time).
I think there are likely going to be places where an Iterator is created and the status is never set that are causing some of the assertions, and those are very hard to track down.
175c4a1
to
f1691d1
Compare
@zhichao-cao has updated the pull request. You must reimport the pull request before landing. |
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.
@zhichao-cao has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
db/db_iter.h
Outdated
@@ -132,6 +132,7 @@ class DBIter final : public Iterator { | |||
ResetInternalKeysSkippedCounter(); | |||
local_stats_.BumpGlobalStatistics(statistics_); | |||
iter_.DeleteIter(arena_mode_); | |||
status_.PermitUncheckedError(); |
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.
I agree with @riversand963 that, this thing will defeat the whole purpose of the status check for iterators.
I would rather fix those unit tests than do it here.
f1691d1
to
4f029b0
Compare
@zhichao-cao has updated the pull request. You must reimport the pull request before landing. |
1 similar comment
@zhichao-cao has updated the pull request. You must reimport the pull request before landing. |
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.
@zhichao-cao has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@@ -37,9 +37,10 @@ Status TableFactory::CreateFromString(const ConfigOptions& config_options_in, | |||
factory->reset(new CuckooTableFactory()); | |||
#endif // ROCKSDB_LITE | |||
} else { | |||
return Status::NotSupported("Could not load table factory: ", name); | |||
status = Status::NotSupported("Could not load table factory: ", name); | |||
return status; |
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.
I do not think you need to return here with the line 43 change...
4f029b0
to
aab35ea
Compare
@zhichao-cao has updated the pull request. You must reimport the pull request before landing. |
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.
@zhichao-cao has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
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.
LGTM.
aab35ea
to
133ddef
Compare
@zhichao-cao has updated the pull request. You must reimport the pull request before landing. |
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.
@zhichao-cao has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
My comment of DBIter has been addressed. Thanks! |
133ddef
to
893d519
Compare
@zhichao-cao has updated the pull request. You must reimport the pull request before landing. |
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.
@zhichao-cao has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@zhichao-cao merged this pull request in 16bff53. |
Summary: Add plain_table_db_test to ASSERT_STATUS_CHECKED list Pull Request resolved: facebook#7482 Test Plan: ASSERT_STATUS_CHECKED=1 make -j48 plain_table_db_test Reviewed By: riversand963 Differential Revision: D24034987 Pulled By: zhichao-cao fbshipit-source-id: e61c937d55ded0947cc8936937362dafed572a60
summary: Add plain_table_db_test to ASSERT_STATUS_CHECKED list
test plan: ASSERT_STATUS_CHECKED=1 make -j48 plain_table_db_test