mirror of
https://github.com/neondatabase/neon.git
synced 2026-10-16 08:42:56 +00:00
Prepare for first stage of deployment: do not bump format version and do not write data in new format but recognoze new format
This commit is contained in:
@@ -40,7 +40,7 @@ use tracing::info;
|
||||
/// format, bump this!
|
||||
/// Note that TimelineMetadata uses its own version number to track
|
||||
/// backwards-compatible changes to the metadata format.
|
||||
pub const STORAGE_FORMAT_VERSION: u16 = 4;
|
||||
pub const STORAGE_FORMAT_VERSION: u16 = 3;
|
||||
|
||||
/// Minimal sorage format version with compression support
|
||||
pub const COMPRESSED_STORAGE_FORMAT_VERSION: u16 = 4;
|
||||
|
||||
@@ -396,8 +396,8 @@ impl ImageLayerInner {
|
||||
let actual_summary =
|
||||
Summary::des_prefix(summary_blk.as_ref()).context("deserialize first block")?;
|
||||
|
||||
if actual_summary.format_version > STORAGE_FORMAT_VERSION {
|
||||
bail!("Forward compatibility of storage is not supported: current format version is {}, format version of layer {} is {}", STORAGE_FORMAT_VERSION, path, actual_summary.format_version);
|
||||
if actual_summary.format_version > COMPRESSED_STORAGE_FORMAT_VERSION {
|
||||
bail!("Forward compatibility of storage is not supported: current format version is {}, format version of layer {} is {}", COMPRESSED_STORAGE_FORMAT_VERSION, path, actual_summary.format_version);
|
||||
}
|
||||
if let Some(mut expected_summary) = summary {
|
||||
// assume backward compatibility
|
||||
@@ -697,10 +697,15 @@ impl ImageLayerWriterInner {
|
||||
///
|
||||
async fn put_image(&mut self, key: Key, img: Bytes) -> anyhow::Result<()> {
|
||||
ensure!(self.key_range.contains(&key));
|
||||
let off = self
|
||||
.blob_writer
|
||||
.write_compressed_blob(img, self.compression)
|
||||
.await?;
|
||||
let off = if STORAGE_FORMAT_VERSION >= COMPRESSED_STORAGE_FORMAT_VERSION {
|
||||
self.blob_writer
|
||||
.write_compressed_blob(img, self.compression)
|
||||
.await?
|
||||
} else {
|
||||
let (_img, res) = self.blob_writer.write_blob(img).await;
|
||||
// TODO: re-use the buffer for `img` further upstack
|
||||
res?
|
||||
};
|
||||
let mut keybuf: [u8; KEY_SIZE] = [0u8; KEY_SIZE];
|
||||
key.write_to_byte_slice(&mut keybuf);
|
||||
self.tree.append(&keybuf, off)?;
|
||||
|
||||
@@ -195,7 +195,6 @@ def test_backward_compatibility(
|
||||
@check_ondisk_data_compatibility_if_enabled
|
||||
@pytest.mark.xdist_group("compatibility")
|
||||
@pytest.mark.order(after="test_create_snapshot")
|
||||
@pytest.mark.skip("Compression support breaks forward compatibility")
|
||||
def test_forward_compatibility(
|
||||
neon_env_builder: NeonEnvBuilder,
|
||||
test_output_dir: Path,
|
||||
|
||||
Reference in New Issue
Block a user