mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
6eca3d6cc4
|
@ -5,9 +5,15 @@
|
|||
@startDocuBlock collectionDatabaseName
|
||||
|
||||
!SUBSECTION Create
|
||||
<!-- arangod/V8Server/v8-vocbase.cpp -->
|
||||
<!-- arangod/V8Server/v8-vocindex.cpp -->
|
||||
@startDocuBlock collectionDatabaseCreate
|
||||
|
||||
<!-- arangod/V8Server/v8-vocindex.cpp -->
|
||||
@startDocuBlock collectionCreateEdgeCollection
|
||||
|
||||
<!-- arangod/V8Server/v8-vocindex.cpp -->
|
||||
@startDocuBlock collectionCreateDocumentCollection
|
||||
|
||||
!SUBSECTION All Collections
|
||||
<!-- arangod/V8Server/v8-vocbase.cpp -->
|
||||
@startDocuBlock collectionDatabaseNameAll
|
||||
|
|
|
@ -135,7 +135,7 @@ AqlItemBlock::AqlItemBlock (Json const& json) {
|
|||
}
|
||||
}
|
||||
else if (n == 1) {
|
||||
Json x(data.at(posInRaw++));
|
||||
Json x(raw.at(posInRaw++));
|
||||
AqlValue a(new Json(TRI_UNKNOWN_MEM_ZONE, x.copy().steal()));
|
||||
try {
|
||||
setValue(i, column, a); // if this throws, a is destroyed again
|
||||
|
|
|
@ -3492,6 +3492,26 @@ int GatherBlock::initializeCursor (AqlItemBlock* items, size_t pos) {
|
|||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int GatherBlock::shutdown() {
|
||||
//don't call default shutdown method since it does the wrong thing to _buffer
|
||||
for (auto it = _dependencies.begin(); it != _dependencies.end(); ++it) {
|
||||
int res = (*it)->shutdown();
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
for (std::deque<AqlItemBlock*> x: _buffer) {
|
||||
for (AqlItemBlock* y: x) {
|
||||
delete y;
|
||||
}
|
||||
x.clear();
|
||||
}
|
||||
_buffer.clear();
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
int64_t GatherBlock::count () const {
|
||||
int64_t sum = 0;
|
||||
for (auto x: _dependencies) {
|
||||
|
@ -3724,7 +3744,7 @@ size_t GatherBlock::skipSome (size_t atLeast, size_t atMost) {
|
|||
// renew the comparison function
|
||||
OurLessThan ourLessThan(_trx, _buffer, _sortRegisters, colls);
|
||||
}
|
||||
_pos.at(val.first) = make_pair(val.first,0);
|
||||
_pos.at(val.first) = make_pair(val.first, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3756,10 +3776,25 @@ bool GatherBlock::OurLessThan::operator() (std::pair<size_t, size_t> const& a,
|
|||
// --SECTION-- class ScatterBlock
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
int ScatterBlock::initializeCursor (AqlItemBlock* items, size_t pos) {
|
||||
int res = ExecutionBlock::initializeCursor(items, pos);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
return res;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < _nrClients; i++) {
|
||||
_posForClient.push_back(std::make_pair(0, 0));
|
||||
_doneForClient.push_back(false);
|
||||
}
|
||||
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
bool ScatterBlock::hasMoreForClient (size_t clientId){
|
||||
|
||||
TRI_ASSERT(0 <= clientId && clientId < _nrClients);
|
||||
|
||||
if (_doneForClient.at(clientId)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -3788,14 +3823,20 @@ bool ScatterBlock::hasMore () {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
_done = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
AqlItemBlock* ScatterBlock::getSomeForClient (size_t atLeast, size_t atMost, size_t clientId){
|
||||
int ScatterBlock::getOrSkipSomeForClient (size_t atLeast,
|
||||
size_t atMost, bool skipping, AqlItemBlock*& result,
|
||||
size_t& skipped, size_t clientId){
|
||||
|
||||
TRI_ASSERT(0 < atLeast && atLeast <= atMost);
|
||||
TRI_ASSERT(result == nullptr && skipped == 0);
|
||||
TRI_ASSERT(0 <= clientId && clientId < _nrClients);
|
||||
|
||||
if (_doneForClient.at(clientId)) {
|
||||
return nullptr;
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
std::pair<size_t, size_t> pos = _posForClient.at(clientId);
|
||||
|
@ -3804,37 +3845,68 @@ AqlItemBlock* ScatterBlock::getSomeForClient (size_t atLeast, size_t atMost, siz
|
|||
if (pos.first > _buffer.size()) {
|
||||
if (!getBlock(atLeast, atMost)) {
|
||||
_doneForClient.at(clientId) = true;
|
||||
return nullptr;
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
size_t available = _buffer.at(pos.first)->size() - pos.second;
|
||||
// available should be non-zero
|
||||
|
||||
size_t toSend = (std::min)(available, atMost); //nr rows in outgoing block
|
||||
skipped = std::min(available, atMost); //nr rows in outgoing block
|
||||
|
||||
AqlItemBlock* res = _buffer.at(pos.first)->slice(pos.second, pos.second + toSend);
|
||||
if(!skipping){
|
||||
result = _buffer.at(pos.first)->slice(pos.second, pos.second + skipped);
|
||||
}
|
||||
|
||||
// increment the position . . .
|
||||
_posForClient.at(clientId).second += toSend;
|
||||
|
||||
_posForClient.at(clientId).second += skipped;
|
||||
|
||||
// check if we're done at current block in buffer . . .
|
||||
if (_posForClient.at(clientId).second == _buffer.at(_posForClient.at(clientId).first)->size()) {
|
||||
_posForClient.at(clientId).first++;
|
||||
_posForClient.at(clientId).second = 0;
|
||||
}
|
||||
|
||||
// check if we can pop the front of the buffer . . .
|
||||
bool popit = true;
|
||||
for (size_t i = 0; i < _nrClients; i++) {
|
||||
if (_posForClient.at(i).first == 0) {
|
||||
popit = false;
|
||||
break;
|
||||
// check if we can pop the front of the buffer . . .
|
||||
bool popit = true;
|
||||
for (size_t i = 0; i < _nrClients; i++) {
|
||||
if (_posForClient.at(i).first == 0) {
|
||||
popit = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (popit) {
|
||||
delete(_buffer.front());
|
||||
_buffer.pop_front();
|
||||
// update the values in first coord of _posForClient
|
||||
for (size_t i = 0; i < _nrClients; i++) {
|
||||
_posForClient.at(i).first--;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (popit) {
|
||||
_buffer.pop_front();
|
||||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
AqlItemBlock* ScatterBlock::getSomeForClient (
|
||||
size_t atLeast, size_t atMost, size_t clientId) {
|
||||
size_t skipped = 0;
|
||||
AqlItemBlock* result = nullptr;
|
||||
int out = getOrSkipSome(atLeast, atMost, false, result, skipped);
|
||||
if (out != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION(out);
|
||||
}
|
||||
return res;
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t ScatterBlock::skipSomeForClient (size_t atLeast, size_t atMost, size_t clientId) {
|
||||
size_t skipped = 0;
|
||||
AqlItemBlock* result = nullptr;
|
||||
int out = getOrSkipSome(atLeast, atMost, true, result, skipped);
|
||||
TRI_ASSERT(result == nullptr);
|
||||
if (out != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION(out);
|
||||
}
|
||||
return skipped;
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
|
|
|
@ -1516,6 +1516,9 @@ public:
|
|||
AqlItemBlock* getSome (size_t, size_t);
|
||||
|
||||
size_t skipSome (size_t, size_t);
|
||||
|
||||
// need our own shutdown method since our _buffer is different
|
||||
int shutdown ();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -1590,7 +1593,7 @@ public:
|
|||
return ExecutionBlock::initialize();
|
||||
}
|
||||
|
||||
//int initializeCursor (AqlItemBlock* items, size_t pos);
|
||||
int initializeCursor (AqlItemBlock* items, size_t pos);
|
||||
|
||||
int64_t remaining () {
|
||||
return _dependencies[0]->remaining();
|
||||
|
@ -1607,8 +1610,13 @@ public:
|
|||
}
|
||||
|
||||
bool hasMoreForClient (size_t clientId);
|
||||
AqlItemBlock* getSomeForClient (size_t atLeast, size_t atMost, size_t clientId);
|
||||
|
||||
int getOrSkipSomeForClient (size_t atLeast, size_t atMost,
|
||||
bool skipping, AqlItemBlock*& result, size_t& skipped, size_t clientId);
|
||||
|
||||
size_t skipSomeForClient (size_t atLeast, size_t atMost, size_t clientId);
|
||||
|
||||
AqlItemBlock* getSomeForClient (size_t atLeast, size_t atMost, size_t clientId);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -1673,7 +1673,7 @@ static v8::Handle<v8::Value> CreateVocBase (v8::Arguments const& argv,
|
|||
/// *false*, then the key generator will solely be responsible for
|
||||
/// generating keys and supplying own key values in the *_key* attribute
|
||||
/// of documents is considered an error.
|
||||
/// * *{increment*: increment value for *autoincrement* key generator.
|
||||
/// * *increment*: increment value for *autoincrement* key generator.
|
||||
/// Not used for other key generator types.
|
||||
/// * *offset*: initial offset value for *autoincrement* key generator.
|
||||
/// Not used for other key generator types.
|
||||
|
@ -1705,6 +1705,12 @@ static v8::Handle<v8::Value> CreateVocBase (v8::Arguments const& argv,
|
|||
/// attribute and this can only be done efficiently if this is the
|
||||
/// only shard key by delegating to the individual shards.
|
||||
///
|
||||
/// `db._create(collection-name, properties, type)`
|
||||
///
|
||||
/// Specifies the optional *type* of the collection, it can either be *document*
|
||||
/// or *edge*. On default it is document. Instead of giving a type you can also use
|
||||
/// *db._createEdgeCollection* or *db._createDocumentCollection*.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// With defaults:
|
||||
|
@ -1751,14 +1757,11 @@ static v8::Handle<v8::Value> JS_CreateVocbase (v8::Arguments const& argv) {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates a new document collection
|
||||
/// @startDocuBlock collectionCreateDocumentaion
|
||||
/// @startDocuBlock collectionCreateDocumentCollection
|
||||
/// `db._createDocumentCollection(collection-name)`
|
||||
///
|
||||
/// `db._createDocumentCollection(collection-name, properties)`
|
||||
///
|
||||
/// Creates a new document collection named *collection-name*.
|
||||
/// This is an alias for @ref JS_CreateVocbase, with the difference that the
|
||||
/// collection type is not automatically detected.
|
||||
/// Creates a new document collection named *collection-name*. If the
|
||||
/// document name already exists and error is thrown.
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -1766,13 +1769,13 @@ static v8::Handle<v8::Value> JS_CreateDocumentCollectionVocbase (v8::Arguments c
|
|||
return CreateVocBase(argv, TRI_COL_TYPE_DOCUMENT);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
dan////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates a new edge collection
|
||||
/// @startDocuBlock collectionCreateEdgeCollection
|
||||
/// `db._createEdgeCollection(collection-name)`
|
||||
///
|
||||
/// Creates a new edge collection named *collection-name*. If the
|
||||
/// collection name already exists, then an error is thrown. The default value
|
||||
/// collection name already exists an error is thrown. The default value
|
||||
/// for *waitForSync* is *false*.
|
||||
///
|
||||
/// `db._createEdgeCollection(collection-name, properties)`
|
||||
|
@ -1781,14 +1784,11 @@ static v8::Handle<v8::Value> JS_CreateDocumentCollectionVocbase (v8::Arguments c
|
|||
///
|
||||
/// * *waitForSync* (optional, default *false*): If *true* creating
|
||||
/// a document will only return after the data was synced to disk.
|
||||
/// * *journalSize* (optional, default is a @ref CommandLineArangod
|
||||
/// * *journalSize* (optional, default is
|
||||
/// "configuration parameter"): The maximal size of
|
||||
/// a journal or datafile. Note that this also limits the maximal
|
||||
/// size of a single object. Must be at least 1MB.
|
||||
/// size of a single object and must be at least 1MB.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// See @ref JS_CreateVocbase for example.
|
||||
/// @endDocuBlock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ var generatePerfReportXML = function (reportName, testdata) {
|
|||
|
||||
var generatePerfReportGrinderCSV = function (reportName, testdata) {
|
||||
"use strict";
|
||||
var x = "Thread, Run, Test, Start time (ms since Epoch), Test time, Errors, HTTP response code, HTTP response length, HTTP response errors, Time to resolve host, Time to establish connection, Time to first byte, New connections";
|
||||
var x = "Thread, Run, Test 1, Start time (ms since Epoch), Test time, Errors, TPS , HTTP response length, HTTP response errors, Time to resolve host, Time to establish connection, Time to first byte, New connections";
|
||||
|
||||
|
||||
for (var testname in testdata) {
|
||||
|
@ -53,7 +53,7 @@ var generatePerfReportGrinderCSV = function (reportName, testdata) {
|
|||
{
|
||||
var s = testdata[testname][testCalculation].duration;
|
||||
if (!isNaN(s)) {
|
||||
x = x + '\n0, 0, ' + testname + '/' + testCalculation + ',' + require("internal").time() + ', ' + s + ', 0, 0, 0, 0, 0, 0, 0, 0';
|
||||
x = x + '\n0, 0, ' + testname + '/' + testCalculation + ',' + Math.floor(require("internal").time()*1000) + ', ' + Math.floor(s*1000) + ', 0, 0, 0, 0, 0, 0, 0, 0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue