Skip to content

Commit 6b1057d

Browse files
committed
rebalancer: don't show "object is outdated" log
This patch removes logging of `OBJECT_IS_OUTDATED` errors in the rebalancer and recovery services. Part of #212 NO_DOC=bugfix
1 parent fc7a877 commit 6b1057d

File tree

2 files changed

+33
-9
lines changed

2 files changed

+33
-9
lines changed

test/storage-luatest/storage_1_1_1_test.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,19 @@ rebalancer_recovery_group.test_no_log_spam_when_buckets_no_active = function(g)
270270
end)
271271
g.replica_2_a:start()
272272
end
273+
274+
rebalancer_recovery_group.test_no_object_is_outdated_logs = function(g)
275+
g.replica_1_a:exec(function(cfg)
276+
ivshard.storage.internal.errinj.ERRINJ_CFG_OUTDATED_DELAY = true
277+
require('fiber').new(function()
278+
ivshard.storage.cfg(cfg, box.info.uuid)
279+
end)
280+
ivshard.storage.rebalancer_wakeup()
281+
end, {global_cfg})
282+
move_bucket(g.replica_3_a, g.replica_1_a,
283+
get_first_storage_bucket_id(g.replica_3_a))
284+
g.replica_1_a:exec(function()
285+
ivshard.storage.internal.errinj.ERRINJ_CFG_OUTDATED_DELAY = false
286+
end)
287+
t.assert_not(g.replica_1_a:grep_log('Object is outdated'))
288+
end

vshard/storage/init.lua

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ if not M then
8686
total_bucket_count = 0,
8787
errinj = {
8888
ERRINJ_CFG = false,
89+
ERRINJ_CFG_OUTDATED_DELAY = false,
8990
ERRINJ_RELOAD = false,
9091
ERRINJ_CFG_DELAY = false,
9192
ERRINJ_LONG_RECEIVE = false,
@@ -964,9 +965,11 @@ local function recovery_step_by_type(type)
964965
if err == nil then
965966
err = 'unknown'
966967
end
967-
log.info(start_format, type)
968-
log.error('Error during recovery of bucket %s on replicaset '..
969-
'%s: %s', bucket_id, peer_id, err)
968+
if err.name ~= 'OBJECT_IS_OUTDATED' then
969+
log.info(start_format, type)
970+
log.error('Error during recovery of bucket %s ' ..
971+
' on replicaset %s: %s', bucket_id, peer_id, err)
972+
end
970973
is_step_empty = false
971974
end
972975
goto continue
@@ -1854,7 +1857,7 @@ local function bucket_send_xc(bucket_id, destination, opts, exception_guard)
18541857
{bucket_id, id, data}, opts)
18551858
bucket_generation =
18561859
bucket_guard_xc(bucket_generation, bucket_id, sendg)
1857-
if not status then
1860+
if not status and err.name ~= 'OBJECT_IS_OUTDATED' then
18581861
return status, lerror.make(err)
18591862
end
18601863
limit = consts.BUCKET_CHUNK_SIZE
@@ -1866,7 +1869,7 @@ local function bucket_send_xc(bucket_id, destination, opts, exception_guard)
18661869
end
18671870
status, err = master_call(replicaset, 'vshard.storage.bucket_recv',
18681871
{bucket_id, id, data}, opts)
1869-
if not status then
1872+
if not status and err.name ~= 'OBJECT_IS_OUTDATED' then
18701873
return status, lerror.make(err)
18711874
end
18721875
while M.errinj.ERRINJ_LAST_SEND_DELAY do
@@ -1896,7 +1899,7 @@ local function bucket_send_xc(bucket_id, destination, opts, exception_guard)
18961899
-- the same bucket is activated on the destination.
18971900
status, err = master_call(replicaset, 'vshard.storage.bucket_recv',
18981901
{bucket_id, id, {}, {is_last = true}}, opts)
1899-
if not status then
1902+
if not status and err.name ~= 'OBJECT_IS_OUTDATED' then
19001903
return status, lerror.make(err)
19011904
end
19021905
return true
@@ -2901,9 +2904,11 @@ local function rebalancer_service_f(service)
29012904
rs, 'vshard.storage.rebalancer_apply_routes', {src_routes},
29022905
{timeout = consts.REBALANCER_APPLY_ROUTES_TIMEOUT})
29032906
if not status then
2904-
log.error(service:set_status_error(
2905-
'Error during routes appying on "%s": %s. '..
2906-
'Try rebalance later', rs, lerror.make(err)))
2907+
if err.name ~= 'OBJECT_IS_OUTDATED' then
2908+
log.error(service:set_status_error(
2909+
'Error during routes appying on "%s": %s. '..
2910+
'Try rebalance later', rs, lerror.make(err)))
2911+
end
29072912
service:set_activity('idling')
29082913
lfiber.sleep(consts.REBALANCER_WORK_INTERVAL)
29092914
goto continue
@@ -3757,6 +3762,9 @@ local function storage_cfg_xc(cfgctx)
37573762
lschema.cfg(new_cfg)
37583763
lreplicaset.rebind_replicasets(new_replicasets, M.replicasets)
37593764
lreplicaset.outdate_replicasets(M.replicasets)
3765+
while M.errinj.ERRINJ_CFG_OUTDATED_DELAY do
3766+
lfiber.sleep(0.01)
3767+
end
37603768
lreplicaset.create_workers(new_replicasets)
37613769
M.replicasets = new_replicasets
37623770
M.this_replicaset = new_replicasets[replicaset_id]

0 commit comments

Comments
 (0)