[PATCH v2 3/3] ddl: allow to execute non-yielding DDL statements in transactions
Konstantin Osipov
kostja at tarantool.org
Thu Jul 11 00:07:11 MSK 2019
* Vladimir Davydov <vdavydov.dev at gmail.com> [19/07/10 16:13]:
A test plan for this feature:
1. A transaction which swaps two spaces by name.
name = foo.name;
foo.name = bar.name
bar.name = name
2. 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'
3. 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.
4. A transaction, which revokes all privileges from a user and drops
the space.
5. A transaction which creates a space and secondary indexes
6. A transaction which creates a space with a sequence.
7. Transactional drop a) empty b) nonempty space with all its belongings:
secondary indexes, check constraints, sequences.
5. 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.
6. 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)
--
Konstantin Osipov, Moscow, Russia
More information about the Tarantool-patches
mailing list