fix lru cache handle field order (#21435)

For LRUHandle, all fields should be put ahead of key_data.
The LRUHandle is allocated using malloc and starting from field key_data is for key data.
This commit is contained in:
hqx871
2023-07-04 16:10:05 +08:00
committed by GitHub
parent 9e8501f191
commit 09f414e0f4

View File

@ -254,8 +254,8 @@ struct LRUHandle {
uint32_t hash; // Hash of key(); used for fast sharding and comparisons
CachePriority priority = CachePriority::NORMAL;
MemTrackerLimiter* mem_tracker;
char key_data[1]; // Beginning of key
LRUCacheType type;
char key_data[1]; // Beginning of key
CacheKey key() const {
// For cheaper lookups, we allow a temporary Handle object