mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of ssh://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
9334547583
17
CHANGELOG
17
CHANGELOG
|
@ -1,6 +1,23 @@
|
|||
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
|
||||
|
||||
* fixed issue #1027: Stack traces are off-by-one
|
||||
|
|
|
@ -637,7 +637,7 @@ class KeySpace {
|
|||
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) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
|
@ -674,6 +674,55 @@ class KeySpace {
|
|||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
h->data.erase(it);
|
||||
delete (*it).second;
|
||||
h->data.erase(it);
|
||||
}
|
||||
|
||||
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
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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;
|
||||
|
||||
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();
|
||||
|
@ -1574,7 +1623,46 @@ static v8::Handle<v8::Value> JS_KeyAt (v8::Arguments const& argv) {
|
|||
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) {
|
||||
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_POP", JS_KeyPop);
|
||||
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);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -415,8 +415,8 @@ namespace triagens {
|
|||
double pct = 100.0 * ((double) totalRead / (double) totalLength);
|
||||
|
||||
if (pct >= nextProgress && totalLength >= 1024) {
|
||||
LOG_INFO("processed %lld bytes (%0.2f%%) of input file", (long long) totalRead, pct);
|
||||
nextProgress = pct + ProgressStep;
|
||||
LOG_INFO("processed %lld bytes (%0.1f%%) of input file", (long long) totalRead, nextProgress);
|
||||
nextProgress = (double) ((int) (pct + ProgressStep));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,15 +87,15 @@ JAVASCRIPT_JSLINT = \
|
|||
|
||||
jslint:
|
||||
@RESULT=0; \
|
||||
for file in $(JAVASCRIPT_JSLINT); do \
|
||||
FILELIST=""; \
|
||||
for file in $(JAVASCRIPT_JSLINT); do FILELIST="$$FILELIST --jslint $$file"; done; \
|
||||
@builddir@/bin/arangosh \
|
||||
-c none \
|
||||
--log.level error \
|
||||
--server.password "" \
|
||||
--javascript.startup-directory @srcdir@/js \
|
||||
--jslint $$file; \
|
||||
$$FILELIST; \
|
||||
if [ "$$?x" != "0x" ]; then RESULT=1; fi; \
|
||||
done; \
|
||||
exit $$RESULT
|
||||
|
||||
jshint: jslint
|
||||
|
|
|
@ -400,71 +400,9 @@ controller.get("/query/result/download/:query", function(req, res) {
|
|||
var query = req.params("query"),
|
||||
parsedQuery;
|
||||
|
||||
var _utf8_decode = function (utftext) {
|
||||
var string = "";
|
||||
var i = 0;
|
||||
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);
|
||||
|
||||
var internal = require("internal");
|
||||
query = internal.base64Decode(query);
|
||||
internal.print(query);
|
||||
try {
|
||||
parsedQuery = JSON.parse(query);
|
||||
}
|
||||
|
|
|
@ -162,7 +162,20 @@
|
|||
header: "Requests",
|
||||
labels: ["datetime", "GET", "PUT", "POST", "DELETE", "PATCH", "HEAD", "OPTIONS", "OTHER"],
|
||||
stackedGraph: true,
|
||||
div: "requestsChart"
|
||||
div: "requestsChart",
|
||||
axes: {
|
||||
y: {
|
||||
valueFormatter: function (y) {
|
||||
return parseFloat(y.toPrecision(3));
|
||||
},
|
||||
axisLabelFormatter: function (y) {
|
||||
if (y === 0) {
|
||||
return 0;
|
||||
}
|
||||
return parseFloat(y.toPrecision(3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -168,6 +168,10 @@ $iconsize: 50px;
|
|||
padding-left: 4px;
|
||||
padding-right: 9px;
|
||||
|
||||
&.loading {
|
||||
border-bottom-color: $c-unloaded;
|
||||
}
|
||||
|
||||
&.loaded {
|
||||
border-bottom-color: $c-positive;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -83,8 +83,8 @@ function RunCommandLineTests (options) {
|
|||
var testResult = RunTest(file, options);
|
||||
result = result && testResult && testResult.passed;
|
||||
if (testResult && (! testResult.passed && testResult.errors)) {
|
||||
for (var i = 0; i < testResult.errors.length; ++i) {
|
||||
var err = testResult.errors[i];
|
||||
for (var j = 0; j < testResult.errors.length; ++j) {
|
||||
var err = testResult.errors[j];
|
||||
if (! err) {
|
||||
continue;
|
||||
}
|
||||
|
@ -105,7 +105,6 @@ function RunCommandLineTests (options) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
internal.setUnitTestsResult(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -983,7 +983,7 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid,
|
|||
#ifndef _WIN32
|
||||
TRI_pid_t res;
|
||||
int opts;
|
||||
int loc;
|
||||
int loc = 0;
|
||||
|
||||
if (wait) {
|
||||
opts = WUNTRACED;
|
||||
|
@ -995,7 +995,13 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid,
|
|||
if (res == 0) {
|
||||
external->_exitStatus = 0;
|
||||
}
|
||||
else if (WIFEXITED(loc)) {
|
||||
else if (res == -1) {
|
||||
LOG_WARNING("waitpid returned error for pid %d: %s",
|
||||
(int) external->_pid,
|
||||
TRI_errno_string(errno));
|
||||
}
|
||||
else if (static_cast<TRI_pid_t>(external->_pid) == static_cast<TRI_pid_t>(res)) {
|
||||
if (WIFEXITED(loc)) {
|
||||
external->_status = TRI_EXT_TERMINATED;
|
||||
external->_exitStatus = WEXITSTATUS(loc);
|
||||
}
|
||||
|
@ -1011,6 +1017,12 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid,
|
|||
external->_status = TRI_EXT_ABORTED;
|
||||
external->_exitStatus = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_WARNING("unexpected waitpid result for pid %d: %d",
|
||||
(int) external->_pid,
|
||||
(int) res);
|
||||
}
|
||||
#else
|
||||
if (wait) {
|
||||
DWORD result;
|
||||
|
@ -1036,6 +1048,11 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid,
|
|||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
LOG_WARNING("unexpected process status %d: %d",
|
||||
(int) external->_status,
|
||||
(int) external->_exitStatus);
|
||||
}
|
||||
|
||||
status._status = external->_status;
|
||||
status._exitStatus = external->_exitStatus;
|
||||
|
|
Loading…
Reference in New Issue