Skip to content

Commit

Permalink
Large object storage (#125)
Browse files Browse the repository at this point in the history
vsql now supports storing objects (rows, tables, etc) larger than a page
(which previously was a serious limitation). This happens entirely
transparently on the B-tree implementation where larger objects are
split (and reconstructed) to and from new `B` (blob) and `F` (fragment)
objects.

This is a breaking change to the file format. Some other notable
improvements:

- Documentation now has Excalidraw diagrams. The "File Format" page has
been totally overhauled and is a lot easier to understand and much
nicer to look at: https://vsql.readthedocs.io/en/latest/file-format.html

- Added "Limitations" page. Among which, a vsql file - in theory - can
hold up to 128PB (wholly untested, of course).

- Page splitting now has a heavy bias towards filling the left page as
much as possible (rather than even splitting). We prefer the left page
to be a full as possible because the keys are sequential, so in the case
of lots of sequential inserts it can pack the data more tightly and
causes less page splits as new data is inserted.

- Added another B-tree test for testing 100k sequential inserts/deletes
and improved the existing random insert/remove test matrix from just 48
byte objects to also include 148 byte objects (one object per page) and
348 byte objects (always using blob storage).

Fixes #43
  • Loading branch information
elliotchance authored Aug 4, 2022
1 parent 2c4c6f1 commit 7ee3bfd
Show file tree
Hide file tree
Showing 27 changed files with 11,326 additions and 507 deletions.
478 changes: 142 additions & 336 deletions docs/file-format.rst

Large diffs are not rendered by default.

1,074 changes: 1,074 additions & 0 deletions docs/img/file-format-blob-1.excalidraw

Large diffs are not rendered by default.

Binary file added docs/img/file-format-blob-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,412 changes: 1,412 additions & 0 deletions docs/img/file-format-blob-2.excalidraw

Large diffs are not rendered by default.

Binary file added docs/img/file-format-blob-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,503 changes: 1,503 additions & 0 deletions docs/img/file-format-blob-3.excalidraw

Large diffs are not rendered by default.

Binary file added docs/img/file-format-blob-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
878 changes: 878 additions & 0 deletions docs/img/file-format-layout.excalidraw

Large diffs are not rendered by default.

Binary file added docs/img/file-format-layout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
598 changes: 598 additions & 0 deletions docs/img/file-format-leaf-page.excalidraw

Large diffs are not rendered by default.

Binary file added docs/img/file-format-leaf-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
965 changes: 965 additions & 0 deletions docs/img/file-format-non-leaf-page.excalidraw

Large diffs are not rendered by default.

Binary file added docs/img/file-format-non-leaf-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,860 changes: 2,860 additions & 0 deletions docs/img/file-format-non-leaf-reference.excalidraw

Large diffs are not rendered by default.

Binary file added docs/img/file-format-non-leaf-reference.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
976 changes: 976 additions & 0 deletions docs/img/file-format-object.excalidraw

Large diffs are not rendered by default.

Binary file added docs/img/file-format-object.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
450 changes: 450 additions & 0 deletions docs/img/file-format-page.excalidraw

Large diffs are not rendered by default.

Binary file added docs/img/file-format-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Internals
:maxdepth: 1

file-format.rst
limitations.rst
mvcc.rst
28 changes: 28 additions & 0 deletions docs/limitations.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Limitations
===========

These have not been tested, but are based on fundamental design choices:

.. list-table::
:header-rows: 1

* - Description
- Limit

* - The maximum page size (when creating a new file)
- 65536 bytes (64 KB)

* - The maximum number of pages in a file
- 2147483647 (~2.1 billion)

* - The maximum file size (using the default page size)
- 8 PB

* - The maximum file size (using the maximum page size)
- 128 PB

* - The maximum object size (using the default page size)
- 8 TB

* - The maximum object size (using the maximum page size)
- 128 TB
Loading

0 comments on commit 7ee3bfd

Please sign in to comment.