github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/sstable/testdata/buffer_pool (about) 1 # Each command prints the current state of the buffer pool. 2 # 3 # [ ] - Indicates a cell within BufferPool.pool's underlying array that's 4 # unused and does not hold a buffer. 5 # [ n] - Indicates a cell within BufferPool.pool that is not currently in use, 6 # but does hold a buffer of size n. 7 # < n> - Indicates a cell within BufferPool.pool that holds a buffer of size 8 # n, and that buffer is presently in-use and ineligible for reuse. 9 10 init size=5 11 ---- 12 [ ] [ ] [ ] [ ] [ ] 13 14 alloc n=512 handle=foo 15 ---- 16 < 512> [ ] [ ] [ ] [ ] 17 18 release handle=foo 19 ---- 20 [ 512] [ ] [ ] [ ] [ ] 21 22 # Allocating again should use the existing buffer. 23 24 alloc n=512 handle=bar 25 ---- 26 < 512> [ ] [ ] [ ] [ ] 27 28 # Allocating again should allocate a new buffer for the next slot. 29 30 alloc n=512 handle=bax 31 ---- 32 < 512> < 512> [ ] [ ] [ ] 33 34 release handle=bar 35 ---- 36 [ 512] < 512> [ ] [ ] [ ] 37 38 release handle=bax 39 ---- 40 [ 512] [ 512] [ ] [ ] [ ] 41 42 # Fill up the entire preallocated pool slice. 43 44 alloc n=128 handle=bar 45 ---- 46 < 512> [ 512] [ ] [ ] [ ] 47 48 alloc n=1 handle=bax 49 ---- 50 < 512> < 512> [ ] [ ] [ ] 51 52 alloc n=1 handle=bux 53 ---- 54 < 512> < 512> < 1> [ ] [ ] 55 56 alloc n=1024 handle=foo 57 ---- 58 < 512> < 512> < 1> <1024> [ ] 59 60 alloc n=1024 handle=fax 61 ---- 62 < 512> < 512> < 1> <1024> <1024> 63 64 # Allocating one more should grow the underlying slice, and allocate a 65 # new appropriately sized buffer. 66 67 alloc n=2048 handle=zed 68 ---- 69 < 512> < 512> < 1> <1024> <1024> <2048> [ ] [ ] [ ] [ ] 70 71 release handle=bux 72 ---- 73 < 512> < 512> [ 1] <1024> <1024> <2048> [ ] [ ] [ ] [ ] 74 75 alloc n=2 handle=bux 76 ---- 77 < 512> < 512> [ 1] <1024> <1024> <2048> < 2> [ ] [ ] [ ] 78 79 init size=0 80 ---- 81 82 alloc n=1 handle=foo 83 ---- 84 < 1>