Skip to content

box.commit(wait = 'none') may yield #11224

@nshy

Description

@nshy

Bug description

box.commit(wait = 'none') may yield while is not expected to. The issue on commit we check that queue size is less then limit but there is a gap when we decrease queue size and when waiting fibers are actually poped off the queue.

Found in 3.4.0-entrypoint-158-g904e0a702e.

Steps to reproduce

Reproducer script:

local fiber = require('fiber')
os.execute('rm -f *.snap *.xlog *.vylog')
box.cfg{log_level = 'warn', wal_queue_max_size = 100}
local s = box.schema.create_space('test')
s:create_index('pk')
fiber.create(function()
    box.begin()
    box.on_commit(function()
        fiber.new(function()
            box.begin()
            s:insert({3})
            print(fiber.self().info().csw)
            box.commit({wait = 'none'})
            print(fiber.self().info().csw)
        end)
    end)
    s:insert({1, string.rep('a', 1000)})
    box.commit()
end)
s:insert({2})
os.exit()

Actual behavior

The script prints:

0
1

Expected behavior

The box.commit({wait = 'none'}) should fail because the txn can not be send to WAL immeditately.

Metadata

Metadata

Assignees

Labels

3.2Target is 3.2 and all newer release/master branches3.3Target is 3.3 and all newer release/master branchesbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions