Skip to content

Bootstrap the project #1

@knazarov

Description

@knazarov

Let's implement a proof-of-concept of sharding based on Virtual Buckets concept.

local router = require('vshard.router')
router.cfg { --will be moved to box.cfg() sometime
    sharding = {
           { uri = '10.0.0.21:3301', replicaset=1, master = true },
           { uri = '10.0.0.22:3301', replicaset=1 },

           { uri = '10.0.0.21:3302', replicaset=2, master = true },
           { uri = '10.0.0.22:3302', replicaset=2 },

           { uri = '10.0.0.21:3303', replicaset=3, master = true },
           { uri = '10.0.0.22:3303', replicaset=3 },
    },
}
  • router: parse configuration into Lua hash { replicaset => [master, slave, ...] }, where master-slave are net.box objects. Use https://github.com/tarantool/shard/tree/dev for this code.
  • storage: create table _vbucket to store bucked_id (the single field)
  • storage: set box.cfg { read_only = false } if master is false
  • router: on shard.cfg() connect to all servers and check for _vbucket table
  • router: create routing table based on _vbucket contents from replicasets
  • router: add a method shard.bootstrap() which will make initial redistribution of buckets over shards. The number of vbuckets can be hardcoded for now.
  • storage: add a dispatcher function which will check bucket_id for every request and execute a Lua function with provided arguments
vshard.storage.dispatch = function(bucket_id, func, {arg1, arg2, ...}) end
  • router: implement a function to call procedures by bucket_id:
    shard.call(key, func, {args}) => result
  • Add tests
  • Add CI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions