From 8cd838f9e6c3d4bdb2974c40e0c10f0ca3208d9f Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 19 Jan 2023 13:16:43 +0100 Subject: [PATCH 1/7] seek into large logfiles --- release_tester/arangodb/instance.py | 4 ++++ release_tester/arangodb/starter/manager.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/release_tester/arangodb/instance.py b/release_tester/arangodb/instance.py index fff90e60a..df7d8e1e3 100644 --- a/release_tester/arangodb/instance.py +++ b/release_tester/arangodb/instance.py @@ -639,6 +639,10 @@ def detect_pid(self, ppid, offset=0, full_binary_path=""): raise TimeoutError("instance logfile '" + str(self.logfile) + "' didn't show up in 120 seconds") with open(self.logfile, errors="backslashreplace", encoding="utf8") as log_fh: + file_size = self.logfile.stat().st_size + if file_size > 10 * 1024 * 1024: + print(f"detect_pid(): large logfile {file_size / 1024 / 1024}. Seeking forward to the last 10k.") + log_fh.seek(file_size - 10 * 1024) for line in log_fh: # skip empty lines if line == "": diff --git a/release_tester/arangodb/starter/manager.py b/release_tester/arangodb/starter/manager.py index 1208137b1..875e308d3 100644 --- a/release_tester/arangodb/starter/manager.py +++ b/release_tester/arangodb/starter/manager.py @@ -76,7 +76,8 @@ def __init__( # self.moreopts += ["--all.log.escape-unicode-chars=true"] if (basecfg.semver.major==3 and basecfg.semver.minor>=9) or (basecfg.semver.major>3): self.moreopts += ["--args.all.database.extended-names-databases=true"] - + # doesn't work since it will put anything into one directory: + # self.moreopts += ['--all.log.output', 'general=file://./arangod.log', '--all.log.output', 'requests=file://./requests.log'] # directories self.raw_basedir = install_prefix self.old_install_prefix = self.cfg.install_prefix From 2e631086e0d540456b1f8b560ad5b0af8fdc6b0a Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 19 Jan 2023 14:49:52 +0100 Subject: [PATCH 2/7] debug --- release_tester/arangodb/instance.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/release_tester/arangodb/instance.py b/release_tester/arangodb/instance.py index df7d8e1e3..2e0a737a4 100644 --- a/release_tester/arangodb/instance.py +++ b/release_tester/arangodb/instance.py @@ -640,11 +640,15 @@ def detect_pid(self, ppid, offset=0, full_binary_path=""): with open(self.logfile, errors="backslashreplace", encoding="utf8") as log_fh: file_size = self.logfile.stat().st_size + debug = False if file_size > 10 * 1024 * 1024: print(f"detect_pid(): large logfile {file_size / 1024 / 1024}. Seeking forward to the last 10k.") log_fh.seek(file_size - 10 * 1024) + debug = True for line in log_fh: # skip empty lines + if debug: + print(line) if line == "": time.sleep(1) continue @@ -655,6 +659,8 @@ def detect_pid(self, ppid, offset=0, full_binary_path=""): # (why not slurp the whole file?) last_line = line log_file_content += "\n" + line + if debug: + print('done looping') # check last line or continue match = re.search(r"Z \[(\d*)\]", last_line) From 36562c98ff9738a58ef813c06b383bc51083d5ce Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 19 Jan 2023 16:36:44 +0100 Subject: [PATCH 3/7] try to skip DEBUG/TRACE early to save cpu cycles --- release_tester/arangodb/instance.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/release_tester/arangodb/instance.py b/release_tester/arangodb/instance.py index 2e0a737a4..9584f798a 100644 --- a/release_tester/arangodb/instance.py +++ b/release_tester/arangodb/instance.py @@ -642,11 +642,13 @@ def detect_pid(self, ppid, offset=0, full_binary_path=""): file_size = self.logfile.stat().st_size debug = False if file_size > 10 * 1024 * 1024: - print(f"detect_pid(): large logfile {file_size / 1024 / 1024}. Seeking forward to the last 10k.") - log_fh.seek(file_size - 10 * 1024) + #print(f"detect_pid(): large logfile {file_size / 1024 / 1024}. Seeking forward to the last 10k.") + #log_fh.seek(file_size - 10 * 1024) debug = True for line in log_fh: # skip empty lines + if 'DEBUG' in line or 'TRACE' in line: + continue if debug: print(line) if line == "": @@ -661,6 +663,7 @@ def detect_pid(self, ppid, offset=0, full_binary_path=""): log_file_content += "\n" + line if debug: print('done looping') + print(last_line) # check last line or continue match = re.search(r"Z \[(\d*)\]", last_line) From f3c8bfae04e49196096c2fa5aa6d36b8d32aa08c Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 19 Jan 2023 17:54:08 +0100 Subject: [PATCH 4/7] requests as well --- release_tester/arangodb/instance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_tester/arangodb/instance.py b/release_tester/arangodb/instance.py index 9584f798a..563518a0c 100644 --- a/release_tester/arangodb/instance.py +++ b/release_tester/arangodb/instance.py @@ -647,7 +647,7 @@ def detect_pid(self, ppid, offset=0, full_binary_path=""): debug = True for line in log_fh: # skip empty lines - if 'DEBUG' in line or 'TRACE' in line: + if 'DEBUG' in line or 'TRACE' in line or '{requests}' in line: continue if debug: print(line) From 12a970af360f24ebaa225f437fc32aee7ccab77a Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 19 Jan 2023 20:21:57 +0100 Subject: [PATCH 5/7] more filtering --- release_tester/arangodb/instance.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/release_tester/arangodb/instance.py b/release_tester/arangodb/instance.py index 563518a0c..03e8c67cc 100644 --- a/release_tester/arangodb/instance.py +++ b/release_tester/arangodb/instance.py @@ -647,7 +647,12 @@ def detect_pid(self, ppid, offset=0, full_binary_path=""): debug = True for line in log_fh: # skip empty lines - if 'DEBUG' in line or 'TRACE' in line or '{requests}' in line: + if ('DEBUG' in line or + 'TRACE' in line or + '{requests}' in line or + 'U_USING_DEFAULT_WARNING' in line or + '{maintenance}' in line or + '{replication}' in line): continue if debug: print(line) @@ -669,7 +674,7 @@ def detect_pid(self, ppid, offset=0, full_binary_path=""): match = re.search(r"Z \[(\d*)\]", last_line) if match is None: tries -= 1 - logging.info("no PID in [%s]: %s", self.logfile, last_line) + print("no PID in [%s]: %s", self.logfile, last_line) progress(".") time.sleep(1) continue From 20e2fcd885d7431184715ec191ca95fb4a8e5c5c Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Mon, 23 Jan 2023 16:44:49 +0100 Subject: [PATCH 6/7] hide iresearch noise --- release_tester/arangodb/instance.py | 1 + 1 file changed, 1 insertion(+) diff --git a/release_tester/arangodb/instance.py b/release_tester/arangodb/instance.py index 03e8c67cc..71094d8e8 100644 --- a/release_tester/arangodb/instance.py +++ b/release_tester/arangodb/instance.py @@ -27,6 +27,7 @@ "40e37", # -> upgrade required TODO remove me from here, add system instance handling. "d72fb", # -> license is going to expire... "1afb1", # -> unlicensed enterprise instance + "9afd3", # -> noisy 'icu::Collator from locale 'en' : 'U_USING_DEFAULT_WARNING' ] # log tokens we ignore in system ugprades... From 6794f685c8bf8d362dbe0e54b1f78f6a73b2333e Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Mon, 23 Jan 2023 19:26:47 +0100 Subject: [PATCH 7/7] print --- release_tester/arangodb/instance.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/release_tester/arangodb/instance.py b/release_tester/arangodb/instance.py index 71094d8e8..ec4583962 100644 --- a/release_tester/arangodb/instance.py +++ b/release_tester/arangodb/instance.py @@ -656,7 +656,7 @@ def detect_pid(self, ppid, offset=0, full_binary_path=""): '{replication}' in line): continue if debug: - print(line) + print(line.rstrip()) if line == "": time.sleep(1) continue @@ -710,7 +710,7 @@ def detect_pid(self, ppid, offset=0, full_binary_path=""): continue t_start = match.group(1) - logging.debug( + print( "found pid {0} for instance with logfile {1} at {2}.".format(self.pid, str(self.logfile), t_start) ) try: @@ -724,10 +724,10 @@ def detect_pid(self, ppid, offset=0, full_binary_path=""): if self.pid == 0: print() - logging.error("could not get pid for instance: " + repr(self)) - logging.error("inspect: " + str(self.logfile)) + print("could not get pid for instance: " + repr(self)) + print("inspect: " + str(self.logfile)) raise TimeoutError("could not get pid for instance: " + repr(self)) - logging.info( + print( "found process for pid {0} for " "instance with logfile {1} at {2}.".format(self.pid, str(self.logfile), t_start) )