Merge pull request #1711 from alainjobart/splitshardcount

Splitshardcount
This commit is contained in:
Alain Jobart 2016-05-20 09:37:20 -07:00
Родитель 2b8b9d06c3 8708e91530
Коммит 923ca110a8
26 изменённых файлов: 139 добавлений и 271 удалений

Просмотреть файл

@ -837,7 +837,6 @@ SrvKeyspace is a rollup node for the keyspace itself.
| <code>sharding_column_name</code> <br>string| copied from Keyspace |
| <code>sharding_column_type</code> <br>[KeyspaceIdType](#topodata.keyspaceidtype)| |
| <code>served_from</code> <br>list &lt;[ServedFrom](#srvkeyspace.servedfrom)&gt;| |
| <code>split_shard_count</code> <br>int32| |
#### Messages

Просмотреть файл

@ -118,7 +118,7 @@ Creates the specified keyspace.
#### Example
<pre class="command-example">CreateKeyspace [-sharding_column_name=name] [-sharding_column_type=type] [-served_from=tablettype1:ks1,tablettype2,ks2,...] [-split_shard_count=N] [-force] &lt;keyspace name&gt;</pre>
<pre class="command-example">CreateKeyspace [-sharding_column_name=name] [-sharding_column_type=type] [-served_from=tablettype1:ks1,tablettype2,ks2,...] [-force] &lt;keyspace name&gt;</pre>
#### Flags
@ -128,7 +128,6 @@ Creates the specified keyspace.
| served_from | string | Specifies a comma-separated list of dbtype:keyspace pairs used to serve traffic |
| sharding_column_name | string | Specifies the column to use for sharding operations |
| sharding_column_type | string | Specifies the type of the column to use for sharding operations |
| split_shard_count | Int | Specifies the number of shards to use for data splits |
#### Arguments
@ -388,14 +387,13 @@ Updates the sharding information for a keyspace.
#### Example
<pre class="command-example">SetKeyspaceShardingInfo [-force] [-split_shard_count=N] &lt;keyspace name&gt; [&lt;column name&gt;] [&lt;column type&gt;]</pre>
<pre class="command-example">SetKeyspaceShardingInfo [-force] &lt;keyspace name&gt; [&lt;column name&gt;] [&lt;column type&gt;]</pre>
#### Flags
| Name | Type | Definition |
| :-------- | :--------- | :--------- |
| force | Boolean | Updates fields even if they are already set. Use caution before calling this command. |
| split_shard_count | Int | Specifies the number of shards to use for data splits |
#### Arguments

Просмотреть файл

@ -120,7 +120,7 @@ if [ $num_shards -gt 0 ]
then
echo Calling CreateKeyspace and SetKeyspaceShardingInfo
$kvtctl CreateKeyspace -force $KEYSPACE
$kvtctl SetKeyspaceShardingInfo -force -split_shard_count $num_shards $KEYSPACE keyspace_id uint64
$kvtctl SetKeyspaceShardingInfo -force $KEYSPACE keyspace_id uint64
fi
echo 'Running vttablet-up.sh' && CELLS=$CELLS ./vttablet-up.sh
@ -152,14 +152,8 @@ while [ $counter -lt $MAX_VTTABLET_TOPO_WAIT_RETRIES ]; do
fi
done
# split_shard_count = num_shards for sharded keyspace, 0 for unsharded
split_shard_count=$num_shards
if [ $split_shard_count -eq 1 ]; then
split_shard_count=0
fi
echo -n Setting Keyspace Sharding Info...
$kvtctl SetKeyspaceShardingInfo -force -split_shard_count $split_shard_count $KEYSPACE keyspace_id uint64
$kvtctl SetKeyspaceShardingInfo -force $KEYSPACE keyspace_id uint64
echo Done
echo -n Rebuilding Keyspace Graph...
$kvtctl RebuildKeyspaceGraph $KEYSPACE

Просмотреть файл

@ -44,7 +44,6 @@ func testGetSrvKeyspace(t *testing.T, conn *vtgateconn.VTGateConn) {
Keyspace: "other_keyspace",
},
},
SplitShardCount: 128,
}
got, err := conn.GetSrvKeyspace(context.Background(), "big")
if err != nil {

Просмотреть файл

@ -71,7 +71,6 @@ func (c *successClient) GetSrvKeyspace(ctx context.Context, keyspace string) (*t
Keyspace: "other_keyspace",
},
},
SplitShardCount: 128,
}, nil
}
if keyspace == "small" {

Просмотреть файл

@ -339,9 +339,6 @@ type Keyspace struct {
// type of the column used for sharding
// UNSET if the keyspace is not sharded
ShardingColumnType KeyspaceIdType `protobuf:"varint,2,opt,name=sharding_column_type,json=shardingColumnType,enum=topodata.KeyspaceIdType" json:"sharding_column_type,omitempty"`
// SplitShardCount stores the number of jobs to run to be sure to
// always have at most one job per shard (used during resharding).
SplitShardCount int32 `protobuf:"varint,3,opt,name=split_shard_count,json=splitShardCount" json:"split_shard_count,omitempty"`
// ServedFrom will redirect the appropriate traffic to
// another keyspace.
ServedFroms []*Keyspace_ServedFrom `protobuf:"bytes,4,rep,name=served_froms,json=servedFroms" json:"served_froms,omitempty"`
@ -439,7 +436,6 @@ type SrvKeyspace struct {
ShardingColumnName string `protobuf:"bytes,2,opt,name=sharding_column_name,json=shardingColumnName" json:"sharding_column_name,omitempty"`
ShardingColumnType KeyspaceIdType `protobuf:"varint,3,opt,name=sharding_column_type,json=shardingColumnType,enum=topodata.KeyspaceIdType" json:"sharding_column_type,omitempty"`
ServedFrom []*SrvKeyspace_ServedFrom `protobuf:"bytes,4,rep,name=served_from,json=servedFrom" json:"served_from,omitempty"`
SplitShardCount int32 `protobuf:"varint,5,opt,name=split_shard_count,json=splitShardCount" json:"split_shard_count,omitempty"`
}
func (m *SrvKeyspace) Reset() { *m = SrvKeyspace{} }
@ -517,72 +513,71 @@ func init() {
}
var fileDescriptor0 = []byte{
// 1070 bytes of a gzipped FileDescriptorProto
// 1051 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x6e, 0xe2, 0x46,
0x14, 0xae, 0xcd, 0x4f, 0xe0, 0x40, 0x58, 0x67, 0x9a, 0xad, 0x2c, 0x57, 0x55, 0x23, 0x6e, 0xba,
0x4a, 0x55, 0x5a, 0x65, 0xfb, 0x13, 0xad, 0x54, 0x69, 0x09, 0x65, 0xdb, 0x6c, 0x12, 0x42, 0x07,
0x47, 0xdb, 0x5c, 0x59, 0x06, 0x66, 0xb3, 0xd6, 0x82, 0xed, 0x7a, 0x86, 0x48, 0x3c, 0xc3, 0x5e,
0xf4, 0xbe, 0x0f, 0xd2, 0xdb, 0x3e, 0x51, 0x1f, 0xa1, 0x52, 0x67, 0xce, 0xd8, 0x60, 0x20, 0x49,
0xb3, 0xab, 0x5c, 0x71, 0xce, 0x9c, 0xff, 0x6f, 0xbe, 0x33, 0x06, 0x1a, 0x22, 0x8a, 0xa3,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0x42, 0x7d, 0x93, 0x61, 0x52, 0x85, 0xd2, 0xa0, 0xdb, 0xef, 0x78,
0xf6, 0x07, 0x04, 0xa0, 0x3c, 0x38, 0xed, 0x7a, 0xdf, 0x7e, 0x6d, 0x6b, 0xf2, 0xf3, 0xc9, 0x95,
0xd7, 0xe9, 0xdb, 0xfa, 0x53, 0x41, 0x16, 0xac, 0x2f, 0x24, 0x16, 0xec, 0x0d, 0xba, 0x67, 0xdd,
0xcb, 0x57, 0x5d, 0x95, 0x72, 0xd1, 0xea, 0x7b, 0x1d, 0x2a, 0x52, 0x84, 0x83, 0x76, 0x7a, 0xe7,
0xa7, 0xed, 0x96, 0xad, 0x4b, 0x07, 0xfd, 0xe1, 0xb2, 0x7b, 0x7e, 0x65, 0x1b, 0x58, 0xab, 0xe5,
0xb5, 0x7f, 0x52, 0xc7, 0x7e, 0xaf, 0x45, 0x3b, 0xb6, 0x29, 0x7e, 0x1b, 0x6a, 0x9d, 0x5f, 0x7a,
0x1d, 0x7a, 0x7a, 0xd1, 0xe9, 0x7a, 0xad, 0x73, 0xbb, 0x24, 0x73, 0x4e, 0x5a, 0xed, 0xb3, 0x41,
0xcf, 0x2e, 0xab, 0x62, 0x7d, 0xef, 0x52, 0x84, 0xee, 0x49, 0xc7, 0xab, 0x4b, 0x7a, 0x26, 0x6e,
0xa9, 0xb8, 0xba, 0xad, 0x9d, 0xb8, 0xe0, 0x8c, 0xa2, 0x69, 0x73, 0x19, 0xcd, 0xd3, 0xf9, 0x90,
0x35, 0x17, 0x61, 0xca, 0x38, 0x57, 0xff, 0xa4, 0x0e, 0xcb, 0xf8, 0xe7, 0xd9, 0x3f, 0x01, 0x00,
0x00, 0xff, 0xff, 0xd5, 0x8c, 0x39, 0x13, 0xbd, 0x0a, 0x00, 0x00,
}

Просмотреть файл

@ -48,13 +48,6 @@ func Run(port int) {
Close()
}
// FireRunHooks fires the hooks registered by OnHook.
// Use this in a non-server to run the hooks registered
// by servenv.OnRun().
func FireRunHooks() {
onRunHooks.Fire()
}
// Close runs any registered exit hooks in parallel.
func Close() {
onCloseHooks.Fire()

Просмотреть файл

@ -14,7 +14,6 @@
// a vitess distribution, register them using onInit and onClose. A
// clean way of achieving that is adding to this package a file with
// an init() function that registers the hooks.
package servenv
import (
@ -26,17 +25,20 @@ import (
"syscall"
"time"
// register the HTTP handlers for profiling
_ "net/http/pprof"
log "github.com/golang/glog"
"github.com/youtube/vitess/go/event"
"github.com/youtube/vitess/go/netutil"
"github.com/youtube/vitess/go/stats"
// register the proper init and shutdown hooks for logging
_ "github.com/youtube/vitess/go/vt/logutil"
)
var (
// The flags used when calling RegisterDefaultFlags.
// Port is part of the flags used when calling RegisterDefaultFlags.
Port *int
// Flags to alter the behavior of the library.
@ -53,10 +55,11 @@ var (
onRunHooks event.Hooks
inited bool
// filled in when calling Run
// ListeningURL is filled in when calling Run, contains the server URL.
ListeningURL url.URL
)
// Init is the first phase of the server startup.
func Init() {
mu.Lock()
defer mu.Unlock()
@ -72,10 +75,6 @@ func Init() {
}
runtime.MemProfileRate = *memProfileRate
gomaxprocs := os.Getenv("GOMAXPROCS")
if gomaxprocs == "" {
gomaxprocs = "1"
}
// We used to set this limit directly, but you pretty much have to
// use a root account to allow increasing a limit reliably. Dropping
@ -164,6 +163,13 @@ func OnRun(f func()) {
onRunHooks.Add(f)
}
// FireRunHooks fires the hooks registered by OnHook.
// Use this in a non-server to run the hooks registered
// by servenv.OnRun().
func FireRunHooks() {
onRunHooks.Fire()
}
// RegisterDefaultFlags registers the default flags for
// listening to a given port for standard connections.
// If calling this, then call RunDefault()

Просмотреть файл

@ -63,7 +63,6 @@ func CheckKeyspace(ctx context.Context, t *testing.T, ts topo.Impl) {
Keyspace: "test_keyspace3",
},
},
SplitShardCount: 64,
}
if err := ts.CreateKeyspace(ctx, "test_keyspace2", k); err != nil {
t.Errorf("CreateKeyspace: %v", err)

Просмотреть файл

@ -169,7 +169,7 @@ func CheckWatchSrvKeyspace(ctx context.Context, t *testing.T, ts topo.Impl) {
}
// re-create the value, a bit different, should get a notification
srvKeyspace.SplitShardCount = 2
srvKeyspace.ShardingColumnName = "test_column2"
if err := ts.UpdateSrvKeyspace(ctx, cell, keyspace, srvKeyspace); err != nil {
t.Fatalf("UpdateSrvKeyspace failed: %v", err)
}

Просмотреть файл

@ -43,7 +43,6 @@ func findCellsForRebuild(ki *topo.KeyspaceInfo, shardMap map[string]*topo.ShardI
ShardingColumnName: ki.ShardingColumnName,
ShardingColumnType: ki.ShardingColumnType,
ServedFrom: ki.ComputeCellServedFrom(cell),
SplitShardCount: ki.SplitShardCount,
}
}
}

Просмотреть файл

@ -245,7 +245,7 @@ var commands = []commandGroup{
{
"Keyspaces", []command{
{"CreateKeyspace", commandCreateKeyspace,
"[-sharding_column_name=name] [-sharding_column_type=type] [-served_from=tablettype1:ks1,tablettype2,ks2,...] [-split_shard_count=N] [-force] <keyspace name>",
"[-sharding_column_name=name] [-sharding_column_type=type] [-served_from=tablettype1:ks1,tablettype2,ks2,...] [-force] <keyspace name>",
"Creates the specified keyspace."},
{"DeleteKeyspace", commandDeleteKeyspace,
"[-recursive] <keyspace>",
@ -260,7 +260,7 @@ var commands = []commandGroup{
"",
"Outputs a sorted list of all keyspaces."},
{"SetKeyspaceShardingInfo", commandSetKeyspaceShardingInfo,
"[-force] [-split_shard_count=N] <keyspace name> [<column name>] [<column type>]",
"[-force] <keyspace name> [<column name>] [<column type>]",
"Updates the sharding information for a keyspace."},
{"SetKeyspaceServedFrom", commandSetKeyspaceServedFrom,
"[-source=<source keyspace name>] [-remove] [-cells=c1,c2,...] <keyspace name> <tablet type>",
@ -1465,7 +1465,6 @@ func commandDeleteShard(ctx context.Context, wr *wrangler.Wrangler, subFlags *fl
func commandCreateKeyspace(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {
shardingColumnName := subFlags.String("sharding_column_name", "", "Specifies the column to use for sharding operations")
shardingColumnType := subFlags.String("sharding_column_type", "", "Specifies the type of the column to use for sharding operations")
splitShardCount := subFlags.Int("split_shard_count", 0, "Specifies the number of shards to use for data splits")
force := subFlags.Bool("force", false, "Proceeds even if the keyspace already exists")
var servedFrom flagutil.StringMapValue
subFlags.Var(&servedFrom, "served_from", "Specifies a comma-separated list of dbtype:keyspace pairs used to serve traffic")
@ -1484,7 +1483,6 @@ func commandCreateKeyspace(ctx context.Context, wr *wrangler.Wrangler, subFlags
ki := &topodatapb.Keyspace{
ShardingColumnName: *shardingColumnName,
ShardingColumnType: kit,
SplitShardCount: int32(*splitShardCount),
}
if len(servedFrom) > 0 {
for name, value := range servedFrom {
@ -1558,7 +1556,6 @@ func commandGetKeyspaces(ctx context.Context, wr *wrangler.Wrangler, subFlags *f
func commandSetKeyspaceShardingInfo(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {
force := subFlags.Bool("force", false, "Updates fields even if they are already set. Use caution before calling this command.")
splitShardCount := subFlags.Int("split_shard_count", 0, "Specifies the number of shards to use for data splits")
if err := subFlags.Parse(args); err != nil {
return err
}
@ -1586,7 +1583,7 @@ func commandSetKeyspaceShardingInfo(ctx context.Context, wr *wrangler.Wrangler,
return fmt.Errorf("Both <column name> and <column type> must be set, or both must be unset.")
}
return wr.SetKeyspaceShardingInfo(ctx, keyspace, columnName, kit, int32(*splitShardCount), *force)
return wr.SetKeyspaceShardingInfo(ctx, keyspace, columnName, kit, *force)
}
func commandSetKeyspaceServedFrom(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {

Просмотреть файл

@ -2205,5 +2205,4 @@ var getSrvKeyspaceResult = &topodatapb.SrvKeyspace{
Keyspace: "other_keyspace",
},
},
SplitShardCount: 128,
}

Просмотреть файл

@ -133,7 +133,7 @@ func (tc *splitCloneTestCase) setUp(v3 bool) {
if err := tc.ts.CreateShard(ctx, "ks", "80-"); err != nil {
tc.t.Fatalf("CreateShard(\"-80\") failed: %v", err)
}
if err := tc.wi.wr.SetKeyspaceShardingInfo(ctx, "ks", "keyspace_id", topodatapb.KeyspaceIdType_UINT64, 4, false); err != nil {
if err := tc.wi.wr.SetKeyspaceShardingInfo(ctx, "ks", "keyspace_id", topodatapb.KeyspaceIdType_UINT64, false); err != nil {
tc.t.Fatalf("SetKeyspaceShardingInfo failed: %v", err)
}
if err := tc.wi.wr.RebuildKeyspaceGraph(ctx, "ks", nil); err != nil {

Просмотреть файл

@ -220,7 +220,7 @@ func testSplitDiff(t *testing.T, v3 bool) {
t.Fatalf("CreateShard(\"-80\") failed: %v", err)
}
wi.wr.SetSourceShards(ctx, "ks", "-40", []*topodatapb.TabletAlias{sourceRdonly1.Tablet.Alias}, nil)
if err := wi.wr.SetKeyspaceShardingInfo(ctx, "ks", "keyspace_id", topodatapb.KeyspaceIdType_UINT64, 4, false); err != nil {
if err := wi.wr.SetKeyspaceShardingInfo(ctx, "ks", "keyspace_id", topodatapb.KeyspaceIdType_UINT64, false); err != nil {
t.Fatalf("SetKeyspaceShardingInfo failed: %v", err)
}
if err := wi.wr.RebuildKeyspaceGraph(ctx, "ks", nil); err != nil {

Просмотреть файл

@ -36,19 +36,19 @@ func (wr *Wrangler) unlockKeyspace(ctx context.Context, keyspace string, actionN
// SetKeyspaceShardingInfo locks a keyspace and sets its ShardingColumnName
// and ShardingColumnType
func (wr *Wrangler) SetKeyspaceShardingInfo(ctx context.Context, keyspace, shardingColumnName string, shardingColumnType topodatapb.KeyspaceIdType, splitShardCount int32, force bool) error {
func (wr *Wrangler) SetKeyspaceShardingInfo(ctx context.Context, keyspace, shardingColumnName string, shardingColumnType topodatapb.KeyspaceIdType, force bool) error {
actionNode := actionnode.SetKeyspaceShardingInfo()
lockPath, err := wr.lockKeyspace(ctx, keyspace, actionNode)
if err != nil {
return err
}
err = wr.setKeyspaceShardingInfo(ctx, keyspace, shardingColumnName, shardingColumnType, splitShardCount, force)
err = wr.setKeyspaceShardingInfo(ctx, keyspace, shardingColumnName, shardingColumnType, force)
return wr.unlockKeyspace(ctx, keyspace, actionNode, lockPath, err)
}
func (wr *Wrangler) setKeyspaceShardingInfo(ctx context.Context, keyspace, shardingColumnName string, shardingColumnType topodatapb.KeyspaceIdType, splitShardCount int32, force bool) error {
func (wr *Wrangler) setKeyspaceShardingInfo(ctx context.Context, keyspace, shardingColumnName string, shardingColumnType topodatapb.KeyspaceIdType, force bool) error {
ki, err := wr.ts.GetKeyspace(ctx, keyspace)
if err != nil {
return err
@ -72,7 +72,6 @@ func (wr *Wrangler) setKeyspaceShardingInfo(ctx context.Context, keyspace, shard
ki.ShardingColumnName = shardingColumnName
ki.ShardingColumnType = shardingColumnType
ki.SplitShardCount = splitShardCount
return wr.ts.UpdateKeyspace(ctx, ki)
}

Просмотреть файл

@ -442,7 +442,6 @@ public abstract class RpcClientTest {
.setTabletType(TabletType.MASTER)
.setKeyspace("other_keyspace")
.build())
.setSplitShardCount(128)
.build();
SrvKeyspace actual = conn.getSrvKeyspace(ctx, "big");
Assert.assertEquals(expected, actual);

Просмотреть файл

@ -12,9 +12,6 @@ namespace Vitess\Proto\Topodata {
/** @var int - \Vitess\Proto\Topodata\KeyspaceIdType */
public $sharding_column_type = null;
/** @var int */
public $split_shard_count = null;
/** @var \Vitess\Proto\Topodata\Keyspace\ServedFrom[] */
public $served_froms = array();
@ -43,14 +40,6 @@ namespace Vitess\Proto\Topodata {
$f->reference = '\Vitess\Proto\Topodata\KeyspaceIdType';
$descriptor->addField($f);
// OPTIONAL INT32 split_shard_count = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "split_shard_count";
$f->type = \DrSlump\Protobuf::TYPE_INT32;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// REPEATED MESSAGE served_froms = 4
$f = new \DrSlump\Protobuf\Field();
$f->number = 4;
@ -141,43 +130,6 @@ namespace Vitess\Proto\Topodata {
return $this->_set(2, $value);
}
/**
* Check if <split_shard_count> has a value
*
* @return boolean
*/
public function hasSplitShardCount(){
return $this->_has(3);
}
/**
* Clear <split_shard_count> value
*
* @return \Vitess\Proto\Topodata\Keyspace
*/
public function clearSplitShardCount(){
return $this->_clear(3);
}
/**
* Get <split_shard_count> value
*
* @return int
*/
public function getSplitShardCount(){
return $this->_get(3);
}
/**
* Set <split_shard_count> value
*
* @param int $value
* @return \Vitess\Proto\Topodata\Keyspace
*/
public function setSplitShardCount( $value){
return $this->_set(3, $value);
}
/**
* Check if <served_froms> has a value
*

Просмотреть файл

@ -18,9 +18,6 @@ namespace Vitess\Proto\Topodata {
/** @var \Vitess\Proto\Topodata\SrvKeyspace\ServedFrom[] */
public $served_from = array();
/** @var int */
public $split_shard_count = null;
/** @var \Closure[] */
protected static $__extensions = array();
@ -64,14 +61,6 @@ namespace Vitess\Proto\Topodata {
$f->reference = '\Vitess\Proto\Topodata\SrvKeyspace\ServedFrom';
$descriptor->addField($f);
// OPTIONAL INT32 split_shard_count = 5
$f = new \DrSlump\Protobuf\Field();
$f->number = 5;
$f->name = "split_shard_count";
$f->type = \DrSlump\Protobuf::TYPE_INT32;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
@ -266,43 +255,6 @@ namespace Vitess\Proto\Topodata {
public function addServedFrom(\Vitess\Proto\Topodata\SrvKeyspace\ServedFrom $value){
return $this->_add(4, $value);
}
/**
* Check if <split_shard_count> has a value
*
* @return boolean
*/
public function hasSplitShardCount(){
return $this->_has(5);
}
/**
* Clear <split_shard_count> value
*
* @return \Vitess\Proto\Topodata\SrvKeyspace
*/
public function clearSplitShardCount(){
return $this->_clear(5);
}
/**
* Get <split_shard_count> value
*
* @return int
*/
public function getSplitShardCount(){
return $this->_get(5);
}
/**
* Set <split_shard_count> value
*
* @param int $value
* @return \Vitess\Proto\Topodata\SrvKeyspace
*/
public function setSplitShardCount( $value){
return $this->_set(5, $value);
}
}
}

Просмотреть файл

@ -418,7 +418,6 @@ class VTGateConnTest extends \PHPUnit_Framework_TestCase
$served_from->setTabletType(Proto\Topodata\TabletType::MASTER);
$served_from->setKeyspace('other_keyspace');
$expected->addServedFrom($served_from);
$expected->setSplitShardCount(128);
$actual = $conn->getSrvKeyspace($ctx, "big");
$this->assertEquals($expected, $actual);

Просмотреть файл

@ -198,9 +198,8 @@ message Keyspace {
// UNSET if the keyspace is not sharded
KeyspaceIdType sharding_column_type = 2;
// SplitShardCount stores the number of jobs to run to be sure to
// always have at most one job per shard (used during resharding).
int32 split_shard_count = 3;
// OBSOLETE int32 split_shard_count = 3;
reserved 3;
// ServedFrom indicates a relationship between a TabletType and the
// keyspace name that's serving it.
@ -268,5 +267,6 @@ message SrvKeyspace {
string sharding_column_name = 2;
KeyspaceIdType sharding_column_type = 3;
repeated ServedFrom served_from = 4;
int32 split_shard_count = 5;
// OBSOLETE int32 split_shard_count = 5;
reserved 5;
}

Просмотреть файл

@ -554,9 +554,6 @@ class Proto3Connection(object):
}
result['Partitions'] = pmap
if sk.split_shard_count:
result['SplitShardCount'] = sk.split_shard_count
return result
def keyspace_from_response(self, name, response):

Просмотреть файл

@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
name='topodata.proto',
package='topodata',
syntax='proto3',
serialized_pb=_b('\n\x0etopodata.proto\x12\x08topodata\"&\n\x08KeyRange\x12\r\n\x05start\x18\x01 \x01(\x0c\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x0c\"(\n\x0bTabletAlias\x12\x0c\n\x04\x63\x65ll\x18\x01 \x01(\t\x12\x0b\n\x03uid\x18\x02 \x01(\r\"\x90\x03\n\x06Tablet\x12$\n\x05\x61lias\x18\x01 \x01(\x0b\x32\x15.topodata.TabletAlias\x12\x10\n\x08hostname\x18\x02 \x01(\t\x12\n\n\x02ip\x18\x03 \x01(\t\x12/\n\x08port_map\x18\x04 \x03(\x0b\x32\x1d.topodata.Tablet.PortMapEntry\x12\x10\n\x08keyspace\x18\x05 \x01(\t\x12\r\n\x05shard\x18\x06 \x01(\t\x12%\n\tkey_range\x18\x07 \x01(\x0b\x32\x12.topodata.KeyRange\x12\"\n\x04type\x18\x08 \x01(\x0e\x32\x14.topodata.TabletType\x12\x18\n\x10\x64\x62_name_override\x18\t \x01(\t\x12(\n\x04tags\x18\n \x03(\x0b\x32\x1a.topodata.Tablet.TagsEntry\x1a.\n\x0cPortMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a+\n\tTagsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01J\x04\x08\x0b\x10\x0c\"\xcb\x04\n\x05Shard\x12+\n\x0cmaster_alias\x18\x01 \x01(\x0b\x32\x15.topodata.TabletAlias\x12%\n\tkey_range\x18\x02 \x01(\x0b\x32\x12.topodata.KeyRange\x12\x30\n\x0cserved_types\x18\x03 \x03(\x0b\x32\x1a.topodata.Shard.ServedType\x12\x32\n\rsource_shards\x18\x04 \x03(\x0b\x32\x1b.topodata.Shard.SourceShard\x12\r\n\x05\x63\x65lls\x18\x05 \x03(\t\x12\x36\n\x0ftablet_controls\x18\x06 \x03(\x0b\x32\x1d.topodata.Shard.TabletControl\x1a\x46\n\nServedType\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\r\n\x05\x63\x65lls\x18\x02 \x03(\t\x1ar\n\x0bSourceShard\x12\x0b\n\x03uid\x18\x01 \x01(\r\x12\x10\n\x08keyspace\x18\x02 \x01(\t\x12\r\n\x05shard\x18\x03 \x01(\t\x12%\n\tkey_range\x18\x04 \x01(\x0b\x32\x12.topodata.KeyRange\x12\x0e\n\x06tables\x18\x05 \x03(\t\x1a\x84\x01\n\rTabletControl\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\r\n\x05\x63\x65lls\x18\x02 \x03(\t\x12\x1d\n\x15\x64isable_query_service\x18\x03 \x01(\x08\x12\x1a\n\x12\x62lacklisted_tables\x18\x04 \x03(\t\"\x8a\x02\n\x08Keyspace\x12\x1c\n\x14sharding_column_name\x18\x01 \x01(\t\x12\x36\n\x14sharding_column_type\x18\x02 \x01(\x0e\x32\x18.topodata.KeyspaceIdType\x12\x19\n\x11split_shard_count\x18\x03 \x01(\x05\x12\x33\n\x0cserved_froms\x18\x04 \x03(\x0b\x32\x1d.topodata.Keyspace.ServedFrom\x1aX\n\nServedFrom\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\r\n\x05\x63\x65lls\x18\x02 \x03(\t\x12\x10\n\x08keyspace\x18\x03 \x01(\t\"w\n\x10ShardReplication\x12.\n\x05nodes\x18\x01 \x03(\x0b\x32\x1f.topodata.ShardReplication.Node\x1a\x33\n\x04Node\x12+\n\x0ctablet_alias\x18\x01 \x01(\x0b\x32\x15.topodata.TabletAlias\"E\n\x0eShardReference\x12\x0c\n\x04name\x18\x01 \x01(\t\x12%\n\tkey_range\x18\x02 \x01(\x0b\x32\x12.topodata.KeyRange\"\xb1\x03\n\x0bSrvKeyspace\x12;\n\npartitions\x18\x01 \x03(\x0b\x32\'.topodata.SrvKeyspace.KeyspacePartition\x12\x1c\n\x14sharding_column_name\x18\x02 \x01(\t\x12\x36\n\x14sharding_column_type\x18\x03 \x01(\x0e\x32\x18.topodata.KeyspaceIdType\x12\x35\n\x0bserved_from\x18\x04 \x03(\x0b\x32 .topodata.SrvKeyspace.ServedFrom\x12\x19\n\x11split_shard_count\x18\x05 \x01(\x05\x1ar\n\x11KeyspacePartition\x12)\n\x0bserved_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\x32\n\x10shard_references\x18\x02 \x03(\x0b\x32\x18.topodata.ShardReference\x1aI\n\nServedFrom\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\x10\n\x08keyspace\x18\x02 \x01(\t*2\n\x0eKeyspaceIdType\x12\t\n\x05UNSET\x10\x00\x12\n\n\x06UINT64\x10\x01\x12\t\n\x05\x42YTES\x10\x02*\x8f\x01\n\nTabletType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\n\n\x06MASTER\x10\x01\x12\x0b\n\x07REPLICA\x10\x02\x12\n\n\x06RDONLY\x10\x03\x12\t\n\x05\x42\x41TCH\x10\x03\x12\t\n\x05SPARE\x10\x04\x12\x10\n\x0c\x45XPERIMENTAL\x10\x05\x12\n\n\x06\x42\x41\x43KUP\x10\x06\x12\x0b\n\x07RESTORE\x10\x07\x12\n\n\x06WORKER\x10\x08\x1a\x02\x10\x01\x42\x1a\n\x18\x63om.youtube.vitess.protob\x06proto3')
serialized_pb=_b('\n\x0etopodata.proto\x12\x08topodata\"&\n\x08KeyRange\x12\r\n\x05start\x18\x01 \x01(\x0c\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x0c\"(\n\x0bTabletAlias\x12\x0c\n\x04\x63\x65ll\x18\x01 \x01(\t\x12\x0b\n\x03uid\x18\x02 \x01(\r\"\x90\x03\n\x06Tablet\x12$\n\x05\x61lias\x18\x01 \x01(\x0b\x32\x15.topodata.TabletAlias\x12\x10\n\x08hostname\x18\x02 \x01(\t\x12\n\n\x02ip\x18\x03 \x01(\t\x12/\n\x08port_map\x18\x04 \x03(\x0b\x32\x1d.topodata.Tablet.PortMapEntry\x12\x10\n\x08keyspace\x18\x05 \x01(\t\x12\r\n\x05shard\x18\x06 \x01(\t\x12%\n\tkey_range\x18\x07 \x01(\x0b\x32\x12.topodata.KeyRange\x12\"\n\x04type\x18\x08 \x01(\x0e\x32\x14.topodata.TabletType\x12\x18\n\x10\x64\x62_name_override\x18\t \x01(\t\x12(\n\x04tags\x18\n \x03(\x0b\x32\x1a.topodata.Tablet.TagsEntry\x1a.\n\x0cPortMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x05:\x02\x38\x01\x1a+\n\tTagsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01J\x04\x08\x0b\x10\x0c\"\xcb\x04\n\x05Shard\x12+\n\x0cmaster_alias\x18\x01 \x01(\x0b\x32\x15.topodata.TabletAlias\x12%\n\tkey_range\x18\x02 \x01(\x0b\x32\x12.topodata.KeyRange\x12\x30\n\x0cserved_types\x18\x03 \x03(\x0b\x32\x1a.topodata.Shard.ServedType\x12\x32\n\rsource_shards\x18\x04 \x03(\x0b\x32\x1b.topodata.Shard.SourceShard\x12\r\n\x05\x63\x65lls\x18\x05 \x03(\t\x12\x36\n\x0ftablet_controls\x18\x06 \x03(\x0b\x32\x1d.topodata.Shard.TabletControl\x1a\x46\n\nServedType\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\r\n\x05\x63\x65lls\x18\x02 \x03(\t\x1ar\n\x0bSourceShard\x12\x0b\n\x03uid\x18\x01 \x01(\r\x12\x10\n\x08keyspace\x18\x02 \x01(\t\x12\r\n\x05shard\x18\x03 \x01(\t\x12%\n\tkey_range\x18\x04 \x01(\x0b\x32\x12.topodata.KeyRange\x12\x0e\n\x06tables\x18\x05 \x03(\t\x1a\x84\x01\n\rTabletControl\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\r\n\x05\x63\x65lls\x18\x02 \x03(\t\x12\x1d\n\x15\x64isable_query_service\x18\x03 \x01(\x08\x12\x1a\n\x12\x62lacklisted_tables\x18\x04 \x03(\t\"\xf5\x01\n\x08Keyspace\x12\x1c\n\x14sharding_column_name\x18\x01 \x01(\t\x12\x36\n\x14sharding_column_type\x18\x02 \x01(\x0e\x32\x18.topodata.KeyspaceIdType\x12\x33\n\x0cserved_froms\x18\x04 \x03(\x0b\x32\x1d.topodata.Keyspace.ServedFrom\x1aX\n\nServedFrom\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\r\n\x05\x63\x65lls\x18\x02 \x03(\t\x12\x10\n\x08keyspace\x18\x03 \x01(\tJ\x04\x08\x03\x10\x04\"w\n\x10ShardReplication\x12.\n\x05nodes\x18\x01 \x03(\x0b\x32\x1f.topodata.ShardReplication.Node\x1a\x33\n\x04Node\x12+\n\x0ctablet_alias\x18\x01 \x01(\x0b\x32\x15.topodata.TabletAlias\"E\n\x0eShardReference\x12\x0c\n\x04name\x18\x01 \x01(\t\x12%\n\tkey_range\x18\x02 \x01(\x0b\x32\x12.topodata.KeyRange\"\x9c\x03\n\x0bSrvKeyspace\x12;\n\npartitions\x18\x01 \x03(\x0b\x32\'.topodata.SrvKeyspace.KeyspacePartition\x12\x1c\n\x14sharding_column_name\x18\x02 \x01(\t\x12\x36\n\x14sharding_column_type\x18\x03 \x01(\x0e\x32\x18.topodata.KeyspaceIdType\x12\x35\n\x0bserved_from\x18\x04 \x03(\x0b\x32 .topodata.SrvKeyspace.ServedFrom\x1ar\n\x11KeyspacePartition\x12)\n\x0bserved_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\x32\n\x10shard_references\x18\x02 \x03(\x0b\x32\x18.topodata.ShardReference\x1aI\n\nServedFrom\x12)\n\x0btablet_type\x18\x01 \x01(\x0e\x32\x14.topodata.TabletType\x12\x10\n\x08keyspace\x18\x02 \x01(\tJ\x04\x08\x05\x10\x06*2\n\x0eKeyspaceIdType\x12\t\n\x05UNSET\x10\x00\x12\n\n\x06UINT64\x10\x01\x12\t\n\x05\x42YTES\x10\x02*\x8f\x01\n\nTabletType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\n\n\x06MASTER\x10\x01\x12\x0b\n\x07REPLICA\x10\x02\x12\n\n\x06RDONLY\x10\x03\x12\t\n\x05\x42\x41TCH\x10\x03\x12\t\n\x05SPARE\x10\x04\x12\x10\n\x0c\x45XPERIMENTAL\x10\x05\x12\n\n\x06\x42\x41\x43KUP\x10\x06\x12\x0b\n\x07RESTORE\x10\x07\x12\n\n\x06WORKER\x10\x08\x1a\x02\x10\x01\x42\x1a\n\x18\x63om.youtube.vitess.protob\x06proto3')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
@ -45,8 +45,8 @@ _KEYSPACEIDTYPE = _descriptor.EnumDescriptor(
],
containing_type=None,
options=None,
serialized_start=2000,
serialized_end=2050,
serialized_start=1958,
serialized_end=2008,
)
_sym_db.RegisterEnumDescriptor(_KEYSPACEIDTYPE)
@ -100,8 +100,8 @@ _TABLETTYPE = _descriptor.EnumDescriptor(
],
containing_type=None,
options=_descriptor._ParseOptions(descriptor_pb2.EnumOptions(), _b('\020\001')),
serialized_start=2053,
serialized_end=2196,
serialized_start=2011,
serialized_end=2154,
)
_sym_db.RegisterEnumDescriptor(_TABLETTYPE)
@ -618,8 +618,8 @@ _KEYSPACE_SERVEDFROM = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1282,
serialized_end=1370,
serialized_start=1255,
serialized_end=1343,
)
_KEYSPACE = _descriptor.Descriptor(
@ -644,14 +644,7 @@ _KEYSPACE = _descriptor.Descriptor(
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='split_shard_count', full_name='topodata.Keyspace.split_shard_count', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='served_froms', full_name='topodata.Keyspace.served_froms', index=3,
name='served_froms', full_name='topodata.Keyspace.served_froms', index=2,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
@ -670,7 +663,7 @@ _KEYSPACE = _descriptor.Descriptor(
oneofs=[
],
serialized_start=1104,
serialized_end=1370,
serialized_end=1349,
)
@ -700,8 +693,8 @@ _SHARDREPLICATION_NODE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1440,
serialized_end=1491,
serialized_start=1419,
serialized_end=1470,
)
_SHARDREPLICATION = _descriptor.Descriptor(
@ -730,8 +723,8 @@ _SHARDREPLICATION = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1372,
serialized_end=1491,
serialized_start=1351,
serialized_end=1470,
)
@ -768,8 +761,8 @@ _SHARDREFERENCE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1493,
serialized_end=1562,
serialized_start=1472,
serialized_end=1541,
)
@ -806,8 +799,8 @@ _SRVKEYSPACE_KEYSPACEPARTITION = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1809,
serialized_end=1923,
serialized_start=1761,
serialized_end=1875,
)
_SRVKEYSPACE_SERVEDFROM = _descriptor.Descriptor(
@ -843,8 +836,8 @@ _SRVKEYSPACE_SERVEDFROM = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1925,
serialized_end=1998,
serialized_start=1877,
serialized_end=1950,
)
_SRVKEYSPACE = _descriptor.Descriptor(
@ -882,13 +875,6 @@ _SRVKEYSPACE = _descriptor.Descriptor(
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='split_shard_count', full_name='topodata.SrvKeyspace.split_shard_count', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
@ -901,8 +887,8 @@ _SRVKEYSPACE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1565,
serialized_end=1998,
serialized_start=1544,
serialized_end=1956,
)
_TABLET_PORTMAPENTRY.containing_type = _TABLET

Просмотреть файл

@ -57,19 +57,17 @@ class K8sEnvironment(base_environment.BaseEnvironment):
'Invalid environment, no keyspaces found')
self.num_shards = []
self.shards = []
for keyspace in self.keyspaces:
keyspace_info = json.loads(self.vtctl_helper.execute_vtctl_command(
['GetKeyspace', keyspace]))
if not keyspace_info:
self.num_shards.append(1)
else:
self.num_shards.append(keyspace_info['split_shard_count'])
shards = json.loads(self.vtctl_helper.execute_vtctl_command(
['FindAllShardsInKeyspace', keyspace]))
self.shards.append(shards)
self.num_shards.append(len(shards))
# This assumes that all keyspaces use the same set of cells
# This assumes that all keyspaces/shards use the same set of cells
self.cells = json.loads(self.vtctl_helper.execute_vtctl_command(
['GetShard', '%s/%s' % (
self.keyspaces[0], utils.get_shard_name(0, self.num_shards[0]))]
['GetShard', '%s/%s' % (self.keyspaces[0], self.shards[0][0])]
))['cells']
self.primary_cells = self.cells

Просмотреть файл

@ -245,7 +245,6 @@ index by_msg (msg)
utils.run_vtctl(['CreateKeyspace',
'--sharding_column_name', 'custom_sharding_key',
'--sharding_column_type', keyspace_id_type,
'--split_shard_count', '4',
'test_keyspace'])
shard_0_master.init_tablet('master', 'test_keyspace', '-40')
@ -261,7 +260,7 @@ index by_msg (msg)
utils.run_vtctl(['RebuildKeyspaceGraph', 'test_keyspace'], auto_log=True)
ks = utils.run_vtctl_json(['GetSrvKeyspace', 'test_nj', 'test_keyspace'])
self.assertEqual(ks['split_shard_count'], 4)
self.assertEqual(ks['sharding_column_name'], 'custom_sharding_key')
# create databases so vttablet can start behaving normally
for t in [shard_0_master, shard_0_replica, shard_0_rdonly,

Просмотреть файл

@ -389,12 +389,10 @@ primary key (name)
utils.run_vtctl(['CreateKeyspace',
'--sharding_column_name', 'bad_column',
'--sharding_column_type', 'bytes',
'--split_shard_count', '2',
'test_keyspace'])
utils.run_vtctl(['SetKeyspaceShardingInfo', 'test_keyspace',
'custom_sharding_key', 'uint64'], expect_fail=True)
utils.run_vtctl(['SetKeyspaceShardingInfo',
'-force', '-split_shard_count', '4',
utils.run_vtctl(['SetKeyspaceShardingInfo', '-force',
'test_keyspace', 'custom_sharding_key', keyspace_id_type])
shard_0_master.init_tablet('master', 'test_keyspace', '-80')
@ -409,7 +407,7 @@ primary key (name)
utils.run_vtctl(['RebuildKeyspaceGraph', 'test_keyspace'], auto_log=True)
ks = utils.run_vtctl_json(['GetSrvKeyspace', 'test_nj', 'test_keyspace'])
self.assertEqual(ks['split_shard_count'], 4)
self.assertEqual(ks['sharding_column_name'], 'custom_sharding_key')
# we set full_mycnf_args to True as a test in the KIT_BYTES case
full_mycnf_args = keyspace_id_type == keyrange_constants.KIT_BYTES
@ -438,6 +436,12 @@ primary key (name)
utils.run_vtctl(['InitShardMaster', 'test_keyspace/80-',
shard_1_master.tablet_alias], auto_log=True)
# check the shards
shards = utils.run_vtctl_json(['FindAllShardsInKeyspace', 'test_keyspace'])
self.assertIn('-80', shards, 'unexpected shards: %s' % str(shards))
self.assertIn('80-', shards, 'unexpected shards: %s' % str(shards))
self.assertEqual(len(shards), 2, 'unexpected shards: %s' % str(shards))
# create the tables
self._create_schema()
self._insert_startup_values()
@ -474,6 +478,12 @@ primary key (name)
utils.run_vtctl(['InitShardMaster', 'test_keyspace/c0-',
shard_3_master.tablet_alias], auto_log=True)
# check the shards
shards = utils.run_vtctl_json(['FindAllShardsInKeyspace', 'test_keyspace'])
for s in ['-80', '80-', '80-c0', 'c0-']:
self.assertIn(s, shards, 'unexpected shards: %s' % str(shards))
self.assertEqual(len(shards), 4, 'unexpected shards: %s' % str(shards))
utils.run_vtctl(['RebuildKeyspaceGraph', 'test_keyspace'],
auto_log=True)
utils.check_srv_keyspace(