From d113b755a0b74ccaf4b95c20e6fb30a2aef1400d Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 5 Jan 2018 14:51:26 +0100 Subject: [PATCH] fixed issue #4199: Internal failure: JavaScript exception in file 'arangosh.js' at 98,7: ArangoError 4: Expecting type String (#4202) --- CHANGELOG | 112 +++++++++++++++++---- arangod/Aql/ClusterBlocks.cpp | 2 - arangod/Aql/IndexBlock.cpp | 3 + js/server/tests/aql/aql-vpack-externals.js | 25 ++++- lib/Basics/VelocyPackHelper.cpp | 56 ++++++----- 5 files changed, 151 insertions(+), 47 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1361a0a65a..a5d8cb5f30 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,5 @@ devel ----- -* UI: displayed wrong wfs property for a collection when using rocksdb as storage engine * UI: updated dygraph js library to version 2.1.0 @@ -22,43 +21,112 @@ devel Release packages will still install arangoimp as a symlink so user scripts invoking arangoimp do not need to be changed -* UI: improved the behavior during collection creation in a cluster environment +* UI: Shard distribution view now has an accordion view instead of displaying + all shards of all collections at once. + + +v3.3.2 (XXXX-XX-XX) +------------------- + +* fixed issue #4199: Internal failure: JavaScript exception in file 'arangosh.js' + at 98,7: ArangoError 4: Expecting type String + + +v3.3.1 (2017-12-28) +------------------- + +* UI: displayed wrong wfs property for a collection when using RocksDB as + storage engine + +* added `--ignore-missing` option to arangoimp + this option allows importing lines with less fields than specified in the CSV + header line + +* changed misleading error message from "no leader" to "not a leader" + +* optimize usage of AQL FULLTEXT index function to a FOR loop with index + usage in some cases + When the optimization is applied, this especially speeds up fulltext index + queries in the cluster + +* UI: improved the behavior during collection creation in a cluster environment + +* Agency lockup fixes for very small machines. + +* Agency performance improvement by finer grained locking. + +* Use steady_clock in agency whereever possible. + +* Agency prevent Supervision thread crash. + +* Fix agency integer overflow in timeout calculation. + + +v3.3.0 (2012-12-14) +------------------- + +* release version + +* added a missing try/catch block in the supervision thread + + +v3.3.rc8 (2017-12-12) +--------------------- * UI: fixed broken foxx configuration keys. Some valid configuration values could not be edited via the ui. -* UI: Shard distribution view now has an accordion view instead of displaying - all shards of all collections at once. - -* UI: pressing the return key inside a select2 box no longer triggers the modals +* UI: pressing the return key inside a select2 box no longer triggers the modal's success function * UI: coordinators and db servers are now in sorted order (ascending) -* UI: fixed disappearing of the navigation label in some cases -* fixed issue #3917: traversals with high maximal depth take extremely long - in planning phase. - -* UI: fixed issue #3822: disabled name input field for system collections +v3.3.rc7 (2017-12-07) +--------------------- * fixed issue #3741: fix terminal color output in Windows +* UI: fixed issue #3822: disabled name input field for system collections + +* fixed issue #3640: limit in subquery + +* fixed issue #3745: Invalid result when using OLD object with array attribute in UPSERT statement + +* UI: edge collections were wrongly added to from and to vertices select box during graph creation + +* UI: added not found views for documents and collections + * UI: using default user database api during database creation now * UI: the graph viewer backend now picks one random start vertex of the first 1000 documents instead of calling any(). The implementation of - any is known to scale bad on huge collections with rocksdb. + "any" is known to scale bad on huge collections with RocksDB. -* UI: added not found views for documents and collections - -* UI: edge collections were wrongly added to from and to vertices select box during graph creation - -* fixed issue #3640: limit in subquery +* UI: fixed disappearing of the navigation label in some case special case * UI: the graph viewer now displays updated label values correctly. Additionally the included node/edge editor now closes automatically - after a successful node/edge update. + after a successful node/edge update. + +* fixed issue #3917: traversals with high maximal depth take extremely long + in planning phase. + + +v3.3.rc4 (2017-11-28) +--------------------- + +* minor bug-fixes + + +v3.3.rc3 (2017-11-24) +--------------------- + +* bug-fixes + + +v3.3.rc2 (2017-11-22) +--------------------- * UI: document/edge editor now remembering their modes (e.g. code or tree) @@ -71,12 +139,20 @@ devel * added options `--encryption.keyfile` and `--encryption.key-generator` to arangodump and arangorestore +* UI: the graph viewer now displays updated label values correctly. + Additionally the included node/edge editor now closes automatically + after a successful node/edge update. + * removed `--recycle-ids` option for arangorestore using that option could have led to problems on the restore, with potential id conflicts between the originating server (the source dump server) and the target server (the restore server) + +v3.3.rc1 (2017-11-17) +--------------------- + * add readonly mode REST API * allow compilation of ArangoDB source code with g++ 7 diff --git a/arangod/Aql/ClusterBlocks.cpp b/arangod/Aql/ClusterBlocks.cpp index b76acf8c56..1284bf0fdf 100644 --- a/arangod/Aql/ClusterBlocks.cpp +++ b/arangod/Aql/ClusterBlocks.cpp @@ -79,7 +79,6 @@ GatherBlock::GatherBlock(ExecutionEngine* engine, GatherNode const* en) } GatherBlock::~GatherBlock() { - DEBUG_BEGIN_BLOCK(); for (std::deque& x : _gatherBlockBuffer) { for (AqlItemBlock* y : x) { delete y; @@ -87,7 +86,6 @@ GatherBlock::~GatherBlock() { x.clear(); } _gatherBlockBuffer.clear(); - DEBUG_END_BLOCK(); } /// @brief initialize diff --git a/arangod/Aql/IndexBlock.cpp b/arangod/Aql/IndexBlock.cpp index a769093397..632e4a17f4 100644 --- a/arangod/Aql/IndexBlock.cpp +++ b/arangod/Aql/IndexBlock.cpp @@ -406,6 +406,9 @@ bool IndexBlock::skipIndex(size_t atMost) { } } return false; + + // cppcheck-suppress style + DEBUG_END_BLOCK(); } // this is called every time we need to fetch data from the indexes diff --git a/js/server/tests/aql/aql-vpack-externals.js b/js/server/tests/aql/aql-vpack-externals.js index 82013f08ba..197f877bbc 100644 --- a/js/server/tests/aql/aql-vpack-externals.js +++ b/js/server/tests/aql/aql-vpack-externals.js @@ -51,7 +51,7 @@ function aqlVPackExternalsTestSuite () { let coll = db._create(collName); for (let i = 1000; i < 5000; ++i) { - coll.save({_key: "test" + i}); + coll.save({_key: "test" + i, value: "test" + i}); } let ecoll = db._createEdgeCollection(edgeColl); @@ -62,6 +62,25 @@ function aqlVPackExternalsTestSuite () { }, tearDown: cleanUp, + + testCustom: function () { + const query = `FOR x IN ${collName} FILTER x IN [${JSON.stringify(db[collName].any())}] RETURN x`; + const cursor = db._query(query); + assertTrue(cursor.hasNext()); + }, + + testCustomSubquery: function () { + const query = `FOR x IN ${collName} FILTER x IN (FOR doc IN ${collName} LIMIT 1 RETURN doc) RETURN x`; + const cursor = db._query(query); + assertTrue(cursor.hasNext()); + }, + + testCustomSubquery2: function () { + db[collName].insert({ value: db[collName].any() }); + const query = `FOR x IN ${collName} FILTER x.value IN (FOR doc IN ${collName} RETURN doc) RETURN x`; + const cursor = db._query(query); + assertTrue(cursor.hasNext()); + }, testPlainExternal: function () { const query = `FOR x IN ${collName} SORT x._key RETURN x`; @@ -116,13 +135,13 @@ function aqlVPackExternalsTestSuite () { }, testExternalInMerge: function () { - const query = `FOR x IN ${collName} SORT x._key RETURN MERGE({value: 5}, x)`; + const query = `FOR x IN ${collName} SORT x._key RETURN MERGE({value2: 5}, x)`; const cursor = db._query(query); for (let i = 1000; i < 5000; ++i) { assertTrue(cursor.hasNext()); let n = cursor.next(); assertEqual(n._key, "test" + i); - assertEqual(n.value, 5); + assertEqual(n.value2, 5); } }, diff --git a/lib/Basics/VelocyPackHelper.cpp b/lib/Basics/VelocyPackHelper.cpp index 7bde43eacc..3769a92194 100644 --- a/lib/Basics/VelocyPackHelper.cpp +++ b/lib/Basics/VelocyPackHelper.cpp @@ -760,32 +760,40 @@ int VelocyPackHelper::compare(VPackSlice lhs, VPackSlice rhs, bool useUTF8, case VPackValueType::SmallInt: { return compareNumberValues(lhsType, lhs, rhs); } - case VPackValueType::String: { - VPackValueLength nl; - char const* left = lhs.getString(nl); - TRI_ASSERT(left != nullptr); - - VPackValueLength nr; - char const* right = rhs.getString(nr); - TRI_ASSERT(right != nullptr); - - return compareStringValues(left, nl, right, nr, useUTF8); - } + case VPackValueType::String: case VPackValueType::Custom: { - if (lhsBase == nullptr || rhsBase == nullptr || - options == nullptr || - options->customTypeHandler == nullptr) { - THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, - "Could not extract custom attribute."); - } - std::string lhsString(options->customTypeHandler->toString(lhs, options, *lhsBase)); - char const* left = lhsString.data(); - VPackValueLength nl = lhsString.size(); - TRI_ASSERT(left != nullptr); + VPackValueLength nl; + VPackValueLength nr; + char const* left; + char const* right; + std::string lhsString; + std::string rhsString; - std::string rhsString(options->customTypeHandler->toString(rhs, options, *rhsBase)); - char const* right = rhsString.data(); - VPackValueLength nr = rhsString.size(); + if (lhs.isCustom()) { + if (lhsBase == nullptr || options == nullptr || options->customTypeHandler == nullptr) { + THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, + "Could not extract custom attribute."); + } + lhsString = options->customTypeHandler->toString(lhs, options, *lhsBase); + left = lhsString.data(); + nl = lhsString.size(); + } else { + left = lhs.getString(nl); + } + + if (rhs.isCustom()) { + if (rhsBase == nullptr || options == nullptr || options->customTypeHandler == nullptr) { + THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, + "Could not extract custom attribute."); + } + rhsString = options->customTypeHandler->toString(rhs, options, *rhsBase); + right = rhsString.data(); + nr = rhsString.size(); + } else { + right = rhs.getString(nr); + } + + TRI_ASSERT(left != nullptr); TRI_ASSERT(right != nullptr); return compareStringValues(left, nl, right, nr, useUTF8);