1
0
Fork 0

fixed some minor issues in arangob

This commit is contained in:
Jan Steemann 2013-09-24 10:45:01 +02:00
parent 66e03951f1
commit c3a2886148
8 changed files with 58 additions and 23 deletions

View File

@ -108,10 +108,6 @@ namespace triagens {
_time(0.0) {
_errorHeader = StringUtils::tolower(HttpResponse::getBatchErrorHeader());
if (_async) {
_headers["x-arango-async"] = "true";
}
}
////////////////////////////////////////////////////////////////////////////////
@ -183,11 +179,6 @@ namespace triagens {
delete result;
if (! _keepAlive) {
_client->close();
}
// if we're the first thread, set up the test
if (_threadNumber == 0) {
if (! _operation->setUp(_client)) {
@ -195,6 +186,10 @@ namespace triagens {
}
}
if (_async) {
_headers["x-arango-async"] = "true";
}
_callback();
// wait for start condition to be broadcasted
@ -216,10 +211,6 @@ namespace triagens {
else {
executeBatchRequest(numOps);
}
if (! _keepAlive) {
_client->close();
}
}
}
@ -253,10 +244,10 @@ namespace triagens {
}
if (location[0] == '/') {
return "/_db/" + t->_databaseName + location;
return string("/_db/" + t->_databaseName + location);
}
else {
return "/_db/" + t->_databaseName + "/" + location;
return string("/_db/" + t->_databaseName + "/" + location);
}
}

View File

@ -368,8 +368,19 @@ int main (int argc, char* argv[]) {
size_t failures = operationsCounter.failures();
cout << endl;
cout << "Total number of operations: " << Operations << ", batch size: " << BatchSize << ", concurrency level (threads): " << Concurrency << endl;
cout << "Test case: " << TestCase << ", complexity: " << Complexity << ", database: '" << BaseClient.databaseName() << "', collection: '" << Collection << "'" << endl;
cout << "Total number of operations: " << Operations <<
", keep alive: " << (KeepAlive ? "yes" : "no") <<
", async: " << (Async ? "yes" : "no") <<
", batch size: " << BatchSize <<
", concurrency level (threads): " << Concurrency <<
endl;
cout << "Test case: " << TestCase <<
", complexity: " << Complexity <<
", database: '" << BaseClient.databaseName() <<
"', collection: '" << Collection << "'" <<
endl;
cout << "Total request/response duration (sum of all threads): " << fixed << requestTime << " s" << endl;
cout << "Request/response duration (per thread): " << fixed << (requestTime / (double) Concurrency) << " s" << endl;
cout << "Time needed per operation: " << fixed << (time / Operations) << " s" << endl;

View File

@ -1084,7 +1084,8 @@ static bool DeleteCollection (SimpleHttpClient* client, const string& name) {
bool failed = true;
if (result != 0) {
if (result->getHttpReturnCode() == 200 || result->getHttpReturnCode() == 404) {
int statusCode = result->getHttpReturnCode();
if (statusCode == 200 || statusCode == 201 || statusCode == 202 || statusCode == 404) {
failed = false;
}
@ -1114,7 +1115,8 @@ static bool CreateCollection (SimpleHttpClient* client,
bool failed = true;
if (result != 0) {
if (result->getHttpReturnCode() == 200 || result->getHttpReturnCode() == 201) {
int statusCode = result->getHttpReturnCode();
if (statusCode == 200 || statusCode == 201 || statusCode == 202) {
failed = false;
}

View File

@ -0,0 +1,6 @@
keep-alive = true
progress = true
[server]
disable-authentication = true

View File

@ -1,6 +1,6 @@
[database]
# directory= /var/arangodb
# maximal-journal-size = 1200000
# maximal-journal-size = 33554432
# remove-on-drop = true
[server]

View File

@ -704,6 +704,7 @@ bool ProgramOptions::extractValues (ProgramOptionsDescription const& description
}
if (TRI_errno() != TRI_ERROR_NO_ERROR) {
_errorMessage = "error parsing option '" + name + "'";
return false;
}
}

View File

@ -98,12 +98,19 @@ bool ClientConnection::checkSocket () {
assert(_socket.fileHandle > 0);
getsockopt(_socket.fileHandle, SOL_SOCKET, SO_ERROR, (char*)(&so_error), &len);
int res = getsockopt(_socket.fileHandle, SOL_SOCKET, SO_ERROR, (char*)(&so_error), &len);
if (res != TRI_ERROR_NO_ERROR) {
TRI_set_errno(errno);
return false;
}
if (so_error == 0) {
return true;
}
TRI_set_errno(so_error);
return false;
}
@ -223,9 +230,9 @@ bool ClientConnection::writeClientConnection (void* buffer, size_t length, size_
return false;
}
*bytesWritten = status;
*bytesWritten = (size_t) status;
return (status >= 0);
return true;
}
////////////////////////////////////////////////////////////////////////////////
@ -243,6 +250,7 @@ bool ClientConnection::readClientConnection (StringBuffer& stringBuffer) {
// reserve some memory for reading
if (stringBuffer.reserve(READBUFFER_SIZE) == TRI_ERROR_OUT_OF_MEMORY) {
// out of memory
TRI_set_errno(TRI_ERROR_OUT_OF_MEMORY);
return false;
}

View File

@ -403,6 +403,10 @@ namespace triagens {
else {
_result->setResultType(SimpleHttpResult::COMPLETE);
_state = FINISHED;
if (! _keepAlive) {
_connection->disconnect();
}
}
break;
}
@ -420,6 +424,9 @@ namespace triagens {
// HEAD requests may be responded to without a body...
_result->setResultType(SimpleHttpResult::COMPLETE);
_state = FINISHED;
if (! _keepAlive) {
_connection->disconnect();
}
return true;
}
@ -436,6 +443,9 @@ namespace triagens {
_readBuffer.erase_front(_result->getContentLength());
_result->setResultType(SimpleHttpResult::COMPLETE);
_state = FINISHED;
if (! _keepAlive) {
_connection->disconnect();
}
}
return true;
@ -467,6 +477,9 @@ namespace triagens {
_result->setResultType(SimpleHttpResult::COMPLETE);
_state = FINISHED;
if (! _keepAlive) {
_connection->disconnect();
}
return true;
}
@ -496,6 +509,9 @@ namespace triagens {
// HEAD requests may be responded to without a body...
_result->setResultType(SimpleHttpResult::COMPLETE);
_state = FINISHED;
if (! _keepAlive) {
_connection->disconnect();
}
return true;
}