Skip to content

Commit

Permalink
SERVER-19674 Change S2 fatal error to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinAlbs committed Aug 14, 2015
1 parent 9f8dc3a commit a925e26
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
14 changes: 14 additions & 0 deletions jstests/core/geo_s2index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,17 @@ t.drop();
t.save({loc: [0,0]})
res = t.ensureIndex({ loc: "2dsphere" }, { finestIndexedLevel: 30, coarsestIndexedLevel: -1 });
assert.commandFailed(res);

// Ensure polygon which previously triggered an assertion error in SERVER-19674
// is able to be indexed.
t.drop();
t.insert({
loc: {
"type" : "Polygon",
"coordinates" : [
[[-45, 0], [-44.875, 0], [-44.875, 0.125], [-45, 0.125], [-45,0]]
]
}
});
res = t.createIndex({loc: "2dsphere"});
assert.commandWorked(res);
4 changes: 0 additions & 4 deletions src/third_party/s2/base/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ LogMessageInfo::LogMessageInfo() : LogMessageBase(std::move(mongo::log())) { }
LogMessageWarning::LogMessageWarning(const char* file, int line) :
LogMessageBase(mongo::warning(), file, line) { }

LogMessageWarning::~LogMessageWarning() {
mongo::logContext(NULL);
}

LogMessageFatal::LogMessageFatal(const char* file, int line) :
LogMessageBase(mongo::severe(), file, line) { }

Expand Down
3 changes: 2 additions & 1 deletion src/third_party/s2/base/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

#include "base/port.h"
#define INFO LogMessageInfo().stream()
#define WARN LogMessageWarning(__FILE__, __LINE__).stream()
#define FATAL LogMessageFatal(__FILE__, __LINE__).stream()
#define DFATAL LogMessageFatal(__FILE__, __LINE__).stream()

Expand Down Expand Up @@ -89,7 +90,7 @@ class LogMessageInfo : public LogMessageBase {
class LogMessageWarning : public LogMessageBase {
public:
LogMessageWarning(const char* file, int line);
virtual ~LogMessageWarning();
virtual ~LogMessageWarning() { };

private:
DISALLOW_COPY_AND_ASSIGN(LogMessageWarning);
Expand Down
8 changes: 7 additions & 1 deletion src/third_party/s2/s2edgeutil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ bool S2EdgeUtil::VertexCrossing(S2Point const& a, S2Point const& b,
if (a == c) return S2::OrderedCCW(S2::Ortho(a), d, b, a);
if (b == d) return S2::OrderedCCW(S2::Ortho(b), c, a, b);

S2LOG(DFATAL) << "VertexCrossing called with 4 distinct vertices";
// TODO Changing the following to a warning is a workaround fix for SERVER-19674.
//
// Because ExpensiveCCW is subject to numerical errors there are some
// edge cases where this function will be called with 4 distinct
// (but with two extremely close) vertices
//
S2LOG(WARN) << "VertexCrossing called with 4 distinct vertices";
return false;
}

Expand Down

0 comments on commit a925e26

Please sign in to comment.