Add support for Foregin keys table in Pstress#92
Add support for Foregin keys table in Pstress#92rahulmalik87 wants to merge 4 commits intoPercona-QA:masterfrom
Conversation
Added new table type in pstress with suffix _fk table. Number of tables depends on fk-prob. Such table will have column ifk_col reference to a parent table ipkey for example if --fk-prob is 50 and --tables 100. there is 50% chance there will be a table tt_N_fk whose parent would be tt_N Since they linked to pk of parent table. To test FK use --fk-prob=100 --pk-prob=100 To disable foreign keys use --no-fk Also rename some existing options like primary-key-probability is now pk-prob ratio-normal-temp is not temp-prob Fixed the code around START TRANSACTION. Previously it was running as single transaction which would block transaction on other session. Decrease the probability of using SAVE POINT in a transaction to 10 % from 25% default Decrease the probablity of partition tables to 10%; Decrease the probablity of temporary tables to 10%;
60e3375 to
6305c08
Compare
|
Hi @rahulmalik87 - Thanks for the pull request. We are looking into it. |
| TRANSATION_PRB_K, | ||
| TRANSACTIONS_SIZE, | ||
| COMMMIT_TO_ROLLBACK_RATIO, | ||
| COMMMIT_PROB, |
There was a problem hiding this comment.
Fix the name to "COMMIT_PROB"
|
@rahulmalik87 - Few observations
Tested the patch, but don't see which table the foreign key column is referencing to. Normally a foreign key syntax looks like this
|
|
Thank you for testing. |
|
@rahulmalik87 - Use |
|
@rahulmalik87 Some more problems found: `Test Case1: ./pstress-ps --tables 50 --records 100 --no-temp-tables --no-partition-tables --fk-prob 100 --socket /tmp/mysql_22000.sock --threads 5 --logdir Thread 2 failed, check logs for detail message Error: Test Case 2: ./pstress-ps --tables 10 --records 100 --only-partition-tables --fk-prob 100 --socket /tmp/mysql_22000.sock --threads 5 --logdir This creates only one table instead of creating 10 partition tables with FK references Test Case 3: ./pstress-ps --tables 10 --records 100 --fk-prob 100 --pk-prob 100 --seconds 10 --threads 5 --socket /tmp/mysql_22000.sock --logdir This does not create FK reference tables` |
|
I have fixed the Test case 1. |
Fk table tries to insert entries from previous table and gets an error Failed to add constraint during alter Now if parent table has 0 records, then fk table will also be empty
c1cf914 to
b2d7b76
Compare
|
@rahulmalik87 Thanks for the contribution, can u please look into the other failures? |
|
Thank you @rahulmalik87 for reviving/addressing review comments! |
https://perconadev.atlassian.net/browse/PSTRESS-152 Introduced support for Foreign key tables in Pstress. * The tables with foreign key references are suffixed with `_fk` while creating the tables. * These FK tables include `ifk_col` column referencing parent table's `ipkey`. * Example : When --fk-prob is 50 --tables 100 options are passed, there is a 50% chance there will be a table tt_N_fk whose parent would be tt_N. * To fully test FK behaviour, use `--fk-prob=100 --pk-prob=100` * The FK tables can be disabled with `--no-fk` option. Renamed some command-line options for clarity: * `--primary-key-probability` -> `--pk-prob` * `--ration-normal-temp` -> `--temp-prob` Fixed transaction behaviour: * Ensured `START TRANSACTION` doesn't block other sessions by running transactions independently. Adjusted the default probabilities of some features: * Decreased the probability of using SAVEPOINT in a transaction from 25% to 10%. * Decreased the probability of partition tables to 10%. * Decreased the probability of temporary tables to 10%. Thanks Rahul Malik for the contribution. (github.com/Percona-QA/pull/92)
https://perconadev.atlassian.net/browse/PSTRESS-152 Introduced support for Foreign key tables in Pstress. * The tables with foreign key references are suffixed with `_fk` while creating the tables. * These FK tables include `ifk_col` column referencing parent table's `ipkey`. * Example : When --fk-prob is 50 --tables 100 options are passed, there is a 50% chance there will be a table tt_N_fk whose parent would be tt_N. * To fully test FK behaviour, use `--fk-prob=100 --pk-prob=100` * The FK tables can be disabled with `--no-fk` option. Renamed some command-line options for clarity: * `--primary-key-probability` -> `--pk-prob` * `--ration-normal-temp` -> `--temp-prob` Fixed transaction behaviour: * Ensured `START TRANSACTION` doesn't block other sessions by running transactions independently. Adjusted the default probabilities of some features: * Decreased the probability of using SAVEPOINT in a transaction from 25% to 10%. * Decreased the probability of partition tables to 10%. * Decreased the probability of temporary tables to 10%. Thanks Rahul Malik for the contribution. (github.com/Percona-QA/pull/92)
https://perconadev.atlassian.net/browse/PSTRESS-152 Introduced support for Foreign key tables in Pstress. * The tables with foreign key references are suffixed with `_fk` while creating the tables. * These FK tables include `ifk_col` column referencing parent table's `ipkey`. * Example : When --fk-prob is 50 --tables 100 options are passed, there is a 50% chance there will be a table tt_N_fk whose parent would be tt_N. * To fully test FK behaviour, use `--fk-prob=100 --pk-prob=100` * The FK tables can be disabled with `--no-fk` option. Fixed transaction behaviour: * Ensured `START TRANSACTION` doesn't block other sessions by running transactions independently. Adjusted the default probabilities of some features: * A new option called partition-prob is added which controls the number of partition tables created and is set to 10% by default. * The exisiting option ratio-normal-temp is replaced with a new option, temporary-prob to control the number of temporary tables and is set to 10% by default. * The exisiting option commit-rollback-ratio is replaced with a new option, commit-prob, which controls the probability of executing commit and is set to 95 by default. * Decreased the probability of using SAVEPOINT in a transaction from 50% to 10%. * The option `primary-key-probability` is renamed to `--pk-prob` fpr clarity. Thanks Rahul Malik for the contribution. (github.com/Percona-QA/pull/92)
https://perconadev.atlassian.net/browse/PSTRESS-152 Introduced support for Foreign key tables in Pstress. * The tables with foreign key references are suffixed with `_fk` while creating the tables. * These FK tables include `ifk_col` column referencing parent table's `ipkey`. * Example : When --fk-prob is 50 --tables 100 options are passed, there is a 50% chance there will be a table tt_N_fk whose parent would be tt_N. * To fully test FK behaviour, use `--fk-prob=100 --pk-prob=100` * The FK tables can be disabled with `--no-fk` option. Fixed transaction behaviour: * Ensured `START TRANSACTION` doesn't block other sessions by running transactions independently. Adjusted the default probabilities of some features: * A new option called partition-prob is added which controls the number of partition tables created and is set to 10% by default. * The exisiting option ratio-normal-temp is replaced with a new option, temporary-prob to control the number of temporary tables and is set to 10% by default. * The exisiting option commit-rollback-ratio is replaced with a new option, commit-prob, which controls the probability of executing commit and is set to 95 by default. * Decreased the probability of using SAVEPOINT in a transaction from 50% to 10%. * The option `primary-key-probability` is renamed to `--pk-prob` fpr clarity. Thanks Rahul Malik for the contribution. (github.com/Percona-QA/pull/92)
Added new table type in pstress with suffix _fk table.
Number of tables depends on fk-prob.
Such table will have column ifk_col reference to a parent table ipkey
for example if --fk-prob is 50 and --tables 100.
there is 50% chance there will be a table tt_N_fk whose parent would be tt_N
Since they linked to pk of parent table. To test FK use --fk-prob=100 --pk-prob=100
To disable foreign keys use --no-fk
Also rename some existing options like
primary-key-probability is now pk-prob
ratio-normal-temp is now temp-prob
Fixed the code around START TRANSACTION. Previously it was running as single transaction which would block transaction on other session.
Decrease the probability of using SAVE POINT in a transaction to 10 % from 25% default