github.com/cockroachdb/pebble@v1.1.2/testdata/compaction_iter (about) 1 define 2 a.SET.1:b 3 ---- 4 5 iter print-snapshot-pinned 6 first 7 next 8 ---- 9 a#1,1:b (not pinned) 10 . 11 12 define 13 a.SET.2:c 14 a.SET.1:b 15 ---- 16 17 iter print-snapshot-pinned 18 first 19 next 20 ---- 21 a#2,1:c (not pinned) 22 . 23 24 iter print-snapshot-pinned snapshots=0 25 first 26 next 27 ---- 28 a#2,1:c (not pinned) 29 . 30 31 iter snapshots=1 32 first 33 next 34 ---- 35 a#2,1:c 36 . 37 38 iter print-snapshot-pinned snapshots=2 39 first 40 next 41 next 42 ---- 43 a#2,1:c (not pinned) 44 a#1,1:b (pinned) 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 print-snapshot-pinned elide-tombstones=true snapshots=2 65 first 66 next 67 next 68 ---- 69 a#2,0: (pinned) 70 a#1,1:b (pinned) 71 . 72 73 iter print-snapshot-pinned elide-tombstones=true snapshots=1 74 first 75 next 76 ---- 77 a#2,0: (pinned) 78 . 79 80 define 81 a.DEL.2: 82 a.SET.1:b 83 b.SET.3:c 84 ---- 85 86 iter print-snapshot-pinned 87 first 88 next 89 next 90 ---- 91 a#2,0: (not pinned) 92 b#3,1:c (not pinned) 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 print-snapshot-pinned 150 first 151 next 152 next 153 next 154 ---- 155 a#3,2:d (not pinned) 156 a#2,1:bc[base] (pinned) 157 b#2,2:ab (not pinned) 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) print-snapshot-pinned 219 first 220 next 221 next 222 next 223 next 224 next 225 ---- 226 a#9,1:b (not pinned) 227 a#8,0: (pinned) 228 a#7,1:d (pinned) 229 a#6,0: (pinned) 230 a#5,1:f (pinned) 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: INVALID 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: INVALID 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: INVALID 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: INVALID 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) print-snapshot-pinned 286 first 287 next 288 next 289 next 290 ---- 291 a#2,2:b (not pinned) 292 a#1,2:c (pinned) 293 a#0,2:d (pinned) 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 # NB: Range deletions are always marked as 'not pinned' currently. Extending 305 # snapshot-pinning statistics to range deletions and range keys is TODO. 306 307 iter print-snapshot-pinned 308 first 309 next 310 next 311 next 312 tombstones 313 ---- 314 a#2,1:b (not pinned) 315 a#1,15:c (not pinned) 316 b#4,15:d (not pinned) 317 . 318 a-b#1 319 b-c#4 320 c-d#4 321 . 322 323 iter snapshots=2 print-snapshot-pinned 324 first 325 next 326 next 327 next 328 tombstones 329 ---- 330 a#2,1:b (not pinned) 331 a#1,15:c (not pinned) 332 b#4,15:d (not pinned) 333 . 334 a-b#1 335 b-c#4 336 b-c#1 337 c-d#4 338 . 339 340 iter snapshots=3 print-snapshot-pinned 341 first 342 next 343 next 344 next 345 next 346 tombstones 347 ---- 348 a#2,1:b (not pinned) 349 a#1,15:c (not pinned) 350 b#4,15:d (not pinned) 351 b#2,1:e (pinned) 352 . 353 a-b#1 354 b-c#4 355 b-c#1 356 c-d#4 357 . 358 359 iter snapshots=4 print-snapshot-pinned 360 first 361 next 362 next 363 next 364 next 365 next 366 tombstones 367 ---- 368 a#2,1:b (not pinned) 369 a#1,15:c (not pinned) 370 b#4,15:d (not pinned) 371 b#2,1:e (pinned) 372 c#3,1:f (pinned) 373 . 374 a-b#1 375 b-c#4 376 b-c#1 377 c-d#4 378 . 379 380 define 381 a.RANGEDEL.3:e 382 b.SET.4:b 383 c.SET.3:c 384 d.SET.2:d 385 e.SET.1:e 386 ---- 387 388 iter 389 first 390 next 391 next 392 next 393 next 394 tombstones 395 ---- 396 a#3,15:e 397 b#4,1:b 398 c#3,1:c 399 e#1,1:e 400 . 401 a-e#3 402 . 403 404 define 405 a.RANGEDEL.3:e 406 b.MERGE.4:b 407 c.MERGE.3:c 408 d.MERGE.2:d 409 e.MERGE.1:e 410 ---- 411 412 iter 413 first 414 next 415 next 416 next 417 next 418 tombstones 419 ---- 420 a#3,15:e 421 b#4,2:b 422 c#3,2:c 423 e#1,2:e 424 . 425 a-e#3 426 . 427 428 define 429 a.RANGEDEL.3:c 430 b.MERGE.5:e 431 b.MERGE.4:d 432 b.MERGE.2:c 433 b.MERGE.1:b 434 d.MERGE.5:c 435 d.MERGE.4:b 436 d.RANGEDEL.3:f 437 d.MERGE.2:e 438 d.MERGE.1:d 439 ---- 440 441 iter 442 first 443 next 444 next 445 next 446 next 447 tombstones 448 ---- 449 a#3,15:c 450 b#5,2:de 451 d#5,2:bc 452 d#3,15:f 453 . 454 a-c#3 455 d-f#3 456 . 457 458 define 459 a.RANGEDEL.3:d 460 b.RANGEDEL.2:e 461 c.RANGEDEL.1:f 462 ---- 463 464 iter 465 first 466 next 467 next 468 next 469 tombstones 470 ---- 471 a#3,15:d 472 b#2,15:e 473 c#1,15:f 474 . 475 a-b#3 476 b-c#3 477 c-d#3 478 d-e#2 479 e-f#1 480 . 481 482 iter snapshots=2 483 first 484 next 485 next 486 next 487 tombstones 488 ---- 489 a#3,15:d 490 b#2,15:e 491 c#1,15:f 492 . 493 a-b#3 494 b-c#3 495 c-d#3 496 c-d#1 497 d-e#2 498 d-e#1 499 e-f#1 500 . 501 502 iter snapshots=3 503 first 504 next 505 next 506 next 507 tombstones 508 ---- 509 a#3,15:d 510 b#2,15:e 511 c#1,15:f 512 . 513 a-b#3 514 b-c#3 515 b-c#2 516 c-d#3 517 c-d#2 518 d-e#2 519 e-f#1 520 . 521 522 iter snapshots=(2,3) 523 first 524 next 525 next 526 next 527 tombstones 528 ---- 529 a#3,15:d 530 b#2,15:e 531 c#1,15:f 532 . 533 a-b#3 534 b-c#3 535 b-c#2 536 c-d#3 537 c-d#2 538 c-d#1 539 d-e#2 540 d-e#1 541 e-f#1 542 . 543 544 define 545 a.RANGEDEL.10:k 546 f.SET.9:f 547 f.SET.8:f 548 ---- 549 550 iter snapshots=(9,10) 551 first 552 next 553 tombstones f 554 next 555 tombstones 556 ---- 557 a#10,15:k 558 f#9,1:f 559 a-f#10 560 . 561 f#8,1:f 562 f-k#10 563 . 564 565 define 566 f.RANGEDEL.10:k 567 f.SET.9:f 568 f.SET.8:f 569 ---- 570 571 iter snapshots=(9,10) 572 first 573 next 574 tombstones f 575 next 576 tombstones 577 ---- 578 f#10,15:k 579 f#9,1:f 580 . 581 f#8,1:f 582 f-k#10 583 . 584 585 define 586 a.SET.1:a 587 b.RANGEDEL.2:d 588 c.RANGEDEL.3:e 589 d.SET.4:d 590 ---- 591 592 iter 593 first 594 next 595 next 596 next 597 tombstones c 598 tombstones 599 ---- 600 a#1,1:a 601 b#2,15:d 602 c#3,15:e 603 d#4,1:d 604 b-c#2 605 . 606 c-d#3 607 d-e#3 608 . 609 610 iter snapshots=3 611 first 612 next 613 next 614 next 615 tombstones c 616 tombstones 617 ---- 618 a#1,1:a 619 b#2,15:d 620 c#3,15:e 621 d#4,1:d 622 b-c#2 623 . 624 c-d#3 625 c-d#2 626 d-e#3 627 . 628 629 define 630 a.SET.1:a 631 b.RANGEDEL.2:d 632 c.SET.4:d 633 ---- 634 635 iter 636 first 637 next 638 next 639 tombstones c 640 tombstones 641 ---- 642 a#1,1:a 643 b#2,15:d 644 c#4,1:d 645 b-c#2 646 . 647 c-d#2 648 . 649 650 define 651 a.RANGEDEL.2:d 652 a.SET.2:a 653 b.SET.2:b 654 c.SET.2:c 655 ---- 656 657 iter 658 first 659 next 660 next 661 next 662 next 663 ---- 664 a#2,15:d 665 a#2,1:a 666 b#2,1:b 667 c#2,1:c 668 . 669 670 define 671 a.SINGLEDEL.1: 672 ---- 673 674 iter 675 first 676 next 677 ---- 678 a#1,7: 679 . 680 681 iter elide-tombstones=true 682 first 683 ---- 684 . 685 ineffectual-single-deletes: a 686 687 define 688 a.SINGLEDEL.2: 689 a.SINGLEDEL.1: 690 ---- 691 692 iter 693 first 694 next 695 ---- 696 a#2,7: 697 . 698 ineffectual-single-deletes: a 699 700 define 701 a.SINGLEDEL.3: 702 a.SINGLEDEL.2: 703 a.SET.1:a 704 ---- 705 706 iter 707 first 708 ---- 709 . 710 ineffectual-single-deletes: a 711 712 define 713 a.SET.3:a 714 b.SINGLEDEL.2: 715 b.DEL.1: 716 ---- 717 718 iter 719 first 720 next 721 next 722 ---- 723 a#3,1:a 724 b#2,0: 725 . 726 ineffectual-single-deletes: b 727 728 define 729 a.SINGLEDEL.2: 730 a.DEL.1: 731 ---- 732 733 iter 734 first 735 next 736 ---- 737 a#2,0: 738 . 739 ineffectual-single-deletes: a 740 741 iter elide-tombstones=true 742 first 743 ---- 744 . 745 ineffectual-single-deletes: a 746 747 define 748 a.SINGLEDEL.2: 749 a.MERGE.1: 750 ---- 751 752 iter 753 first 754 ---- 755 . 756 757 iter elide-tombstones=true 758 first 759 ---- 760 . 761 762 define 763 a.SINGLEDEL.2: 764 a.SET.1:b 765 ---- 766 767 iter 768 first 769 ---- 770 . 771 772 define 773 a.SET.2:b 774 a.SINGLEDEL.1: 775 ---- 776 777 iter 778 first 779 next 780 ---- 781 a#2,1:b 782 . 783 784 # We don't notice the ineffectual single delete since the SET causes all 785 # SingleDelete error checking to be skipped. 786 iter elide-tombstones=true 787 first 788 next 789 ---- 790 a#2,1:b 791 . 792 793 define 794 a.MERGE.6:b 795 a.SINGLEDEL.5: 796 a.SET.4:a 797 ---- 798 799 iter 800 first 801 next 802 ---- 803 a#6,18:b[base] 804 . 805 806 # Non-deterministic use of SINGLEDEL where there are two older SETs that have 807 # not been deleted or single deleted. It is permitted to shadow both, since 808 # MERGE turns into a SETWITHDELETE when it meets the SINGLEDEL. 809 define 810 a.MERGE.6:b 811 a.SINGLEDEL.5: 812 a.SET.4:a 813 a.SET.3:a 814 ---- 815 816 iter 817 first 818 next 819 ---- 820 a#6,18:b[base] 821 . 822 823 define 824 a.SINGLEDEL.2: 825 a.SET.1:b 826 b.SET.3:c 827 ---- 828 829 iter 830 first 831 next 832 ---- 833 b#3,1:c 834 . 835 836 define 837 a.SINGLEDEL.3: 838 a.SET.2:b 839 a.SET.1:a 840 ---- 841 842 iter 843 first 844 next 845 ---- 846 a#1,1:a 847 . 848 invariant-violation-single-deletes: a 849 850 define 851 a.SINGLEDEL.3: 852 a.MERGE.2:b 853 a.MERGE.1:a 854 ---- 855 856 # SINGLEDEL consumes the first MERGE. 857 iter 858 first 859 next 860 ---- 861 a#1,2:a 862 . 863 invariant-violation-single-deletes: a 864 865 define 866 a.SINGLEDEL.4: 867 a.SET.3:val 868 a.SINGLEDEL.2: 869 a.SET.1:val 870 ---- 871 872 iter 873 first 874 ---- 875 . 876 877 iter snapshots=2 878 first 879 next 880 next 881 ---- 882 a#2,7: 883 a#1,1:val 884 . 885 886 define 887 a.SINGLEDEL.4: 888 a.SET.3:val 889 a.DEL.2: 890 a.SET.1:val 891 ---- 892 893 iter 894 first 895 next 896 ---- 897 a#2,0: 898 . 899 900 iter snapshots=2 901 first 902 next 903 next 904 ---- 905 a#2,0: 906 a#1,1:val 907 . 908 909 iter snapshots=3 910 first 911 next 912 ---- 913 a#2,0: 914 . 915 916 iter snapshots=(2,3) 917 first 918 next 919 next 920 ---- 921 a#2,0: 922 a#1,1:val 923 . 924 925 define 926 a.SINGLEDEL.4: 927 a.SET.3:c 928 a.MERGE.2:b 929 a.SET.1:a 930 ---- 931 932 iter 933 first 934 next 935 ---- 936 a#2,1:ab[base] 937 . 938 invariant-violation-single-deletes: a 939 940 iter snapshots=2 941 first 942 next 943 next 944 ---- 945 a#2,2:b 946 a#1,1:a 947 . 948 invariant-violation-single-deletes: a 949 950 iter snapshots=3 951 first 952 next 953 ---- 954 a#2,1:ab[base] 955 . 956 invariant-violation-single-deletes: a 957 958 iter snapshots=(2,3,4) 959 first 960 next 961 next 962 next 963 next 964 ---- 965 a#4,7: 966 a#3,1:c 967 a#2,2:b 968 a#1,1:a 969 . 970 971 define 972 a.SINGLEDEL.3: 973 a.RANGEDEL.2:c 974 a.SET.1:val 975 ---- 976 977 iter 978 first 979 next 980 next 981 tombstones 982 ---- 983 a#3,7: 984 a#2,15:c 985 . 986 a-c#2 987 . 988 989 define 990 a.RANGEDEL.3:d 991 a.DEL.2: 992 a.SET.1:a 993 d.DEL.2: 994 ---- 995 996 iter 997 first 998 next 999 next 1000 tombstones 1001 ---- 1002 a#3,15:d 1003 d#2,0: 1004 . 1005 a-d#3 1006 . 1007 1008 iter snapshots=3 1009 first 1010 next 1011 next 1012 next 1013 ---- 1014 a#3,15:d 1015 a#2,0: 1016 d#2,0: 1017 . 1018 1019 iter snapshots=2 1020 first 1021 next 1022 next 1023 next 1024 ---- 1025 a#3,15:d 1026 a#1,1:a 1027 d#2,0: 1028 . 1029 1030 iter snapshots=1 1031 first 1032 next 1033 next 1034 ---- 1035 a#3,15:d 1036 d#2,0: 1037 . 1038 1039 define 1040 a.MERGE.2:a 1041 b.RANGEDEL.1:c 1042 ---- 1043 1044 iter 1045 first 1046 tombstones a 1047 next 1048 next 1049 tombstones 1050 ---- 1051 a#2,2:a 1052 . 1053 b#1,15:c 1054 . 1055 b-c#1 1056 . 1057 1058 define 1059 a.MERGE.2:v2 1060 a.RANGEDEL.1:b 1061 a.MERGE.1:v1 1062 ---- 1063 1064 iter allow-zero-seqnum=true 1065 first 1066 next 1067 next 1068 next 1069 tombstones 1070 ---- 1071 a#2,2:v2 1072 a#1,15:b 1073 a#0,2:v1 1074 . 1075 a-b#1 1076 . 1077 1078 # Verify that we transform merge+del -> set. 1079 1080 define 1081 a.MERGE.5:5 1082 a.DEL.3: 1083 a.MERGE.1:1 1084 ---- 1085 1086 iter 1087 first 1088 next 1089 ---- 1090 a#5,18:5[base] 1091 . 1092 1093 iter allow-zero-seqnum=true 1094 first 1095 next 1096 ---- 1097 a#0,18:5[base] 1098 . 1099 1100 iter elide-tombstones=true 1101 first 1102 next 1103 ---- 1104 a#5,18:5[base] 1105 . 1106 1107 iter snapshots=2 1108 first 1109 next 1110 next 1111 ---- 1112 a#5,18:5[base] 1113 a#1,2:1 1114 . 1115 1116 iter snapshots=2 elide-tombstones=true 1117 first 1118 next 1119 next 1120 ---- 1121 a#5,18:5[base] 1122 a#1,2:1 1123 . 1124 1125 # Verify that merge+rangedel -> merge. 1126 1127 define 1128 a.RANGEDEL.3:c 1129 b.MERGE.5:5 1130 b.SET.2:2 1131 b.MERGE.1:1 1132 ---- 1133 1134 iter 1135 first 1136 next 1137 next 1138 ---- 1139 a#3,15:c 1140 b#5,2:5 1141 . 1142 1143 iter allow-zero-seqnum=true 1144 first 1145 next 1146 next 1147 ---- 1148 a#3,15:c 1149 b#0,2:5 1150 . 1151 1152 iter snapshots=2 1153 first 1154 next 1155 next 1156 ---- 1157 a#3,15:c 1158 b#5,2:5 1159 b#1,2:1 1160 1161 define 1162 a.RANGEDEL.3:c 1163 b.MERGE.5:5 1164 b.MERGE.2:2 1165 b.MERGE.1:1 1166 ---- 1167 1168 iter 1169 first 1170 next 1171 next 1172 ---- 1173 a#3,15:c 1174 b#5,2:5 1175 . 1176 1177 iter snapshots=2 1178 first 1179 next 1180 next 1181 ---- 1182 a#3,15:c 1183 b#5,2:5 1184 b#1,2:1 1185 1186 # NB: Zero values are skipped by deletable merger. 1187 define merger=deletable 1188 a.MERGE.4:-2 1189 a.MERGE.3:-1 1190 a.MERGE.2:2 1191 a.MERGE.1:1 1192 b.MERGE.4:-3 1193 b.MERGE.3:3 1194 b.MERGE.2:2 1195 b.MERGE.1:-2 1196 ---- 1197 1198 iter 1199 first 1200 next 1201 next 1202 ---- 1203 . 1204 . 1205 . 1206 1207 # Test that range keys are interleaved, and exposed to the fragmenter. 1208 1209 define 1210 a.SINGLEDEL.4: 1211 a.SET.3:val 1212 a.DEL.2: 1213 a.SET.1:val 1214 c.SET.3:val 1215 ---- 1216 1217 define-range-keys 1218 a-b:{(#3,RANGEKEYSET,@2,foo)} 1219 d-e:{(#3,RANGEKEYSET,@2,foo)} 1220 ---- 1221 1222 iter 1223 first 1224 next 1225 next 1226 next 1227 next 1228 range-keys 1229 ---- 1230 a#72057594037927935,21: 1231 a#2,0: 1232 c#3,1:val 1233 d#72057594037927935,21: 1234 . 1235 a-b:{(#3,RANGEKEYSET,@2,foo)} 1236 d-e:{(#3,RANGEKEYSET,@2,foo)} 1237 .