-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
SERVER-9751 Force S2 geometry library to use Mongo's LOG instead of stderr #430
Conversation
…std::cerr. Right now S2 library just writes any debugging output and errors to std::cerr. This patch changes S2's logger to use Mongo's LOG macros. That way it is much easier to find errors in geometry primitives.
Hi Alexander, Before we can accept any pull request, we have two main requirements. (1) reference a SERVER ticket, (2) make sure you've signed the contributor agreement. This is explained in CONTRIBUTING.rst in the root of our source tree. I see you already have the SERVER ticket taken care of, so that's great! Now we need the contributor agreement. The form is at http://www.10gen.com/legal/contributor-agreement Even though it's not "required" in the form, please make sure you specify your GitHub username. This will help us verify compliance quickly in the future. Thank you for contributing to MongoDB! |
Hi, I already did it yesterday. |
Hi Alexander, Unfortunately I do not see you on our contributors list yet. Can you fill out the form again? It's possible the problem is on our end. If you tell me you submitted the form a second time and I still see nothing, I will be happy to hunt for a problem here. Again, please specify your GitHub username, even though the form doesn't require it (yet). |
Done |
Ok. I still don't see your name on the contributors list, but I will assume the problem is on our end. Let me work on this. |
Alexander, I've confirmed that we have a problem on our end. I'm trying to
|
|
||
// Always-on checking | ||
#define CHECK(x) if(x){}else LogMessageFatal(__FILE__, __LINE__).stream() << "Check failed: " #x | ||
#define CHECK(x) if(x){}else VLOG(2) << __FILE__ << ":" << __LINE__ << ": Check failed: " #x |
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.
We need CHECK to still be fatal, especially in non-debug mode. Maybe a verify(x) after the vlog?
I think we want:
error() << FILE << .. (and so on) verify(x);
when the check fails.
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, original CHECK is not fatal. Do you really think this should be changed?
And I'm not familiar with MongoDB's codebase, what does verify
do?
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 isn't? ~LogMessageFatal calls ::abort() which should stop the server. Did you see different behavior in practice?
Verify stops the server if the condition is false and prints out a stack trace/other info.
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, I've read assert_util.h
and think that this line should be replaced with just:
#define CHECK MONGO_verify
Do you agree with me?
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. Thanks for looking into this. Should be good to pull once that change is made.
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.
Verify is thread-fatal, while fassert is process-fatal. Is the process
compromised after CHECK failures in S2? If so, fassert.
On Jun 5, 2013 1:37 PM, "Hari Khalsa" notifications@github.com wrote:
In src/third_party/s2/base/logging.h:
// Always-on checking
-#define CHECK(x) if(x){}else LogMessageFatal(FILE, LINE).stream() << "Check failed: " #x
+#define CHECK(x) if(x){}else VLOG(2) << FILE << ":" << LINE << ": Check failed: " #xI agree. Thanks for looking into this. Should be good to pull once that
change is made.—
Reply to this email directly or view it on GitHubhttps://github.com//pull/430/files#r4550584
.
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.
@andy10gen original behaviour was to call abort()
if check failed.
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, guys, I found that CHECK
can't be just redefined as a MONGO_verify
. Because originally, CHECK
returns an object to be used as a stream for error message.
What should be used in this case? Probably MONGO_massert
? If yes, then what should I use as msgid
?
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, I had intended to make all of the assertions streamable, a la
Google's CHECK, eventually, but never got around to it. I'm working on
making at least the fatal asssertions (fassert) streamable, and will
respond here and on SERVER-9751 when I do. Should be sometime in the next
week to two, after I get a few other things taken care of.
On Thu, Jun 6, 2013 at 3:53 AM, Alexander Artemenko <
notifications@github.com> wrote:
In src/third_party/s2/base/logging.h:
// Always-on checking
-#define CHECK(x) if(x){}else LogMessageFatal(FILE, LINE).stream() << "Check failed: " #x
+#define CHECK(x) if(x){}else VLOG(2) << FILE << ":" << LINE << ": Check failed: " #xWell, guys, I found that CHECK can't be just redefined as a MONGO_verify.
Because originally, CHECK returns an object to be used as a stream for
error message.What should be used in this case? Probably MONGO_massert? If yes, then
what should I use as msgid?—
Reply to this email directly or view it on GitHubhttps://github.com//pull/430/files#r4562525
.
Alexander, sorry it took so long, but we finally resolved this in 8af9af8. Thank you for your patience and for contributing to MongoDB! |
Hello. |
Hi Andrii, We redirected the non-debug S2 logs in SERVER-9751. We're currently working on the debug S2 messages in SERVER-14467. Once SERVER-14467 is resolved, you should be able to see in a development release the S2 messages with the details on a query with an invalid geometry. Ben |
Thanks Ben. |
Hi Andrii, We resolved SERVER-14467 recently so you should see this in the upcoming 2.7.5 development release. Here's some sample logs (at verbosity 5) from running the JS test geo_invalid_polygon.js:
Regards, |
Thanks Ben. |
Hello Ben. Thanks. |
Disable forced eviction if eviction is disabled for the whole tree.
Right now S2 library just writes any debugging output and errors
to std::cerr. This patch changes S2's logger to use Mongo's LOG macros.
That way it is much easier to find errors in geometry primitives.