Skip to content

tarantool does not remove subfolders

Environment:
OS: Ubuntu 22.04.2 LTS, Centos7 (and I suppose any OS)
tarantool: 2.10.4-13-g0bd23eb1d, Tarantool 2.10.5-14-ga646920
sbroad: current master

Expected Behavior:
After the space is dropped corresponding folder is removed

Actual Behavior:
After the space is dropped corresponding folder is empty

Steps to Reproduce:
vinyl engine space:

testing_space_vinyl:
      format:
      - type: integer
        name: id
        is_nullable: false
      - type: string
        name: name
        is_nullable: false
      - type: integer
        name: product_units
        is_nullable: false
      - type: unsigned
        name: bucket_id
        is_nullable: true
      temporary: false
      engine: vinyl
      is_local: false
      sharding_key:
      - id
      - name
      indexes:
      - unique: true
        parts:
        - path: id
          type: integer
          is_nullable: false
        name: id
        type: TREE
      - unique: false
        parts:
        - path: bucket_id
          type: unsigned
          is_nullable: true
        name: bucket_id
        type: TREE

run test:

g.test_alotof_insert = function()
    local api = cluster:server("api-1").net_box
    for i=1,100000 do
        local r, err = api:call("sbroad.execute", {
            [[insert into "testing_space_vinyl" ("id", "name", "product_units") values (?, ?, ?)]],
            {i, "123", 1}
        })
        t.assert_equals(err, nil)
        t.assert_equals(r, {row_count = 1})
    end
end

After some time I see a lot of folders, that supposed to be removed I guess.

sbroad/sbroad-cartridge/test_app$ du -hs tmp/db_test/localhost-13303/*
8.0K    tmp/db_test/localhost-13303/00000000000000000000.snap
52K     tmp/db_test/localhost-13303/00000000000000000000.vylog
1.1M    tmp/db_test/localhost-13303/00000000000000000000.xlog
12K     tmp/db_test/localhost-13303/522
12K     tmp/db_test/localhost-13303/524
12K     tmp/db_test/localhost-13303/540
12K     tmp/db_test/localhost-13303/542
8.0K    tmp/db_test/localhost-13303/545
8.0K    tmp/db_test/localhost-13303/546
8.0K    tmp/db_test/localhost-13303/547
...
8.0K    tmp/db_test/localhost-13303/820
72K     tmp/db_test/localhost-13303/config
20K     tmp/db_test/localhost-13303/config.backup

Empty folder in my system is 4kB. So, we have at least 8kB on each folder:

du -hs tmp/db_test/localhost-13303/820/*
4.0K    tmp/db_test/localhost-13303/820/0

du -hs tmp/db_test/localhost-13303/542/*
4.0K    tmp/db_test/localhost-13303/542/0
4.0K    tmp/db_test/localhost-13303/542/1

With inserted 10k rows I see 5498 folders for one storage.

du -hs tmp/db_test/*
172K    tmp/db_test/localhost-13301
46M     tmp/db_test/localhost-13302
45M     tmp/db_test/localhost-13303

With 100k inserted rows there is about 800MB extra used space. I'm not sure it is okay