Browse Source

Add comprehensive tests for LOCK TABLES and UNLOCK TABLES (#3982)

* Add comprehensive tests for LOCK TABLES and UNLOCK TABLES

* test: implement cross-session LOCK TABLES tests using debug sleep

* test: improvement of test-lock-unlock-tables.rec according to comments

* Update test/clt-tests/data-manipulation/test-lock-unlock-tables.rec

---------

Co-authored-by: Sergey Nikolaev <[email protected]>
Pavel Shilin 6 days ago
parent
commit
4dd00a7307

+ 1 - 1
test/clt-tests/buddy-plugins/test-prometheus-exporter.rec

@@ -16,7 +16,7 @@ cat /tmp/exporter_unfiltered_output.txt | grep -e "^manticore" | cut -d" " -f1 |
 searchd --iostats --cpustats --status | cut -d":" -f1 | tail -n +10 | sort > /tmp/searchd_output.txt
 ––– output –––
 ––– input –––
-ls -1 /tmp
+ls -1 /tmp | grep -E "^(exporter|searchd).*\.txt$"
 ––– output –––
 exporter_output.txt
 exporter_unfiltered_output.txt

+ 98 - 0
test/clt-tests/data-manipulation/test-lock-tables-mysqldump-compat.rec

@@ -0,0 +1,98 @@
+# Test LOCK TABLES compatibility with mysqldump
+# Ensures mysqldump can create a dump and restore it correctly
+# Issue: https://github.com/manticoresoftware/manticoresearch/issues/3047
+
+––– block: ../base/start-searchd –––
+––– comment –––
+Create test table with sample data
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS test_dump; CREATE TABLE test_dump (id BIGINT, name TEXT, value INTEGER);"
+––– output –––
+––– comment –––
+Insert sample data
+––– input –––
+mysql -h0 -P9306 -e "INSERT INTO test_dump VALUES (1, 'first', 100), (2, 'second', 200), (3, 'third', 300);"
+––– output –––
+––– comment –––
+Verify initial data
+––– input –––
+mysql -h0 -P9306 -e "SELECT COUNT(*) FROM test_dump;"
+––– output –––
++----------+
+| count(*) |
++----------+
+|        3 |
++----------+
+––– comment –––
+Check if mysqldump is available
+––– input –––
+which mysqldump
+––– output –––
+#!/.*mysqldump/!#
+––– comment –––
+Test 1: mysqldump WITH LOCK TABLES (default behavior)
+This tests that LOCK TABLES works correctly with mysqldump
+––– input –––
+mysqldump -h0 -P9306 manticore test_dump > /tmp/test_dump_with_locks.sql 2>/dev/null
+––– output –––
+––– comment –––
+Drop the table and restore from dump created WITH locks
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE test_dump;"
+––– output –––
+––– comment –––
+Restore from dump that was created WITH LOCK TABLES
+––– input –––
+mysql -h0 -P9306 < /tmp/test_dump_with_locks.sql 2>/dev/null
+––– output –––
+––– comment –––
+Verify all data was restored correctly from dump WITH locks
+––– input –––
+mysql -h0 -P9306 -e "SELECT * FROM test_dump;"
+––– output –––
++------+--------+-------+
+| id   | name   | value |
++------+--------+-------+
+|    1 | first  |   100 |
+|    2 | second |   200 |
+|    3 | third  |   300 |
++------+--------+-------+
+––– comment –––
+Cleanup first dump file
+––– input –––
+rm -f /tmp/test_dump_with_locks.sql
+––– output –––
+––– comment –––
+Test 2: mysqldump WITHOUT LOCK TABLES (using --skip-lock-tables)
+This tests the alternative approach when LOCK TABLES is not desired
+––– input –––
+mysqldump -h0 -P9306 --skip-lock-tables manticore test_dump > /tmp/test_dump.sql 2>/dev/null
+––– output –––
+––– comment –––
+Drop the table again and restore from dump WITHOUT locks
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE test_dump;"
+––– output –––
+––– comment –––
+Restore from dump that was created WITHOUT LOCK TABLES
+––– input –––
+mysql -h0 -P9306 < /tmp/test_dump.sql 2>/dev/null
+––– output –––
+––– comment –––
+Verify all data was restored correctly from dump WITHOUT locks
+––– input –––
+mysql -h0 -P9306 -e "SELECT * FROM test_dump;"
+––– output –––
++------+--------+-------+
+| id   | name   | value |
++------+--------+-------+
+|    1 | first  |   100 |
+|    2 | second |   200 |
+|    3 | third  |   300 |
++------+--------+-------+
+––– comment –––
+Cleanup
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS test_dump;"
+rm -f /tmp/test_dump.sql
+––– output –––

+ 250 - 0
test/clt-tests/data-manipulation/test-lock-unlock-tables.rec

@@ -0,0 +1,250 @@
+# Test LOCK TABLES and UNLOCK TABLES functionality
+# Validates MySQL-compatible table locking for READ operations with cross-session behavior
+# Uses 'debug sleep' to keep locks active while testing from another session
+# NOTE: WRITE locks are not implemented - syntax accepted but shows warning and has no effect
+# Issue: https://github.com/manticoresoftware/manticoresearch/issues/3047
+
+––– block: ../base/start-searchd –––
+––– comment –––
+Create test table with sample product data
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS products; CREATE TABLE products (id BIGINT, title TEXT, price FLOAT);"
+––– output –––
+––– comment –––
+Insert initial test data
+––– input –––
+mysql -h0 -P9306 -e "INSERT INTO products VALUES (1, 'iPhone 15', 999.99), (2, 'Samsung Galaxy S24', 899.99), (3, 'Google Pixel 8', 799.99);"
+––– output –––
+––– comment –––
+Verify initial data count
+––– input –––
+mysql -h0 -P9306 -e "SELECT COUNT(*) FROM products;"
+––– output –––
++----------+
+| count(*) |
++----------+
+|        3 |
++----------+
+––– comment –––
+Lock table with READ lock and read from it (should work in same session)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products READ; SELECT * FROM products WHERE id = 1;"
+––– output –––
++------+-----------+------------+
+| id   | title     | price      |
++------+-----------+------------+
+|    1 | iPhone 15 | 999.989990 |
++------+-----------+------------+
+––– comment –––
+Test WRITE lock syntax (Manticore accepts syntax but shows warning - WRITE locks not implemented)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products WRITE; SHOW WARNINGS;"
+––– output –––
++---------+------+--------------------------------+
+| Level   | Code | Message                        |
++---------+------+--------------------------------+
+| warning | 1000 | Write lock is not implemented. |
++---------+------+--------------------------------+
+––– comment –––
+Add more test data
+––– input –––
+mysql -h0 -P9306 -e "INSERT INTO products VALUES (4, 'OnePlus 12', 699.99);"
+––– output –––
+––– comment –––
+Test cross-session READ lock blocking INSERT (session 1 holds READ lock, session 2 tries to INSERT)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products READ; debug sleep 5" > /dev/null 2>&1 & LOCK_PID=$!; 
+sleep 1; 
+mysql -h0 -P9306 -e "INSERT INTO products VALUES (5, 'Blocked Insert', 500);" 2>&1; wait $LOCK_PID 2>/dev/null
+––– output –––
+ERROR 1064 (42000) at line 1: table 'products' is locked
+––– comment –––
+Test cross-session READ lock blocking UPDATE (session 1 holds READ lock, session 2 tries to UPDATE)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products READ; debug sleep 5" > /dev/null 2>&1 & LOCK_PID=$!; 
+sleep 1; 
+mysql -h0 -P9306 -e "UPDATE products SET price = 1199.99 WHERE id = 1;" 2>&1; wait $LOCK_PID 2>/dev/null
+––– output –––
+ERROR 1064 (42000) at line 1: table products: table is locked
+––– comment –––
+Test cross-session READ lock blocking DELETE (session 1 holds READ lock, session 2 tries to DELETE)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products READ; debug sleep 5" > /dev/null 2>&1 & LOCK_PID=$!;
+sleep 1;
+mysql -h0 -P9306 -e "DELETE FROM products WHERE id = 4;" 2>&1; wait $LOCK_PID 2>/dev/null
+––– output –––
+ERROR 1064 (42000) at line 1: table products: table is locked
+––– comment –––
+Test cross-session READ lock allowing SELECT (session 1 holds READ lock, session 2 can SELECT)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products READ; debug sleep 5" > /dev/null 2>&1 & LOCK_PID=$!;
+sleep 1;
+mysql -h0 -P9306 -e "SELECT COUNT(*) FROM products;"; wait $LOCK_PID 2>/dev/null
+––– output –––
++----------+
+| count(*) |
++----------+
+|        4 |
++----------+
+––– comment –––
+Test WRITE lock doesn't block cross-session modifications (WRITE locks not implemented)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products WRITE; debug sleep 5" > /dev/null 2>&1 & LOCK_PID=$!;
+sleep 1;
+mysql -h0 -P9306 -e "INSERT INTO products VALUES (5, 'Not Blocked', 500);"; wait $LOCK_PID 2>/dev/null
+––– output –––
+––– comment –––
+Verify INSERT succeeded (WRITE lock has no effect)
+––– input –––
+mysql -h0 -P9306 -e "SELECT COUNT(*) FROM products;"
+––– output –––
++----------+
+| count(*) |
++----------+
+|        5 |
++----------+
+––– comment –––
+Test locking multiple tables with READ
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS products2; CREATE TABLE products2 (id BIGINT, name TEXT);"
+––– output –––
+––– comment –––
+Insert test data into second table
+––– input –––
+mysql -h0 -P9306 -e "INSERT INTO products2 VALUES (1, 'test1'), (2, 'test2');"
+––– output –––
+––– comment –––
+Test cross-session multi-table READ lock allows SELECT (session 1 locks both tables, session 2 can read)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products READ, products2 READ; debug sleep 5" > /dev/null 2>&1 & LOCK_PID=$!;
+sleep 1;
+mysql -h0 -P9306 -e "SELECT COUNT(*) FROM products; SELECT COUNT(*) FROM products2;";
+wait $LOCK_PID 2>/dev/null
+––– output –––
++----------+
+| count(*) |
++----------+
+|        5 |
++----------+
++----------+
+| count(*) |
++----------+
+|        2 |
++----------+
+––– comment –––
+Create second table for multi-table lock test
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS orders; CREATE TABLE orders (id BIGINT, product_id BIGINT, quantity INTEGER);"
+––– output –––
+––– comment –––
+Insert data into orders table
+––– input –––
+mysql -h0 -P9306 -e "INSERT INTO orders VALUES (1, 1, 2), (2, 2, 1);"
+––– output –––
+––– comment –––
+Test cross-session multi-table READ lock (session 1 locks products, session 2 tries INSERT into products)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products READ, orders READ; debug sleep 5" > /dev/null 2>&1 & LOCK_PID=$!; sleep 1; mysql -h0 -P9306 -e "INSERT INTO products VALUES (6, 'Blocked Multi', 600);" 2>&1; wait $LOCK_PID 2>/dev/null
+––– output –––
+ERROR 1064 (42000) at line 1: table 'products' is locked
+––– comment –––
+Create distributed table for testing lock compatibility
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS dist_products; CREATE TABLE dist_products type='distributed' local='products';"
+––– output –––
+––– comment –––
+Lock distributed table with READ (should fail - distributed tables don't support locks)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES dist_products READ;"
+––– output –––
+ERROR 1064 (42000) at line 1: Table dist_products absent, or not suitable for lock
+––– comment –––
+Verify we can still query distributed table even though locking failed
+––– input –––
+mysql -h0 -P9306 -e "SELECT * FROM dist_products WHERE id = 1;"
+––– output –––
++------+-----------+------------+
+| id   | title     | price      |
++------+-----------+------------+
+|    1 | iPhone 15 | 999.989990 |
++------+-----------+------------+
+––– comment –––
+Test SHOW TABLES works while table is locked (must be in same session)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products READ; SHOW TABLES; UNLOCK TABLES;"
+––– output –––
++---------------+-------------+
+| Table         | Type        |
++---------------+-------------+
+| dist_products | distributed |
+| orders        | rt          |
+| products      | rt          |
+| products2     | rt          |
++---------------+-------------+
+––– comment –––
+Test re-locking (consecutive LOCK replaces previous lock, not accumulates)
+Two separate LOCK commands on same table should result in Count: 1
+––– input –––
+mysql -h0 -P9306 << 'EOF'
+LOCK TABLES products READ;
+LOCK TABLES products READ;
+SHOW LOCKS;
+UNLOCK TABLES;
+EOF
+––– output –––
++------+----------+-----------+-----------------+
+| Type | Name     | Lock Type | Additional Info |
++------+----------+-----------+-----------------+
+| rt   | products | read      | Count: 1        |
++------+----------+-----------+-----------------+
+––– comment –––
+WRITE lock doesn't block modifications (not implemented), test within same session
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products WRITE; INSERT INTO products VALUES (7, 'Same Session Insert', 699.99); SELECT COUNT(*) FROM products; UNLOCK TABLES;"
+––– output –––
++----------+
+| count(*) |
++----------+
+|        6 |
++----------+
+––– comment –––
+Test SHOW LOCKS displays active locks (must be in same session)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products READ; SHOW LOCKS; UNLOCK TABLES;"
+––– output –––
++------+----------+-----------+-----------------+
+| Type | Name     | Lock Type | Additional Info |
++------+----------+-----------+-----------------+
+| rt   | products | read      | Count: 1        |
++------+----------+-----------+-----------------+
+––– comment –––
+Test SHOW LOCKS with multiple tables locked
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products READ, products2 READ; SHOW LOCKS; UNLOCK TABLES;"
+––– output –––
++------+-----------+-----------+-----------------+
+| Type | Name      | Lock Type | Additional Info |
++------+-----------+-----------+-----------------+
+| rt   | products  | read      | Count: 1        |
+| rt   | products2 | read      | Count: 1        |
++------+-----------+-----------+-----------------+
+––– comment –––
+Test cross-session READ locks: two sessions lock same table, SHOW LOCKS displays Count: 2
+Session 1: LOCK products READ + hold via debug sleep
+Session 2: LOCK products READ + SHOW LOCKS (should show Count: 2)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES products READ; debug sleep 5" > /dev/null 2>&1 & LOCK_PID=$!;
+sleep 1;
+mysql -h0 -P9306 -e "LOCK TABLES products READ; SHOW LOCKS; UNLOCK TABLES;";
+wait $LOCK_PID 2>/dev/null
+––– output –––
++------+----------+-----------+-----------------+
+| Type | Name     | Lock Type | Additional Info |
++------+----------+-----------+-----------------+
+| rt   | products | read      | Count: 2        |
++------+----------+-----------+-----------------+
+––– comment –––
+Final cleanup - drop all test tables
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS products; DROP TABLE IF EXISTS products2; DROP TABLE IF EXISTS orders; DROP TABLE IF EXISTS dist_products;"
+––– output –––

+ 219 - 0
test/clt-tests/expected-errors/test-lock-tables-errors.rec

@@ -0,0 +1,219 @@
+# Negative tests for LOCK TABLES and UNLOCK TABLES
+# Validates error handling for incorrect usage and lock violations
+# Issue: https://github.com/manticoresoftware/manticoresearch/issues/3047
+
+––– block: ../base/start-searchd –––
+––– comment –––
+Create test table for error validation
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS test_locks; CREATE TABLE test_locks (id BIGINT, title TEXT);"
+––– output –––
+––– comment –––
+Insert test data
+––– input –––
+mysql -h0 -P9306 -e "INSERT INTO test_locks VALUES (1, 'test');"
+––– output –––
+––– comment –––
+Error: Lock non-existent table
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES nonexistent_table READ;"
+––– output –––
+ERROR 1064 (42000) at line 1: Table nonexistent_table absent, or not suitable for lock
+––– comment –––
+Error: Invalid lock mode
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks INVALID_MODE;"
+––– output –––
+ERROR 1064 (42000) at line 1: P02: syntax error, unexpected identifier near 'LOCK TABLES test_locks INVALID_MODE'
+––– comment –––
+Error: LOCK TABLES without table name
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES;"
+––– output –––
+ERROR 1064 (42000) at line 1: P02: syntax error, unexpected identifier near 'LOCK TABLES'
+––– comment –––
+Error: UNLOCK TABLES with table name (incorrect syntax)
+––– input –––
+mysql -h0 -P9306 -e "UNLOCK TABLES test_locks;"
+––– output –––
+ERROR 1064 (42000) at line 1: P02: syntax error, unexpected identifier near 'UNLOCK TABLES test_locks'
+––– comment –––
+Error: Wrong command (LOCK TABLE instead of LOCK TABLES)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLE test_locks READ;"
+––– output –––
+ERROR 1064 (42000) at line 1: P02: syntax error, unexpected identifier near 'LOCK TABLE test_locks READ'
+––– comment –––
+Error: Cannot specify both READ and WRITE
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks READ WRITE;"
+––– output –––
+ERROR 1064 (42000) at line 1: P02: syntax error, unexpected identifier near 'LOCK TABLES test_locks READ WRITE'
+––– comment –––
+Error: LOCK TABLES without READ or WRITE mode
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks;"
+––– output –––
+ERROR 1064 (42000) at line 1: P02: syntax error, unexpected identifier near 'LOCK TABLES test_locks'
+––– comment –––
+DROP TABLE with READ lock is allowed (intentional, differs from MySQL)
+READ lock only blocks data modifications (INSERT/UPDATE/DELETE), not DDL operations
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks READ; DROP TABLE test_locks;"
+––– output –––
+––– comment –––
+Recreate table after DROP
+––– input –––
+mysql -h0 -P9306 -e "CREATE TABLE test_locks (id BIGINT, title TEXT); INSERT INTO test_locks VALUES (1, 'test');"
+––– output –––
+––– comment –––
+Error: Try to INSERT into READ-locked table
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks READ; INSERT INTO test_locks VALUES (2, 'forbidden');"
+––– output –––
+ERROR 1064 (42000) at line 1: table 'test_locks' is locked
+––– comment –––
+Release lock
+––– input –––
+mysql -h0 -P9306 -e "UNLOCK TABLES;"
+––– output –––
+––– comment –––
+Cross-session INSERT: Session 1 locks, Session 2 tries INSERT (blocked)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks READ; debug sleep 5" > /dev/null 2>&1 & sleep 1; mysql -h0 -P9306 -e "INSERT INTO test_locks VALUES (2, 'from_another_session');" 2>&1
+––– output –––
+ERROR 1064 (42000) at line 1: table 'test_locks' is locked
+––– comment –––
+Wait for background session to complete and verify table state unchanged
+––– input –––
+sleep 5; mysql -h0 -P9306 -e "SELECT COUNT(*) FROM test_locks;"
+––– output –––
++----------+
+| count(*) |
++----------+
+|        1 |
++----------+
+––– comment –––
+After session 1 closed, lock is released - modifications from session 2 should succeed
+––– input –––
+mysql -h0 -P9306 -e "INSERT INTO test_locks VALUES (2, 'session_2_after_lock_released');"
+––– output –––
+––– comment –––
+Verify the insert succeeded
+––– input –––
+mysql -h0 -P9306 -e "SELECT COUNT(*) FROM test_locks;"
+––– output –––
++----------+
+| count(*) |
++----------+
+|        2 |
++----------+
+––– comment –––
+Cleanup - delete the inserted row for next tests
+––– input –––
+mysql -h0 -P9306 -e "DELETE FROM test_locks WHERE id = 2;"
+––– output –––
+––– comment –––
+Cross-session UPDATE: Session 1 locks, Session 2 tries UPDATE (blocked)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks READ; debug sleep 5" > /dev/null 2>&1 & sleep 1; mysql -h0 -P9306 -e "UPDATE test_locks SET title = 'blocked' WHERE id = 1;" 2>&1
+––– output –––
+ERROR 1064 (42000) at line 1: table test_locks: table is locked
+––– comment –––
+Wait for background session to complete
+––– input –––
+sleep 5
+––– output –––
+––– comment –––
+Cross-session DELETE: Session 1 locks, Session 2 tries DELETE (blocked)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks READ; debug sleep 5" > /dev/null 2>&1 & sleep 1; mysql -h0 -P9306 -e "DELETE FROM test_locks WHERE id = 1;" 2>&1
+––– output –––
+ERROR 1064 (42000) at line 1: table test_locks: table is locked
+––– comment –––
+Wait for background session to complete
+––– input –––
+sleep 5
+––– output –––
+––– comment –––
+Error: Try to UPDATE READ-locked table (same session test)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks READ; UPDATE test_locks SET title = 'new' WHERE id = 1;"
+––– output –––
+ERROR 1064 (42000) at line 1: table test_locks: table is locked
+––– comment –––
+Release lock
+––– input –––
+mysql -h0 -P9306 -e "UNLOCK TABLES;"
+––– output –––
+––– comment –––
+Error: Try to DELETE from READ-locked table (same session test)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks READ; DELETE FROM test_locks WHERE id = 1;"
+––– output –––
+ERROR 1064 (42000) at line 1: table test_locks: table is locked
+––– comment –––
+Release lock
+––– input –––
+mysql -h0 -P9306 -e "UNLOCK TABLES;"
+––– output –––
+––– comment –––
+Cross-session DROP TABLE: Session 1 locks, Session 2 drops (allowed - DDL not blocked)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks READ; debug sleep 5" > /dev/null 2>&1 & sleep 1; mysql -h0 -P9306 -e "DROP TABLE test_locks;" 2>&1 && echo "DROP succeeded from another session"
+––– output –––
+DROP succeeded from another session
+––– comment –––
+Wait for background session to complete
+––– input –––
+sleep 4
+––– output –––
+––– comment –––
+Recreate table for remaining tests
+––– input –––
+mysql -h0 -P9306 -e "CREATE TABLE test_locks (id BIGINT, title TEXT); INSERT INTO test_locks VALUES (1, 'test');"
+––– output –––
+––– comment –––
+Create second table for lock scope testing
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS other_table; CREATE TABLE other_table (id BIGINT);"
+––– output –––
+––– comment –––
+Manticore allows accessing unlocked tables even when other tables are locked
+This differs from MySQL behavior
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks READ; SELECT * FROM other_table;"
+––– output –––
+––– comment –––
+Release lock
+––– input –––
+mysql -h0 -P9306 -e "UNLOCK TABLES;"
+––– output –––
+––– comment –––
+Manticore allows accessing unlocked tables even with WRITE lock on another table
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_locks WRITE; SELECT * FROM other_table;"
+––– output –––
+––– comment –––
+Release lock
+––– input –––
+mysql -h0 -P9306 -e "UNLOCK TABLES;"
+––– output –––
+––– comment –––
+Manticore allows CREATE TABLE even while locks are active
+––– input –––
+mysql -h0 -P9306 << 'EOF'
+LOCK TABLES test_locks READ;
+CREATE TABLE new_table (id BIGINT);
+EOF
+––– output –––
+––– comment –––
+Release any remaining locks
+––– input –––
+mysql -h0 -P9306 -e "UNLOCK TABLES;"
+––– output –––
+––– comment –––
+Cleanup test tables
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS test_locks; DROP TABLE IF EXISTS other_table; DROP TABLE IF EXISTS new_table;"
+––– output –––

+ 37 - 1
test/clt-tests/mysqldump/versions/mariadb/script_versions_mariadb.sh

@@ -88,9 +88,45 @@ for version in "${versions[@]}"; do
         echo "Error: dump.sql is empty for $version"
     fi
 
+    # Test replicated table (cluster:table syntax) - Issue #3047
+    echo "Testing cluster:table with $version..."
+    
+    # Create cluster and replicated table
+    docker exec manticore mysql -h0 -P9306 -e "DELETE CLUSTER test_c;" 2>/dev/null || true
+    docker exec manticore mysql -h0 -P9306 -e "CREATE CLUSTER test_c;"
+    docker exec manticore mysql -h0 -P9306 -e "CREATE TABLE test_repl (id BIGINT, data TEXT);"
+    docker exec manticore mysql -h0 -P9306 -e "ALTER CLUSTER test_c ADD test_repl;"
+    docker exec manticore mysql -h0 -P9306 -e "INSERT INTO test_c:test_repl (id, data) VALUES (1, 'cluster_data');"
+    
+    # Test 1: mariadb-dump WITHOUT --skip-lock-tables should fail
+    echo "  Testing WITHOUT --skip-lock-tables (should fail)..."
+    if docker exec db-test $dump_command --skip-ssl-verify-server-cert -hmanticore -P9306 -ucluster -t manticore test_c:test_repl > cluster_dump_fail.sql 2>&1; then
+        echo "  ⚠️  WARNING: mariadb-dump succeeded without --skip-lock-tables (bug may be fixed)"
+    else
+        echo "  ✅ Expected: mariadb-dump failed without --skip-lock-tables"
+    fi
+    
+    # Test 2: mariadb-dump WITH --skip-lock-tables should succeed
+    echo "  Testing WITH --skip-lock-tables (should succeed)..."
+    if docker exec db-test $dump_command --skip-ssl-verify-server-cert -hmanticore -P9306 -ucluster -t --skip-lock-tables --compact manticore test_c:test_repl > cluster_dump_ok.sql 2> >(grep -E -v "Warning: column statistics|Warning: version string returned by server is incorrect|Couldn't read status information" >&2); then
+        if grep -q "cluster_data" cluster_dump_ok.sql; then
+            echo "  ✅ Workaround successful: dump contains data with --skip-lock-tables"
+        else
+            echo "  ❌ ERROR: dump succeeded but data missing"
+        fi
+    else
+        echo "  ❌ ERROR: mariadb-dump failed even with --skip-lock-tables"
+    fi
+    
+    # Cleanup cluster test
+    docker exec manticore mysql -h0 -P9306 -e "ALTER CLUSTER test_c DROP test_repl;" 2>/dev/null || true
+    docker exec manticore mysql -h0 -P9306 -e "DELETE CLUSTER test_c;" 2>/dev/null || true
+    docker exec manticore mysql -h0 -P9306 -e "DROP TABLE IF EXISTS test_repl;" 2>/dev/null || true
+    rm -f cluster_dump_fail.sql cluster_dump_ok.sql
+
     # Stopping and deleting a container
     docker stop db-test > /dev/null
-    rm -f dump.sql
+    rm -f dump.sql 2>/dev/null || true
 done
 
 echo "All MariaDB versions tested successfully!"

+ 100 - 0
test/clt-tests/mysqldump/versions/mariadb/test-supported-mysqldump-mariadb-versions.rec

@@ -67,6 +67,11 @@ Testing version: mariadb:10.5
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:10.5 completed successfully
+Testing cluster:table with mariadb:10.5...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:10.6
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -95,6 +100,11 @@ Testing version: mariadb:10.6
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:10.6 completed successfully
+Testing cluster:table with mariadb:10.6...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:10.7
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -123,6 +133,11 @@ Testing version: mariadb:10.7
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:10.7 completed successfully
+Testing cluster:table with mariadb:10.7...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:10.8
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -151,6 +166,11 @@ Testing version: mariadb:10.8
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:10.8 completed successfully
+Testing cluster:table with mariadb:10.8...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:10.9
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -179,6 +199,11 @@ Testing version: mariadb:10.9
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:10.9 completed successfully
+Testing cluster:table with mariadb:10.9...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:10.10
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -207,6 +232,11 @@ Testing version: mariadb:10.10
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:10.10 completed successfully
+Testing cluster:table with mariadb:10.10...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:10.11
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -235,6 +265,11 @@ Testing version: mariadb:10.11
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:10.11 completed successfully
+Testing cluster:table with mariadb:10.11...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:11.0
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -263,6 +298,11 @@ Testing version: mariadb:11.0
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:11.0 completed successfully
+Testing cluster:table with mariadb:11.0...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:11.1
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -291,6 +331,11 @@ Testing version: mariadb:11.1
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:11.1 completed successfully
+Testing cluster:table with mariadb:11.1...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:11.2
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -319,6 +364,11 @@ Testing version: mariadb:11.2
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:11.2 completed successfully
+Testing cluster:table with mariadb:11.2...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:11.3-rc
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -347,6 +397,11 @@ Testing version: mariadb:11.3-rc
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:11.3-rc completed successfully
+Testing cluster:table with mariadb:11.3-rc...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:11.4
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -375,6 +430,11 @@ Testing version: mariadb:11.4
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:11.4 completed successfully
+Testing cluster:table with mariadb:11.4...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:11.5
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -403,6 +463,11 @@ Testing version: mariadb:11.5
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:11.5 completed successfully
+Testing cluster:table with mariadb:11.5...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:11.6
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -431,6 +496,11 @@ Testing version: mariadb:11.6
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:11.6 completed successfully
+Testing cluster:table with mariadb:11.6...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:11.7
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -459,6 +529,11 @@ Testing version: mariadb:11.7
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:11.7 completed successfully
+Testing cluster:table with mariadb:11.7...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:11.8
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -487,6 +562,11 @@ Testing version: mariadb:11.8
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:11.8 completed successfully
+Testing cluster:table with mariadb:11.8...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:12.0
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -515,6 +595,11 @@ Testing version: mariadb:12.0
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:12.0 completed successfully
+Testing cluster:table with mariadb:12.0...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:12.1
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -543,6 +628,11 @@ Testing version: mariadb:12.1
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:12.1 completed successfully
+Testing cluster:table with mariadb:12.1...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:12.2
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -571,6 +661,11 @@ Testing version: mariadb:12.2
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:12.2 completed successfully
+Testing cluster:table with mariadb:12.2...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mariadb:latest
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -599,6 +694,11 @@ Testing version: mariadb:latest
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mariadb:latest completed successfully
+Testing cluster:table with mariadb:latest...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mariadb-dump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 All MariaDB versions tested successfully!
 Checking documentation versions...
 Checking documentation file...

+ 37 - 1
test/clt-tests/mysqldump/versions/mysql/script_versions_mysql.sh

@@ -88,9 +88,45 @@ for version in "${versions[@]}"; do
         echo "Error: dump.sql is empty for $version"
     fi
 
+    # Test replicated table (cluster:table syntax) - Issue #3047
+    echo "Testing cluster:table with $version..."
+    
+    # Create cluster and replicated table
+    docker exec manticore mysql -h0 -P9306 -e "DELETE CLUSTER test_c;" 2>/dev/null || true
+    docker exec manticore mysql -h0 -P9306 -e "CREATE CLUSTER test_c;"
+    docker exec manticore mysql -h0 -P9306 -e "CREATE TABLE test_repl (id BIGINT, data TEXT);"
+    docker exec manticore mysql -h0 -P9306 -e "ALTER CLUSTER test_c ADD test_repl;"
+    docker exec manticore mysql -h0 -P9306 -e "INSERT INTO test_c:test_repl (id, data) VALUES (1, 'cluster_data');"
+    
+    # Test 1: mysqldump WITHOUT --skip-lock-tables should fail
+    echo "  Testing WITHOUT --skip-lock-tables (should fail)..."
+    if docker exec db-test $dump_command -hmanticore -P9306 -ucluster -t manticore test_c:test_repl > cluster_dump_fail.sql 2>&1; then
+        echo "  ⚠️  WARNING: mysqldump succeeded without --skip-lock-tables (bug may be fixed)"
+    else
+        echo "  ✅ Expected: mysqldump failed without --skip-lock-tables"
+    fi
+    
+    # Test 2: mysqldump WITH --skip-lock-tables should succeed
+    echo "  Testing WITH --skip-lock-tables (should succeed)..."
+    if docker exec db-test $dump_command -hmanticore -P9306 -ucluster -t --skip-lock-tables --compact manticore test_c:test_repl > cluster_dump_ok.sql 2> >(grep -E -v "Warning: column statistics|Warning: version string returned by server is incorrect." >&2); then
+        if grep -q "cluster_data" cluster_dump_ok.sql; then
+            echo "  ✅ Workaround successful: dump contains data with --skip-lock-tables"
+        else
+            echo "  ❌ ERROR: dump succeeded but data missing"
+        fi
+    else
+        echo "  ❌ ERROR: mysqldump failed even with --skip-lock-tables"
+    fi
+    
+    # Cleanup cluster test
+    docker exec manticore mysql -h0 -P9306 -e "ALTER CLUSTER test_c DROP test_repl;" 2>/dev/null || true
+    docker exec manticore mysql -h0 -P9306 -e "DELETE CLUSTER test_c;" 2>/dev/null || true
+    docker exec manticore mysql -h0 -P9306 -e "DROP TABLE IF EXISTS test_repl;" 2>/dev/null || true
+    rm -f cluster_dump_fail.sql cluster_dump_ok.sql
+
     # Stopping and deleting a container
     docker stop db-test > /dev/null
-    rm -f dump.sql
+    rm -f dump.sql 2>/dev/null || true
 done
 
 echo "All MySQL versions tested successfully!"

+ 70 - 0
test/clt-tests/mysqldump/versions/mysql/test-supported-mysqldump-mysql-versions.rec

@@ -67,6 +67,11 @@ Testing version: mysql:5.6
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:5.6 completed successfully
+Testing cluster:table with mysql:5.6...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:5.7
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -95,6 +100,11 @@ Testing version: mysql:5.7
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:5.7 completed successfully
+Testing cluster:table with mysql:5.7...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:8.0
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -123,6 +133,11 @@ Testing version: mysql:8.0
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:8.0 completed successfully
+Testing cluster:table with mysql:8.0...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:8.2
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -151,6 +166,11 @@ Testing version: mysql:8.2
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:8.2 completed successfully
+Testing cluster:table with mysql:8.2...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:8.3
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -179,6 +199,11 @@ Testing version: mysql:8.3
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:8.3 completed successfully
+Testing cluster:table with mysql:8.3...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:8.4
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -207,6 +232,11 @@ Testing version: mysql:8.4
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:8.4 completed successfully
+Testing cluster:table with mysql:8.4...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:9.0
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -235,6 +265,11 @@ Testing version: mysql:9.0
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:9.0 completed successfully
+Testing cluster:table with mysql:9.0...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:9.1
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -263,6 +298,11 @@ Testing version: mysql:9.1
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:9.1 completed successfully
+Testing cluster:table with mysql:9.1...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:9.2
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -291,6 +331,11 @@ Testing version: mysql:9.2
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:9.2 completed successfully
+Testing cluster:table with mysql:9.2...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:9.3
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -319,6 +364,11 @@ Testing version: mysql:9.3
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:9.3 completed successfully
+Testing cluster:table with mysql:9.3...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:9.4
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -347,6 +397,11 @@ Testing version: mysql:9.4
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:9.4 completed successfully
+Testing cluster:table with mysql:9.4...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:9.5
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -375,6 +430,11 @@ Testing version: mysql:9.5
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:9.5 completed successfully
+Testing cluster:table with mysql:9.5...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:9.6
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -403,6 +463,11 @@ Testing version: mysql:9.6
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:9.6 completed successfully
+Testing cluster:table with mysql:9.6...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 Testing version: mysql:latest
 +------+----------------------------------------------------------------------------------------------------+--------+-------------------+----------------------------------------------+----------------------------------+----------------------------------------------------------------------------------------------------+------+------------+------------+-------------------+
 | id   | f                                                                                                  | a      | b                 | j                                            | m                                | s                                                                                                  | e    | d          | v          | fv                |
@@ -431,6 +496,11 @@ Testing version: mysql:latest
    Query log content:
 /* #!/[A-Za-z]{3}\s+[A-Za-z]{3}\s+[0-9]{1,2}\s+[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}\s+[0-9]{4}/!# conn %{NUMBER} (%{IPADDR}:%{NUMBER}) real #!/[0-9]{1}.[0-9]{3}/!# wall #!/[0-9]{1}.[0-9]{3}/!# found %{NUMBER} */ SELECT * FROM t ORDER BY id asc;
 Dump mysql:latest completed successfully
+Testing cluster:table with mysql:latest...
+  Testing WITHOUT --skip-lock-tables (should fail)...
+  ✅ Expected: mysqldump failed without --skip-lock-tables
+  Testing WITH --skip-lock-tables (should succeed)...
+  ✅ Workaround successful: dump contains data with --skip-lock-tables
 All MySQL versions tested successfully!
 Checking documentation versions...
 Checking documentation file...

+ 138 - 0
test/clt-tests/replication/test-lock-tables-replicated.rec

@@ -0,0 +1,138 @@
+# Test LOCK TABLES with replicated tables (cluster:table syntax)
+# Tests mysqldump behavior on replicated tables according to documentation:
+# 1. LOCK TABLES cluster:table fails (replicated tables don't support locks)
+# 2. mysqldump WITHOUT --skip-lock-tables fails with LOCK error
+# 3. mysqldump WITH --skip-lock-tables works (recommended way per docs)
+# 4. Regular tables work correctly with LOCK TABLES and mysqldump
+
+––– block: ../base/start-searchd –––
+––– comment –––
+Delete cluster if exists from previous tests
+––– input –––
+mysql -h0 -P9306 -e "DELETE CLUSTER test_cluster;" 2>&1 || echo "Cluster doesn't exist yet"
+––– output –––
+ERROR 1064 (42000) at line 1: unknown cluster 'test_cluster'
+Cluster doesn't exist yet
+––– comment –––
+Create replication cluster
+––– input –––
+mysql -h0 -P9306 -e "CREATE CLUSTER test_cluster;"
+––– output –––
+––– comment –––
+Create table for replication
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS repl_table; CREATE TABLE repl_table (id BIGINT, data TEXT);"
+––– output –––
+––– comment –––
+Add table to cluster (makes it replicated)
+––– input –––
+mysql -h0 -P9306 -e "ALTER CLUSTER test_cluster ADD repl_table;"
+––– output –––
+––– comment –––
+Insert test data into replicated table using cluster:table syntax
+––– input –––
+mysql -h0 -P9306 -e "INSERT INTO test_cluster:repl_table (id, data) VALUES (1, 'replicated_data');"
+––– output –––
+––– comment –––
+Verify data was inserted
+––– input –––
+mysql -h0 -P9306 -e "SELECT * FROM test_cluster:repl_table;"
+––– output –––
++------+-----------------+
+| id   | data            |
++------+-----------------+
+|    1 | replicated_data |
++------+-----------------+
+––– comment –––
+Expected behavior: Replicated tables don't support LOCK TABLES (by design)
+LOCK TABLES only works for local real-time or percolate tables
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES test_cluster:repl_table READ;" 2>&1
+––– output –––
+ERROR 1064 (42000) at line 1: Table test_cluster:repl_table absent, or not suitable for lock
+––– comment –––
+Release lock if it was somehow acquired
+––– input –––
+mysql -h0 -P9306 -e "UNLOCK TABLES;" 2>&1
+––– output –––
+––– comment –––
+Check if mysqldump is available
+––– input –––
+which mysqldump
+––– output –––
+#!/.*/mysqldump/!#
+––– comment –––
+Test mysqldump on cluster:table WITHOUT --skip-lock-tables (should fail with LOCK error)
+––– input –––
+mysqldump -h0 -P9306 -ucluster --no-tablespaces -t manticore test_cluster:repl_table 2>&1 | grep "Got error"
+––– output –––
+mysqldump: Got error: 1064: Table test_cluster:repl_table absent, or not suitable for lock when doing LOCK TABLES
+––– comment –––
+Test mysqldump WITH --skip-lock-tables (should work according to docs)
+Required flags: -ucluster, -t, --skip-lock-tables
+––– input –––
+mysqldump -h0 -P9306 -ucluster --no-tablespaces --skip-lock-tables -t --compact manticore test_cluster:repl_table 2>&1 | grep "INSERT INTO"
+––– output –––
+INSERT INTO `test_cluster:repl_table` VALUES ('1','replicated_data');
+––– comment –––
+Test regular (non-replicated) table for comparison
+Create regular table
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS regular_table; CREATE TABLE regular_table (id BIGINT, data TEXT);"
+––– output –––
+––– comment –––
+Insert data into regular table
+––– input –––
+mysql -h0 -P9306 -e "INSERT INTO regular_table VALUES (1, 'regular_data');"
+––– output –––
+––– comment –––
+Lock regular table (should work fine unlike cluster:table)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES regular_table READ;"
+––– output –––
+––– comment –––
+Verify regular table can be read under lock
+––– input –––
+mysql -h0 -P9306 -e "SELECT * FROM regular_table;"
+––– output –––
++------+--------------+
+| id   | data         |
++------+--------------+
+|    1 | regular_data |
++------+--------------+
+––– comment –––
+Release lock on regular table
+––– input –––
+mysql -h0 -P9306 -e "UNLOCK TABLES;"
+––– output –––
+––– comment –––
+Verify mysqldump works on regular table (should include INSERT statement)
+––– input –––
+mysqldump -h0 -P9306 --no-tablespaces --compact manticore regular_table 2>&1 | grep -E "INSERT" | head -1
+––– output –––
+INSERT INTO `regular_table` VALUES ('1','regular_data');
+––– comment –––
+Test SHOW LOCKS with regular table (must be in same session)
+––– input –––
+mysql -h0 -P9306 -e "LOCK TABLES regular_table READ; SHOW LOCKS; UNLOCK TABLES;"
+––– output –––
++------+---------------+-----------+-----------------+
+| Type | Name          | Lock Type | Additional Info |
++------+---------------+-----------+-----------------+
+| rt   | regular_table | read      | Count: 1        |
++------+---------------+-----------+-----------------+
+––– comment –––
+Cleanup - remove table from cluster first
+––– input –––
+mysql -h0 -P9306 -e "ALTER CLUSTER test_cluster DROP repl_table;" 2>&1 || echo "Already removed"
+––– output –––
+––– comment –––
+Delete cluster
+––– input –––
+mysql -h0 -P9306 -e "DELETE CLUSTER test_cluster;" 2>&1
+––– output –––
+––– comment –––
+Drop tables
+––– input –––
+mysql -h0 -P9306 -e "DROP TABLE IF EXISTS repl_table; DROP TABLE IF EXISTS regular_table;"
+––– output –––