1
0
Fork 0

Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel

This commit is contained in:
Willi Goesgens 2014-10-10 09:59:50 +02:00
commit 616db57417
10 changed files with 712 additions and 622 deletions

View File

@ -1,6 +1,23 @@
v2.3.0 (XXXX-XX-XX) v2.3.0 (XXXX-XX-XX)
------------------- -------------------
* command-line options that require a boolean value now validate the
value given on the command-line
This prevents issues if no value is specified for an option that
requires a boolean value. For example, the following command-line would
have caused trouble in 2.2, because `--server.endpoint` would have been
used as the value for the `--server.disable-authentication` options
(which requires a boolean value):
arangod --server.disable-authentication --server.endpoint tcp://127.0.0.1:8529 data
In 2.3, running this command will fail with an error and requires to
be modified to:
arangod --server.disable-authentication true --server.endpoint tcp://127.0.0.1:8529 data
* improved performance of CSV import in arangoimp * improved performance of CSV import in arangoimp
* fixed issue #1027: Stack traces are off-by-one * fixed issue #1027: Stack traces are off-by-one

View File

@ -3625,6 +3625,18 @@ BlockWithClients::BlockWithClients (ExecutionEngine* engine,
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief shutdown
////////////////////////////////////////////////////////////////////////////////
int BlockWithClients::shutdown () {
if (!_initOrShutdown) {
return TRI_ERROR_NO_ERROR;
}
_initOrShutdown = false;
return ExecutionBlock::shutdown();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief getSomeForShard /// @brief getSomeForShard
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -3722,18 +3734,6 @@ int ScatterBlock::initializeCursor (AqlItemBlock* items, size_t pos) {
return TRI_ERROR_NO_ERROR; return TRI_ERROR_NO_ERROR;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief shutdown
////////////////////////////////////////////////////////////////////////////////
int ScatterBlock::shutdown () {
if (!_initOrShutdown) {
return TRI_ERROR_NO_ERROR;
}
_initOrShutdown = false;
return ExecutionBlock::shutdown();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief hasMoreForShard: any more for shard <shardId>? /// @brief hasMoreForShard: any more for shard <shardId>?
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -3859,6 +3859,36 @@ int ScatterBlock::getOrSkipSomeForShard (size_t atLeast,
// --SECTION-- class DistributeBlock // --SECTION-- class DistributeBlock
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief initializeCursor
////////////////////////////////////////////////////////////////////////////////
int DistributeBlock::initializeCursor (AqlItemBlock* items, size_t pos) {
if (!_initOrShutdown) {
return TRI_ERROR_NO_ERROR;
}
int res = ExecutionBlock::initializeCursor(items, pos);
if (res != TRI_ERROR_NO_ERROR) {
return res;
}
for (auto x: _distBuffer) {
x.clear();
}
_distBuffer.clear();
_distBuffer.reserve(_nrClients);
for (auto x: _doneForClient) {
x = false;
}
_initOrShutdown = false;
return TRI_ERROR_NO_ERROR;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief hasMore: any more for any shard? /// @brief hasMore: any more for any shard?
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -3920,7 +3950,7 @@ int DistributeBlock::getOrSkipSomeForShard (size_t atLeast,
} }
} }
skipped = std::min(buf.size(), atMost); skipped = (std::min)(buf.size(), atMost);
if (skipping) { if (skipping) {
for (size_t i = 0; i < skipped; i++){ for (size_t i = 0; i < skipped; i++){
@ -3975,7 +4005,7 @@ int DistributeBlock::getOrSkipSomeForShard (size_t atLeast,
return TRI_ERROR_NO_ERROR; // don't have to do any clean-up return TRI_ERROR_NO_ERROR; // don't have to do any clean-up
} }
else { else {
smallestIndex = std::min(index, smallestIndex); smallestIndex = (std::min)(index, smallestIndex);
} }
} }
@ -4030,7 +4060,8 @@ bool DistributeBlock::getBlockForClient (size_t atLeast,
size_t reg = cur->getNrRegs() - 1; // FIXME this is a totally arbitrary choice size_t reg = cur->getNrRegs() - 1; // FIXME this is a totally arbitrary choice
while (_pos < cur->size() && buf.at(clientId).size() < atLeast) { while (_pos < cur->size() && buf.at(clientId).size() < atLeast) {
// inspect cur in row _pos and check to which shard it should be sent . . // inspect cur in row _pos and check to which shard it should be sent . .
size_t id = sendToClient(cur->getValue(_pos, reg)); size_t id = sendToClient(cur->getValue(_pos,
static_cast<triagens::aql::RegisterId>(reg)));
buf.at(id).push_back(make_pair(_index, _pos++)); buf.at(id).push_back(make_pair(_index, _pos++));
} }
if (_pos == cur->size()) { if (_pos == cur->size()) {

View File

@ -1524,6 +1524,12 @@ namespace triagens {
public: public:
////////////////////////////////////////////////////////////////////////////////
/// @brief shutdown
////////////////////////////////////////////////////////////////////////////////
int shutdown ();
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief getSome: shouldn't be used, use skipSomeForShard /// @brief getSome: shouldn't be used, use skipSomeForShard
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -1685,12 +1691,6 @@ namespace triagens {
int initializeCursor (AqlItemBlock* items, size_t pos); int initializeCursor (AqlItemBlock* items, size_t pos);
////////////////////////////////////////////////////////////////////////////////
/// @brief initializeCursor
////////////////////////////////////////////////////////////////////////////////
int shutdown ();
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief hasMoreForShard: any more for shard <shardId>? /// @brief hasMoreForShard: any more for shard <shardId>?
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -1752,6 +1752,12 @@ namespace triagens {
~DistributeBlock () {} ~DistributeBlock () {}
////////////////////////////////////////////////////////////////////////////////
/// @brief initializeCursor
////////////////////////////////////////////////////////////////////////////////
int initializeCursor (AqlItemBlock* items, size_t pos);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief remainingForShard: remaining for shard <shardId>? /// @brief remainingForShard: remaining for shard <shardId>?
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -637,8 +637,8 @@ class KeySpace {
return scope.Close(result); return scope.Close(result);
} }
v8::Handle<v8::Value> keyAt (std::string const& key, v8::Handle<v8::Value> keyGetAt (std::string const& key,
int64_t index) { int64_t index) {
v8::HandleScope scope; v8::HandleScope scope;
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result;
@ -673,6 +673,55 @@ class KeySpace {
return scope.Close(result); return scope.Close(result);
} }
bool keySetAt (std::string const& key,
int64_t index,
v8::Handle<v8::Value> const& value) {
WRITE_LOCKER(_lock);
auto found = static_cast<KeySpaceElement*>(TRI_LookupByKeyAssociativePointer(&_hash, key.c_str()));
if (found == nullptr) {
// TODO: change error code
return TRI_ERROR_INTERNAL;
}
else {
if (! TRI_IsListJson(found->json)) {
// TODO: change error code
return TRI_ERROR_INTERNAL;
}
size_t const n = found->json->_value._objects._length;
if (index < 0) {
// TODO: change error code
return TRI_ERROR_INTERNAL;
}
auto json = TRI_ObjectToJson(value);
if (json == nullptr) {
return TRI_ERROR_OUT_OF_MEMORY;
}
if (index >= static_cast<int64_t>(n)) {
// insert new element
TRI_InsertVector(&found->json->_value._objects, json, static_cast<size_t>(index));
}
else {
// overwrite existing element
auto item = static_cast<TRI_json_t*>(TRI_AtVector(&found->json->_value._objects, static_cast<size_t>(index)));
if (item != nullptr) {
TRI_DestroyJson(TRI_UNKNOWN_MEM_ZONE, item);
}
TRI_SetVector(&found->json->_value._objects, static_cast<size_t>(index), json);
}
// only free pointer to json, but not its internal structures
TRI_Free(TRI_UNKNOWN_MEM_ZONE, json);
}
return TRI_ERROR_NO_ERROR;
}
char const* keyType (std::string const& key) { char const* keyType (std::string const& key) {
READ_LOCKER(_lock); READ_LOCKER(_lock);
@ -886,8 +935,8 @@ static v8::Handle<v8::Value> JS_KeyspaceDrop (v8::Arguments const& argv) {
TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL);
} }
h->data.erase(it);
delete (*it).second; delete (*it).second;
h->data.erase(it);
} }
return scope.Close(v8::True()); return scope.Close(v8::True());
@ -1547,11 +1596,11 @@ static v8::Handle<v8::Value> JS_KeyTransfer (v8::Arguments const& argv) {
/// @brief get an element at a specific list position /// @brief get an element at a specific list position
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static v8::Handle<v8::Value> JS_KeyAt (v8::Arguments const& argv) { static v8::Handle<v8::Value> JS_KeyGetAt (v8::Arguments const& argv) {
v8::HandleScope scope; v8::HandleScope scope;
if (argv.Length() < 3 || ! argv[0]->IsString() || ! argv[1]->IsString()) { if (argv.Length() < 3 || ! argv[0]->IsString() || ! argv[1]->IsString()) {
TRI_V8_EXCEPTION_USAGE(scope, "KEY_AT(<name>, <key>, <index>)"); TRI_V8_EXCEPTION_USAGE(scope, "KEY_GET_AT(<name>, <key>, <index>)");
} }
TRI_vocbase_t* vocbase = GetContextVocBase(); TRI_vocbase_t* vocbase = GetContextVocBase();
@ -1574,7 +1623,46 @@ static v8::Handle<v8::Value> JS_KeyAt (v8::Arguments const& argv) {
TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL); TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL);
} }
return scope.Close(hash->keyAt(key, offset)); return scope.Close(hash->keyGetAt(key, offset));
}
////////////////////////////////////////////////////////////////////////////////
/// @brief set an element at a specific list position
////////////////////////////////////////////////////////////////////////////////
static v8::Handle<v8::Value> JS_KeySetAt (v8::Arguments const& argv) {
v8::HandleScope scope;
if (argv.Length() < 4 || ! argv[0]->IsString() || ! argv[1]->IsString()) {
TRI_V8_EXCEPTION_USAGE(scope, "KEY_SET_AT(<name>, <key>, <index>, <value>)");
}
TRI_vocbase_t* vocbase = GetContextVocBase();
if (vocbase == nullptr) {
TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract vocbase");
}
std::string const&& name = TRI_ObjectToString(argv[0]);
std::string const&& key = TRI_ObjectToString(argv[1]);
int64_t offset = TRI_ObjectToInt64(argv[2]);
auto h = &(static_cast<UserStructures*>(vocbase->_userStructures)->hashes);
READ_LOCKER(h->lock);
auto hash = GetKeySpace(vocbase, name);
if (hash == nullptr) {
// TODO: change error code
TRI_V8_EXCEPTION(scope, TRI_ERROR_INTERNAL);
}
int res = hash->keySetAt(key, offset, argv[3]);
if (res != TRI_ERROR_NO_ERROR) {
TRI_V8_EXCEPTION(scope, res);
}
return scope.Close(v8::True());
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -1679,7 +1767,13 @@ void TRI_CreateUserStructuresVocBase (TRI_vocbase_t* vocbase) {
void TRI_FreeUserStructuresVocBase (TRI_vocbase_t* vocbase) { void TRI_FreeUserStructuresVocBase (TRI_vocbase_t* vocbase) {
if (vocbase->_userStructures != nullptr) { if (vocbase->_userStructures != nullptr) {
delete static_cast<UserStructures*>(vocbase->_userStructures); auto us = static_cast<UserStructures*>(vocbase->_userStructures);
for (auto& hash : us->hashes.data) {
if (hash.second != nullptr) {
delete hash.second;
}
}
delete us;
} }
} }
@ -1716,7 +1810,8 @@ void TRI_InitV8UserStructures (v8::Handle<v8::Context> context) {
TRI_AddGlobalFunctionVocbase(context, "KEY_PUSH", JS_KeyPush); TRI_AddGlobalFunctionVocbase(context, "KEY_PUSH", JS_KeyPush);
TRI_AddGlobalFunctionVocbase(context, "KEY_POP", JS_KeyPop); TRI_AddGlobalFunctionVocbase(context, "KEY_POP", JS_KeyPop);
TRI_AddGlobalFunctionVocbase(context, "KEY_TRANSFER", JS_KeyTransfer); TRI_AddGlobalFunctionVocbase(context, "KEY_TRANSFER", JS_KeyTransfer);
TRI_AddGlobalFunctionVocbase(context, "KEY_AT", JS_KeyAt); TRI_AddGlobalFunctionVocbase(context, "KEY_GET_AT", JS_KeyGetAt);
TRI_AddGlobalFunctionVocbase(context, "KEY_SET_AT", JS_KeySetAt);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -415,8 +415,8 @@ namespace triagens {
double pct = 100.0 * ((double) totalRead / (double) totalLength); double pct = 100.0 * ((double) totalRead / (double) totalLength);
if (pct >= nextProgress && totalLength >= 1024) { if (pct >= nextProgress && totalLength >= 1024) {
LOG_INFO("processed %lld bytes (%0.2f%%) of input file", (long long) totalRead, pct); LOG_INFO("processed %lld bytes (%0.1f%%) of input file", (long long) totalRead, nextProgress);
nextProgress = pct + ProgressStep; nextProgress = (double) ((int) (pct + ProgressStep));
} }
} }

View File

@ -87,15 +87,15 @@ JAVASCRIPT_JSLINT = \
jslint: jslint:
@RESULT=0; \ @RESULT=0; \
for file in $(JAVASCRIPT_JSLINT); do \ FILELIST=""; \
@builddir@/bin/arangosh \ for file in $(JAVASCRIPT_JSLINT); do FILELIST="$$FILELIST --jslint $$file"; done; \
-c none \ @builddir@/bin/arangosh \
--log.level error \ -c none \
--server.password "" \ --log.level error \
--javascript.startup-directory @srcdir@/js \ --server.password "" \
--jslint $$file; \ --javascript.startup-directory @srcdir@/js \
if [ "$$?x" != "0x" ]; then RESULT=1; fi; \ $$FILELIST; \
done; \ if [ "$$?x" != "0x" ]; then RESULT=1; fi; \
exit $$RESULT exit $$RESULT
jshint: jslint jshint: jslint

View File

@ -400,71 +400,9 @@ controller.get("/query/result/download/:query", function(req, res) {
var query = req.params("query"), var query = req.params("query"),
parsedQuery; parsedQuery;
var _utf8_decode = function (utftext) { var internal = require("internal");
var string = ""; query = internal.base64Decode(query);
var i = 0; internal.print(query);
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
var decodeFunction = function (input) {
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = keyStr.indexOf(input.charAt(i++));
enc2 = keyStr.indexOf(input.charAt(i++));
enc3 = keyStr.indexOf(input.charAt(i++));
enc4 = keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = _utf8_decode(output);
return output;
};
query = decodeFunction(query);
try { try {
parsedQuery = JSON.parse(query); parsedQuery = JSON.parse(query);
} }

View File

@ -167,6 +167,10 @@ $iconsize: 50px;
height: 0; height: 0;
padding-left: 4px; padding-left: 4px;
padding-right: 9px; padding-right: 9px;
&.loading {
border-bottom-color: $c-unloaded;
}
&.loaded { &.loaded {
border-bottom-color: $c-positive; border-bottom-color: $c-positive;

File diff suppressed because it is too large Load Diff

View File

@ -83,8 +83,8 @@ function RunCommandLineTests (options) {
var testResult = RunTest(file, options); var testResult = RunTest(file, options);
result = result && testResult && testResult.passed; result = result && testResult && testResult.passed;
if (testResult && (! testResult.passed && testResult.errors)) { if (testResult && (! testResult.passed && testResult.errors)) {
for (var i = 0; i < testResult.errors.length; ++i) { for (var j = 0; j < testResult.errors.length; ++j) {
var err = testResult.errors[i]; var err = testResult.errors[j];
if (! err) { if (! err) {
continue; continue;
} }
@ -105,7 +105,6 @@ function RunCommandLineTests (options) {
} }
} }
internal.setUnitTestsResult(result); internal.setUnitTestsResult(result);
} }