-
Notifications
You must be signed in to change notification settings - Fork 9
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
checking in changes in verify-loader script for log loss simulation #17
base: main
Are you sure you want to change the base?
Changes from 2 commits
592104b
f9d7121
c29fceb
16fd032
b1bfc5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,8 +122,10 @@ def verify(input_gen, report_interval=REPORT_INTERVAL): | |
|
||
ignored_bytes = 0 | ||
ignored_count = 0 | ||
loss_count = 0 | ||
|
||
report_bytes = 0 | ||
# report stats after every <report_interval> MB | ||
report_bytes_target = report_interval * MB | ||
report_ignored_bytes = 0 | ||
report_ignored_count = 0 | ||
|
@@ -135,16 +137,21 @@ def verify(input_gen, report_interval=REPORT_INTERVAL): | |
try: | ||
for line in input_gen: | ||
line_len = len(line) | ||
if not line.startswith("loader seq - "): | ||
#find the log header: loader seq - | ||
#for container logs the line will not start with header - instead there's a timestamp; if header not present ignore this line | ||
if "loader seq - " not in line: | ||
report_ignored_bytes += line_len | ||
report_ignored_count += 1 | ||
else: | ||
#check that line read has constituent parts after header (<header> - <uuid> - <seq_num> - <payload>) | ||
try: | ||
_, invocid, seqval, payload = line.split('-', 4) | ||
indx = line.find('loader seq -') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, we don't want to add support for prefixed data of the log lines generated by the |
||
_, invocid, seqval, payload = line[indx:].split('-', 4) | ||
except Exception: | ||
report_ignored_bytes += line_len | ||
report_ignored_count += 1 | ||
else: | ||
#check if seq_num is valid | ||
try: | ||
seq = int(seqval) | ||
except Exception: | ||
|
@@ -155,9 +162,11 @@ def verify(input_gen, report_interval=REPORT_INTERVAL): | |
invocid = invocid.strip() | ||
ctx = contexts[invocid] | ||
prev = ctx.msg(seq, line_len) | ||
# check for out of order lines - this implies LOG LOSS | ||
if prev is not None: | ||
# Bad record encountered, flag it | ||
print("%s: %d %d <-" % (invocid, seq, prev)) | ||
loss_count += (seq-prev) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if Instead we might want to consider two conditions: The add the distance between |
||
sys.stdout.flush() | ||
if payload.startswith(" (stats:"): | ||
print_stats(invocid, ctx, payload) | ||
|
@@ -192,6 +201,7 @@ def verify(input_gen, report_interval=REPORT_INTERVAL): | |
(total_count / (now - start)), | ||
(ignored_bytes / MB) / (now - start), | ||
(ignored_count / (now - start)))) | ||
print("interval stats:: total bytes: %d, total lines: %d, ignored: %d" % (report_bytes, report_count, report_ignored_count)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not add this data to the previous print statement? |
||
print("--- verify-loader\n") | ||
sys.stdout.flush() | ||
|
||
|
@@ -226,6 +236,8 @@ def verify(input_gen, report_interval=REPORT_INTERVAL): | |
(total_count / (now - start)), | ||
(ignored_bytes / MB) / (now - start), | ||
(ignored_count / (now - start)))) | ||
print("total bytes: %d, total lines: %d, ignored lines: %d, lost(out-ofseq) lines: %d" % (total_bytes, total_count, ignored_count, loss_count)) | ||
print("overall loss percentage = %.3f" %(loss_count*100.0/total_count)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not add this data to the previous print statement? |
||
print("--- verify-loader\n") | ||
if tot_skips + tot_dupes > 0: | ||
ret_val = 1 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the log lines read by
verify-loader
have a fixed prefix added to them, then something else should process that header away before sending the log lines to the verify-loader.I don't think we should try to endow
verify-loader
with an understanding of how to pull out the log lines.