Skip to content

Commit

Permalink
fix: Apply limit on matching rows, not read rows (#102)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ankush authored May 17, 2024
1 parent 246fed1 commit 2d8eadf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion agent/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def search_binary_log(
f"mysqlbinlog --short-form --database {database} "
f"--start-datetime '{start_datetime}' "
f"--stop-datetime '{stop_datetime}' "
f" {log} | grep -Piv '{LINES_TO_SKIP}' | head -n {max_lines}"
f" {log} | grep -Piv '{LINES_TO_SKIP}'"
)

DELIMITER = "/*!*/;"
Expand All @@ -55,6 +55,8 @@ def search_binary_log(
),
}
)
if len(events) > max_lines:
break
return events

@property
Expand Down

0 comments on commit 2d8eadf

Please sign in to comment.