records.snap version check ignores the major version once it has two digits
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with RecFile.cc and P_RecCore.cc, especially the RecSnapFileWrite() and CheckSnapFileVersion() locations linked in the issue. Trace how the five-byte header is written and checked, then review the version constants and snapshot reader behavior. Done means snapshots from incompatible formats are rejected while compatible releases keep the intended persistent stats.
索引モデルが issue の本文から書いたものです。
説明
RecSnapFileWrite() starts records.snap with five version bytes, 'V', PACKAGE_VERSION[0], PACKAGE_VERSION[2], PACKAGE_VERSION[4] and '\0' (RecFile.cc). At startup CheckSnapFileVersion() compares the same three characters and removes the file when they differ (P_RecCore.cc).
The check was added when the major version had one digit, so those characters were major, minor and patch: 9.2.5 writes 9, 2, 5. With a two-digit major they are the first digit of the major and two dots. 10.2.1 and 11.0.0 both write 1, ., ., so every 10.x and 11.x release accepts a snapshot written by any other, and the file is never removed on an upgrade between them.
No harm today: the RecRecord layout that the snapshot stores has not changed since 10.2.1. Once it changes, an 11.x server will read records written with the old layout, and only the reader's own bounds and type checks (added in #14147) stand between those bytes and the restore. Those checks keep the reader inside the buffer, but they cannot tell that a field moved, so a stat could come back with a wrong value.
A fix would compare what actually identifies the format. Two options that keep the five-byte header:
- Write the major, minor and patch numbers as byte values (
TS_VERSION_MAJOR,TS_VERSION_MINOR,TS_VERSION_MICRO) instead of characters of the version string, and compare all three. A file from a release with the old encoding then differs and is removed once, on the upgrade. - Write a snapshot format number that is bumped whenever
RecRecordor the message layout changes, so a patch release does not throw away persistent stats for nothing.
Comparing the whole PACKAGE_VERSION string would also work, but needs a longer header.
Raised by Damian (brbzull0) in review of #14147.
- 主要言語
- C++
- スター
- 2k
- フォーク
- 903
- 平均マージ
- 4日 4時間
- マージ済み PR(30日)
- 135
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/trafficserver のほかの issue
-
UnixNetVConnection::do_io_write with a null reader leaves the previous reader in the write VIO対応中かも @NginxL が今日担当しました。 オープンBug Good First Issue IOBuffer Network
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/trafficserver#14220 ·
メンテナーはふだん 2 日以内に返信
-
MallocAllocator does not check for allocation failure対応中かも @umrndem が今日担当しました。 オープンBug Core Good First Issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/trafficserver#14218 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
Bug Event System Threads
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/trafficserver#14217 ·
メンテナーはふだん 2 日以内に返信
-
TSContScheduleEveryOnPool and TSContScheduleEveryOnThread accept a zero or negative period対応中かも @rajeetvk が 1 日前に担当しました。 オープンBug Event System Good First Issue TS API
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/trafficserver#14214 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
HostDBContinuation::init memsets a polymorphic Action対応中かも @ANMOLSCRIPT が今日担当しました。 オープンBug Good First Issue HostDB
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/trafficserver#14204 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
apache/trafficserver の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 2 日以内に返信
-
bug data-types
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ClickHouse/clickhouse-cpp#645 ·
メンテナーはふだん 1 日以内に返信
-
bug compatibility difficulty:easy prio:normal
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
NatronGitHub/openfx-misc#524 ·
メンテナーはふだん 1 日以内に返信
-
documentation enhancement help wanted P0
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
メンテナーはふだん 1 日以内に返信
-
Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openscad/openscad#7360 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信