Skip to content

Commit 2d8eadf

Browse files
authored
fix: Apply limit on matching rows, not read rows (#102)
Binary log browser is unintuitive to use with filters, the "max lines" is applied before filtering. Since we have bounded size of bin log (100MB per file) just reading everything which is ~= 100MB of text is fine IMO.
1 parent 246fed1 commit 2d8eadf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

agent/database.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def search_binary_log(
3030
f"mysqlbinlog --short-form --database {database} "
3131
f"--start-datetime '{start_datetime}' "
3232
f"--stop-datetime '{stop_datetime}' "
33-
f" {log} | grep -Piv '{LINES_TO_SKIP}' | head -n {max_lines}"
33+
f" {log} | grep -Piv '{LINES_TO_SKIP}'"
3434
)
3535

3636
DELIMITER = "/*!*/;"
@@ -55,6 +55,8 @@ def search_binary_log(
5555
),
5656
}
5757
)
58+
if len(events) > max_lines:
59+
break
5860
return events
5961

6062
@property

0 commit comments

Comments
 (0)