mirror of https://gitee.com/bigwinds/arangodb
fix generateLogIds.py (#8570)
* fix generateLogIds.py, update README_mainatiners * Add missing `or` in doc. * remove quotes before inserting into map
This commit is contained in:
parent
dbcc9767fa
commit
deb770caba
|
@ -20,12 +20,12 @@ Unique Log Ids
|
|||
We have unique log ids in order to allow for easy locating of code producing
|
||||
errors.
|
||||
|
||||
LOG_TOPIC(2dead, ....)
|
||||
LOG_TOPIC("2dead", ....)
|
||||
|
||||
To ensure that the ids are unique we run the script `./utils/generateLogIds.py`
|
||||
during CI runs. The script will fail with a non-zero status if id collisions
|
||||
are found. You can use `openssl rand -hex 3 | sed 's/.//'` anything that suits
|
||||
you to generate a **5 hex digit log** id.
|
||||
are found. You can use `openssl rand -hex 3 | sed 's/.//;s/\(.*\)/"\1"/'` or
|
||||
anything that suits you to generate a **5 hex digit log** id.
|
||||
|
||||
CMake
|
||||
=====
|
||||
|
|
|
@ -1875,8 +1875,8 @@ static void JS_Log(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
StringUtils::tolowerInPlace(&ls);
|
||||
StringUtils::tolowerInPlace(&ts);
|
||||
|
||||
LogTopic const* topicPtr = LogTopic::lookup(ts);
|
||||
LogTopic const& topic = ( ts.empty() || topicPtr == nullptr ) ? Logger::FIXME : *topicPtr;
|
||||
LogTopic const* topicPtr = ts.empty() ? nullptr : LogTopic::lookup(ts);
|
||||
LogTopic const& topic = (topicPtr != nullptr) ? *topicPtr : Logger::FIXME;
|
||||
|
||||
if (args[1]->IsArray()) {
|
||||
auto loglines = v8::Handle<v8::Array>::Cast(args[1]);
|
||||
|
@ -1910,7 +1910,7 @@ static void JS_Log(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
prefix = ls + "!";
|
||||
LOG_TOPIC("6b817", WARN, topic) << prefix << message;
|
||||
}
|
||||
} // for
|
||||
} // for
|
||||
} else {
|
||||
TRI_Utf8ValueNFC message(isolate, args[1]);
|
||||
|
||||
|
@ -1937,7 +1937,6 @@ static void JS_Log(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
prefix = ls + "!";
|
||||
LOG_TOPIC("0c009", WARN, topic) << prefix << msg;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TRI_V8_RETURN_UNDEFINED();
|
||||
|
@ -4367,9 +4366,11 @@ void TRI_LogV8Exception(v8::Isolate* isolate, v8::TryCatch* tryCatch) {
|
|||
// exception.
|
||||
if (message.IsEmpty()) {
|
||||
if (exceptionString == nullptr) {
|
||||
LOG_TOPIC("49465", ERR, arangodb::Logger::FIXME) << "JavaScript exception";
|
||||
LOG_TOPIC("49465", ERR, arangodb::Logger::FIXME)
|
||||
<< "JavaScript exception";
|
||||
} else {
|
||||
LOG_TOPIC("7e60e", ERR, arangodb::Logger::FIXME) << "JavaScript exception: " << exceptionString;
|
||||
LOG_TOPIC("7e60e", ERR, arangodb::Logger::FIXME)
|
||||
<< "JavaScript exception: " << exceptionString;
|
||||
}
|
||||
} else {
|
||||
TRI_Utf8ValueNFC filename(isolate, message->GetScriptResourceName());
|
||||
|
@ -4382,9 +4383,11 @@ void TRI_LogV8Exception(v8::Isolate* isolate, v8::TryCatch* tryCatch) {
|
|||
|
||||
if (filenameString == nullptr) {
|
||||
if (exceptionString == nullptr) {
|
||||
LOG_TOPIC("27c91", ERR, arangodb::Logger::FIXME) << "JavaScript exception";
|
||||
LOG_TOPIC("27c91", ERR, arangodb::Logger::FIXME)
|
||||
<< "JavaScript exception";
|
||||
} else {
|
||||
LOG_TOPIC("52220", ERR, arangodb::Logger::FIXME) << "JavaScript exception: " << exceptionString;
|
||||
LOG_TOPIC("52220", ERR, arangodb::Logger::FIXME)
|
||||
<< "JavaScript exception: " << exceptionString;
|
||||
}
|
||||
} else {
|
||||
if (exceptionString == nullptr) {
|
||||
|
|
|
@ -25,6 +25,8 @@ g_hash_algorithm = hashlib.md5()
|
|||
|
||||
|
||||
def generate_id(location_string, params, rest, id_database):
|
||||
sys.exit(1) #disabled on purpose
|
||||
|
||||
id_len = 5
|
||||
g_hash_algorithm.update((location_string + params + rest).encode())
|
||||
digest = g_hash_algorithm.hexdigest()
|
||||
|
@ -107,9 +109,9 @@ def do_operation(fullpath, project_path, target_file_handle, id_database, levels
|
|||
# still unmodified
|
||||
continue
|
||||
|
||||
elif len(param) == 5:
|
||||
elif len(param) == 7 and param.startswith('"') and param.endswith('"'):
|
||||
# we need to store / check the id
|
||||
uid = param
|
||||
uid = param[1:-1]
|
||||
|
||||
if uid in id_database:
|
||||
print("collision check failed - the following lines contain equal ids:")
|
||||
|
|
Loading…
Reference in New Issue