Skip to content

Test transactional DDL more thoroughly #4349

@locker

Description

@locker

A test plan by @kostja:

  1. A transaction which swaps two spaces by name.
name = foo.name;
foo.name = bar.name
bar.name = name
  1. A transaction which creates a space, formats it to have an integer column, changes the format to 'any', changes the values to 'string', changes the format to 'string'

  2. A transaction which creates a space, a user, and grants all privileges on this space to the user. Then sudoes to the user and tries to use the space.

  3. A transaction, which revokes all privileges from a user and drops the space.

  4. A transaction which creates a space and secondary indexes

  5. A transaction which creates a space with a sequence.

  6. Transactional drop a) empty b) nonempty space with all its belongings: secondary indexes, check constraints, sequences.

  7. A transaction which creates a space and sets space triggers, as well as on_rollback trigger, then inserts a bunch of data and then a) commits b) rolls back.

  8. An error injection crash test which starts 10 fibers which perform a random combination of transactional DDL in a loop, then, after 0.1 second ER_WAL_IO is enabled, fibers are joined, ER_WAL_IO is disabled. The DDL is using objects which names clash, so that it does something useful, e.g:

   function name(object_type)
        return object_type_name ..  math.random(1, NUM_NAMES)
    end

    function ddl(object_type, object_name) 
        -- this function actually checks if the name exists 
        --  at the moment and only returns valid statements
        if object_type is user or role then
            return random("grant", "revoke", "create", "drop")
        end
        if object_type is table then 
            return random("create ", "format", "rename", "add
            index", "drop index", "rename index", "change index
            keys", "change unique -> non_unique", "add
            constraint", "drop constraint", "drop")
        end


    function gen_test()
        for each object type:
            eval = "box.begin()"
            eval = eval .. ddl(object_type, name(object_type))
            eval = eval .. "box.commit()"
        end
        return eval
    end
    function fiber()
        while true do
            eval(gen_test)
        end
    end

    for i in 1.. NUM_FIBERS do
        fibers[i] = fiber.create(fiber)
    end
    fiber.sleep(0.1)
    errinj.enable(er_wal_io)
    for i in 1.. NUM_FIBERS do
        fiber.join(fibers[i])
    end
    (cleanup all objects matching the name..$i pattern)

Follow-up #4083

Metadata

Metadata

Assignees

Labels

ddlqaIssues related to tests or testing subsystem

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions