github.com/petermattis/pebble@v0.0.0-20190905164901-ab51a2166067/testdata/range_del (about) 1 # 1 memtable. 2 3 define 4 mem 5 a.SET.1:b 6 a.SET.3:c 7 a.SET.5:d 8 b.MERGE.1:b 9 b.MERGE.3:c 10 b.MERGE.5:d 11 b.RANGEDEL.6:c 12 b.MERGE.7:e 13 c.SET.1:b 14 c.SET.3:c 15 c.SET.5:d 16 ---- 17 mem: 1 18 19 get seq=2 20 a 21 b 22 c 23 ---- 24 b 25 b 26 b 27 28 get seq=4 29 a 30 b 31 c 32 ---- 33 c 34 cb 35 c 36 37 get seq=6 38 a 39 b 40 c 41 ---- 42 d 43 dcb 44 d 45 46 get seq=7 47 a 48 b 49 c 50 ---- 51 d 52 pebble: not found 53 d 54 55 get seq=8 56 a 57 b 58 c 59 ---- 60 d 61 e 62 d 63 64 get seq=6 65 a 66 b 67 c 68 ---- 69 d 70 dcb 71 d 72 73 iter seq=6 74 first 75 next 76 next 77 next 78 seek-ge a 79 seek-ge b 80 seek-ge c 81 seek-ge d 82 last 83 prev 84 prev 85 prev 86 seek-lt a 87 seek-lt b 88 seek-lt c 89 seek-lt d 90 ---- 91 a:d 92 b:dcb 93 c:d 94 . 95 a:d 96 b:dcb 97 c:d 98 . 99 c:d 100 b:dcb 101 a:d 102 . 103 . 104 a:d 105 b:dcb 106 c:d 107 108 iter seq=7 109 first 110 next 111 next 112 seek-ge a 113 seek-ge b 114 seek-ge c 115 seek-ge d 116 last 117 prev 118 prev 119 seek-lt a 120 seek-lt b 121 seek-lt c 122 seek-lt d 123 ---- 124 a:d 125 c:d 126 . 127 a:d 128 c:d 129 c:d 130 . 131 c:d 132 a:d 133 . 134 . 135 a:d 136 a:d 137 c:d 138 139 # Multiple memtables. 140 141 define 142 mem 143 a.SET.1:b 144 b.MERGE.1:b 145 c.SET.1:b 146 mem 147 a.SET.3:c 148 b.MERGE.3:c 149 c.SET.3:c 150 mem 151 a.SET.5:d 152 b.MERGE.5:d 153 c.SET.5:d 154 mem 155 b.RANGEDEL.6:c 156 mem 157 b.MERGE.7:e 158 ---- 159 mem: 5 160 161 get seq=2 162 a 163 b 164 c 165 ---- 166 b 167 b 168 b 169 170 get seq=4 171 a 172 b 173 c 174 ---- 175 c 176 cb 177 c 178 179 get seq=6 180 a 181 b 182 c 183 ---- 184 d 185 dcb 186 d 187 188 get seq=7 189 a 190 b 191 c 192 ---- 193 d 194 pebble: not found 195 d 196 197 get seq=8 198 a 199 b 200 c 201 ---- 202 d 203 e 204 d 205 206 get seq=6 207 a 208 b 209 c 210 ---- 211 d 212 dcb 213 d 214 215 iter seq=6 216 first 217 next 218 next 219 next 220 seek-ge a 221 seek-ge b 222 seek-ge c 223 seek-ge d 224 last 225 prev 226 prev 227 prev 228 seek-lt a 229 seek-lt b 230 seek-lt c 231 seek-lt d 232 ---- 233 a:d 234 b:dcb 235 c:d 236 . 237 a:d 238 b:dcb 239 c:d 240 . 241 c:d 242 b:dcb 243 a:d 244 . 245 . 246 a:d 247 b:dcb 248 c:d 249 250 iter seq=7 251 first 252 next 253 next 254 seek-ge a 255 seek-ge b 256 seek-ge c 257 seek-ge d 258 last 259 prev 260 prev 261 seek-lt a 262 seek-lt b 263 seek-lt c 264 seek-lt d 265 ---- 266 a:d 267 c:d 268 . 269 a:d 270 c:d 271 c:d 272 . 273 c:d 274 a:d 275 . 276 . 277 a:d 278 a:d 279 c:d 280 281 # Overlapping range deletions in the same memtable. 282 283 define 284 mem 285 a.SET.1:1 286 a.SET.3:2 287 a.SET.5:3 288 a.SET.7:4 289 b.SET.1:1 290 b.SET.3:2 291 b.SET.5:3 292 b.SET.7:4 293 c.SET.1:1 294 c.SET.3:2 295 c.SET.5:3 296 c.SET.7:4 297 d.SET.1:1 298 d.SET.3:2 299 d.SET.5:3 300 d.SET.7:4 301 a.RANGEDEL.2:b 302 b.RANGEDEL.4:c 303 b.RANGEDEL.2:c 304 c.RANGEDEL.6:d 305 c.RANGEDEL.4:d 306 c.RANGEDEL.2:d 307 ---- 308 mem: 1 309 310 get seq=2 311 a 312 b 313 c 314 d 315 ---- 316 1 317 1 318 1 319 1 320 321 get seq=3 322 a 323 b 324 c 325 d 326 ---- 327 pebble: not found 328 pebble: not found 329 pebble: not found 330 1 331 332 get seq=5 333 a 334 b 335 c 336 d 337 ---- 338 2 339 pebble: not found 340 pebble: not found 341 2 342 343 get seq=7 344 a 345 b 346 c 347 d 348 ---- 349 3 350 3 351 pebble: not found 352 3 353 354 get seq=9 355 a 356 b 357 c 358 d 359 ---- 360 4 361 4 362 4 363 4 364 365 iter seq=2 366 first 367 next 368 next 369 next 370 next 371 last 372 prev 373 prev 374 prev 375 prev 376 ---- 377 a:1 378 b:1 379 c:1 380 d:1 381 . 382 d:1 383 c:1 384 b:1 385 a:1 386 . 387 388 iter seq=3 389 first 390 next 391 last 392 prev 393 ---- 394 d:1 395 . 396 d:1 397 . 398 399 iter seq=5 400 first 401 next 402 next 403 last 404 prev 405 prev 406 ---- 407 a:2 408 d:2 409 . 410 d:2 411 a:2 412 . 413 414 iter seq=7 415 first 416 next 417 next 418 next 419 last 420 prev 421 prev 422 prev 423 ---- 424 a:3 425 b:3 426 d:3 427 . 428 d:3 429 b:3 430 a:3 431 . 432 433 iter seq=9 434 first 435 next 436 next 437 next 438 next 439 last 440 prev 441 prev 442 prev 443 prev 444 ---- 445 a:4 446 b:4 447 c:4 448 d:4 449 . 450 d:4 451 c:4 452 b:4 453 a:4 454 . 455 456 # Overlapping range deletions in different memtables. Note that the 457 # range tombstones are not fragmented in this case. 458 459 define 460 mem 461 a.SET.1:1 462 b.SET.1:1 463 c.SET.1:1 464 d.SET.1:1 465 mem 466 a.SET.3:2 467 b.SET.3:2 468 c.SET.3:2 469 d.SET.3:2 470 a.RANGEDEL.2:d 471 mem 472 a.SET.5:3 473 b.SET.5:3 474 c.SET.5:3 475 d.SET.5:3 476 b.RANGEDEL.4:d 477 mem 478 a.SET.7:4 479 b.SET.7:4 480 c.SET.7:4 481 d.SET.7:4 482 c.RANGEDEL.4:d 483 ---- 484 mem: 4 485 486 get seq=2 487 a 488 b 489 c 490 d 491 ---- 492 1 493 1 494 1 495 1 496 497 get seq=3 498 a 499 b 500 c 501 d 502 ---- 503 pebble: not found 504 pebble: not found 505 pebble: not found 506 1 507 508 get seq=5 509 a 510 b 511 c 512 d 513 ---- 514 2 515 pebble: not found 516 pebble: not found 517 2 518 519 get seq=7 520 a 521 b 522 c 523 d 524 ---- 525 3 526 3 527 pebble: not found 528 3 529 530 get seq=9 531 a 532 b 533 c 534 d 535 ---- 536 4 537 4 538 4 539 4 540 541 iter seq=2 542 first 543 next 544 next 545 next 546 next 547 last 548 prev 549 prev 550 prev 551 prev 552 ---- 553 a:1 554 b:1 555 c:1 556 d:1 557 . 558 d:1 559 c:1 560 b:1 561 a:1 562 . 563 564 iter seq=3 565 first 566 next 567 last 568 prev 569 ---- 570 d:1 571 . 572 d:1 573 . 574 575 iter seq=5 576 first 577 next 578 next 579 last 580 prev 581 prev 582 ---- 583 a:2 584 d:2 585 . 586 d:2 587 a:2 588 . 589 590 iter seq=7 591 first 592 next 593 next 594 next 595 last 596 prev 597 prev 598 prev 599 ---- 600 a:3 601 b:3 602 d:3 603 . 604 d:3 605 b:3 606 a:3 607 . 608 609 iter seq=9 610 first 611 next 612 next 613 next 614 next 615 last 616 prev 617 prev 618 prev 619 prev 620 ---- 621 a:4 622 b:4 623 c:4 624 d:4 625 . 626 d:4 627 c:4 628 b:4 629 a:4 630 . 631 632 # User-key that spans tables in a level. 633 634 define 635 L1 636 a.SET.3:3 637 L1 638 a.SET.2:2 639 L1 640 a.SET.1:1 641 ---- 642 mem: 1 643 1: a-a a-a a-a 644 645 get seq=1 646 a 647 ---- 648 pebble: not found 649 650 get seq=2 651 a 652 ---- 653 1 654 655 get seq=3 656 a 657 ---- 658 2 659 660 get seq=4 661 a 662 ---- 663 3 664 665 iter seq=2 666 first 667 seek-ge a 668 seek-ge b 669 last 670 seek-lt a 671 seek-lt b 672 ---- 673 a:1 674 a:1 675 . 676 a:1 677 . 678 a:1 679 680 iter seq=3 681 first 682 seek-ge a 683 seek-ge b 684 last 685 seek-lt a 686 seek-lt b 687 ---- 688 a:2 689 a:2 690 . 691 a:2 692 . 693 a:2 694 695 iter seq=4 696 first 697 seek-ge a 698 seek-ge b 699 last 700 seek-lt a 701 seek-lt b 702 ---- 703 a:3 704 a:3 705 . 706 a:3 707 . 708 a:3 709 710 define 711 L1 712 a.MERGE.3:3 713 L1 714 a.MERGE.2:2 715 L1 716 a.MERGE.1:1 717 ---- 718 mem: 1 719 1: a-a a-a a-a 720 721 get seq=1 722 a 723 ---- 724 pebble: not found 725 726 get seq=2 727 a 728 ---- 729 1 730 731 get seq=3 732 a 733 ---- 734 21 735 736 get seq=4 737 a 738 ---- 739 321 740 741 iter seq=2 742 first 743 seek-ge a 744 seek-ge b 745 last 746 seek-lt a 747 seek-lt b 748 ---- 749 a:1 750 a:1 751 . 752 a:1 753 . 754 a:1 755 756 iter seq=3 757 first 758 seek-ge a 759 seek-ge b 760 last 761 seek-lt a 762 seek-lt b 763 ---- 764 a:21 765 a:21 766 . 767 a:21 768 . 769 a:21 770 771 iter seq=4 772 first 773 seek-ge a 774 seek-ge b 775 last 776 seek-lt a 777 seek-lt b 778 ---- 779 a:321 780 a:321 781 . 782 a:321 783 . 784 a:321 785 786 # User-key spread across multiple levels. 787 788 define 789 mem 790 a.MERGE.4:4 791 L1 792 a.MERGE.3:3 793 L2 794 a.MERGE.2:2 795 L3 796 a.MERGE.1:1 797 ---- 798 mem: 1 799 1: a-a 800 2: a-a 801 3: a-a 802 803 get seq=1 804 a 805 ---- 806 pebble: not found 807 808 get seq=2 809 a 810 ---- 811 1 812 813 get seq=3 814 a 815 ---- 816 21 817 818 get seq=4 819 a 820 ---- 821 321 822 823 get seq=5 824 a 825 ---- 826 4321 827 828 iter seq=2 829 first 830 seek-ge a 831 seek-ge b 832 last 833 seek-lt a 834 seek-lt b 835 ---- 836 a:1 837 a:1 838 . 839 a:1 840 . 841 a:1 842 843 iter seq=3 844 first 845 seek-ge a 846 seek-ge b 847 last 848 seek-lt a 849 seek-lt b 850 ---- 851 a:21 852 a:21 853 . 854 a:21 855 . 856 a:21 857 858 iter seq=4 859 first 860 seek-ge a 861 seek-ge b 862 last 863 seek-lt a 864 seek-lt b 865 ---- 866 a:321 867 a:321 868 . 869 a:321 870 . 871 a:321 872 873 iter seq=5 874 first 875 seek-ge a 876 seek-ge b 877 last 878 seek-lt a 879 seek-lt b 880 ---- 881 a:4321 882 a:4321 883 . 884 a:4321 885 . 886 a:4321 887 888 # Range deletions on multiple levels. 889 define 890 L0 891 a.SET.4:4 892 b.SET.4:4 893 d.SET.4:4 894 c.RANGEDEL.4:d 895 L1 896 a.SET.3:3 897 d.SET.3:3 898 b.RANGEDEL.3:d 899 L2 900 d.SET.2:2 901 a.RANGEDEL.2:d 902 L3 903 a.SET.1:1 904 b.SET.1:1 905 c.SET.1:1 906 d.SET.1:1 907 ---- 908 mem: 1 909 0: a-d 910 1: a-d 911 2: a-d 912 3: a-d 913 914 get seq=2 915 a 916 b 917 c 918 d 919 ---- 920 1 921 1 922 1 923 1 924 925 get seq=3 926 a 927 b 928 c 929 d 930 ---- 931 pebble: not found 932 pebble: not found 933 pebble: not found 934 2 935 936 get seq=4 937 a 938 b 939 c 940 d 941 ---- 942 3 943 pebble: not found 944 pebble: not found 945 3 946 947 get seq=5 948 a 949 b 950 c 951 d 952 ---- 953 4 954 4 955 pebble: not found 956 4 957 958 iter seq=2 959 first 960 next 961 next 962 next 963 last 964 prev 965 prev 966 prev 967 ---- 968 a:1 969 b:1 970 c:1 971 d:1 972 d:1 973 c:1 974 b:1 975 a:1 976 977 iter seq=3 978 first 979 last 980 ---- 981 d:2 982 d:2 983 984 iter seq=4 985 first 986 next 987 last 988 prev 989 ---- 990 a:3 991 d:3 992 d:3 993 a:3 994 995 iter seq=5 996 first 997 next 998 next 999 last 1000 prev 1001 prev 1002 ---- 1003 a:4 1004 b:4 1005 d:4 1006 d:4 1007 b:4 1008 a:4 1009 1010 # Range deletions spanning tables within a level. 1011 1012 define 1013 mem 1014 a.SET.3:3 1015 b.SET.3:3 1016 c.SET.3:3 1017 d.SET.3:3 1018 L1 1019 a.RANGEDEL.2:b 1020 L1 1021 b.RANGEDEL.2:c 1022 L1 1023 c.RANGEDEL.2:d 1024 L2 1025 a.SET.1:1 1026 b.SET.1:1 1027 c.SET.1:1 1028 d.SET.1:1 1029 ---- 1030 mem: 1 1031 1: a-b b-c c-d 1032 2: a-d 1033 1034 get seq=2 1035 a 1036 b 1037 c 1038 d 1039 ---- 1040 1 1041 1 1042 1 1043 1 1044 1045 get seq=3 1046 a 1047 b 1048 c 1049 d 1050 ---- 1051 pebble: not found 1052 pebble: not found 1053 pebble: not found 1054 1 1055 1056 get seq=4 1057 a 1058 b 1059 c 1060 d 1061 ---- 1062 3 1063 3 1064 3 1065 3 1066 1067 iter seq=2 1068 first 1069 next 1070 next 1071 next 1072 last 1073 prev 1074 prev 1075 prev 1076 ---- 1077 a:1 1078 b:1 1079 c:1 1080 d:1 1081 d:1 1082 c:1 1083 b:1 1084 a:1 1085 1086 iter seq=3 1087 first 1088 last 1089 ---- 1090 d:1 1091 d:1 1092 1093 iter seq=4 1094 first 1095 next 1096 next 1097 next 1098 last 1099 prev 1100 prev 1101 prev 1102 ---- 1103 a:3 1104 b:3 1105 c:3 1106 d:3 1107 d:3 1108 c:3 1109 b:3 1110 a:3 1111 1112 # Invalid LSM structure (range deletion at newer level covers newer 1113 # write at an older level). This LSM structure is not generated 1114 # naturally, but tested here to show the level-by-level nature of Get. 1115 1116 define 1117 L1 1118 a.RANGEDEL.1:b 1119 L2 1120 a.SET.2:2 1121 ---- 1122 mem: 1 1123 1: a-b 1124 2: a-a 1125 1126 get seq=3 1127 a 1128 ---- 1129 pebble: not found 1130 1131 # A range tombstone straddles two SSTs. One is compacted to a lower level. Its 1132 # keys that are newer than the range tombstone should not disappear. 1133 # 1134 # Uses a snapshot to prevent range tombstone from being elided when it gets 1135 # compacted to the bottommost level. 1136 1137 define target-file-sizes=(100, 1) snapshots=(1) 1138 L0 1139 a.RANGEDEL.1:e 1140 L0 1141 a.SET.2:v 1142 L0 1143 c.SET.3:v 1144 ---- 1145 mem: 1 1146 0: a-e a-a c-c 1147 1148 compact a-e 1149 ---- 1150 1: a-c c-e 1151 1152 compact d-e 1153 ---- 1154 1: a-c 1155 2: c-e 1156 1157 iter seq=4 1158 seek-ge b 1159 next 1160 ---- 1161 c:v 1162 . 1163 1164 # Reverse the above test: compact the left file containing the split range 1165 # tombstone downwards, and iterate from right to left. 1166 1167 define target-file-sizes=(100, 1) snapshots=(1) 1168 L0 1169 a.RANGEDEL.1:e 1170 L0 1171 a.SET.2:v 1172 L0 1173 c.SET.3:v 1174 ---- 1175 mem: 1 1176 0: a-e a-a c-c 1177 1178 compact a-e 1179 ---- 1180 1: a-c c-e 1181 1182 compact a-b 1183 ---- 1184 1: c-e 1185 2: a-c 1186 1187 iter seq=4 1188 seek-lt d 1189 prev 1190 prev 1191 ---- 1192 c:v 1193 a:v 1194 . 1195 1196 # A range tombstone straddles two sstables. One is compacted two 1197 # levels lower. The other is compacted one level lower. The one that 1198 # is compacted one level lower should not see its boundaries expand 1199 # causing it to delete more keys. A snapshot is used to prevent range 1200 # tombstone from being elided when it gets compacted to the bottommost 1201 # level. 1202 1203 define target-file-sizes=(100, 1) snapshots=(1) 1204 L0 1205 a.RANGEDEL.1:e 1206 L0 1207 a.SET.2:v 1208 L0 1209 c.SET.3:v 1210 L2 1211 d.SET.0:v 1212 ---- 1213 mem: 1 1214 0: a-e a-a c-c 1215 2: d-d 1216 1217 compact a-b 1218 ---- 1219 1: a-c c-e 1220 2: d-d 1221 1222 compact d-e 1223 ---- 1224 1: a-c 1225 3: c-d d-e 1226 1227 get seq=4 1228 c 1229 ---- 1230 v 1231 1232 compact a-b L1 1233 ---- 1234 2: a-c 1235 3: c-d d-e 1236 1237 get seq=4 1238 c 1239 ---- 1240 v 1241 1242 # A slight variation on the scenario above where a range tombstone is 1243 # expanded past the boundaries of its "atomic compaction unit". 1244 1245 define target-file-sizes=(100, 1) snapshots=(1) 1246 L0 1247 a.RANGEDEL.1:e 1248 L0 1249 a.SET.2:v 1250 L0 1251 c.SET.3:v 1252 L0 1253 f.SET.4:v 1254 L2 1255 d.SET.0:v 1256 ---- 1257 mem: 1 1258 0: a-e a-a c-c f-f 1259 2: d-d 1260 1261 compact a-b 1262 ---- 1263 0: f-f 1264 1: a-c c-e 1265 2: d-d 1266 1267 compact d-e 1268 ---- 1269 0: f-f 1270 1: a-c 1271 3: c-d d-e 1272 1273 get seq=4 1274 c 1275 ---- 1276 v 1277 1278 compact f-f L0 1279 ---- 1280 1: a-c f-f 1281 3: c-d d-e 1282 1283 compact a-f L1 1284 ---- 1285 2: a-c f-f 1286 3: c-d d-e 1287 1288 get seq=4 1289 c 1290 ---- 1291 v