tarantool / vshard

The new generation of sharding based on virtual buckets
Other
100 stars 31 forks source link

Constant `DISCOVERY_INTERVAL` missing in vshard/consts.lua which effects version < 1.10 #250

Closed jeevansirela closed 4 years ago

jeevansirela commented 4 years ago

in vshard/router/init.lua const DISCOVERY_INTERVAL is present, which effects version < 1.10.

discovery_f = function(router)
    local module_version = M.module_version
    while module_version == M.module_version do
        while not next(router.replicasets) do
            lfiber.sleep(consts.DISCOVERY_INTERVAL)
        end
        local old_replicasets = router.replicasets
        for rs_uuid, replicaset in pairs(router.replicasets) do
            local active_buckets, err =
                replicaset:callro('vshard.storage.buckets_discovery', {},
                                  {timeout = 2})
            while M.errinj.ERRINJ_LONG_DISCOVERY do
                M.errinj.ERRINJ_LONG_DISCOVERY = 'waiting'
                lfiber.sleep(0.01)
            end
            -- Renew replicasets object captured by the for loop
            -- in case of reconfigure and reload events.
            if router.replicasets ~= old_replicasets then
                break
            end
            if not active_buckets then
                log.error('Error during discovery %s: %s', replicaset, err)
            else
                discovery_handle_buckets(router, replicaset, active_buckets)
            end
            lfiber.sleep(consts.DISCOVERY_INTERVAL)
        end
    end
end

in consts.lua, it is missing.

return {
    -- Bucket FSM
    BUCKET = {
        ACTIVE = 'active',
        PINNED = 'pinned',
        SENDING = 'sending',
        SENT = 'sent',
        RECEIVING = 'receiving',
        GARBAGE = 'garbage',
    },

    STATUS = {
        GREEN = 0,
        YELLOW = 1,
        ORANGE = 2,
        RED = 3,
    },

    REPLICATION_THRESHOLD_SOFT = 1,
    REPLICATION_THRESHOLD_HARD = 5,
    REPLICATION_THRESHOLD_FAIL = 10,

    DEFAULT_BUCKET_COUNT = 3000;
    BUCKET_SENT_GARBAGE_DELAY = 0.5;
    BUCKET_CHUNK_SIZE = 1000;
    DEFAULT_REBALANCER_DISBALANCE_THRESHOLD = 1;
    REBALANCER_IDLE_INTERVAL = 60 * 60;
    REBALANCER_WORK_INTERVAL = 10;
    REBALANCER_CHUNK_TIMEOUT = 60 * 5;
    DEFAULT_REBALANCER_MAX_SENDING = 1;
    REBALANCER_MAX_SENDING_MAX = 15;
    DEFAULT_REBALANCER_MAX_RECEIVING = 100;
    CALL_TIMEOUT_MIN = 0.5;
    CALL_TIMEOUT_MAX = 64;
    FAILOVER_UP_TIMEOUT = 5;
    FAILOVER_DOWN_TIMEOUT = 1;
    DEFAULT_FAILOVER_PING_TIMEOUT = 5;
    DEFAULT_SYNC_TIMEOUT = 1;
    RECONNECT_TIMEOUT = 0.5;
    DEFAULT_COLLECT_BUCKET_GARBAGE_INTERVAL = 0.5;
    RECOVERY_INTERVAL = 5;
    COLLECT_LUA_GARBAGE_INTERVAL = 100;

    DISCOVERY_IDLE_INTERVAL = 10,
    DISCOVERY_WORK_INTERVAL = 1,
    DISCOVERY_WORK_STEP = 0.01,
    DISCOVERY_TIMEOUT = 10,
}
jeevansirela commented 4 years ago

Hi @Gerold103, Should i create a PR?

Gerold103 commented 4 years ago

You can try if you want.