github.com/cockroachdb/pebble@v1.1.2/sstable/testdata/writer_range_keys (about) 1 # NOTE: The operations SET, UNSET, and DEL in this test file are aliases for 2 # RANGEKEYSET, RANGEKEYUNSET and RANGEKEYDEL, respectively. 3 4 # Keys must be added in order of start key. 5 6 build 7 SET b-d @3=foo 8 SET a-c @5=bar 9 ---- 10 pebble: spans must be added in order: b > a 11 12 # All disjoint RANGEKEYSETs. 13 # 14 # ^ 15 # | •―――○ [e,f) SET @3=baz 16 # | •―――○ [c,d) SET @2=bar 17 # |•―――――――○ [a,c) SET @1=foo 18 # |___________________________________ 19 # a b c d e f g h i 20 21 build 22 SET a-c @1=foo 23 SET c-d @2=bar 24 SET e-f @3=baz 25 ---- 26 a-c:{(#0,RANGEKEYSET,@1,foo)} 27 c-d:{(#0,RANGEKEYSET,@2,bar)} 28 e-f:{(#0,RANGEKEYSET,@3,baz)} 29 30 # Merge aligned RANGEKEYSETs. 31 # 32 # ^ 33 # |•―――――――○ [a,c) SET @3=baz 34 # |•―――――――○ [a,c) SET @1=bar 35 # |•―――――――○ [a,c) SET @2=foo 36 # |___________________________________ 37 # a b c d e f g h i 38 # 39 # Note that suffixes are sorted in descending order of the timestamp value in 40 # the suffix, rather than in lexical order. 41 42 build 43 SET a-c @2=foo 44 SET a-c @1=bar 45 SET a-c @3=baz 46 ---- 47 a-c:{(#0,RANGEKEYSET,@3,baz) (#0,RANGEKEYSET,@2,foo) (#0,RANGEKEYSET,@1,bar)} 48 49 # Aligned spans, mixed range key kinds. 50 # 51 # ^ 52 # | •―――――――――――○ [f,i) DEL 53 # | •―――――――――――○ [f,i) SET @9=v9 54 # | •―――――――――――○ [f,i) SET @8=v8 55 # | •―――――――――――○ [f,i) SET @7=v7 56 # | •―――――――――――○ [f,i) UNSET @6 57 # | •―――――――――――○ [f,i) SET @5=v5 58 # | •―――――――――――○ [f,i) SET @4=v4 59 # | •―――○ [d,e) SET @9=v9 60 # | •―――○ [d,e) DEL 61 # | •―――○ [c,d) SET @5=v5 62 # | •―――○ [c,d) SET @2=v2 63 # |•―――――――○ [a,c) UNSET @5 64 # |•―――――――○ [a,c) SET @1=v1 65 # |___________________________________ 66 # a b c d e f g h i 67 68 build 69 SET a-c @1=v1 70 UNSET a-c @5 71 SET c-d @2=v2 72 SET c-d @5=v5 73 DEL d-e 74 SET d-e @9=v9 75 SET f-i @4=v4 76 SET f-i @5=v5 77 UNSET f-i @6 78 SET f-i @7=v7 79 SET f-i @8=v8 80 SET f-i @9=v9 81 DEL f-i 82 ---- 83 a-c:{(#0,RANGEKEYSET,@1,v1) (#0,RANGEKEYUNSET,@5)} 84 c-d:{(#0,RANGEKEYSET,@5,v5) (#0,RANGEKEYSET,@2,v2)} 85 d-e:{(#0,RANGEKEYSET,@9,v9) (#0,RANGEKEYDEL)} 86 f-i:{(#0,RANGEKEYSET,@9,v9) (#0,RANGEKEYSET,@8,v8) (#0,RANGEKEYSET,@7,v7) (#0,RANGEKEYSET,@5,v5) (#0,RANGEKEYSET,@4,v4) (#0,RANGEKEYUNSET,@6) (#0,RANGEKEYDEL)} 87 88 # Merge overlapping RANGEKEYSETs. 89 # 90 # ^ 91 # | •―――○ [c,d) SET @3=baz 92 # | •―――――――――――――――○ [b,f) SET @2=bar 93 # |•―――――――○ [a,c) SET @1=foo 94 # |___________________________________ 95 # a b c d e f 96 97 build 98 SET a-c @1=foo 99 SET b-f @2=bar 100 SET c-d @3=baz 101 ---- 102 a-b:{(#0,RANGEKEYSET,@1,foo)} 103 b-c:{(#0,RANGEKEYSET,@2,bar) (#0,RANGEKEYSET,@1,foo)} 104 c-d:{(#0,RANGEKEYSET,@3,baz) (#0,RANGEKEYSET,@2,bar)} 105 d-f:{(#0,RANGEKEYSET,@2,bar)} 106 107 # Overlapping spans, mixed range keys kinds. 108 # 109 # ^ 110 # | •―――――○ [l,o) DEL 111 # | •―――――――――――――○ [e,l) SET @4=baz 112 # | •―○ [p,q) DEL 113 # | •―――――――――○ [c,h) UNSET @3 114 # | •―○ [b,c) SET @2=bar 115 # |•―――――――――――――――○ [a,i) SET @1=foo 116 # |___________________________________ 117 # a b c d e f g h i j k l m n o p q 118 119 build 120 SET a-i @1=foo 121 SET b-c @2=bar 122 UNSET c-h @3 123 DEL c-d 124 SET e-q @4=baz 125 DEL l-o 126 ---- 127 a-b:{(#0,RANGEKEYSET,@1,foo)} 128 b-c:{(#0,RANGEKEYSET,@2,bar) (#0,RANGEKEYSET,@1,foo)} 129 c-d:{(#0,RANGEKEYSET,@1,foo) (#0,RANGEKEYUNSET,@3) (#0,RANGEKEYDEL)} 130 d-e:{(#0,RANGEKEYSET,@1,foo) (#0,RANGEKEYUNSET,@3)} 131 e-h:{(#0,RANGEKEYSET,@4,baz) (#0,RANGEKEYSET,@1,foo) (#0,RANGEKEYUNSET,@3)} 132 h-i:{(#0,RANGEKEYSET,@4,baz) (#0,RANGEKEYSET,@1,foo)} 133 i-l:{(#0,RANGEKEYSET,@4,baz)} 134 l-o:{(#0,RANGEKEYSET,@4,baz) (#0,RANGEKEYDEL)} 135 o-q:{(#0,RANGEKEYSET,@4,baz)}