From 16f77d26c0c38a6572d522c9bf0c77558e01e229 Mon Sep 17 00:00:00 2001 From: Christopher Berner Date: Fri, 10 Feb 2023 19:40:51 -0800 Subject: [PATCH] Update design doc with value alignment design This feature is not implemented, and there is no clear path to implementing it (see https://github.com/cberner/redb/issues/360). However, if it becomes possible to implement it in the future, this design should be backward compatible --- docs/design.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/design.md b/docs/design.md index 61a94706..b282c289 100644 --- a/docs/design.md +++ b/docs/design.md @@ -238,7 +238,7 @@ Allocated pages may be of two types: b-tree branch pages, or b-tree leaf pages. -------------------------------------------------------------------------------------------------- | child page number (repeated num_keys + 1 times) | -------------------------------------------------------------------------------------------------- -| (optional) key end (repeated num_keys times) | ... more key ends | +| (optional) key end (repeated num_keys times) | alignment padding | ================================================================================================== | Key data | ================================================================================================== @@ -253,6 +253,8 @@ Allocated pages may be of two types: b-tree branch pages, or b-tree leaf pages. `key_end` is an array of ending offsets for the keys. It is optional, MUST NOT be stored for fixed width key types +`alignment padding` optional padding so that the key data begins at a multiple of the key type's required alignment + ### Leaf page: * 1 byte: type * 1 byte: reserved (padding to 16bits aligned) @@ -270,9 +272,9 @@ Allocated pages may be of two types: b-tree branch pages, or b-tree leaf pages. ================================================================================================== | type | padding | number of entries | (optional) key end (repeated entries times) | -------------------------------------------------------------------------------------------------- -| (optional) value end (repeated entries times) | .. more key/value ends | +| (optional) value end (repeated entries times) | (optional) key alignment padding | ================================================================================================== -| Key data | +| Key data | (optional) value alignment padding | ================================================================================================== | Value data | ================================================================================================== @@ -286,6 +288,10 @@ Allocated pages may be of two types: b-tree branch pages, or b-tree leaf pages. `value_end` is an array of ending offsets for the values. It is optional, MUST NOT be stored for fixed width value types +`key alignment padding` optional padding so that the key data begins at a multiple of the key type's required alignment + +`value alignment padding` optional padding so that the value data begins at a multiple of the value type's required alignment + # Commit strategies All redb transactions are atomic, and use one of the following commit strategies.