github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/testdata/compaction_iter (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,1:b 173 . 174 175 iter snapshots=6 176 first 177 next 178 next 179 ---- 180 a#9,1:b 181 a#5,1:f 182 . 183 184 iter snapshots=7 185 first 186 next 187 next 188 ---- 189 a#9,1:b 190 a#6,0: 191 . 192 193 iter snapshots=8 194 first 195 next 196 next 197 ---- 198 a#9,1:b 199 a#7,1: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,1: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,1: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,1: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,1: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,1: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 define 766 a.SET.2:b 767 a.SINGLEDEL.1: 768 ---- 769 770 iter 771 first 772 next 773 ---- 774 a#2,1:b 775 . 776 777 define 778 a.MERGE.6:b 779 a.SINGLEDEL.5: 780 a.SET.4:a 781 ---- 782 783 iter 784 first 785 next 786 ---- 787 a#6,1:b[base] 788 . 789 790 # Non-deterministic use of SINGLEDEL where there are two older SETs that have 791 # not been deleted or single deleted. It is permitted to shadow both. 792 define 793 a.MERGE.6:b 794 a.SINGLEDEL.5: 795 a.SET.4:a 796 a.SET.3:a 797 ---- 798 799 iter 800 first 801 next 802 ---- 803 a#6,1:b[base] 804 . 805 806 define 807 a.SINGLEDEL.2: 808 a.SET.1:b 809 b.SET.3:c 810 ---- 811 812 iter 813 first 814 next 815 ---- 816 b#3,1:c 817 . 818 819 define 820 a.SINGLEDEL.3: 821 a.SET.2:b 822 a.SET.1:a 823 ---- 824 825 iter 826 first 827 next 828 ---- 829 a#1,1:a 830 . 831 832 define 833 a.SINGLEDEL.3: 834 a.MERGE.2:b 835 a.MERGE.1:a 836 ---- 837 838 iter 839 first 840 next 841 ---- 842 a#3,0: 843 . 844 845 define 846 a.SINGLEDEL.4: 847 a.SET.3:val 848 a.SINGLEDEL.2: 849 a.SET.1:val 850 ---- 851 852 iter 853 first 854 ---- 855 . 856 857 iter snapshots=2 858 first 859 next 860 next 861 ---- 862 a#2,7: 863 a#1,1:val 864 . 865 866 define 867 a.SINGLEDEL.4: 868 a.SET.3:val 869 a.DEL.2: 870 a.SET.1:val 871 ---- 872 873 iter 874 first 875 next 876 ---- 877 a#2,0: 878 . 879 880 iter snapshots=2 881 first 882 next 883 next 884 ---- 885 a#2,0: 886 a#1,1:val 887 . 888 889 iter snapshots=3 890 first 891 next 892 ---- 893 a#2,0: 894 . 895 896 iter snapshots=(2,3) 897 first 898 next 899 next 900 ---- 901 a#2,0: 902 a#1,1:val 903 . 904 905 define 906 a.SINGLEDEL.4: 907 a.SET.3:c 908 a.MERGE.2:b 909 a.SET.1:a 910 ---- 911 912 iter 913 first 914 next 915 ---- 916 a#2,1:ab[base] 917 . 918 919 iter snapshots=2 920 first 921 next 922 next 923 ---- 924 a#2,2:b 925 a#1,1:a 926 . 927 928 iter snapshots=3 929 first 930 next 931 ---- 932 a#2,1:ab[base] 933 . 934 935 iter snapshots=(2,3,4) 936 first 937 next 938 next 939 next 940 next 941 ---- 942 a#4,7: 943 a#3,1:c 944 a#2,2:b 945 a#1,1:a 946 . 947 948 define 949 a.SINGLEDEL.3: 950 a.RANGEDEL.2:c 951 a.SET.1:val 952 ---- 953 954 iter 955 first 956 next 957 next 958 tombstones 959 ---- 960 a#3,7: 961 a#2,15:c 962 . 963 a-c#2 964 . 965 966 define 967 a.RANGEDEL.3:d 968 a.DEL.2: 969 a.SET.1:a 970 d.DEL.2: 971 ---- 972 973 iter 974 first 975 next 976 next 977 tombstones 978 ---- 979 a#3,15:d 980 d#2,0: 981 . 982 a-d#3 983 . 984 985 iter snapshots=3 986 first 987 next 988 next 989 next 990 ---- 991 a#3,15:d 992 a#2,0: 993 d#2,0: 994 . 995 996 iter snapshots=2 997 first 998 next 999 next 1000 next 1001 ---- 1002 a#3,15:d 1003 a#1,1:a 1004 d#2,0: 1005 . 1006 1007 iter snapshots=1 1008 first 1009 next 1010 next 1011 ---- 1012 a#3,15:d 1013 d#2,0: 1014 . 1015 1016 define 1017 a.MERGE.2:a 1018 b.RANGEDEL.1:c 1019 ---- 1020 1021 iter 1022 first 1023 tombstones a 1024 next 1025 next 1026 tombstones 1027 ---- 1028 a#2,2:a 1029 . 1030 b#1,15:c 1031 . 1032 b-c#1 1033 . 1034 1035 define 1036 a.MERGE.2:v2 1037 a.RANGEDEL.1:b 1038 a.MERGE.1:v1 1039 ---- 1040 1041 iter allow-zero-seqnum=true 1042 first 1043 next 1044 next 1045 next 1046 tombstones 1047 ---- 1048 a#2,2:v2 1049 a#1,15:b 1050 a#0,2:v1 1051 . 1052 a-b#1 1053 . 1054 1055 # Verify that we transform merge+del -> set. 1056 1057 define 1058 a.MERGE.5:5 1059 a.DEL.3: 1060 a.MERGE.1:1 1061 ---- 1062 1063 iter 1064 first 1065 next 1066 ---- 1067 a#5,1:5[base] 1068 . 1069 1070 iter allow-zero-seqnum=true 1071 first 1072 next 1073 ---- 1074 a#0,1:5[base] 1075 . 1076 1077 iter elide-tombstones=true 1078 first 1079 next 1080 ---- 1081 a#5,1:5[base] 1082 . 1083 1084 iter snapshots=2 1085 first 1086 next 1087 next 1088 ---- 1089 a#5,1:5[base] 1090 a#1,2:1 1091 . 1092 1093 iter snapshots=2 elide-tombstones=true 1094 first 1095 next 1096 next 1097 ---- 1098 a#5,1:5[base] 1099 a#1,2:1 1100 . 1101 1102 # Verify that we transform merge+rangedel -> set. This isn't strictly 1103 # necessary, but provides consistency with the behavior for merge+del. 1104 1105 define 1106 a.RANGEDEL.3:c 1107 b.MERGE.5:5 1108 b.SET.2:2 1109 b.MERGE.1:1 1110 ---- 1111 1112 iter 1113 first 1114 next 1115 next 1116 ---- 1117 a#3,15:c 1118 b#5,1:5[base] 1119 . 1120 1121 iter allow-zero-seqnum=true 1122 first 1123 next 1124 next 1125 ---- 1126 a#3,15:c 1127 b#0,1:5[base] 1128 . 1129 1130 iter snapshots=2 1131 first 1132 next 1133 next 1134 ---- 1135 a#3,15:c 1136 b#5,1:5[base] 1137 b#1,2:1 1138 1139 define 1140 a.RANGEDEL.3:c 1141 b.MERGE.5:5 1142 b.MERGE.2:2 1143 b.MERGE.1:1 1144 ---- 1145 1146 iter 1147 first 1148 next 1149 next 1150 ---- 1151 a#3,15:c 1152 b#5,1:5[base] 1153 . 1154 1155 iter snapshots=2 1156 first 1157 next 1158 next 1159 ---- 1160 a#3,15:c 1161 b#5,1:5[base] 1162 b#1,2:1 1163 1164 # NB: Zero values are skipped by deletable merger. 1165 define merger=deletable 1166 a.MERGE.4:-2 1167 a.MERGE.3:-1 1168 a.MERGE.2:2 1169 a.MERGE.1:1 1170 b.MERGE.4:-3 1171 b.MERGE.3:3 1172 b.MERGE.2:2 1173 b.MERGE.1:-2 1174 ---- 1175 1176 iter 1177 first 1178 next 1179 next 1180 ---- 1181 . 1182 . 1183 . 1184 1185 # Test that range keys are interleaved, and exposed to the fragmenter. 1186 1187 define 1188 a.SINGLEDEL.4: 1189 a.SET.3:val 1190 a.DEL.2: 1191 a.SET.1:val 1192 c.SET.3:val 1193 ---- 1194 1195 define-range-keys 1196 a-b:{(#3,RANGEKEYSET,@2,foo)} 1197 d-e:{(#3,RANGEKEYSET,@2,foo)} 1198 ---- 1199 1200 iter 1201 first 1202 next 1203 next 1204 next 1205 next 1206 range-keys 1207 ---- 1208 a#72057594037927935,21: 1209 a#2,0: 1210 c#3,1:val 1211 d#72057594037927935,21: 1212 . 1213 a-b:{(#3,RANGEKEYSET,@2,foo)} 1214 d-e:{(#3,RANGEKEYSET,@2,foo)} 1215 .