8000 Bug fix/tests cleanup by jsteemann · Pull Request #11028 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Bug fix/tests cleanup #11028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions arangod/Aql/EnumerateCollectionExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@

using namespace arangodb;
using namespace arangodb::aql;

namespace {
std::vector<size_t> const emptyAttributePositions;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supposed to be thread_local

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vector is only used to be passed into the DocumentProducingContext, where a const reference to it is stored. The data in the vector is never modified by the DocumentProducingContext, nor is it modified by EnumerateCollectionExecutor(Infos).
Thus it can be static and const.

}

EnumerateCollectionExecutorInfos::EnumerateCollectionExecutorInfos(
RegisterId outputRegister, RegisterId nrInputRegisters, RegisterId nrOutputRegisters,
Expand All @@ -52,7 +56,6 @@ EnumerateCollectionExecutorInfos::EnumerateCollectionExecutorInfos(
Collection const* collection, Variable const* outVariable, bool produceResult,
Expression* filter,
std::vector<std::string> const& projections,
std::vector<size_t> const& coveringIndexAttributePositions,
bool useRawDocumentPointers, bool random)
: ExecutorInfos(make_shared_unordered_set(),
make_shared_unordered_set({outputRegister}),
Expand All @@ -63,7 +66,6 @@ EnumerateCollectionExecutorInfos::EnumerateCollectionExecutorInfos(
_outVariable(outVariable),
_filter(filter),
_projections(projections),
_coveringIndexAttributePositions(coveringIndexAttributePositions),
_outputRegisterId(outputRegister),
_useRawDocumentPointers(useRawDocumentPointers),
_produceResult(produceResult),
Expand Down Expand Up @@ -97,11 +99,6 @@ std::vector<std::string> const& EnumerateCollectionExecutorInfos::getProjections
return _projections;
}

std::vector<size_t> const& EnumerateCollectionExecutorInfos::getCoveringIndexAttributePositions() const
noexcept {
return _coveringIndexAttributePositions;
}

bool EnumerateCollectionExecutorInfos::getProduceResult() const {
return _produceResult;
}
Expand All @@ -123,7 +120,7 @@ EnumerateCollectionExecutor::EnumerateCollectionExecutor(Fetcher& fetcher, Infos
_infos.getProduceResult(),
_infos.getQuery(), _infos.getFilter(),
_infos.getProjections(),
_infos.getCoveringIndexAttributePositions(),
::emptyAttributePositions,
true, _infos.getUseRawDocumentPointers(), false),
_state(ExecutionState::HASMORE),
_cursorHasMore(false),
Expand Down Expand Up @@ -260,19 +257,10 @@ std::tuple<ExecutionState, EnumerateCollectionStats, size_t> EnumerateCollection
void EnumerateCollectionExecutor::initializeCursor() {
_state = ExecutionState::HASMORE;
_input = InputAqlItemRow{CreateInvalidInputRowHint{}};
setAllowCoveringIndexOptimization(true);
_cursorHasMore = false;
_cursor->reset();
}

void EnumerateCollectionExecutor::setAllowCoveringIndexOptimization(bool const allowCoveringIndexOptimization) {
_documentProducingFunctionContext.setAllowCoveringIndexOptimization(allowCoveringIndexOptimization);
}

bool EnumerateCollectionExecutor::getAllowCoveringIndexOptimization() const noexcept {
return _documentProducingFunctionContext.getAllowCoveringIndexOptimization();
}

#ifndef USE_ENTERPRISE
bool EnumerateCollectionExecutor::waitForSatellites(ExecutionEngine* engine,
Collection const* collection) const {
Expand Down
9 changes: 0 additions & 9 deletions arangod/Aql/EnumerateCollectionExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class EnumerateCollectionExecutorInfos : public ExecutorInfos {
Collection const* collection, Variable const* outVariable, bool produceResult,
Expression* filter,
std::vector<std::string> const& projections,
std::vector<size_t> const& coveringIndexAttributePositions,
bool useRawDocumentPointers, bool random);

EnumerateCollectionExecutorInfos() = delete;
Expand All @@ -79,7 +78,6 @@ class EnumerateCollectionExecutorInfos : public ExecutorInfos {
transaction::Methods* getTrxPtr() const;
Expression* getFilter() const;
std::vector<std::string> const& getProjections() const noexcept;
std::vector<size_t> const& getCoveringIndexAttributePositions() const noexcept;
bool getProduceResult() const;
bool getUseRawDocumentPointers() const;
bool getRandom() const;
Expand All @@ -91,7 +89,6 @@ class EnumerateCollectionExecutorInfos : public ExecutorInfos {
Variable const* _outVariable;
Expression* _filter;
std::vector<std::string> const& _projections;
std::vector<size_t> const& _coveringIndexAttributePositions;
RegisterId _outputRegisterId;
bool _useRawDocumentPointers;
bool _produceResult;
Expand Down Expand Up @@ -134,12 +131,6 @@ class EnumerateCollectionExecutor {
private:
bool waitForSatellites(ExecutionEngine* engine, Collection const* collection) const;

void setAllowCoveringIndexOptimization(bool allowCoveringIndexOptimization);

/// @brief whether or not we are allowed to use the covering index
/// optimization in a callback
bool getAllowCoveringIndexOptimization() const noexcept;

private:
Infos& _infos;
Fetcher& _fetcher;
Expand Down
4 changes: 1 addition & 3 deletions arangod/Aql/ExecutionNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1351,9 +1351,7 @@ std::unique_ptr<ExecutionBlock> EnumerateCollectionNode::createBlock(
getRegisterPlan()->nrRegs[previousNode->getDepth()],
getRegisterPlan()->nrRegs[getDepth()], getRegsToClear(), calcRegsToKeep(),
&engine, this->_collection, _outVariable, (this->isVarUsedLater(_outVariable) || this->_filter != nullptr),
this->_filter.get(),
this->projections(), this->coveringIndexAttributePositions(),
EngineSelectorFeature::ENGINE->useRawDocumentPointers(), this->_random);
this->_filter.get(), this->projections(), EngineSelectorFeature::ENGINE->useRawDocumentPointers(), this->_random);
return std::make_unique<ExecutionBlockImpl<EnumerateCollectionExecutor>>(&engine, this,
std::move(infos));
}
Expand Down
17 changes: 8 additions & 9 deletions arangosh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ endif ()

if (USE_FAIL_ON_WARNINGS)
if (MSVC)
target_compile_options(arangobench PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
target_compile_options(arangobench PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
else ()
target_compile_options(arangobench PRIVATE -Werror -Wno-error=deprecated-declarations)
endif ()
Expand Down Expand Up @@ -139,7 +139,7 @@ endif ()

if (USE_FAIL_ON_WARNINGS)
if (MSVC)
target_compile_options(arangobackup PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
target_compile_options(arangobackup PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
else ()
target_compile_options(arangobackup PRIVATE -Werror -Wno-error=deprecated-declarations)
endif ()
Expand Down Expand Up @@ -198,7 +198,7 @@ endif ()

if (USE_FAIL_ON_WARNINGS)
if (MSVC)
target_compile_options(arangodump PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
target_compile_options(arangodump PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
else ()
target_compile_options(arangodump PRIVATE -Werror -Wno-error=deprecated-declarations)
endif ()
Expand Down Expand Up @@ -254,7 +254,7 @@ endif ()

if (USE_FAIL_ON_WARNINGS)
if (MSVC)
target_compile_options(arangoexport PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
target_compile_options(arangoexport PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
else ()
target_compile_options(arangoexport PRIVATE -Werror -Wno-error=deprecated-declarations)
endif ()
Expand Down Expand Up @@ -290,7 +290,6 @@ target_link_libraries(${BIN_ARANGOIMPORT}
arango
${MSVC_LIBS}
${SYSTEM_LIBRARIES}
fuerte
boost_system
boost_boost
arango_shell
Expand Down Expand Up @@ -322,7 +321,7 @@ install_command_alias(arangoimport

if (USE_FAIL_ON_WARNINGS)
if (MSVC)
target_compile_options(arangoimport PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
target_compile_options(arangoimport PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
else ()
target_compile_options(arangoimport PRIVATE -Werror -Wno-error=deprecated-declarations)
endif ()
Expand Down Expand Up @@ -379,7 +378,7 @@ endif ()

if (USE_FAIL_ON_WARNINGS)
if (MSVC)
target_compile_options(arangorestore PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
target_compile_options(arangorestore PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
else ()
target_compile_options(arangorestore PRIVATE -Werror -Wno-error=deprecated-declarations)
endif ()
Expand Down Expand Up @@ -444,7 +443,7 @@ endif ()
F438
if (USE_FAIL_ON_WARNINGS)
if (MSVC)
target_compile_options(arangosh PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
target_compile_options(arangosh PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
else ()
target_compile_options(arangosh PRIVATE -Werror -Wno-error=deprecated-declarations)
endif ()
Expand Down Expand Up @@ -500,7 +499,7 @@ endif ()

if (USE_FAIL_ON_WARNINGS)
if (MSVC)
target_compile_options(arangovpack PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
target_compile_options(arangovpack PRIVATE /WX /D_WINSOCK_DEPRECATED_NO_WARNINGS)
else ()
target_compile_options(arangovpack PRIVATE -Werror -Wno-error=deprecated-declarations)
endif ()
Expand Down
14 changes: 7 additions & 7 deletions js/client/modules/@arangodb/result-processing.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,11 @@ ${failedMessages}${color} * Overall state: ${statusMessage}${RESET}${crashText}$
if (crashedText !== '') {
onlyFailedMessages += '\n' + crashedText;
}
fs.write(options.testOutputDirectory + options.testFailureText, onlyFailedMessages);
fs.write(fs.join(options.testOutputDirectory, options.testFailureText), onlyFailedMessages);

if (cu.GDB_OUTPUT !== '' && options.crashAnalysisText !== options.testFailureText ) {
// write more verbose failures to the testFailureText file
fs.write(options.testOutputDirectory + options.crashAnalysisText, cu.GDB_OUTPUT);
fs.write(fs.join(options.testOutputDirectory, options.crashAnalysisText), cu.GDB_OUTPUT);
}

}
Expand Down Expand Up @@ -768,8 +768,8 @@ function locateShortServerLife(options, results) {
// //////////////////////////////////////////////////////////////////////////////

function writeDefaultReports(options, testSuites) {
fs.write(options.testOutputDirectory + '/UNITTEST_RESULT_EXECUTIVE_SUMMARY.json', "false", true);
fs.write(options.testOutputDirectory + '/UNITTEST_RESULT_CRASHED.json', "true", true);
fs.write(fs.join(options.testOutputDirectory, 'UNITTEST_RESULT_EXECUTIVE_SUMMARY.json'), "false", true);
fs.write(fs.join(options.testOutputDirectory, 'UNITTEST_RESULT_CRASHED.json'), "true", true);
let testFailureText = 'testfailures.txt';
if (options.hasOwnProperty('testFailureText')) {
testFailureText = options.testFailureText;
Expand All @@ -781,8 +781,8 @@ function writeDefaultReports(options, testSuites) {
}

function writeReports(options, results) {
fs.write(options.testOutputDirectory + '/UNITTEST_RESULT_EXECUTIVE_SUMMARY.json', String(results.status), true);
fs.write(options.testOutputDirectory + '/UNITTEST_RESULT_CRASHED.json', String(results.crashed), true);
fs.write(fs.join(options.testOutputDirectory, 'UNITTEST_RESULT_EXECUTIVE_SUMMARY.json'), String(results.status), true);
fs.write(fs.join(options.testOutputDirectory, 'UNITTEST_RESULT_CRASHED.json'), String(results.crashed), true);
}

function dumpAllResults(options, results) {
Expand All @@ -794,7 +794,7 @@ function dumpAllResults(options, results) {
j = inspect(results);
}

fs.write(options.testOutputDirectory + '/UNITTEST_RESULT.json', j, true);
fs.write(fs.join(options.testOutputDirectory, 'UNITTEST_RESULT.json'), j, true);
}


Expand Down
2 changes: 1 addition & 1 deletion js/client/modules/@arangodb/testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const optionsDefaults = {
'storageEngine': 'rocksdb',
'test': undefined,
'testBuckets': undefined,
'testOutputDirectory': 'out/',
'testOutputDirectory': 'out',
'useReconnect': true,
'username': 'root',
'valgrind': false,
Expand Down
3 changes: 1 addition & 2 deletions tests/Aql/EnumerateCollectionExecutorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class EnumerateCollectionExecutorTestNoRowsUpstream : public ::testing::Test {
Collection abc;
std::vector<std::string> const projections;
transaction::Methods& trx;
std::vector<size_t> const coveringIndexAttributePositions;
bool useRawPointers;
bool random;

Expand All @@ -108,7 +107,7 @@ class EnumerateCollectionExecutorTestNoRowsUpstream : public ::testing::Test {
random(false),
infos(0 /*outReg*/, 1 /*nrIn*/, 1 /*nrOut*/, regToClear, regToKeep,
&engine, &abc, &outVariable, varUsedLater, nullptr, projections,
coveringIndexAttributePositions, useRawPointers, random),
useRawPointers, random),
block(new AqlItemBlock(itemBlockManager, 1000, 2)) {
// fake indexScan
fakeit::When(Method(mockTrx, indexScan))
Expand Down
9 changes: 8 additions & 1 deletion tests/rb/HttpReplication/api-replication-global-spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,16 @@
################################################################################

context "dealing with wal access api" do

api = "/_api/wal"
prefix = "api-wal"

before do
ArangoDB.drop_collection("UnitTestsReplication")
end

after do
ArangoDB.drop_collection("UnitTestsReplication")
end

################################################################################
## state
Expand Down
15 changes: 15 additions & 0 deletions tests/rb/HttpReplication/api-replication-mmfiles-spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@

context "dealing with the logger" do

before do
ArangoDB.drop_collection("UnitTestsReplication")
end

after do
ArangoDB.drop_collection("UnitTestsReplication")
end

################################################################################
## state
################################################################################
Expand Down Expand Up @@ -1448,6 +1456,13 @@
################################################################################

context "dealing with the logger" do
before do
ArangoDB.drop_collection("UnitTestsReplication")
end

after do
ArangoDB.drop_collection("UnitTestsReplication")
end

################################################################################
## state
Expand Down
14 changes: 14 additions & 0 deletions tests/rb/HttpReplication/api-replication-rocksdb-spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,13 @@
################################################################################

context "dealing with the logger" do
before do
ArangoDB.drop_collection("UnitTestsReplication")
end

after do
ArangoDB.drop_collection("UnitTestsReplication")
end

################################################################################
## state
Expand Down Expand Up @@ -1413,6 +1420,13 @@
################################################################################

context "dealing with the logger" do
before do
ArangoDB.drop_collection("UnitTestsReplication")
end

after do
ArangoDB.drop_collection("UnitTestsReplication")
end

################################################################################
## state
Expand Down
0