Skip to content

custombuild-v22.2.12-1-gfb443de61b5

The writeToRegistryFile method first writes the new batch, containing file
mappings, to the registry file, and then if the registry file is too big,
creates a new registry file. The new registry file is populated with the
contents of the map, which doesn't yet contain the edits in the batch,
resulting in a loss of these edits when the file registry is reopened. This
PR changes the logic to first rollover if the registry file is too big,
and then writes the batch to the new file.

This bug has existed since the record writer based registry was implemented
https://github.com/cockroachdb/cockroach/commit/239377a3b194ff7280af39ee06c3499995c44daf.
When it leads to a loss of a file mapping in the registry, it will be
noticed by Pebble as a corruption (so not a silent failure) since the file
corresponding to the mapping will be assumed to be unencrypted, but can't
be successfully read as an unencrypted file. Since we have not seen this
occur in production settings, we suspect that an observable mapping loss
is rare because compactions typically rewrite the files in those lost
mappings before the file registry is reopened.

Epic: none

Fixes: #106617

Release note: None
Assets 2
Loading