[Tarantool-patches] [PATCH 2/2] feedback: collect db engines and index features
Илья Конюхов
runsfor at gmail.com
Fri Jun 19 17:01:43 MSK 2020
Hi,
Got it. That was a flaky test, which was failed on busy host. Fixed by gathering feedback synchronously.
> On 19 Jun 2020, at 02:02, Vladislav Shpilevoy <v.shpilevoy at tarantool.org> wrote:
>
> Hi! Thanks for the fixes!
>
> The patch LGTM except that its test is failing here:
> https://travis-ci.org/github/tarantool/tarantool/jobs/699753951
>
> Also it fails locally on my machine.
>
> ======================================================================================
> WORKR TEST PARAMS RESULT
> ---------------------------------------------------------------------------------
> [001] box-tap/feedback_daemon.test.lua
> [001] not ok 15 - failed subtests #
> [001] Traceback:
> [001] [Lua ] function 'test' at <builtin/tap.lua:249>
> [001] [main] at </Users/gerold/Work/Repositories/tarantool/test/box-tap/feedback_daemon.test.lua:0>
> [001]
> [001] {'failed': 2, 'planned': 10}
> [001]
> [001] not ok 22 - data is equal #
> [001] Expected: {"arch":"x64","features":{"schema":{"local_spaces":1,"functional_indices":0,"hash_indices":1,"rtree_indices":0,"temporary_spaces":1,"tree_indices":1,"jsonpath_indices":0,"vinyl_spaces":0,"bitset_indices":1,"memtx_spaces":1}},"server_id":"fb2c934e-e20e-44c3-824d-2ee854863569","is_docker":false,"os":"OSX","feedback_type":"version","cluster_id":"26f54eba-e463-4248-82ed-03b1e504ec82","tarantool_version":"2.5.0-148-g15a09c910","feedback_version":1}
> [001] Got: {"arch":"x64","features":{"schema":{"local_spaces":0,"functional_indices":0,"hash_indices":0,"rtree_indices":0,"temporary_spaces":0,"tree_indices":0,"jsonpath_indices":0,"vinyl_spaces":0,"bitset_indices":0,"memtx_spaces":0}},"server_id":"fb2c934e-e20e-44c3-824d-2ee854863569","is_docker":false,"os":"OSX","feedback_type":"version","cluster_id":"26f54eba-e463-4248-82ed-03b1e504ec82","tarantool_version":"2.5.0-148-g15a09c910","feedback_version":1}
> [001] Traceback:
> [001] [main] at </Users/gerold/Work/Repositories/tarantool/test/box-tap/feedback_daemon.test.lua:0>
> [001]
> [001] Rejected result file: box-tap/feedback_daemon.reject
> [001] [ fail ]
> [Main process] Got failed test; gently terminate all workers...
> [001] Worker "001_box-tap" got failed test; stopping the server...
> ————————————————————————————————————————
diff --git a/test/box-tap/feedback_daemon.test.lua b/test/box-tap/feedback_daemon.test.lua
index d5c0eacab..1fd5778b4 100755
--- a/test/box-tap/feedback_daemon.test.lua
+++ b/test/box-tap/feedback_daemon.test.lua
@@ -67,7 +67,7 @@ if not ok then
os.exit(0)
end
-test:plan(22)
+test:plan(16)
local function check(message)
while feedback_count < 1 do
@@ -113,13 +113,32 @@ check("feedback after start")
daemon.send_test()
check("feedback after feedback send_test")
+daemon.stop()
+
+actual = daemon.generate_feedback()
+box.feedback.save("feedback.json")
+local fio = require("fio")
+local fh = fio.open("feedback.json")
+test:ok(fh, "file is created")
+local file_data = fh:read()
+test:is(file_data, json.encode(actual), "data is equal")
+fh:close()
+fio.unlink("feedback.json")
+
+server:close()
+-- check it does not fail without server
+daemon = box.internal.feedback_daemon
+daemon.start()
+daemon.send_test()
+daemon.stop()
+
--
-- gh-4943: Collect engines and indices statistics.
--
-local feedback_json = json.decode(feedback_save)
-test:is(type(feedback_json.features), 'table', 'features field is present')
-test:is(type(feedback_json.features.schema), 'table', 'schema stats are present')
+local actual = daemon.generate_feedback()
+test:is(type(actual.features), 'table', 'features field is present')
+test:is(type(actual.features.schema), 'table', 'schema stats are present')
local expected = {
memtx_spaces = 0,
vinyl_spaces = 0,
@@ -132,7 +151,7 @@ local expected = {
jsonpath_indices = 0,
functional_indices = 0,
}
-test:is_deeply(feedback_json.features.schema, expected,
+test:is_deeply(actual.features.schema, expected,
'schema stats are empty at the moment')
box.schema.create_space('features_vinyl', {engine = 'vinyl'})
@@ -154,12 +173,8 @@ box.schema.func.create('features_func', {
box.space.features_memtx:create_index('j',
{parts = {{field = 1, type = 'number'}}, func = 'features_func'})
-check('old feedback received')
-feedback_reset()
-check('feedback with db features received')
-
-feedback_json = json.decode(feedback_save)
-local schema_stats = feedback_json.features.schema
+actual = daemon.generate_feedback()
+local schema_stats = actual.features.schema
test:test('features.schema', function(t)
t:plan(10)
t:is(schema_stats.memtx_spaces, 2, 'memtx engine usage gathered')
@@ -176,38 +191,13 @@ end)
box.space.features_memtx:create_index('memtx_sec', {type = 'hash'})
-check('old feedback received')
-feedback_reset()
-check('feedback with new db features received')
-feedback_json = json.decode(feedback_save)
-test:is(feedback_json.features.schema.hash_indices, 2,
+actual = daemon.generate_feedback()
+test:is(actual.features.schema.hash_indices, 2,
'internal cache invalidates when schema changes')
box.space.features_vinyl:drop()
box.space.features_memtx_empty:drop()
box.space.features_memtx:drop()
-check('old feedback received')
-feedback_reset()
-check('feedback with new stats received')
-
-daemon.stop()
-
-box.feedback.save("feedback.json")
-local fio = require("fio")
-local fh = fio.open("feedback.json")
-test:ok(fh, "file is created")
-local file_data = fh:read()
-test:is(file_data, feedback_save, "data is equal")
-fh:close()
-fio.unlink("feedback.json")
-
-server:close()
--- check it does not fail without server
-local daemon = box.internal.feedback_daemon
-daemon.start()
-daemon.send_test()
-daemon.stop()
-
test:check()
os.exit(0)
More information about the Tarantool-patches
mailing list