cockroachdb / pebble

RocksDB/LevelDB inspired key-value database in Go
BSD 3-Clause "New" or "Revised" License
4.95k stars 458 forks source link

cache: setting an existing cold entry should make it hot #4178

Open sumeerbhola opened 4 days ago

sumeerbhola commented 4 days ago

See comment in https://github.com/cockroachdb/pebble/pull/4157

// TODO(sumeer): unclear why we don't set e.ptype to etHot on this path.
// In the default case below, where the state is etTest we set it to
// etHot. But etTest is "colder" than etCold, since the only transition
// into etTest is etCold => etTest, so since etTest transitions to
// etHot, then etCold should also transition.

And @RaduBerinde's response: I think you're right. The paper says that if the page isn't in the list it is added as cold (the e == nil case) but if it is "the faulted page turns into a hot page and is placed at the head of the list".

Jira issue: PEBBLE-308