diff --git a/3rdParty/velocypack/include/velocypack/Buffer.h b/3rdParty/velocypack/include/velocypack/Buffer.h index 14ed4081c3..abb956a3d5 100644 --- a/3rdParty/velocypack/include/velocypack/Buffer.h +++ b/3rdParty/velocypack/include/velocypack/Buffer.h @@ -142,6 +142,13 @@ class Buffer { initWithNone(); } + void resetTo(ValueLength position) { + if (position >= _alloc) { + throw Exception(Exception::IndexOutOfBounds); + } + _pos = position; + } + void clear() { reset(); if (_buffer != _local) { diff --git a/CHANGELOG b/CHANGELOG index abef0f40ca..647b54cd9c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ devel ----- +* added --replication-factor, --number-of-shards and --wait-for-sync to arangobench + * turn on UTF-8 string validation for VelocyPack values received via VST connections * fixed issue #2257 diff --git a/Documentation/Books/Manual/Troubleshooting/Arangobench.mdpp b/Documentation/Books/Manual/Troubleshooting/Arangobench.mdpp index 4495d3f24b..e6bdbb75eb 100644 --- a/Documentation/Books/Manual/Troubleshooting/Arangobench.mdpp +++ b/Documentation/Books/Manual/Troubleshooting/Arangobench.mdpp @@ -21,6 +21,14 @@ Startup options - *--collection*: Name of collection to use in test (only relevant for tests that invoke collections). +- *--replication-factor*: In case of a cluster, the replication factor of the + created collections. + +- *--number-of-shards*: In case of a cluster, the number of shards of the + created collections. + +- *--wait-for-sync*: The value of *waitForSync* for created collections. + - *--complexity*: Complexity value for test case (default: 1). Meaning depends on test case. diff --git a/arangod/VocBase/LogicalCollection.cpp b/arangod/VocBase/LogicalCollection.cpp index b5a36d651a..5612508fbf 100644 --- a/arangod/VocBase/LogicalCollection.cpp +++ b/arangod/VocBase/LogicalCollection.cpp @@ -3593,9 +3593,9 @@ void LogicalCollection::mergeObjectsForUpdate( std::unordered_map newValues; { - VPackObjectIterator it(newValue, false); + VPackObjectIterator it(newValue, true); while (it.valid()) { - std::string key = it.key().copyString(); + StringRef key(it.key()); if (!key.empty() && key[0] == '_' && (key == StaticStrings::KeyString || key == StaticStrings::IdString || key == StaticStrings::RevString || @@ -3609,7 +3609,7 @@ void LogicalCollection::mergeObjectsForUpdate( } // else do nothing } else { // regular attribute - newValues.emplace(std::move(key), it.value()); + newValues.emplace(std::string(key.data(), key.size()), it.value()); } it.next(); @@ -3647,7 +3647,7 @@ void LogicalCollection::mergeObjectsForUpdate( // add other attributes after the system attributes { - VPackObjectIterator it(oldValue, false); + VPackObjectIterator it(oldValue, true); while (it.valid()) { std::string key = it.key().copyString(); // exclude system attributes in old value now @@ -3690,15 +3690,15 @@ void LogicalCollection::mergeObjectsForUpdate( } // add remaining values that were only in new object - for (auto& it : newValues) { - auto& s = it.second; + for (auto const& it : newValues) { + VPackSlice const& s = it.second; if (s.isNone()) { continue; } if (!keepNull && s.isNull()) { continue; } - b.add(std::move(it.first), s); + b.add(it.first, s); } b.close(); diff --git a/arangosh/Benchmark/BenchFeature.cpp b/arangosh/Benchmark/BenchFeature.cpp index 43ef2af57c..c7b270b4a5 100644 --- a/arangosh/Benchmark/BenchFeature.cpp +++ b/arangosh/Benchmark/BenchFeature.cpp @@ -22,9 +22,9 @@ #include "BenchFeature.h" -#include -#include #include +#include +#include #include "ApplicationFeatures/ApplicationServer.h" #include "Basics/StringUtils.h" @@ -54,7 +54,7 @@ BenchFeature* ARANGOBENCH; #include "Benchmark/test-cases.h" BenchFeature::BenchFeature(application_features::ApplicationServer* server, - int* result) + int* result) : ApplicationFeature(server, "Bench"), _async(false), _concurreny(1), @@ -70,6 +70,9 @@ BenchFeature::BenchFeature(application_features::ApplicationServer* server, _quiet(false), _runs(1), _junitReportFile(""), + _replicationFactor(1), + _numberOfShards(1), + _waitForSync(false), _result(result) { requiresElevatedPrivileges(false); setOptional(false); @@ -99,6 +102,18 @@ void BenchFeature::collectOptions(std::shared_ptr options) { options->addOption("--collection", "collection name to use in tests", new StringParameter(&_collection)); + options->addOption("--replication-factor", + "replication factor of created collections", + new UInt64Parameter(&_replicationFactor)); + + options->addOption("--number-of-shards", + "number of shards of created collections", + new UInt64Parameter(&_numberOfShards)); + + options->addOption("--wait-for-sync", + "use waitForSync for created collections", + new BooleanParameter(&_waitForSync)); + std::unordered_set cases = {"version", "document", "collection", @@ -132,13 +147,13 @@ void BenchFeature::collectOptions(std::shared_ptr options) { "use a startup delay (necessary only when run in series)", new BooleanParameter(&_delay)); - options->addOption("--junit-report-file", "filename to write junit style report to", + options->addOption("--junit-report-file", + "filename to write junit style report to", new StringParameter(&_junitReportFile)); - - options->addOption("--runs", - "run test n times (and calculate statistics based on median)", - new UInt64Parameter(&_runs)); + options->addOption( + "--runs", "run test n times (and calculate statistics based on median)", + new UInt64Parameter(&_runs)); options->addOption("--progress", "show progress", new BooleanParameter(&_progress)); @@ -164,7 +179,9 @@ void BenchFeature::updateStartCounter() { ++_started; } int BenchFeature::getStartCounter() { return _started; } void BenchFeature::start() { - ClientFeature* client = application_features::ApplicationServer::getFeature("Client"); + ClientFeature* client = + application_features::ApplicationServer::getFeature( + "Client"); client->setRetries(3); client->setWarn(true); @@ -181,8 +198,6 @@ void BenchFeature::start() { FATAL_ERROR_EXIT(); } - - double const stepSize = (double)_operations / (double)_concurreny; int64_t realStep = (int64_t)stepSize; @@ -202,18 +217,18 @@ void BenchFeature::start() { bool ok = true; std::vector results; - for (uint64_t j=0;j<_runs;j++) { + for (uint64_t j = 0; j < _runs; j++) { status("starting threads..."); - BenchmarkCounter operationsCounter(0, - (unsigned long)_operations); + BenchmarkCounter operationsCounter( + 0, (unsigned long)_operations); ConditionVariable startCondition; // start client threads _started = 0; for (uint64_t i = 0; i < _concurreny; ++i) { BenchmarkThread* thread = new BenchmarkThread( benchmark.get(), &startCondition, &BenchFeature::updateStartCounter, - static_cast(i), (unsigned long)_batchSize, &operationsCounter, client, _keepAlive, - _async, _verbose); + static_cast(i), (unsigned long)_batchSize, &operationsCounter, + client, _keepAlive, _async, _verbose); thread->setOffset((size_t)(i * realStep)); thread->start(); threads.push_back(thread); @@ -272,11 +287,9 @@ void BenchFeature::start() { } results.push_back({ - time, - operationsCounter.failures(), - operationsCounter.incompleteFailures(), - requestTime, - }); + time, operationsCounter.failures(), + operationsCounter.incompleteFailures(), requestTime, + }); for (size_t i = 0; i < static_cast(_concurreny); ++i) { delete threads[i]; } @@ -297,7 +310,8 @@ void BenchFeature::start() { *_result = ret; } -bool BenchFeature::report(ClientFeature* client, std::vector results) { +bool BenchFeature::report(ClientFeature* client, + std::vector results) { std::cout << std::endl; std::cout << "Total number of operations: " << _operations @@ -305,17 +319,19 @@ bool BenchFeature::report(ClientFeature* client, std::vector res << ", keep alive: " << (_keepAlive ? "yes" : "no") << ", async: " << (_async ? "yes" : "no") << ", batch size: " << _batchSize + << ", replication factor: " << _replicationFactor + << ", number of shards: " << _numberOfShards + << ", wait for sync: " << (_waitForSync ? "true" : "false") << ", concurrency level (threads): " << _concurreny << std::endl; std::cout << "Test case: " << _testCase << ", complexity: " << _complexity << ", database: '" << client->databaseName() << "', collection: '" << _collection << "'" << std::endl; - std::sort(results.begin(), results.end(), [](BenchRunResult a, BenchRunResult b) { - return a.time < b.time; - }); + std::sort(results.begin(), results.end(), + [](BenchRunResult a, BenchRunResult b) { return a.time < b.time; }); - BenchRunResult output {0, 0, 0, 0}; + BenchRunResult output{0, 0, 0, 0}; if (_runs > 1) { size_t size = results.size(); std::cout << std::endl; @@ -329,13 +345,13 @@ bool BenchFeature::report(ClientFeature* client, std::vector res std::cout << "Printing median result" << std::endl; std::cout << "=======================" << std::endl; - size_t mid = (size_t) size / 2; + size_t mid = (size_t)size / 2; if (size % 2 == 0) { - output.update((results[mid - 1].time + results[mid].time) / 2, + output.update( + (results[mid - 1].time + results[mid].time) / 2, (results[mid - 1].failures + results[mid].failures) / 2, (results[mid - 1].incomplete + results[mid].incomplete) / 2, - (results[mid - 1].requestTime + results[mid].requestTime) / 2 - ); + (results[mid - 1].requestTime + results[mid].requestTime) / 2); } else { output = results[mid]; } @@ -351,9 +367,10 @@ bool BenchFeature::report(ClientFeature* client, std::vector res } bool BenchFeature::writeJunitReport(BenchRunResult const& result) { - std::ofstream outfile (_junitReportFile,std::ofstream::binary); + std::ofstream outfile(_junitReportFile, std::ofstream::binary); if (!outfile.is_open()) { - std::cerr << "Could not open JUnit Report File: " << _junitReportFile << std::endl; + std::cerr << "Could not open JUnit Report File: " << _junitReportFile + << std::endl; return false; } @@ -362,29 +379,31 @@ bool BenchFeature::writeJunitReport(BenchRunResult const& result) { std::time_t t = std::time(nullptr); std::tm tm = *std::localtime(&t); - + char date[255]; memset(date, 0, sizeof(date)); - strftime(date, sizeof(date)-1, "%FT%T%z", &tm); + strftime(date, sizeof(date) - 1, "%FT%T%z", &tm); char host[255]; memset(host, 0, sizeof(host)); - gethostname(host, sizeof(host)-1); + gethostname(host, sizeof(host) - 1); std::string hostname(host); bool ok = false; try { outfile << "" << '\n' - << "\n" - << "\n" - << "\n" - << "\n"; + << "\n" + << "\n" + << "\n" + << "\n"; ok = true; - } catch(...) { - std::cerr << "Got an exception writing to junit report file " << _junitReportFile; + } catch (...) { + std::cerr << "Got an exception writing to junit report file " + << _junitReportFile; ok = false; } outfile.close(); @@ -413,7 +432,8 @@ void BenchFeature::printResult(BenchRunResult const& result) { << std::endl; if (result.failures > 0) { - LOG(WARN) << "WARNING: " << result.failures << " arangobench request(s) failed!"; + LOG(WARN) << "WARNING: " << result.failures + << " arangobench request(s) failed!"; } if (result.incomplete > 0) { LOG(WARN) << "WARNING: " << result.incomplete @@ -421,6 +441,4 @@ void BenchFeature::printResult(BenchRunResult const& result) { } } -void BenchFeature::unprepare() { - ARANGOBENCH = nullptr; -} +void BenchFeature::unprepare() { ARANGOBENCH = nullptr; } diff --git a/arangosh/Benchmark/BenchFeature.h b/arangosh/Benchmark/BenchFeature.h index fef2404bb3..fa78e7d183 100644 --- a/arangosh/Benchmark/BenchFeature.h +++ b/arangosh/Benchmark/BenchFeature.h @@ -54,19 +54,22 @@ class BenchFeature final : public application_features::ApplicationFeature { public: bool async() const { return _async; } - uint64_t const& concurrency() const { return _concurreny; } - uint64_t const& operations() const { return _operations; } - uint64_t const& batchSize() const { return _batchSize; } + uint64_t concurrency() const { return _concurreny; } + uint64_t operations() const { return _operations; } + uint64_t batchSize() const { return _batchSize; } bool keepAlive() const { return _keepAlive; } std::string const& collection() const { return _collection; } std::string const& testCase() const { return _testCase; } - uint64_t const& complexity() const { return _complexity; } + uint64_t complexity() const { return _complexity; } bool delay() const { return _delay; } bool progress() const { return _progress; } bool verbose() const { return _verbose; } bool quit() const { return _quiet; } - uint64_t const& runs() const { return _runs; } + uint64_t runs() const { return _runs; } std::string const& junitReportFile() const { return _junitReportFile; } + uint64_t replicationFactor() const { return _replicationFactor; } + uint64_t numberOfShards() const { return _numberOfShards; } + bool waitForSync() const { return _waitForSync; } private: void status(std::string const& value); @@ -89,6 +92,9 @@ class BenchFeature final : public application_features::ApplicationFeature { bool _quiet; uint64_t _runs; std::string _junitReportFile; + uint64_t _replicationFactor; + uint64_t _numberOfShards; + bool _waitForSync; private: int* _result; diff --git a/arangosh/Benchmark/test-cases.h b/arangosh/Benchmark/test-cases.h index 01d249e2a4..517e5acebe 100644 --- a/arangosh/Benchmark/test-cases.h +++ b/arangosh/Benchmark/test-cases.h @@ -49,9 +49,8 @@ struct VersionTest : public BenchmarkOperation { return _url; } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { return rest::RequestType::GET; } @@ -85,18 +84,19 @@ struct DocumentCrudAppendTest : public BenchmarkOperation { size_t const mod = globalCounter % 4; if (mod == 0) { - return std::string("/_api/document?collection=" + ARANGOBENCH->collection()); + return std::string("/_api/document?collection=" + + ARANGOBENCH->collection()); } else { size_t keyId = (size_t)(globalCounter / 4); std::string const key = "testkey" + StringUtils::itoa(keyId); - return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + key); + return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + + key); } } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { size_t const mod = globalCounter % 4; if (mod == 0) { @@ -176,18 +176,19 @@ struct DocumentCrudWriteReadTest : public BenchmarkOperation { size_t const mod = globalCounter % 2; if (mod == 0) { - return std::string("/_api/document?collection=" + ARANGOBENCH->collection()); + return std::string("/_api/document?collection=" + + ARANGOBENCH->collection()); } else { size_t keyId = (size_t)(globalCounter / 2); std::string const key = "testkey" + StringUtils::itoa(keyId); - return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + key); + return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + + key); } } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { size_t const mod = globalCounter % 2; if (mod == 0) { @@ -253,18 +254,19 @@ struct ShapesTest : public BenchmarkOperation { size_t const mod = globalCounter % 3; if (mod == 0) { - return std::string("/_api/document?collection=" + ARANGOBENCH->collection()); + return std::string("/_api/document?collection=" + + ARANGOBENCH->collection()); } else { size_t keyId = (size_t)(globalCounter / 3); std::string const key = "testkey" + StringUtils::itoa(keyId); - return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + key); + return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + + key); } } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { size_t const mod = globalCounter % 3; if (mod == 0) { @@ -339,18 +341,19 @@ struct ShapesAppendTest : public BenchmarkOperation { size_t const mod = globalCounter % 2; if (mod == 0) { - return std::string("/_api/document?collection=" + ARANGOBENCH->collection()); + return std::string("/_api/document?collection=" + + ARANGOBENCH->collection()); } else { size_t keyId = (size_t)(globalCounter / 2); std::string const key = "testkey" + StringUtils::itoa(keyId); - return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + key); + return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + + key); } } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { size_t const mod = globalCounter % 2; if (mod == 0) { @@ -424,7 +427,8 @@ struct RandomShapesTest : public BenchmarkOperation { size_t const mod = globalCounter % 3; if (mod == 0) { - return std::string("/_api/document?collection=") + ARANGOBENCH->collection(); + return std::string("/_api/document?collection=") + + ARANGOBENCH->collection(); } else { size_t keyId = (size_t)(globalCounter / 3); std::string const key = "testkey" + StringUtils::itoa(keyId); @@ -434,9 +438,8 @@ struct RandomShapesTest : public BenchmarkOperation { } } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { size_t const mod = globalCounter % 3; if (mod == 0) { @@ -516,18 +519,19 @@ struct DocumentCrudTest : public BenchmarkOperation { size_t const mod = globalCounter % 5; if (mod == 0) { - return std::string("/_api/document?collection=" + ARANGOBENCH->collection()); + return std::string("/_api/document?collection=" + + ARANGOBENCH->collection()); } else { size_t keyId = (size_t)(globalCounter / 5); std::string const key = "testkey" + StringUtils::itoa(keyId); - return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + key); + return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + + key); } } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { size_t const mod = globalCounter % 5; if (mod == 0) { @@ -609,18 +613,19 @@ struct EdgeCrudTest : public BenchmarkOperation { size_t const mod = globalCounter % 4; if (mod == 0) { - return std::string("/_api/document?collection=" + ARANGOBENCH->collection()); + return std::string("/_api/document?collection=" + + ARANGOBENCH->collection()); } else { size_t keyId = (size_t)(globalCounter / 4); std::string const key = "testkey" + StringUtils::itoa(keyId); - return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + key); + return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + + key); } } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { size_t const mod = globalCounter % 4; if (mod == 0) { @@ -721,18 +726,19 @@ struct SkiplistTest : public BenchmarkOperation { size_t const mod = globalCounter % 4; if (mod == 0) { - return std::string("/_api/document?collection=" + ARANGOBENCH->collection()); + return std::string("/_api/document?collection=" + + ARANGOBENCH->collection()); } else { size_t keyId = (size_t)(globalCounter / 4); std::string const key = "testkey" + StringUtils::itoa(keyId); - return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + key); + return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + + key); } } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { size_t const mod = globalCounter % 4; if (mod == 0) { @@ -794,7 +800,8 @@ struct HashTest : public BenchmarkOperation { bool setUp(SimpleHttpClient* client) override { return DeleteCollection(client, ARANGOBENCH->collection()) && CreateCollection(client, ARANGOBENCH->collection(), 2) && - CreateIndex(client, ARANGOBENCH->collection(), "hash", "[\"value\"]"); + CreateIndex(client, ARANGOBENCH->collection(), "hash", + "[\"value\"]"); } void tearDown() override {} @@ -804,18 +811,19 @@ struct HashTest : public BenchmarkOperation { size_t const mod = globalCounter % 4; if (mod == 0) { - return std::string("/_api/document?collection=" + ARANGOBENCH->collection()); + return std::string("/_api/document?collection=" + + ARANGOBENCH->collection()); } else { size_t keyId = (size_t)(globalCounter / 4); std::string const key = "testkey" + StringUtils::itoa(keyId); - return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + key); + return std::string("/_api/document/" + ARANGOBENCH->collection() + "/" + + key); } } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { size_t const mod = globalCounter % 4; if (mod == 0) { @@ -871,8 +879,8 @@ struct HashTest : public BenchmarkOperation { struct DocumentImportTest : public BenchmarkOperation { DocumentImportTest() : BenchmarkOperation(), _url(), _buffer(0) { - _url = - "/_api/import?collection=" + ARANGOBENCH->collection() + "&type=documents"; + _url = "/_api/import?collection=" + ARANGOBENCH->collection() + + "&type=documents"; uint64_t const n = ARANGOBENCH->complexity(); @@ -902,9 +910,8 @@ struct DocumentImportTest : public BenchmarkOperation { return _url; } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { return rest::RequestType::POST; } @@ -962,9 +969,8 @@ struct DocumentCreationTest : public BenchmarkOperation { return _url; } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { return rest::RequestType::POST; } @@ -999,9 +1005,8 @@ struct CollectionCreationTest : public BenchmarkOperation { return _url; } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { return rest::RequestType::POST; } @@ -1059,9 +1064,8 @@ struct TransactionAqlTest : public BenchmarkOperation { return std::string("/_api/cursor"); } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { return rest::RequestType::POST; } @@ -1148,9 +1152,8 @@ struct TransactionCountTest : public BenchmarkOperation { return std::string("/_api/transaction"); } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { return rest::RequestType::POST; } @@ -1203,9 +1206,8 @@ struct TransactionDeadlockTest : public BenchmarkOperation { return std::string("/_api/transaction"); } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { return rest::RequestType::POST; } @@ -1272,9 +1274,8 @@ struct TransactionMultiTest : public BenchmarkOperation { return std::string("/_api/transaction"); } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { return rest::RequestType::POST; } @@ -1354,9 +1355,8 @@ struct TransactionMultiCollectionTest : public BenchmarkOperation { return std::string("/_api/transaction"); } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { return rest::RequestType::POST; } @@ -1427,9 +1427,8 @@ struct AqlInsertTest : public BenchmarkOperation { return std::string("/_api/cursor"); } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { return rest::RequestType::POST; } @@ -1481,9 +1480,8 @@ struct AqlV8Test : public BenchmarkOperation { return std::string("/_api/cursor"); } - rest::RequestType type(int const threadNumber, - size_t const threadCounter, - size_t const globalCounter) override { + rest::RequestType type(int const threadNumber, size_t const threadCounter, + size_t const globalCounter) override { return rest::RequestType::POST; } @@ -1555,11 +1553,16 @@ static bool CreateCollection(SimpleHttpClient* client, std::string const& name, std::unordered_map headerFields; SimpleHttpResult* result = nullptr; - std::string payload = - "{\"name\":\"" + name + "\",\"type\":" + StringUtils::itoa(type) + "}"; - result = - client->request(rest::RequestType::POST, "/_api/collection", - payload.c_str(), payload.size(), headerFields); + std::string payload = "{\"name\":\"" + name + "\",\"type\":" + + StringUtils::itoa(type) + ",\"replicationFactor\":" + + StringUtils::itoa(ARANGOBENCH->replicationFactor()) + + ",\"numberOfShards\":" + + StringUtils::itoa(ARANGOBENCH->numberOfShards()) + + ",\"waitForSync\":" + + (ARANGOBENCH->waitForSync() ? "true" : "false") + "}"; + + result = client->request(rest::RequestType::POST, "/_api/collection", + payload.c_str(), payload.size(), headerFields); bool failed = true; @@ -1586,9 +1589,9 @@ static bool CreateIndex(SimpleHttpClient* client, std::string const& name, std::string payload = "{\"type\":\"" + type + "\",\"fields\":" + fields + ",\"unique\":false}"; - result = client->request(rest::RequestType::POST, - "/_api/index?collection=" + name, payload.c_str(), - payload.size(), headerFields); + result = + client->request(rest::RequestType::POST, "/_api/index?collection=" + name, + payload.c_str(), payload.size(), headerFields); bool failed = true;