[MDEV-7933] plugins.feedback_plugin_send depends on being executed after plugins.feedback_plugin_load Created: 2015-04-08  Updated: 2015-09-27  Resolved: 2015-09-27

Status: Closed
Project: MariaDB Server
Component/s: Tests
Affects Version/s: 5.5, 10.0, 10.1
Fix Version/s: 5.5.46, 10.0.22, 10.1.8

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Elena Stepanova
Resolution: Fixed Votes: 0
Labels: None


 Description   

plugins.feedback_plugin_send fails when it's executed alone:

CURRENT_TEST: plugins.feedback_plugin_send
--- /data/repo/git/5.5/mysql-test/suite/plugins/r/feedback_plugin_send.result	2015-02-15 23:11:28.000000000 +0300
+++ /data/repo/git/5.5/mysql-test/suite/plugins/r/feedback_plugin_send.reject	2015-04-08 00:08:08.000000000 +0300
@@ -4,7 +4,7 @@
 select * from information_schema.feedback where variable_name like 'feed%'
        and variable_name not like  '%_uid';
 VARIABLE_NAME	VARIABLE_VALUE
-FEEDBACK used	2
+FEEDBACK used	1
 FEEDBACK version	1.1
 FEEDBACK_SEND_RETRY_WAIT	60
 FEEDBACK_SEND_TIMEOUT	60

Apparently, the value '2' is only true for the set feedback_plugin_load feedback_plugin_send. I could mask it, but I'm not sure if it was intentional.



 Comments   
Comment by Elena Stepanova [ 2015-09-27 ]

The culprit is actually feedback_plugin_load test. It queries I_S.FEEDBACK table, and every time the table is queried, 'FEEDBACK used' is increased.
feedback_plugin_load normally requires server restart before execution, so its first execution goes fine, 'FEEDBACK used' = 1.
If the next test in line is feedback_plugin_send, it sources feedback_plugin_load again, so the select returns 'FEEDBACK used' = 2, as recorded in feedback_plugin_send.result.

However, if we execute feedback_plugin_send.test separately, there are no previous selects from I_S.FEEDBACK, so the value is lower.
Or, if we execute feedback_plugin_load more than once, e.g. with --repeat, the 2nd and further runs will fail, because there 'FEEDBACK used' will be greater than 1.

The solution should be either to mask the value, or check that it increases without recording the actual value. I will go with the latter.

Comment by Elena Stepanova [ 2015-09-27 ]

serg, please check if you are okay with this.
Commit mailing list seems to be down, so here is the patch:

commit bdcf37076595b003d74edc6a23c53ac23fba64a8
Author: Elena Stepanova <elenst@montyprogram.com>
Date:   Sun Sep 27 16:00:48 2015 +0300
 
    MDEV-7933 plugins.feedback_plugin_send depends on being executed after 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.
 
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_load.result b/mysql-test/suite/plugins/r/feedback_plugin_load.result
index 443b91b..ea6eae9 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_load.result
+++ b/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
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_send.result b/mysql-test/suite/plugins/r/feedback_plugin_send.result
index 2852240..90a37f7 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_send.result
+++ b/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
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_load.test b/mysql-test/suite/plugins/t/feedback_plugin_load.test
index 5ad3016..f7c62b9 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_load.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_load.test
@@ -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';

Comment by Elena Stepanova [ 2015-09-27 ]

Thinking about it, it's probably not worth reviewing. The change should do the job, for example to allow the test to pass when it's retried by buildbot, and otherwise nobody really cares about it, so I'll push it and see how it goes.

Comment by Elena Stepanova [ 2015-09-27 ]

https://github.com/MariaDB/server/commit/bdcf37076595b003d74edc6a23c53ac23fba64a8

Generated at Thu Feb 08 07:23:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.