mirror of https://gitee.com/bigwinds/arangodb
more tests for shapes
This commit is contained in:
parent
9da8d0ddfe
commit
35cf13a38c
|
@ -857,7 +857,9 @@ unittests-arangob:
|
|||
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 10000 --concurrency 2 --test version --async true || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 20000 --concurrency 1 --test version --async true || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100000 --concurrency 2 --test shapes --batch-size 16 || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100000 --concurrency 2 --test shapes --batch-size 16 --complexity 2 || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100000 --concurrency 2 --test shapes-append --batch-size 16 --complexity 4 || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 50000 --concurrency 3 --test random-shapes --batch-size 16 --complexity 2 || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 1000 --batch-size 16 --concurrency 2 --test version || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100 --batch-size 0 --concurrency 1 --test version || test "x$(FORCE)" == "x1"
|
||||
@builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100 --batch-size 10 --concurrency 2 --test document --complexity 1 || test "x$(FORCE)" == "x1"
|
||||
|
|
|
@ -1209,7 +1209,9 @@ int TRI_WriteElementDatafile (TRI_datafile_t* datafile,
|
|||
|
||||
if (type != TRI_DF_MARKER_HEADER &&
|
||||
type != TRI_DF_MARKER_FOOTER &&
|
||||
type != TRI_COL_MARKER_HEADER) {
|
||||
type != TRI_COL_MARKER_HEADER &&
|
||||
type != TRI_DF_MARKER_ATTRIBUTE &&
|
||||
type != TRI_DF_MARKER_SHAPE) {
|
||||
|
||||
#ifdef TRI_ENABLE_MAINTAINER_MODE
|
||||
// check _tick value of marker and set min/max tick values for datafile
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "Basics/StringUtils.h"
|
||||
#include "BasicsC/init.h"
|
||||
#include "BasicsC/logging.h"
|
||||
#include "BasicsC/random.h"
|
||||
#include "BasicsC/tri-strings.h"
|
||||
#include "BasicsC/string-buffer.h"
|
||||
#include "BasicsC/terminal-utils.h"
|
||||
|
|
|
@ -256,11 +256,10 @@ struct ShapesTest : public BenchmarkOperation {
|
|||
}
|
||||
TRI_AppendStringStringBuffer(buffer, ",\"value");
|
||||
TRI_AppendUInt64StringBuffer(buffer, (uint64_t) ((globalCounter + i) % mod));
|
||||
TRI_AppendStringStringBuffer(buffer, "\":\"");
|
||||
TRI_AppendStringStringBuffer(buffer, "some bogus string value to fill up the datafile...");
|
||||
TRI_AppendStringStringBuffer(buffer, "\":\"some bogus string value to fill up the datafile...\"");
|
||||
}
|
||||
|
||||
TRI_AppendStringStringBuffer(buffer, "\"}");
|
||||
TRI_AppendStringStringBuffer(buffer, "}");
|
||||
|
||||
*length = TRI_LengthStringBuffer(buffer);
|
||||
*mustFree = true;
|
||||
|
@ -278,6 +277,191 @@ struct ShapesTest : public BenchmarkOperation {
|
|||
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- shapes append test
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct ShapesAppendTest : public BenchmarkOperation {
|
||||
ShapesAppendTest ()
|
||||
: BenchmarkOperation () {
|
||||
}
|
||||
|
||||
~ShapesAppendTest () {
|
||||
}
|
||||
|
||||
bool setUp (SimpleHttpClient* client) {
|
||||
return DeleteCollection(client, Collection) &&
|
||||
CreateCollection(client, Collection, 2);
|
||||
}
|
||||
|
||||
void tearDown () {
|
||||
}
|
||||
|
||||
string url (const int threadNumber, const size_t threadCounter, const size_t globalCounter) {
|
||||
const size_t mod = globalCounter % 2;
|
||||
|
||||
if (mod == 0) {
|
||||
return string("/_api/document?collection=" + Collection);
|
||||
}
|
||||
else {
|
||||
size_t keyId = (size_t) (globalCounter / 2);
|
||||
const string key = "testkey" + StringUtils::itoa(keyId);
|
||||
|
||||
return string("/_api/document/" + Collection + "/" + key);
|
||||
}
|
||||
}
|
||||
|
||||
HttpRequest::HttpRequestType type (const int threadNumber, const size_t threadCounter, const size_t globalCounter) {
|
||||
const size_t mod = globalCounter % 2;
|
||||
|
||||
if (mod == 0) {
|
||||
return HttpRequest::HTTP_REQUEST_POST;
|
||||
}
|
||||
return HttpRequest::HTTP_REQUEST_GET;
|
||||
}
|
||||
|
||||
const char* payload (size_t* length, const int threadNumber, const size_t threadCounter, const size_t globalCounter, bool* mustFree) {
|
||||
const size_t mod = globalCounter % 2;
|
||||
|
||||
if (mod == 0) {
|
||||
const uint64_t n = Complexity;
|
||||
TRI_string_buffer_t* buffer;
|
||||
|
||||
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
||||
TRI_AppendStringStringBuffer(buffer, "{\"_key\":\"");
|
||||
|
||||
size_t keyId = (size_t) (globalCounter / 2);
|
||||
const string key = "testkey" + StringUtils::itoa(keyId);
|
||||
TRI_AppendString2StringBuffer(buffer, key.c_str(), key.size());
|
||||
TRI_AppendStringStringBuffer(buffer, "\"");
|
||||
|
||||
for (uint64_t i = 1; i <= n; ++i) {
|
||||
uint64_t mod = Operations / 10;
|
||||
if (mod < 100) {
|
||||
mod = 100;
|
||||
}
|
||||
TRI_AppendStringStringBuffer(buffer, ",\"value");
|
||||
TRI_AppendUInt64StringBuffer(buffer, (uint64_t) ((globalCounter + i) % mod));
|
||||
TRI_AppendStringStringBuffer(buffer, "\":\"some bogus string value to fill up the datafile...\"");
|
||||
}
|
||||
|
||||
TRI_AppendStringStringBuffer(buffer, "}");
|
||||
|
||||
*length = TRI_LengthStringBuffer(buffer);
|
||||
*mustFree = true;
|
||||
char* ptr = TRI_StealStringBuffer(buffer);
|
||||
TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, buffer);
|
||||
|
||||
return (const char*) ptr;
|
||||
}
|
||||
else {
|
||||
*length = 0;
|
||||
*mustFree = false;
|
||||
return (const char*) 0;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- random shapes test
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct RandomShapesTest : public BenchmarkOperation {
|
||||
RandomShapesTest ()
|
||||
: BenchmarkOperation () {
|
||||
_randomValue = TRI_UInt32Random();
|
||||
}
|
||||
|
||||
~RandomShapesTest () {
|
||||
}
|
||||
|
||||
bool setUp (SimpleHttpClient* client) {
|
||||
return DeleteCollection(client, Collection) &&
|
||||
CreateCollection(client, Collection, 2);
|
||||
}
|
||||
|
||||
void tearDown () {
|
||||
}
|
||||
|
||||
string url (const int threadNumber, const size_t threadCounter, const size_t globalCounter) {
|
||||
const size_t mod = globalCounter % 3;
|
||||
|
||||
if (mod == 0) {
|
||||
return string("/_api/document?collection=" + Collection);
|
||||
}
|
||||
else {
|
||||
size_t keyId = (size_t) (globalCounter / 3);
|
||||
const string key = "testkey" + StringUtils::itoa(keyId);
|
||||
|
||||
return string("/_api/document/" + Collection + "/" + key);
|
||||
}
|
||||
}
|
||||
|
||||
HttpRequest::HttpRequestType type (const int threadNumber, const size_t threadCounter, const size_t globalCounter) {
|
||||
const size_t mod = globalCounter % 3;
|
||||
|
||||
if (mod == 0) {
|
||||
return HttpRequest::HTTP_REQUEST_POST;
|
||||
}
|
||||
else if (mod == 1) {
|
||||
return HttpRequest::HTTP_REQUEST_GET;
|
||||
}
|
||||
else {
|
||||
return HttpRequest::HTTP_REQUEST_DELETE;
|
||||
}
|
||||
}
|
||||
|
||||
const char* payload (size_t* length, const int threadNumber, const size_t threadCounter, const size_t globalCounter, bool* mustFree) {
|
||||
const size_t mod = globalCounter % 3;
|
||||
|
||||
if (mod == 0) {
|
||||
const uint64_t n = Complexity;
|
||||
TRI_string_buffer_t* buffer;
|
||||
|
||||
buffer = TRI_CreateSizedStringBuffer(TRI_UNKNOWN_MEM_ZONE, 256);
|
||||
TRI_AppendStringStringBuffer(buffer, "{\"_key\":\"");
|
||||
|
||||
size_t keyId = (size_t) (globalCounter / 3);
|
||||
const string key = "testkey" + StringUtils::itoa(keyId);
|
||||
TRI_AppendString2StringBuffer(buffer, key.c_str(), key.size());
|
||||
TRI_AppendStringStringBuffer(buffer, "\"");
|
||||
|
||||
uint32_t const t = _randomValue % (uint32_t) (globalCounter + threadNumber + 1);
|
||||
|
||||
for (uint64_t i = 1; i <= n; ++i) {
|
||||
TRI_AppendStringStringBuffer(buffer, ",\"value");
|
||||
TRI_AppendUInt64StringBuffer(buffer, (uint64_t) (globalCounter + i));
|
||||
if (t % 3 == 0) {
|
||||
TRI_AppendStringStringBuffer(buffer, "\":true");
|
||||
}
|
||||
else if (t % 3 == 1) {
|
||||
TRI_AppendStringStringBuffer(buffer, "\":null");
|
||||
}
|
||||
else
|
||||
TRI_AppendStringStringBuffer(buffer, "\":\"some bogus string value to fill up the datafile...\"");
|
||||
}
|
||||
|
||||
TRI_AppendStringStringBuffer(buffer, "}");
|
||||
|
||||
*length = TRI_LengthStringBuffer(buffer);
|
||||
*mustFree = true;
|
||||
char* ptr = TRI_StealStringBuffer(buffer);
|
||||
TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, buffer);
|
||||
|
||||
return (const char*) ptr;
|
||||
}
|
||||
else {
|
||||
*length = 0;
|
||||
*mustFree = false;
|
||||
return (const char*) 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t _randomValue;
|
||||
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- document CRUD test
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -1201,6 +1385,12 @@ static BenchmarkOperation* GetTestCase (const string& name) {
|
|||
if (name == "shapes") {
|
||||
return new ShapesTest();
|
||||
}
|
||||
if (name == "shapes-append") {
|
||||
return new ShapesAppendTest();
|
||||
}
|
||||
if (name == "random-shapes") {
|
||||
return new RandomShapesTest();
|
||||
}
|
||||
if (name == "crud") {
|
||||
return new DocumentCrudTest();
|
||||
}
|
||||
|
|
|
@ -760,7 +760,9 @@ testFuncs.dump = function (options) {
|
|||
var benchTodo = [
|
||||
["--requests","10000","--concurrency","2","--test","version", "--async","true"],
|
||||
["--requests","20000","--concurrency","1","--test","version", "--async","true"],
|
||||
["--requests","100000","--concurrency","2","--test","shapes", "--batch-size","16"],
|
||||
["--requests","100000","--concurrency","2","--test","shapes", "--batch-size","16", "--complexity","2"],
|
||||
["--requests","100000","--concurrency","2","--test","shapes-append", "--batch-size","16", "--complexity","4"],
|
||||
["--requests","100000","--concurrency","3","--test","random-shapes", "--batch-size","16", "--complexity","2"],
|
||||
["--requests","1000","--concurrency","2","--test","version", "--batch-size", "16"],
|
||||
["--requests","100","--concurrency","1","--test","version", "--batch-size", "0"],
|
||||
["--requests","100","--concurrency","2","--test","document", "--batch-size",
|
||||
|
|
Loading…
Reference in New Issue