1
0
Fork 0

Bug fix/fixes 1007 (#5815)

This commit is contained in:
Jan 2018-07-10 13:47:04 +02:00 committed by GitHub
parent 2aa17551f3
commit 208f1297e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 5 deletions

View File

@ -1057,6 +1057,10 @@ std::shared_ptr<LogicalView> ClusterInfo::getView(
DatabaseID const& databaseID, DatabaseID const& databaseID,
ViewID const& viewID ViewID const& viewID
) { ) {
if (viewID.empty()) {
return nullptr;
}
auto lookupView = []( auto lookupView = [](
AllViews const& dbs, AllViews const& dbs,
DatabaseID const& databaseID, DatabaseID const& databaseID,
@ -1118,6 +1122,10 @@ std::shared_ptr<LogicalView> ClusterInfo::getViewCurrent(
DatabaseID const& databaseID, DatabaseID const& databaseID,
ViewID const& viewID ViewID const& viewID
) { ) {
if (viewID.empty()) {
return nullptr;
}
static const auto lookupView = []( static const auto lookupView = [](
AllViews const& dbs, AllViews const& dbs,
DatabaseID const& databaseID, DatabaseID const& databaseID,
@ -1141,11 +1149,11 @@ std::shared_ptr<LogicalView> ClusterInfo::getViewCurrent(
return lookupView(_plannedViews, databaseID, viewID); return lookupView(_plannedViews, databaseID, viewID);
} }
size_t planReoads = 0; size_t planReloads = 0;
if (!_planProt.isValid) { if (!_planProt.isValid) {
loadPlan(); // current Views are actually in Plan instead of Current loadPlan(); // current Views are actually in Plan instead of Current
++planReoads; ++planReloads;
} }
for(;;) { for(;;) {
@ -1158,12 +1166,12 @@ std::shared_ptr<LogicalView> ClusterInfo::getViewCurrent(
} }
} }
if (planReoads >= 2) { if (planReloads >= 2) {
break; break;
} }
loadPlan(); // current Views are actually in Plan instead of Current (must load plan outside the lock) loadPlan(); // current Views are actually in Plan instead of Current (must load plan outside the lock)
++planReoads; ++planReloads;
} }
LOG_TOPIC(INFO, Logger::CLUSTER) LOG_TOPIC(INFO, Logger::CLUSTER)

View File

@ -303,9 +303,23 @@ void Communicator::createRequestInProgress(NewRequest&& newRequest) {
} }
} }
if (request->requestType() == RequestType::POST ||
request->requestType() == RequestType::PUT) {
// work around curl's Expect-100 Continue obsession
// by sending an empty "Expect:" header
// this tells curl to not send its "Expect: 100-continue" header
requestHeaders = curl_slist_append(requestHeaders, "Expect:");
}
std::string thisHeader;
for (auto const& header : request->headers()) { for (auto const& header : request->headers()) {
std::string thisHeader(header.first + ": " + header.second); thisHeader.reserve(header.first.size() + header.second.size() + 2);
thisHeader.append(header.first);
thisHeader.append(": ", 2);
thisHeader.append(header.second);
requestHeaders = curl_slist_append(requestHeaders, thisHeader.c_str()); requestHeaders = curl_slist_append(requestHeaders, thisHeader.c_str());
thisHeader.clear();
} }
std::string url = createSafeDottedCurlUrl(newRequest._destination.url()); std::string url = createSafeDottedCurlUrl(newRequest._destination.url());