yknoya opened a new pull request, #12395: URL: https://github.com/apache/trafficserver/pull/12395
# Problem When loading host.db, it is incorrectly determined as "incompatible," and the file fails to load. This issue does not occur on the master branch. An example of how to reproduce the issue is shown below: 1. Set a value greater than 0 for `proxy.config.cache.hostdb.sync_frequency` in records.config: ``` CONFIG proxy.config.cache.hostdb.sync_frequency INT 3 ``` 2. Delete the existing host.db file (to ensure that no old version is reused). 3. Start traffic_server. 4. Wait for host.db to sync (in this example, wait 3 seconds). 5. Restart traffic_server. 6. Check diags.log: ``` $ grep "host.db" diags.log | tail -n2 [Jul 28 09:52:16.055] traffic_server WARNING: Incompatible cache at /opt/ats/9.2.x-9f6abab/var/trafficserver/host.db, not loading. [Jul 28 09:52:16.055] traffic_server WARNING: Error loading cache from /opt/ats/9.2.x-9f6abab/var/trafficserver/host.db: -1 ``` # Cause Compatibility is checked when loading host.db using the following logic: https://ghe.corp.yahoo.co.jp/cdn/trafficserver/blob/16f04bd6a849998d1db9348c5504164328541803/iocore/hostdb/P_RefCountCache.h#L593-L597 The `RefCountCacheHeader::compatible` function checks whether the following member values of `RefCountCacheHeader` are equal: * `magic` * `version` * `object_version` https://ghe.corp.yahoo.co.jp/cdn/trafficserver/blob/16f04bd6a849998d1db9348c5504164328541803/iocore/hostdb/RefCountCache.cc#L49-L53 However, the current implementation mistakenly compares `object_version` with `version`, and since the values differ, the cache is deemed incompatible: * `object_version`: 1.1 * `version`: 1.0 `object_version` was updated to 1.1 in the following PR, which likely introduced the issue starting from ATS 9.1.0: https://github.com/apache/trafficserver/pull/7264 # Fix This patch updates `RefCountCacheHeader::compatible` to compare `object_version` values correctly, instead of incorrectly comparing it with `version`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
