mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' into obi-geo-index
* devel: Clarify the default value of req.body fix VS warning moveShard jobs running cppcheck cppcheck
This commit is contained in:
commit
ae33a790fb
|
@ -115,6 +115,8 @@ body
|
|||
|
||||
Defines the request body recognized by the endpoint. There can only be one request body definition per endpoint. The definition will also be shown in the route details in the API documentation.
|
||||
|
||||
In the absence of a request body definition, the request object's *body* property will be initialized to the unprocessed *rawBody* buffer.
|
||||
|
||||
If the endpoint is a child router, all routes of that router will use this body definition unless overridden. If the endpoint is a middleware, the request body will only be parsed once (i.e. the MIME types of the route matching the same request will be ignored but the body will still be validated again).
|
||||
|
||||
**Arguments**
|
||||
|
|
|
@ -19,7 +19,7 @@ The request object specifies the following properties:
|
|||
|
||||
* **body**: `any`
|
||||
|
||||
The processed and validated request body for the current route.
|
||||
The processed and validated request body for the current route. If no body has been defined for the current route, the value will be identical to *rawBody*.
|
||||
|
||||
For details on how request bodies can be processed and validated by Foxx see the [body method of the endpoint object](Endpoints.md#body).
|
||||
|
||||
|
|
|
@ -121,6 +121,16 @@ JOB_STATUS CleanOutServer::status() {
|
|||
|
||||
bool CleanOutServer::create() { // Only through shrink cluster
|
||||
|
||||
// Lookup server
|
||||
if (_server.find("DBServer") == 0) {
|
||||
try {
|
||||
_server = uuidLookup(_snapshot, _server);
|
||||
} catch (...) {
|
||||
LOG_TOPIC(ERR, Logger::AGENCY) <<
|
||||
"MoveShard: To server " << _server << " does not exist";
|
||||
}
|
||||
}
|
||||
|
||||
LOG_TOPIC(INFO, Logger::AGENCY)
|
||||
<< "Todo: Clean out server " + _server + " for shrinkage";
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ MoveShard::MoveShard(Node const& snapshot, Agent* agent,
|
|||
_shard(shard),
|
||||
_from(from),
|
||||
_to(to) {
|
||||
|
||||
try {
|
||||
JOB_STATUS js = status();
|
||||
|
||||
|
@ -50,7 +51,7 @@ MoveShard::MoveShard(Node const& snapshot, Agent* agent,
|
|||
}
|
||||
}
|
||||
} catch (std::exception const& e) {
|
||||
LOG_TOPIC(WARN, Logger::AGENCY) << e.what() << __FILE__ << __LINE__;
|
||||
LOG_TOPIC(WARN, Logger::AGENCY) << e.what() << ": " << __FILE__ << ":" << __LINE__;
|
||||
finish("Shards/" + _shard, false, e.what());
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +59,26 @@ MoveShard::MoveShard(Node const& snapshot, Agent* agent,
|
|||
MoveShard::~MoveShard() {}
|
||||
|
||||
bool MoveShard::create() {
|
||||
|
||||
// Lookup from server
|
||||
if (_from.compare("DBServer") == 0) {
|
||||
try {
|
||||
_from = uuidLookup(_snapshot, _from);
|
||||
} catch (...) {
|
||||
LOG_TOPIC(ERR, Logger::AGENCY) <<
|
||||
"MoveShard: From server " << _from << " does not exist";
|
||||
}
|
||||
}
|
||||
// Lookup to Server
|
||||
if (_to.find("DBServer") == 0) {
|
||||
try {
|
||||
_to = uuidLookup(_snapshot, _to);
|
||||
} catch (...) {
|
||||
LOG_TOPIC(ERR, Logger::AGENCY) <<
|
||||
"MoveShard: To server " << _to << " does not exist";
|
||||
}
|
||||
}
|
||||
|
||||
LOG_TOPIC(INFO, Logger::AGENCY)
|
||||
<< "Todo: Move shard " + _shard + " from " + _from + " to " << _to;
|
||||
|
||||
|
@ -75,24 +96,6 @@ bool MoveShard::create() {
|
|||
_jb->openArray();
|
||||
_jb->openObject();
|
||||
|
||||
// Lookup from server
|
||||
if (_from.find("DBServer") == 0) {
|
||||
try {
|
||||
_from = uuidLookup(_snapshot, _from);
|
||||
} catch (...) {
|
||||
LOG_TOPIC(ERR, Logger::AGENCY) <<
|
||||
"MoveShard: From server " << _from << " does not exist";
|
||||
}
|
||||
}
|
||||
if (_to.find("DBServer") == 0) {
|
||||
try {
|
||||
_to = uuidLookup(_snapshot, _to);
|
||||
} catch (...) {
|
||||
LOG_TOPIC(ERR, Logger::AGENCY) <<
|
||||
"MoveShard: To server " << _to << " does not exist";
|
||||
}
|
||||
}
|
||||
|
||||
if (_from == _to) {
|
||||
path = _agencyPrefix + failedPrefix + _jobId;
|
||||
_jb->add("timeFinished", VPackValue(now));
|
||||
|
@ -138,6 +141,26 @@ bool MoveShard::create() {
|
|||
}
|
||||
|
||||
bool MoveShard::start() {
|
||||
|
||||
// Lookup from server
|
||||
if (_from.find("DBServer") == 0) {
|
||||
try {
|
||||
_from = uuidLookup(_snapshot, _from);
|
||||
} catch (...) {
|
||||
LOG_TOPIC(ERR, Logger::AGENCY) <<
|
||||
"MoveShard: From server " << _from << " does not exist";
|
||||
}
|
||||
}
|
||||
|
||||
// Lookup to Server
|
||||
if (_to.find("DBServer") == 0) {
|
||||
try {
|
||||
_to = uuidLookup(_snapshot, _to);
|
||||
} catch (...) {
|
||||
LOG_TOPIC(ERR, Logger::AGENCY) <<
|
||||
"MoveShard: To server " << _to << " does not exist";
|
||||
}
|
||||
}
|
||||
|
||||
// Are we distributeShardsLiking other shard?
|
||||
// Invoke moveShard there
|
||||
|
@ -232,7 +255,7 @@ bool MoveShard::start() {
|
|||
try {
|
||||
todo.add(_jb->slice()[0].get(_agencyPrefix + toDoPrefix + _jobId));
|
||||
} catch (std::exception const& e) {
|
||||
LOG_TOPIC(WARN, Logger::AGENCY) << e.what() << __FILE__ << __LINE__;
|
||||
LOG_TOPIC(WARN, Logger::AGENCY) << e.what() << ": " << __FILE__ << ":" << __LINE__;
|
||||
}
|
||||
}
|
||||
todo.close();
|
||||
|
@ -355,6 +378,27 @@ JOB_STATUS MoveShard::status() {
|
|||
_to = _snapshot(pos[status] + _jobId + "/toServer").getString();
|
||||
_shard =
|
||||
_snapshot(pos[status] + _jobId + "/shards").slice()[0].copyString();
|
||||
|
||||
// Lookup from server
|
||||
if (_from.find("DBServer") == 0) {
|
||||
try {
|
||||
_from = uuidLookup(_snapshot, _from);
|
||||
} catch (...) {
|
||||
LOG_TOPIC(ERR, Logger::AGENCY) <<
|
||||
"MoveShard: From server " << _from << " does not exist";
|
||||
}
|
||||
}
|
||||
|
||||
// Lookup to Server
|
||||
if (_to.find("DBServer") == 0) {
|
||||
try {
|
||||
_to = uuidLookup(_snapshot, _to);
|
||||
} catch (...) {
|
||||
LOG_TOPIC(ERR, Logger::AGENCY) <<
|
||||
"MoveShard: To server " << _to << " does not exist";
|
||||
}
|
||||
}
|
||||
|
||||
} catch (std::exception const& e) {
|
||||
std::string err =
|
||||
std::string("Failed to find job ") + _jobId + " in agency: " + e.what();
|
||||
|
|
|
@ -134,7 +134,7 @@ struct IndexBucket {
|
|||
}
|
||||
#endif
|
||||
|
||||
_nrAlloc = numberElements;
|
||||
_nrAlloc = static_cast<IndexType>(numberElements);
|
||||
} catch (...) {
|
||||
deallocateTempfile();
|
||||
TRI_ASSERT(_file == -1);
|
||||
|
|
Loading…
Reference in New Issue