Skip to content

fix: select gather log files by time range overlap and support 14-digit obproxy timestamps - #1270

Merged
askdb merged 1 commit into
oceanbase:masterfrom
sgjr:fix/1269-obproxy-log-time-filter
Nov 19, 2026
Merged

askdb merged 1 commit into
oceanbase:masterfrom
sgjr:fix/1269-obproxy-log-time-filter

Conversation

@sgjr

@sgjr sgjr commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1269. gather obproxy_log with --from/--to did not collect the logs of the requested time range. Observer log gathering also missed the file that covers the end of the requested range.

  • obproxy: support 14-digit timestamps. ObproxyGatherLogOnNode now overrides _parse_timestamp_from_filename / _get_log_type, so it recognizes the YYYYMMDDHHMMSS format used in names like obproxy.log.20261111212023. Before this change it used the 17-digit observer pattern, so no rotated obproxy log could be parsed and all of them were skipped.
  • Select files by time range overlap. A new shared method BaseGatherLogOnNode._filter_logs_by_time_range is used by both obproxy (through _get_logfile_names_by_time) and observer (_filter_logs_by_time).
    • The timestamp in a rotated file name is the end time of that file (the rotation time). Its start time is the previous rotation time of the same log type in the same directory.
    • A file is kept when start <= to and end >= from. The start time of the oldest rotated file and the end time of the current file are unknown, so they are treated as unbounded.
    • The current log file (no timestamp in its name) is no longer collected unconditionally. It is collected only when the period after the last rotation overlaps the requested range.
    • Compressed rotated files (.gz/.zst) are grouped with the uncompressed files of the same log type and share the same time chain.
  • Removed the now unused _is_file_in_time_range.

The --recent_count logic is unchanged. Because obproxy timestamps are now parsed correctly, keeping the most recent N files per log type also gives the right result for obproxy.

Validation

  • Added test/common/test_gather_log_time_filter.py with 8 test cases, covering:
    • parsing of 14-digit obproxy timestamps;
    • a range that spans several rotated files, a range inside a single rotated file, and a range after the last rotation;
    • unrecognized files being skipped;
    • observer compressed files (.zst), separate grouping for the alert/ subdirectory, and a range before the first rotation.
    • 7 of these test cases fail on the code before this fix.
  • python -m unittest discover -s test/common -p 'test_*.py': all 122 tests pass (Python 3.11).
  • black --check -S -l 256 . (black 24.8.0, same as CI): passes.
  • python workflow_data/check_py_files.py .: passes.
  • git diff --check: passes.

Closes #1269

…it obproxy timestamps

- obproxy: parse 14-digit rotated log timestamps (obproxy.log.YYYYMMDDHHMMSS);
  the 17-digit observer pattern made every rotated obproxy log be skipped
- base/observer: keep a log file when [previous rotation, rotation time]
  overlaps [from, to] instead of requiring the rotation time inside the range;
  the current log file is no longer collected unconditionally
- add regression tests for obproxy and observer time filtering

Closes oceanbase#1269
@CLAassistant

CLAassistant commented Nov 13, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@askdb
askdb merged commit 4fda792 into oceanbase:master Nov 19, 2026
17 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 obproxy_log 指定 --from/--to 后拿不到对应时段日志:14 位时间戳的 obproxy 轮转日志始终被跳过

4 participants