Skip to content

Commit

Permalink
MDEV-7933 plugins.feedback_plugin_send depends on being executed afte…
Browse files Browse the repository at this point in the history
…r plugins.feedback_plugin_load

The culprit is the feedback_plugin_load test, which is run both separately
and from inside feedback_plugin_send.test. The test queries I_S.FEEDBACK,
and every time it does, 'FEEDBACK used' value is increased.
Fixed by checking that the value is increased instead of recording the actual
value in the result file.
  • Loading branch information
elenst committed Sep 27, 2015
1 parent 2563609 commit bdcf370
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
7 changes: 5 additions & 2 deletions mysql-test/suite/plugins/r/feedback_plugin_load.result
@@ -1,10 +1,13 @@
select plugin_status from information_schema.plugins where plugin_name='feedback';
plugin_status
ACTIVE
SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used';
SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback where variable_name = 'FEEDBACK used';
variable_value = @feedback_used + 1
1
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK used 1
FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60
Expand Down
7 changes: 5 additions & 2 deletions mysql-test/suite/plugins/r/feedback_plugin_send.result
@@ -1,10 +1,13 @@
select plugin_status from information_schema.plugins where plugin_name='feedback';
plugin_status
ACTIVE
SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used';
SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback where variable_name = 'FEEDBACK used';
variable_value = @feedback_used + 1
1
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK used 2
FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60
Expand Down
19 changes: 18 additions & 1 deletion mysql-test/suite/plugins/t/feedback_plugin_load.test
Expand Up @@ -4,7 +4,24 @@ if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'fe
}

select plugin_status from information_schema.plugins where plugin_name='feedback';

# Every SELECT from INFORMATION_SCHEMA.FEEDBACK increases the value of 'FEEDBACK used'.
# We cannot record the actual value, because the test can be executed more than once,
# but we can check that the value indeed increases as expected.
# There is still a room for some race condition, e.g. if at the very moment
# between first SELECT to store the value and the next SELECT to check that it increases,
# the feedback plugin is activated. But the probability of it is close to 0,
# so lets get back to it if it ever happens.

# Lets say the plugin was used X times before this SELECT
SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used';

# Now $feedback_used == X+1, and 'FEEDBACK used' is also X+1. And variable_value is increased again when we run the next SELECT
SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback where variable_name = 'FEEDBACK used';

# Now when we are happy with 'FEEDBACK used', we can check everything else

--replace_result https http
--sorted_result
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';

0 comments on commit bdcf370

Please sign in to comment.