1
0
Fork 0

fixed queue naming

This commit is contained in:
Jan Steemann 2013-09-20 13:17:32 +02:00
parent 5a5fcca8ee
commit ed163164c4
21 changed files with 96 additions and 203 deletions

View File

@ -76,6 +76,11 @@ RestActionHandler::RestActionHandler (HttpRequest* request,
if (_action != 0) {
_queue = data->_queue;
}
if (_queue.empty()) {
// must have a queue
_queue = "STANDARD";
}
}
////////////////////////////////////////////////////////////////////////////////
@ -103,7 +108,7 @@ bool RestActionHandler::isDirect () {
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
string const& RestActionHandler::queue () const {
std::string const& RestActionHandler::queue () const {
return _queue;
}

View File

@ -79,24 +79,6 @@ RestBatchHandler::~RestBatchHandler () {
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool RestBatchHandler::isDirect () {
return false;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
string const& RestBatchHandler::queue () const {
static string const client = "STANDARD";
return client;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
Handler::status_e RestBatchHandler::execute() {
// extract the request type
const HttpRequest::HttpRequestType type = _request->requestType();

View File

@ -133,18 +133,6 @@ namespace triagens {
public:
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool isDirect ();
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
string const& queue () const;
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////

View File

@ -77,24 +77,6 @@ RestDocumentHandler::RestDocumentHandler (HttpRequest* request)
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool RestDocumentHandler::isDirect () {
return false;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
string const& RestDocumentHandler::queue () const {
static string const client = "STANDARD";
return client;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
HttpHandler::status_e RestDocumentHandler::execute () {
// extract the sub-request type
HttpRequest::HttpRequestType type = _request->requestType();

View File

@ -84,18 +84,6 @@ namespace triagens {
public:
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool isDirect ();
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
string const& queue () const;
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////

View File

@ -75,24 +75,6 @@ RestImportHandler::RestImportHandler (HttpRequest* request)
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool RestImportHandler::isDirect () {
return false;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
string const& RestImportHandler::queue () const {
static string const client = "STANDARD";
return client;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
HttpHandler::status_e RestImportHandler::execute () {
// extract the sub-request type
HttpRequest::HttpRequestType type = _request->requestType();

View File

@ -103,18 +103,6 @@ namespace triagens {
public:
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool isDirect ();
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
string const& queue () const;
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////

View File

@ -97,24 +97,6 @@ RestReplicationHandler::~RestReplicationHandler () {
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool RestReplicationHandler::isDirect () {
return false;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
string const& RestReplicationHandler::queue () const {
static string const client = "STANDARD";
return client;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
Handler::status_e RestReplicationHandler::execute() {
// extract the request type
const HttpRequest::HttpRequestType type = _request->requestType();

View File

@ -102,18 +102,6 @@ namespace triagens {
public:
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool isDirect ();
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
string const& queue () const;
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////

View File

@ -79,24 +79,6 @@ RestUploadHandler::~RestUploadHandler () {
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool RestUploadHandler::isDirect () {
return false;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
string const& RestUploadHandler::queue () const {
static string const client = "STANDARD";
return client;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
Handler::status_e RestUploadHandler::execute() {
// extract the request type
const HttpRequest::HttpRequestType type = _request->requestType();

View File

@ -82,18 +82,6 @@ namespace triagens {
public:
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool isDirect ();
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
string const& queue () const;
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////

View File

@ -61,37 +61,43 @@ using namespace triagens::arango;
/// @brief batch path
////////////////////////////////////////////////////////////////////////////////
string RestVocbaseBaseHandler::BATCH_PATH = "/_api/batch";
const string RestVocbaseBaseHandler::BATCH_PATH = "/_api/batch";
////////////////////////////////////////////////////////////////////////////////
/// @brief document path
////////////////////////////////////////////////////////////////////////////////
string RestVocbaseBaseHandler::DOCUMENT_PATH = "/_api/document";
const string RestVocbaseBaseHandler::DOCUMENT_PATH = "/_api/document";
////////////////////////////////////////////////////////////////////////////////
/// @brief documents import path
////////////////////////////////////////////////////////////////////////////////
string RestVocbaseBaseHandler::DOCUMENT_IMPORT_PATH = "/_api/import";
const string RestVocbaseBaseHandler::DOCUMENT_IMPORT_PATH = "/_api/import";
////////////////////////////////////////////////////////////////////////////////
/// @brief document path
////////////////////////////////////////////////////////////////////////////////
string RestVocbaseBaseHandler::EDGE_PATH = "/_api/edge";
const string RestVocbaseBaseHandler::EDGE_PATH = "/_api/edge";
////////////////////////////////////////////////////////////////////////////////
/// @brief replication path
////////////////////////////////////////////////////////////////////////////////
string RestVocbaseBaseHandler::REPLICATION_PATH = "/_api/replication";
const string RestVocbaseBaseHandler::REPLICATION_PATH = "/_api/replication";
////////////////////////////////////////////////////////////////////////////////
/// @brief upload path
////////////////////////////////////////////////////////////////////////////////
string RestVocbaseBaseHandler::UPLOAD_PATH = "/_api/upload";
const string RestVocbaseBaseHandler::UPLOAD_PATH = "/_api/upload";
////////////////////////////////////////////////////////////////////////////////
/// @brief name of the queue
////////////////////////////////////////////////////////////////////////////////
const string RestVocbaseBaseHandler::QUEUE_NAME = "STANDARD";
////////////////////////////////////////////////////////////////////////////////
/// @}
@ -563,13 +569,9 @@ TRI_json_t* RestVocbaseBaseHandler::parseJsonBody () {
/// @addtogroup ArangoDB
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool RestVocbaseBaseHandler::isDirect () {
return false;
std::string const& RestVocbaseBaseHandler::queue () const {
return QUEUE_NAME;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -85,37 +85,43 @@ namespace triagens {
/// @brief batch path
////////////////////////////////////////////////////////////////////////////////
static string BATCH_PATH;
static const std::string BATCH_PATH;
////////////////////////////////////////////////////////////////////////////////
/// @brief document path
////////////////////////////////////////////////////////////////////////////////
static string DOCUMENT_PATH;
static const std::string DOCUMENT_PATH;
////////////////////////////////////////////////////////////////////////////////
/// @brief document import path
////////////////////////////////////////////////////////////////////////////////
static string DOCUMENT_IMPORT_PATH;
static const std::string DOCUMENT_IMPORT_PATH;
////////////////////////////////////////////////////////////////////////////////
/// @brief edge path
////////////////////////////////////////////////////////////////////////////////
static string EDGE_PATH;
static const std::string EDGE_PATH;
////////////////////////////////////////////////////////////////////////////////
/// @brief replication path
////////////////////////////////////////////////////////////////////////////////
static string REPLICATION_PATH;
static const std::string REPLICATION_PATH;
////////////////////////////////////////////////////////////////////////////////
/// @brief upload path
////////////////////////////////////////////////////////////////////////////////
static string UPLOAD_PATH;
static const std::string UPLOAD_PATH;
////////////////////////////////////////////////////////////////////////////////
/// @brief name of the queue
////////////////////////////////////////////////////////////////////////////////
static const std::string QUEUE_NAME;
// -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors
@ -381,7 +387,16 @@ namespace triagens {
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool isDirect ();
bool isDirect () {
return false;
}
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
std::string const& queue () const;
};
}
}

View File

@ -82,7 +82,8 @@ namespace triagens {
const string& password,
double requestTimeout,
double connectTimeout,
bool keepAlive)
bool keepAlive,
bool async)
: Thread("arangob"),
_operation(operation),
_startCondition(condition),
@ -99,6 +100,7 @@ namespace triagens {
_requestTimeout(requestTimeout),
_connectTimeout(connectTimeout),
_keepAlive(keepAlive),
_async(async),
_client(0),
_connection(0),
_offset(0),
@ -106,6 +108,10 @@ namespace triagens {
_time(0.0) {
_errorHeader = StringUtils::tolower(HttpResponse::getBatchErrorHeader());
if (_async) {
_headers["x-arango-async"] = "true";
}
}
////////////////////////////////////////////////////////////////////////////////
@ -528,6 +534,12 @@ namespace triagens {
bool _keepAlive;
////////////////////////////////////////////////////////////////////////////////
/// @brief send async requests
////////////////////////////////////////////////////////////////////////////////
bool _async;
////////////////////////////////////////////////////////////////////////////////
/// @brief underlying client
////////////////////////////////////////////////////////////////////////////////

View File

@ -87,22 +87,10 @@ static volatile int Started = 0;
Mutex StartMutex;
////////////////////////////////////////////////////////////////////////////////
/// @brief use a startup delay
/// @brief send asychronous requests
////////////////////////////////////////////////////////////////////////////////
static bool Delay = false;
////////////////////////////////////////////////////////////////////////////////
/// @brief concurrency
////////////////////////////////////////////////////////////////////////////////
static int Concurrency = 1;
////////////////////////////////////////////////////////////////////////////////
/// @brief number of operations to perform
////////////////////////////////////////////////////////////////////////////////
static int Operations = 1000;
static bool Async = false;
////////////////////////////////////////////////////////////////////////////////
/// @brief number of operations in one batch
@ -110,12 +98,6 @@ static int Operations = 1000;
static int BatchSize = 0;
////////////////////////////////////////////////////////////////////////////////
/// @brief complexity parameter for tests
////////////////////////////////////////////////////////////////////////////////
static uint64_t Complexity = 1;
////////////////////////////////////////////////////////////////////////////////
/// @brief collection to use
////////////////////////////////////////////////////////////////////////////////
@ -123,10 +105,34 @@ static uint64_t Complexity = 1;
static string Collection = "ArangoBenchmark";
////////////////////////////////////////////////////////////////////////////////
/// @brief test case to use
/// @brief complexity parameter for tests
////////////////////////////////////////////////////////////////////////////////
static string TestCase = "version";
static uint64_t Complexity = 1;
////////////////////////////////////////////////////////////////////////////////
/// @brief concurrency
////////////////////////////////////////////////////////////////////////////////
static int Concurrency = 1;
////////////////////////////////////////////////////////////////////////////////
/// @brief use a startup delay
////////////////////////////////////////////////////////////////////////////////
static bool Delay = false;
////////////////////////////////////////////////////////////////////////////////
/// @brief use HTTP keep-alive
////////////////////////////////////////////////////////////////////////////////
static bool KeepAlive = true;
////////////////////////////////////////////////////////////////////////////////
/// @brief number of operations to perform
////////////////////////////////////////////////////////////////////////////////
static int Operations = 1000;
////////////////////////////////////////////////////////////////////////////////
/// @brief display progress
@ -135,10 +141,10 @@ static string TestCase = "version";
static bool Progress = false;
////////////////////////////////////////////////////////////////////////////////
/// @brief use HTTP keep-alive
/// @brief test case to use
////////////////////////////////////////////////////////////////////////////////
static bool KeepAlive = true;
static string TestCase = "version";
////////////////////////////////////////////////////////////////////////////////
/// @}
@ -196,6 +202,7 @@ static void ParseProgramOptions (int argc, char* argv[]) {
ProgramOptionsDescription description("STANDARD options");
description
("async", &Async, "send asychronous requests")
("concurrency", &Concurrency, "number of parallel connections")
("requests", &Operations, "total number of operations")
("batch-size", &BatchSize, "number of operations in one batch (0 disables batching")
@ -302,7 +309,8 @@ int main (int argc, char* argv[]) {
BaseClient.password(),
BaseClient.requestTimeout(),
BaseClient.connectTimeout(),
KeepAlive);
KeepAlive,
Async);
threads.push_back(thread);
thread->setOffset(i * realStep);

View File

@ -331,7 +331,7 @@ function CompactionSuite () {
assertEqual(n / 2, fig["dead"]["count"]);
assertTrue(0 < fig["dead"]["size"]);
assertTrue(0 < fig["dead"]["deletion"]);
assertEqual(0, fig["journals"]["count"]);
assertEqual(0 <= fig["journals"]["count"]);
assertTrue(0 < fig["datafiles"]["count"]);
// trigger GC

View File

@ -179,6 +179,7 @@ void ApplicationAdminServer::addBasicHandlers (HttpHandlerFactory* factory, stri
_versionDataDirect->_name = _name;
_versionDataDirect->_version = _version;
_versionDataDirect->_isDirect = true;
_versionDataDirect->_queue = "STANDARD";
}
factory->addHandler(prefix + "/version",

View File

@ -51,7 +51,8 @@ using namespace std;
/// @brief constructor
////////////////////////////////////////////////////////////////////////////////
RestVersionHandler::RestVersionHandler (HttpRequest* request, version_options_t const* data)
RestVersionHandler::RestVersionHandler (HttpRequest* request,
version_options_t const* data)
: RestBaseHandler(request),
_name(data->_name),
_version(data->_version),

View File

@ -106,7 +106,7 @@ void Job::attachObserver (JobObserver* observer) {
////////////////////////////////////////////////////////////////////////////////
string const& Job::queue () {
static string standard = "STANDARD";
static string const standard = "STANDARD";
return standard;
}

View File

@ -324,8 +324,7 @@ namespace triagens {
return false;
}
_dispatcher->addJob(job);
return true;
return _dispatcher->addJob(job);
}
// without a dispatcher, simply give up

View File

@ -79,7 +79,7 @@ Job::JobType Handler::type () {
////////////////////////////////////////////////////////////////////////////////
string const& Handler::queue () const {
static string standard = "STANDARD";
static string const standard = "STANDARD";
return standard;
}