github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/objstorage/objstorageprovider/testdata/provider/shared_attach_after_unref (about) 1 # Tests when an object is unrefed before it is attached to another provider. 2 3 open p5 5 4 ---- 5 <local fs> mkdir-all: p5 0755 6 <local fs> open-dir: p5 7 <local fs> open-dir: p5 8 <local fs> create: p5/REMOTE-OBJ-CATALOG-000001 9 <local fs> sync: p5/REMOTE-OBJ-CATALOG-000001 10 <local fs> create: p5/marker.remote-obj-catalog.000001.REMOTE-OBJ-CATALOG-000001 11 <local fs> close: p5/marker.remote-obj-catalog.000001.REMOTE-OBJ-CATALOG-000001 12 <local fs> sync: p5 13 <local fs> sync: p5/REMOTE-OBJ-CATALOG-000001 14 15 create 1 shared 1 100 16 ---- 17 <remote> create object "d632-5-000001.sst" 18 <remote> close writer for "d632-5-000001.sst" after 100 bytes 19 <remote> create object "d632-5-000001.sst.ref.5.000001" 20 <remote> close writer for "d632-5-000001.sst.ref.5.000001" after 0 bytes 21 22 save-backing p5b1 1 23 ---- 24 25 # This should do nothing. 26 remove 1 27 ---- 28 29 open p6 6 30 ---- 31 <local fs> mkdir-all: p6 0755 32 <local fs> open-dir: p6 33 <local fs> open-dir: p6 34 <local fs> create: p6/REMOTE-OBJ-CATALOG-000001 35 <local fs> sync: p6/REMOTE-OBJ-CATALOG-000001 36 <local fs> create: p6/marker.remote-obj-catalog.000001.REMOTE-OBJ-CATALOG-000001 37 <local fs> close: p6/marker.remote-obj-catalog.000001.REMOTE-OBJ-CATALOG-000001 38 <local fs> sync: p6 39 <local fs> sync: p6/REMOTE-OBJ-CATALOG-000001 40 41 # Attach should succeed. 42 attach 43 p5b1 101 44 ---- 45 <remote> create object "d632-5-000001.sst.ref.6.000101" 46 <remote> close writer for "d632-5-000001.sst.ref.6.000101" after 0 bytes 47 <remote> size of object "d632-5-000001.sst.ref.5.000001": 0 48 <local fs> sync: p6/REMOTE-OBJ-CATALOG-000001 49 000101 -> remote://d632-5-000001.sst 50 51 switch p5 52 ---- 53 54 # TODO(radu): after we close the backing, the unref should happen. 55 close-backing p5b1 56 ---- 57 58 create 2 shared 2 100 59 ---- 60 <remote> create object "1ab5-5-000002.sst" 61 <remote> close writer for "1ab5-5-000002.sst" after 100 bytes 62 <remote> create object "1ab5-5-000002.sst.ref.5.000002" 63 <remote> close writer for "1ab5-5-000002.sst.ref.5.000002" after 0 bytes 64 65 save-backing p5b2 2 66 ---- 67 68 # Close the backing, then unref the object. 69 close-backing p5b2 70 ---- 71 72 remove 2 73 ---- 74 <remote> delete object "1ab5-5-000002.sst.ref.5.000002" 75 <remote> list (prefix="1ab5-5-000002.sst.ref.", delimiter="") 76 <remote> delete object "1ab5-5-000002.sst" 77 78 switch p6 79 ---- 80 81 # Attach should error out because it can't find p5's ref. 82 attach 83 p5b2 102 84 ---- 85 <remote> create object "1ab5-5-000002.sst.ref.6.000102" 86 <remote> close writer for "1ab5-5-000002.sst.ref.6.000102" after 0 bytes 87 <remote> size of object "1ab5-5-000002.sst.ref.5.000002": error: file does not exist 88 <remote> delete object "1ab5-5-000002.sst.ref.6.000102" 89 <remote> list (prefix="1ab5-5-000002.sst.ref.", delimiter="") 90 <remote> delete object "1ab5-5-000002.sst" 91 error: origin marker object "1ab5-5-000002.sst.ref.5.000002" does not exist; object probably removed from the provider which created the backing