Skip to content

fix: exclude current logs that start after requested range - #1273

Merged
hidb4ai merged 1 commit into
oceanbase:masterfrom
askdb:codex/fix-current-log-start-time
Nov 19, 2026
Merged

hidb4ai merged 1 commit into
oceanbase:masterfrom
askdb:codex/fix-current-log-start-time

Conversation

@askdb

@askdb askdb commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Fixes #1272.

A current Observer or OBProxy log can be collected for an earlier requested interval when rotation history is missing, or when a restart creates a gap after the last surviving rotation. For example, a current file whose first entry is at 12:00 is currently selected for a 10:00–10:05 query if no rotated files are available.

Use the first entry's timestamp to refine the start of each current file that remains a candidate after rotation-based filtering. Exclude the file when that start is later than --to, preserving fractional seconds. Quote the remote file path using the existing path helper. If the first line is unreadable or unrecognized, keep the existing conservative rotation-based estimate. Rotated/compressed selection and --recent_count behavior remain unchanged; overlapping files are still collected whole.

Update the gather log, gather obproxy_log, and gather all help to explain whole-file selection and the fallback for unknown current-log start times.

Validation:

  • GitHub Actions common unittest job passed on Python 3.11: https://github.com/oceanbase/obdiag/actions/runs/44486369481/job/135430737632
  • Reproduced the issue on master 4fda792168e297ed4ec543a2aea7e5ff84e4e65c using a temporary log directory and the real LocalClient discovery path, without a running database.
  • Added 12 regression/help tests covering missing rotation history, restart gaps, Observer and OBProxy discovery, warning logs, fractional and inclusive boundaries, unreadable/invalid headers, shell-sensitive paths, whole-file copying, and --recent_count.
  • Focused regression: python -m pytest test/common/test_gather_log_time_filter.py test/common/test_log_filter.py -q — 35 tests and 55 subtests passed on Python 3.14.
  • Expanded regression: python -m pytest test/common/test_*.py -q — 134 tests and 75 subtests passed; two existing deprecation warnings.
  • Black 24.8.0 on Python 3.11.14: black --check -S -l 256 . passed for all 446 files.
  • Python file header check passed on a clean snapshot of tracked sources; local build artifacts are excluded from that snapshot.
  • git diff --check passed.

No live remote-node SSH validation was performed. The format-check environment fix is submitted separately in #1271; this PR contains no workflow changes.

@hidb4ai
hidb4ai merged commit a0a6e41 into oceanbase:master Nov 19, 2026
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: gather log selects current files that start after --to without rotation history

2 participants