8000 added backport for BTS-266 (#18042) · arangodb/arangodb@b204078 · GitHub
[go: up one dir, main page]

Skip to content

Commit b204078

Browse files
cpjuliaKVS85
andauthored
added backport for BTS-266 (#18042)
* added backport for BTS-266 * Added testsuite changes * Fixed indent * Update CHANGELOG --------- Co-authored-by: Vadim <vadim@arangodb.com>
1 parent e3f09de commit b204078

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

CHANGELOG

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
v3.8.9 (XXXX-XX-XX)
22
-------------------
33

4+
* BTS-266: When starting up a cluster without `--cluster.force-one-shard`,
5+
creating a database and then restarting the cluster with the startup option
6+
`--cluster.force-one-shard` set to true, when the formerly created database
7+
has more than one shard, but the flag is set to true, this could lead to
8+
arangosearch's analyzers to use optimizations that should not be used if not
9+
in a single shard mode. For this not to happen, the verification of the
10+
parameter being true as a condition to run optimizations was removed.
11+
412
* Updated arangosync to v2.14.0.
513

614
* Updated ArangoDB Starter to 0.15.6.

arangod/IResearch/IResearchAnalyzerFeature.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -816,14 +816,16 @@ arangodb::Result visitAnalyzers(
816816
}
817817

818818
arangodb::Result res;
819-
if (!coords.empty() &&
820-
!vocbase.isSystem() && // System database could be on other server so OneShard optimization will not work
821-
(vocbase.server().getFeature<arangodb::ClusterFeature>().forceOneShard() ||
822-
vocbase.isOneShard())) {
819+
if (!coords.empty() && !vocbase.isSystem() && // System database could be on other server so OneShard optimization will not work
820+
vocbase.isOneShard()) {
821+
TRI_IF_FAILURE("CheckDBWhenSingleShardAndForceOneShardChange") {
822+
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
823+
}
823824
auto& clusterInfo = server.getFeature<arangodb::ClusterFeature>().clusterInfo();
824-
auto collection = clusterInfo.getCollectionNT(vocbase.name(), arangodb::StaticStrings::AnalyzersCollection);
825+
auto collection =
826+
clusterInfo.getCollectionNT(vocbase.name(), arangodb::StaticStrings::AnalyzersCollection);
825827
if (!collection) {
826-
return {}; // treat missing collection as if there are no analyzers
828+
return {}; // treat missing collection as if there are no analyzers
827829
}
828830

829831
auto shards = collection->shardIds();

js/client/modules/@arangodb/testsuites/server_permissions.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ const testPaths = {
5858

5959
function startParameterTest(options, testpath, suiteName) {
6060
let count = 0;
61-
let results = { shutdown: true };
61+
let results = {shutdown: true};
6262
let filtered = {};
6363
const tests = tu.scanTestPaths(testpath, options);
64-
64+
global.testOptions = options;
6565
tests.forEach(function (testFile, i) {
6666
count += 1;
6767
if (tu.filterTestcaseByOptions(testFile, options, filtered)) {
@@ -88,7 +88,8 @@ function startParameterTest(options, testpath, suiteName) {
8888
print(paramsFirstRun);
8989
}
9090
instanceInfo = pu.startInstance(options.protocol, options, paramsFirstRun, suiteName, rootDir); // first start
91-
pu.cleanupDBDirectoriesAppend(instanceInfo.rootDir);
91+
global.instanceInfoGlobal = instanceInfo;
92+
pu.cleanupDBDirectoriesAppend(instanceInfo.rootDir);
9293
try {
9394
print(BLUE + '================================================================================' + RESET);
9495
print(CYAN + 'Running Setup of: ' + testFile + RESET);
@@ -109,15 +110,14 @@ function startParameterTest(options, testpath, suiteName) {
109110
return;
110111
}
111112
if (pu.shutdownInstance(instanceInfo, clonedOpts, false)) { // stop
112-
instanceInfo.arangods.forEach(function(arangod) {
113+
instanceInfo.arangods.forEach(function (arangod) {
113114
arangod.pid = null;
114115
});
115116
if (options.extremeVerbosity) {
116117
print(paramsSecondRun);
117118
}
118119
pu.reStartInstance(clonedOpts, instanceInfo, paramsSecondRun); // restart with restricted permissions
119-
}
120-
else {
120+
} else {
121121
results[testFile] = {
122122
status: false,
123123
message: "failed to stop instance",
@@ -127,17 +127,17 @@ function startParameterTest(options, testpath, suiteName) {
127127
} else {
128128
instanceInfo = pu.startInstance(options.protocol, options, paramsSecondRun, suiteName, rootDir); // one start
129129
}
130+
global.instanceInfoGlobal = instanceInfo;
130131

131132
results[testFile] = tu.runInLocalArangosh(options, instanceInfo, testFile, {});
132133
shutdownStatus = pu.shutdownInstance(instanceInfo, clonedOpts, false);
133134

134135
results['shutdown'] = results['shutdown'] && shutdownStatus;
135-
136+
136137
if (!results[testFile].status || !shutdownStatus) {
137138
print("Not cleaning up " + instanceInfo.rootDir);
138139
results.status = false;
139-
}
140-
else {
140+
} else {
141141
pu.cleanupLastDirectory(options);
142142
}
143143
} else {
@@ -204,5 +204,7 @@ exports.setup = function (testFns, defaultFns, opts, fnDocs, optionsDoc, allTest
204204
testFns['server_parameters'] = server_parameters;
205205
testFns['server_secrets'] = server_secrets;
206206

207-
for (var attrname in functionsDocumentation) { fnDocs[attrname] = functionsDocumentation[attrname]; }
207+
for (var attrname in functionsDocumentation) {
208+
fnDocs[attrname] = functionsDocumentation[attrname];
209+
}
208210
};

0 commit comments

Comments
 (0)
0