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