8000 Bug fix/fixes 0609 (#3227) · MohammedDeveloper/arangodb@5165155 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5165155

Browse files
jsteemannfceller
authored andcommitted
Bug fix/fixes 0609 (arangodb#3227)
* do not use V8 variant of AQL functions in early optimization stage when a C++ variant is available * additionally, simplify AQL function definitions and aliases * warn when more than 90% of max mappings are in use * added C++ variant of replication catchup * added `--log.role` option * updated CHANGELOG * removed non-existing scheduler.threads option from config * removed useless __FILE__, __LINE__ invocations * updated CHANGELOG * allow a priority V8 context * remove TRI_CORE_MEM_ZONE * try to fix Windows errors & warnings * cleanup * removed memory zones altogether * exclude system collections from collection tests
1 parent e1a1427 commit 5165155

File tree

223 files changed

+5045
-5707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+5045
-5707
lines changed

CHANGELOG

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
devel
22
-----
33

4+
* leader-follower replication catchup code has been rewritten in C++
5+
6+
* early stage AQL optimization now also uses the C++ implementations of
7+
AQL functions if present. Previously it always referred to the JavaScript
8+
implementations and ignored the C++ implementations.
9+
10+
* ArangoDB tty log output is now colored for log messages with levels
11+
FATAL, ERR and WARN.
12+
13+
* changed the return values of AQL functions `REGEX_TEST` and `REGEX_REPLACE`
14+
to `null` when the input regex is invalid. Previous versions of ArangoDB
15+
partly returned `false` for invalid regexes and partly `null`.
16+
17+
* added `--log.role` option for arangod
18+
19+
When set to `true`, this option will make the ArangoDB logger print a single
20+
character with the server's role into each logged message. The roles are:
21+
22+
- U: undefined/unclear (used at startup)
23+
- S: single server
24+
- C: coordinator
25+
- P: primary
26+
- A: agent
27+
28+
The default value for this option is `false`, so no roles will be logged.
29+
430
* fixed issue #3106: orphan collections could not be registered in general-graph module
531

632
* fixed wrong selection of the database inside the internal cluster js api
@@ -9,16 +35,20 @@ devel
935
the number of memory mappings currently used by the process and compare it with
1036
the maximum number of allowed mappings as determined by /proc/sys/vm/max_map_count
1137

38+
The default value is `true`, so the checks will be performed. When the current
39+
number of mappings exceeds 90% of the maximum number of mappings, the creation
40+
of further V8 contexts will be deferred.
41+
1242
Note that this option is effective on Linux systems only.
1343

14-
* arangoimp now has a --remove-attribute option
44+
* arangoimp now has a `--remove-attribute` option
1545

1646
* added V8 context lifetime control options
1747
`--javascript.v8-contexts-max-invocations` and `--javascript.v8-contexts-max-age`
1848

1949
These options allow specifying after how many invocations a used V8 context is
2050
disposed, or after what time a V8 context is disposed automatically after its
21-
creation. If either of the two thresholds is reached, a V8 context will be
51+
creation. If either of the two thresholds is reached, an idl V8 context will be
2252
disposed.
2353

2454
The default value of `--javascript.v8-contexts-max-invocations` is 0, meaning that

Documentation/Books/AQL/Functions/String.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ you need to define a pattern group by wrapping the subexpression in parentheses
369369
and place the quantifier right behind it: `(xyz)+`.
370370

371371
If the regular expression in *search* is invalid, a warning will be raised
372-
and the function will return *false*.
372+
and the function will return *null*.
373373

374374
```js
375375
REGEX_TEST("the quick brown fox", "the.*fox") // true
@@ -395,7 +395,7 @@ For more details about the rules for characters and sequences refer
395395
[REGEX_TEST()](#regextest).
396396

397397
If the regular expression in *search* is invalid, a warning will be raised
398-
and the function will return *false*.
398+
and the function will return *null*.
399399

400400
```js
401401
REGEX_REPLACE("the quick brown fox", "the.*fox", "jumped over") // jumped over

Documentation/Books/Manual/Administration/Configuration/Logging.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,18 @@ when no thread is logged and
143143
```
144144

145145
when this command line option is set.
146+
147+
### Role
148+
149+
Log role: `--log.role`
150+
151+
When set to `true`, this option will make the ArangoDB logger print a single
152+
character with the server's role into each logged message. The roles are:
153+
154+
- U: undefined/unclear (used at startup)
155+
- S: single server
156+
- C: coordinator
157+
- P: primary
158+
- A: agent
159+
160+
The default value for this option is `false`, so no roles will be logged.

arangod/Agency/AgencyFeature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ void AgencyFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
190190

191191
if (_maxElectionTimeout <= 2. * _minElectionTimeout) {
192192
LOG_TOPIC(WARN, Logger::AGENCY)
193-
<< "agency.election-timeout-max should probably be chosen longer!"
194-
<< " " << __FILE__ << __LINE__;
193+
<< "agency.election-timeout-max should probably be chosen longer!";
195194
}
196195

197196
if (_compactionKeepSize == 0) {

arangod/Agency/Constituent.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ void Constituent::termNoLock(term_t t) {
146146
result = trx.insert("election", body.slice(), options);
147147
} catch (std::exception const& e) {
148148
LOG_TOPIC(FATAL, Logger::AGENCY)
149-
<< "Failed to persist RAFT election ballot: " << e.what() << ". Bailing out."
150-
<< __FILE__ << ":" << __LINE__;
149+
<< "Failed to persist RAFT election ballot: " << e.what() << ". Bailing out.";
151150
FATAL_ERROR_EXIT();
152151
}
153152

arangod/Agency/Job.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ struct Job {
9292
status(); // This runs everything to to with state PENDING if needed!
9393
} catch (std::exception const& e) {
9494
LOG_TOPIC(WARN, Logger::AGENCY) << "Exception caught in status() method: "
95-
<< e.what() << ": " << __FILE__
96-
<< ":" << __LINE__;
95+
<< e.what();
9796
finish(server, shard, false, e.what());
9897
}
9998
try {
@@ -106,7 +105,7 @@ struct Job {
106105
}
107106
} catch (std::exception const& e) {
108107
LOG_TOPIC(WARN, Logger::AGENCY) << "Exception caught in create() or "
109-
"start() method: " << e.what() << ": " << __FILE__ << ":" << __LINE__;
108+
"start() method: " << e.what();
110109
finish("", "", false, e.what());
111110
}
112111
}
@@ -212,8 +211,7 @@ inline arangodb::consensus::write_ret_t singleWriteTransaction(
212211
}
213212
} catch (std::exception const& e) {
214213
LOG_TOPIC(ERR, Logger::SUPERVISION)
215-
<< "Supervision failed to build transaction.";
216-
LOG_TOPIC(ERR, Logger::SUPERVISION) << e.what() << " " << __FILE__ << __LINE__;
214+
<< "Supervision failed to build single-write transaction: " << e.what();
217215
}
218216

219217
auto ret = _agent->write(envelope);
@@ -260,8 +258,7 @@ inline arangodb::consensus::trans_ret_t generalTransaction(
260258
}
261259
} catch (std::exception const& e) {
262260
LOG_TOPIC(ERR, Logger::SUPERVISION)
263-
<< "Supervision failed to build transaction.";
264-
LOG_TOPIC(ERR, Logger::SUPERVISION) << e.what() << " " << __FILE__ << __LINE__;
261+
<< "Supervision failed to build transaction: " << e.what();
265262
}
266263

267264
auto ret = _agent->transact(envelope);
@@ -297,8 +294,7 @@ inline arangodb::consensus::trans_ret_t transient(AgentInterface* _agent,
297294
}
298295
} catch (std::exception const& e) {
299296
LOG_TOPIC(ERR, Logger::SUPERVISION)
300-
<< "Supervision failed to build transaction.";
301-
LOG_TOPIC(ERR, Logger::SUPERVISION) << e.what() << " " << __FILE__ << __LINE__;
297+
<< "Supervision failed to build transaction for transient: " << e.what();
302298
}
303299

304300

arangod/Agency/State.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,11 @@ index_t State::logNonBlocking(
193193
if (!persist(idx, term, slice, clientId)) { // log to disk or die
194194
if (leading) {
195195
LOG_TOPIC(FATAL, Logger::AGENCY)
196-
<< "RAFT leader fails to persist log entries!"
197-
<< __FILE__ << ":" << __LINE__;
196+
<< "RAFT leader fails to persist log entries!";
198197
FATAL_ERROR_EXIT();
199198
} else {
200199
LOG_TOPIC(ERR, Logger::AGENCY)
201-
<< "RAFT follower fails to persist log entries!"
202-
<< __FILE__ << ":" << __LINE__;
200+
<< "RAFT follower fails to persist log entries!";
203201
return 0;
204202
}
205203
}
@@ -209,13 +207,11 @@ index_t State::logNonBlocking(
209207
} catch (std::bad_alloc const&) {
210208
if (leading) {
211209
LOG_TOPIC(FATAL, Logger::AGENCY)
212-
<< "RAFT leader fails to allocate volatile log entries!"
213-
<< __FILE__ << ":" << __LINE__;
210+
<< "RAFT leader fails to allocate volatile log entries!";
214211
FATAL_ERROR_EXIT();
215212
} else {
216213
LOG_TOPIC(ERR, Logger::AGENCY)
217-
<< "RAFT follower fails to allocate volatile log entries!"
218-
<< __FILE__ << ":" << __LINE__;
214+
<< "RAFT follower fails to allocate volatile log entries!";
219215
return 0;
220216
}
221217
}
@@ -226,8 +222,7 @@ index_t State::logNonBlocking(
226222
std::pair<std::string, index_t>(clientId, idx));
227223
} catch (...) {
228224
LOG_TOPIC(FATAL, Logger::AGENCY)
229-
<< "RAFT leader fails to expand client lookup table!"
230-
<< __FILE__ << ":" << __LINE__;
225+
<< "RAFT leader fails to expand client lookup table!";
231226
FATAL_ERROR_EXIT();
232227
}
233228
}

arangod/Agency/v8-agency.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static void JS_LeadingAgent(v8::FunctionCallbackInfo<v8::Value> const& args) {
6868

6969
v8::Handle<v8::Object> r = v8::Object::New(isolate);
7070

71-
r->Set(TRI_V8_ASCII_STRING("leading"),
71+
r->Set(TRI_V8_ASCII_STRING(isolate, "leading"),
7272
v8::Boolean::New(isolate, agent->leading()));
7373

7474
TRI_V8_RETURN(r);
@@ -154,8 +154,7 @@ static void JS_WriteAgent(v8::FunctionCallbackInfo<v8::Value> const& args) {
154154
try {
155155
max_index = *std::max_element(ret.indices.begin(), ret.indices.end());
156156
} catch (std::exception const& e) {
157-
LOG_TOPIC(WARN, Logger::AGENCY) << e.what() << " " << __FILE__
158-
<< __LINE__;
157+
LOG_TOPIC(WARN, Logger::AGENCY) << e.what();
159158
}
160159

161160
if (max_index > 0) {
@@ -182,29 +181,29 @@ void TRI_InitV8Agency(v8::Isolate* isolate, v8::Handle<v8::Context> context) {
182181
// ...........................................................................
183182

184183
ft = v8::FunctionTemplate::New(isolate);
185-
ft->SetClassName(TRI_V8_ASCII_STRING("ArangoAgent"));
184+
ft->SetClassName(TRI_V8_ASCII_STRING(isolate, "ArangoAgent"));
186185

187186
rt = ft->InstanceTemplate();
188187
rt->SetInternalFieldCount(2);
189188

190-
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("enabled"),
189+
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING(isolate, "enabled"),
191190
JS_EnabledAgent);
192-
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("leading"),
191+
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING(isolate, "leading"),
193192
JS_LeadingAgent);
194-
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("read"), JS_ReadAgent);
195-
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING("write"),
193+
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING(isolate, "read"), JS_ReadAgent);
194+
TRI_AddMethodVocbase(isolate, rt, TRI_V8_ASCII_STRING(isolate, "write"),
196195
JS_WriteAgent);
197196

198197
v8g->AgentTempl.Reset(isolate, rt);
199-
ft->SetClassName(TRI_V8_ASCII_STRING("ArangoAgentCtor"));
198+
ft->SetClassName(TRI_V8_ASCII_STRING(isolate, "ArangoAgentCtor"));
200199

201-
TRI_AddGlobalFunctionVocbase(isolate, TRI_V8_ASCII_STRING("ArangoAgentCtor"),
200+
TRI_AddGlobalFunctionVocbase(isolate, TRI_V8_ASCII_STRING(isolate, "ArangoAgentCtor"),
202201
ft->GetFunction(), true);
203202

204203
// register the global object
205204
v8::Handle<v8::Object> aa = rt->NewInstance();
206205
if (!aa.IsEmpty()) {
207206
TRI_AddGlobalVariableVocbase(isolate,
208-
TRI_V8_ASCII_STRING("ArangoAgent"), aa);
207+
TRI_V8_ASCII_STRING(isolate, "ArangoAgent"), aa);
209208
}
210209
}

0 commit comments

Comments
 (0)
0