Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Slack sync upstream 2018 12 21.r1 #123

Merged
merged 101 commits into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
b5d4c4d
Adds helper method to compare topologies
rafael Nov 22, 2018
028b5b8
Adds tests to compare tool
rafael Nov 26, 2018
e67e7d3
Address PR review comments
rafael Nov 27, 2018
823e3b1
Rename for consistency
rafael Nov 27, 2018
79508d3
Multi split diff
tirsen Sep 21, 2018
4303a66
Clean up of multi_split_diff
systay Oct 9, 2018
761ec75
bootstrap mysql 8.0
Nov 29, 2018
3f1ef52
Support `USE keyspace[keyspace_id]` (#3666)
adsr Nov 28, 2018
85847a7
Add `-init_populate_metadata` to vttablet (#4115)
adsr Nov 29, 2018
ecf36ce
Adds setting the DB server name using a parameter.
mpawliszyn Nov 30, 2018
3eb4014
[closes #4378] Adds keyspaces_to_watch flag to vtgate
Dec 4, 2018
e821613
move log message into vtgate impl
Dec 4, 2018
44b5ded
swap to a different context so that the linter is happy
Dec 4, 2018
7dcd85e
Clean up reference to selectedKeyspaces which is not in scope from vt…
Dec 5, 2018
4c5c2f8
replace the logstats RemoteAddr with a more inclusive CallInfo
demmer Dec 5, 2018
4520762
Correcting web file path in Docker file for alpine
Dec 5, 2018
ec5745a
Silence some noisy log entries
rafael Dec 6, 2018
b96d2f1
Merge branch 'master' into setassociative-#4378-add-keyspace-filtering
Dec 6, 2018
893ca57
PR feedback
Dec 7, 2018
461e7a0
minor unit test cleanups, add test coverage for nil schema & error pa…
Dec 7, 2018
1110a8c
Rename error to meet lint rules
Dec 7, 2018
744c6b5
add super basic srvtopo.Server impl for use in tests and switch to th…
Dec 7, 2018
bef3eb5
Shift filter.KeyspacesToWatch into gateway package per chat w/ demmer
Dec 7, 2018
4508557
helm: add labels to jobs
derekperkins Dec 7, 2018
40ae976
helm: fix pmm bootstrap
derekperkins Dec 7, 2018
239d6d3
helm: support for pmm custom metrics collection
derekperkins Dec 7, 2018
455a3d1
helm: add linux monitoring to pmm
derekperkins Dec 7, 2018
4e7af96
helm: remove old mysql.sock file in InitContainer
derekperkins Dec 7, 2018
90f8fcf
helm: bump version to 1.0.1 and add changelog
derekperkins Dec 7, 2018
58d92c7
Refactor Delete plan to be consistent with update
rafael Dec 7, 2018
2103fb0
Fixes grpc auth options
rafael Dec 8, 2018
0b6cd4f
Store causes and stack traces from errors
systay Dec 6, 2018
5a247cf
Minor cleanups of the JDBC code
systay Dec 11, 2018
f3e5419
Fixed casing problem of imagePullPolicy fields.
trevex Dec 11, 2018
400da15
Fixed missing volume of cron job.
trevex Dec 11, 2018
1c9d2d5
helm: bump Chart to 1.0.2 + changelog
derekperkins Dec 11, 2018
850574e
Log more information about errors
systay Dec 12, 2018
2499f32
Flags multi split diffs as failing before finished
systay Dec 13, 2018
d50a648
Made finding destination shards single threaded
systay Dec 13, 2018
f1b3d5e
Merge remote-tracking branch 'upstream/master' into multi-split-diff
systay Dec 13, 2018
0f9cc1e
fall back to environment variables when building without git
Dec 12, 2018
60ed1bf
added comment
Dec 13, 2018
7938800
This blocks use of the underlying topo server when using a filtering …
Dec 13, 2018
944d406
Updated error mesasge because the previous was awfully specific despi…
Dec 13, 2018
fe3499c
Document the error behavior
Dec 13, 2018
a72b957
Test that everything gets filtered and the return is empty, but not nil
Dec 13, 2018
40dafcf
Optimize jdbc imports
systay Dec 14, 2018
f9becf4
Merge pull request #4400 from adsr/master
demmer Dec 14, 2018
21b226f
Merge pull request #4420 from tinyspeck/setassociative-#4378-add-keys…
demmer Dec 14, 2018
3f51b2c
remove code to resolve dns names while getting a connection to zookeeper
deepthi Dec 14, 2018
744b8e2
Merge pull request #4428 from systay/errors
sougou Dec 16, 2018
03890bd
Merge pull request #4402 from slanning/bootstrap-mysql-8
sougou Dec 16, 2018
503b8dd
Merge pull request #4403 from adsr/init_populate_metadata
sougou Dec 16, 2018
1e1bf99
Merge pull request #4408 from mpawliszyn/mikepaw.add-db-servername
sougou Dec 16, 2018
4e6d1e8
Merge pull request #4422 from tinyspeck/logstats-include-caller-context
sougou Dec 16, 2018
235eb93
Merge pull request #4423 from planetscale/dk-fix-alpine-image
sougou Dec 16, 2018
eb3f685
Merge pull request #4425 from tinyspeck/remove-noisy-log
sougou Dec 16, 2018
877f11c
Merge pull request #4430 from derekperkins/helm-pmm
sougou Dec 16, 2018
7e1145f
Merge pull request #4443 from trevex/fix-minor-bugs
derekperkins Dec 16, 2018
f9b1680
Update to be log.Fatal like. Same behavior as all the other places
rafael Dec 16, 2018
58bcd34
Merge pull request #4432 from tinyspeck/refactor-delete-plan
sougou Dec 16, 2018
a57ef16
Merge pull request #4435 from tinyspeck/fix-for-vtgate-up
sougou Dec 16, 2018
f4b5377
Merge pull request #4446 from slanning/build-git-vars-without-git
sougou Dec 16, 2018
17ccb2c
Merge pull request #4458 from planetscale/ds-zk-dns
sougou Dec 16, 2018
8ff9bf0
Merge pull request #4392 from tinyspeck/topo-to-topo-compare
sougou Dec 16, 2018
f497c64
List all tablets in all cells
rafael Dec 17, 2018
a9aa711
Refactor to not require a new command
rafael Dec 17, 2018
935bf8a
Merge pull request #4460 from tinyspeck/vtctl-list-all-tablets-all-cells
sougou Dec 17, 2018
4242365
Fix govet error
systay Dec 17, 2018
bbff624
Merge pull request #4281 from systay/multi-split-diff
sougou Dec 18, 2018
b0c3523
reformat using go 1.11 formatter
demmer Dec 18, 2018
0289e07
helm: never terminate without reparenting
derekperkins Dec 18, 2018
772a04e
use lower cost vindex if possible when primary vindex is too expensive
deepthi Dec 18, 2018
9020e48
Merge pull request #4469 from planetscale/ds-lookup-vindex
sougou Dec 19, 2018
dba155b
[vt/sqlparser] Use strings.Builder in compliantName
LK4D4 Dec 19, 2018
b2b6db5
Merge pull request #4470 from LK4D4/builder_names
sougou Dec 19, 2018
f10b2cf
Replaced ". ./dev.env" with "source ./dev.env" in GettingStarted.md
Tanmoytkd Dec 19, 2018
7fff616
Merge pull request #4472 from Tanmoytkd/master
sougou Dec 19, 2018
5fe0b66
helm: Use MYSQL_FLAVOR to set flavor instead of EXTRA_MY_CNF
ssup2 Dec 19, 2018
d535156
helm: set better vttablet/vtgate default flags
derekperkins Dec 20, 2018
a3143fe
Merge pull request #4441 from systay/jdbc-cleanup
mpawliszyn Dec 20, 2018
345d3bd
Merge pull request #4473 from ssup2/master
dkhenry Dec 20, 2018
c17d938
helm: version 1.0.3 + changelog
derekperkins Dec 20, 2018
c9f72be
helm: add release script to tag images w/helm tags
derekperkins Dec 20, 2018
0c601e4
helm: remove client-found-rows-pool-size
derekperkins Dec 20, 2018
524f4c2
Merge pull request #4478 from derekperkins/helm-stuff
sougou Dec 21, 2018
af4a648
Merge pull request #4467 from tinyspeck/gofmt-for-go1.11
sougou Dec 21, 2018
3c5e2b2
Add region context to aggr stats
rafael Dec 15, 2018
7426ae5
Adds tests for discovery gateway aggregate stats
rafael Dec 15, 2018
bf37eb5
Change implementation to have aggregates per region
rafael Dec 16, 2018
a308f9c
Refactor test to make it even more generic. Remove extra line in stru…
rafael Dec 16, 2018
f013b8d
Remove l2vtgates
rafael Dec 19, 2018
4197920
Remove references to l2vtgates in docs and integration tests
rafael Dec 20, 2018
0217138
Remove unused dependency
rafael Dec 20, 2018
e33912f
Refactor for clarity. This method is always per region now
rafael Dec 21, 2018
1cf2530
Merge pull request #4476 from tinyspeck/add-region-context-aggr-stats…
sougou Dec 21, 2018
4ec10eb
Revert "Refactor test to make it even more generic. Remove extra line…
rafael Dec 21, 2018
46d4d28
Revert "Change implementation to have aggregates per region"
rafael Dec 21, 2018
de85143
Revert "Adds tests for discovery gateway aggregate stats"
rafael Dec 21, 2018
49b98be
Revert "Add region context to aggr stats"
rafael Dec 21, 2018
3ca419e
Merge branch 'upstream-master' into slack-sync-upstream-2018-12-21.r1
rafael Dec 21, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ fi
case "$MYSQL_FLAVOR" in
"MySQL56")
myversion="$("$VT_MYSQL_ROOT/bin/mysql" --version)"
[[ "$myversion" =~ Distrib\ 5\.[67] ]] || fail "Couldn't find MySQL 5.6+ in $VT_MYSQL_ROOT. Set VT_MYSQL_ROOT to override search location."
[[ "$myversion" =~ Distrib\ 5\.[67] || "$myversion" =~ Ver\ 8\. ]] || fail "Couldn't find MySQL 5.6+ in $VT_MYSQL_ROOT. Set VT_MYSQL_ROOT to override search location."
echo "Found MySQL 5.6+ installation in $VT_MYSQL_ROOT."
;;

Expand Down
2 changes: 1 addition & 1 deletion doc/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ In addition, Vitess requires the software and libraries listed below.

``` sh
# Remaining commands to build Vitess
. ./dev.env
source ./dev.env
make build
```

Expand Down
1 change: 1 addition & 0 deletions doc/ServerConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ Load-balancer in front of vtgate to scale up (not covered by Vitess). Stateless,
### Parameters

* **cells_to_watch**: which cell vtgate is in and will monitor tablets from. Cross-cell master access needs multiple cells here.
* **keyspaces_to_watch**: Specifies that a vtgate will only be able to perform queries against or view the topology of these keyspaces
* **tablet_types_to_wait**: VTGate waits for at least one serving tablet per tablet type specified here during startup, before listening to the serving port. So VTGate does not serve error. It should match the available tablet types VTGate connects to (master, replica, rdonly).
* **discovery_low_replication_lag**: when replication lags of all VTTablet in a particular shard and tablet type are less than or equal the flag (in seconds), VTGate does not filter them by replication lag and uses all to balance traffic.
* **degraded_threshold (30s)**: a tablet will publish itself as degraded if replication lag exceeds this threshold. This will cause VTGates to choose more up-to-date servers over this one. If all servers are degraded, VTGate resorts to serving from all of them.
Expand Down
54 changes: 0 additions & 54 deletions doc/TabletRouting.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,36 +93,7 @@ There are two implementations of the Gateway interface:
discovery section, one per cell) as a source of tablets, a HealthCheck module
to watch their health, and a TabletStatsCache to collect all the health
information. Based on this data, it can find the best tablet to use.
* l2VTGateGateway: It keeps a map of l2vtgate processes to send queries to. See
next section for more details.

## l2vtgate

As we started increasing the number of tablets in a cell, it became clear that a
bottleneck of the system was going to be how many tablets a single vtgate is
connecting to. Since vtgate maintains a streaming health check connection per
tablet, the number of these connections can grow to large numbers. It is common
for vtgate to watch tablets in other cells, to be able to find the master
tablet.

So l2vtgate came to exist, based on very similar concepts and interfaces:

* l2vtgate is an extra hop between a vtgate pool and tablets.
* A l2vtgate pool connects to a subset of tablets, therefore it can have a
reasonable number of streaming health connections. Externally, it exposes the
QueryService RPC interface (that has the Target for the query, keyspace /
shard / tablet type). Internally, it uses a discoveryGateway, as usual.
* vtgate connects to l2vtgate pools (using the l2VTGateGateway instead of the
discoveryGateway). It has a map of which keyspace / shard / tablet type needs
to go to wich l2vtgate pool. At this point, vtgate doesn't maintain any health
information about the tablets, it lets l2vtgate handle it.

Note l2vtgate is not an ideal solution as it is now. For instance, if there are
two cells, and the master for a shard can be in either, l2vtgate still has to
watch the tablets in both cells, to know where the master is. Ideally, we'd want
l2vtgate to be collocated with the tablets in a given cell, and not go
cross-cell.

# Extensions, work in progress

## Regions, cross-cell targeting
Expand Down Expand Up @@ -169,31 +140,6 @@ between vtgate and l2vtgate:
This would also be a good time to merge the vtgate code that uses the VSchema
with the code that doesn't for SrvKeyspace access.

## Hybrid Gateway

It would be nice to re-organize the code a bit inside vtgate to allow for an
hybrid gateway, and get rid of l2vtgate alltogether:

* vtgate would use the discoveryGateway to watch the tablets in the current cell
(and optionally to any other cell we still want to consider local).
* vtgate would use l2vtgateGateway to watch the tablets in a different cell.
* vtgate would expose the RPC APIs currently exposed by the l2vtgate process.

So vtgate would watch the tablets in the local cell only, but also know what
healthy tablets are in the other cells, and be able to send query to them
through their vtgate. The extra hop to the other cell vtgate should be a small
latency price to pay, compared to going cross-cell already.

So queries would go one of two routes:

* client(cell1) -> vtgate(cell1) -> tablet(cell1)
* client(cell1) -> vtgate(cell1) -> vtgate(cell2) -> tablet(cell2)

If the number of tablets in a given cell is still too high for the local vtgate
pool, two or more pools can still be created, each of them knowing about a
subset of the tablets. And they would just forward queries to each others when
addressing the other tablet set.

## Config-based routing

Another possible extension would be to group all routing options for vtgate in a
Expand Down
4 changes: 2 additions & 2 deletions docker/lite/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ FROM alpine:3.8 AS staging

RUN mkdir -p /vt/vtdataroot/ && mkdir -p /vt/bin && mkdir -p /vt/src/vitess.io/vitess/web/vtctld2

COPY --from=builder /vt/src/vitess.io/vitess/web/vtctld /vt/src/vitess.io/web/vtctld
COPY --from=builder /vt/src/vitess.io/vitess/web/vtctld2/app /vt/src/vitess.io/web/vtctld2/app
COPY --from=builder /vt/src/vitess.io/vitess/web/vtctld /vt/src/vitess.io/vitess/web/vtctld
COPY --from=builder /vt/src/vitess.io/vitess/web/vtctld2/app /vt/src/vitess.io/vitess/web/vtctld2/app
COPY --from=builder /vt/src/vitess.io/vitess/config /vt/config
COPY --from=builder /vt/bin/mysqlctld /vt/bin/
COPY --from=builder /vt/bin/vtctld /vt/bin/
Expand Down
4 changes: 3 additions & 1 deletion examples/local/vtgate-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ then
fi

optional_auth_args='-mysql_auth_server_impl none'
optional_grpc_auth_args=''
if [ "$1" = "--enable-grpc-static-auth" ];
then
echo "Enabling Auth with static authentication in grpc"
optional_auth_args='-grpc_auth_static_client_creds ./grpc_static_client_auth.json'
optional_grpc_auth_args='-grpc_auth_static_client_creds ./grpc_static_client_auth.json'
fi

if [ "$1" = "--enable-mysql-static-auth" ];
Expand All @@ -84,6 +85,7 @@ $VTROOT/bin/vtgate \
-service_map 'grpc-vtgateservice' \
-pid_file $VTDATAROOT/tmp/vtgate.pid \
$optional_auth_args \
$optional_grpc_auth_args \
$optional_tls_args \
> $VTDATAROOT/tmp/vtgate.out 2>&1 &

Expand Down
44 changes: 44 additions & 0 deletions go/cmd/topo2topo/topo2topo.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package main

import (
"flag"
"fmt"
"os"

"golang.org/x/net/context"
"vitess.io/vitess/go/exit"
Expand All @@ -36,6 +38,7 @@ var (
toServerAddress = flag.String("to_server", "", "topology server address to copy data to")
toRoot = flag.String("to_root", "", "topology server root to copy data to")

compare = flag.Bool("compare", false, "compares data between topologies")
doKeyspaces = flag.Bool("do-keyspaces", false, "copies the keyspace information")
doShards = flag.Bool("do-shards", false, "copies the shard information")
doShardReplications = flag.Bool("do-shard-replications", false, "copies the shard replication information")
Expand Down Expand Up @@ -64,6 +67,14 @@ func main() {

ctx := context.Background()

if *compare {
compareTopos(ctx, fromTS, toTS)
return
}
copyTopos(ctx, fromTS, toTS)
}

func copyTopos(ctx context.Context, fromTS, toTS *topo.Server) {
if *doKeyspaces {
helpers.CopyKeyspaces(ctx, fromTS, toTS)
}
Expand All @@ -76,4 +87,37 @@ func main() {
if *doTablets {
helpers.CopyTablets(ctx, fromTS, toTS)
}

}

func compareTopos(ctx context.Context, fromTS, toTS *topo.Server) {
var err error
if *doKeyspaces {
err = helpers.CompareKeyspaces(ctx, fromTS, toTS)
if err != nil {
log.Exitf("Compare keyspaces failed: %v", err)
}
}
if *doShards {
err = helpers.CompareShards(ctx, fromTS, toTS)
if err != nil {
log.Exitf("Compare shards failed: %v", err)
}
}
if *doShardReplications {
err = helpers.CompareShardReplications(ctx, fromTS, toTS)
if err != nil {
log.Exitf("Compare shard replications failed: %v", err)
}
}
if *doTablets {
err = helpers.CompareTablets(ctx, fromTS, toTS)
if err != nil {
log.Exitf("Compare tablets failed: %v", err)
}
}
if err == nil {
fmt.Println("Topologies are in sync")
os.Exit(0)
}
}
34 changes: 0 additions & 34 deletions go/cmd/vtgate/plugin_grpcqueryservice.go

This file was deleted.

4 changes: 2 additions & 2 deletions go/mysql/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ func ShowIndexFromTableRow(table string, unique bool, keyName string, seqInIndex
sqltypes.MakeTrusted(sqltypes.VarChar, []byte(columnName)),
sqltypes.MakeTrusted(sqltypes.VarChar, []byte("A")), // Collation
sqltypes.MakeTrusted(sqltypes.Int64, []byte("0")), // Cardinality
sqltypes.NULL, // Sub_part
sqltypes.NULL, // Packed
sqltypes.NULL, // Sub_part
sqltypes.NULL, // Packed
sqltypes.MakeTrusted(sqltypes.VarChar, []byte(nullableStr)),
sqltypes.MakeTrusted(sqltypes.VarChar, []byte("BTREE")), // Index_type
sqltypes.MakeTrusted(sqltypes.VarChar, []byte("")), // Comment
Expand Down
11 changes: 10 additions & 1 deletion go/mysql/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"io"
"net"
"strings"
"time"

"vitess.io/vitess/go/netutil"
Expand Down Expand Up @@ -273,7 +274,9 @@ func (l *Listener) handle(conn net.Conn, connectionID uint32, acceptTime time.Ti
// First build and send the server handshake packet.
salt, err := c.writeHandshakeV10(l.ServerVersion, l.authServer, l.TLSConfig != nil)
if err != nil {
log.Errorf("Cannot send HandshakeV10 packet to %s: %v", c, err)
if err != io.EOF {
log.Errorf("Cannot send HandshakeV10 packet to %s: %v", c, err)
}
return
}

Expand Down Expand Up @@ -547,6 +550,12 @@ func (c *Conn) writeHandshakeV10(serverVersion string, authServer AuthServer, en
}

if err := c.writeEphemeralPacket(); err != nil {
if strings.HasSuffix(err.Error(), "write: connection reset by peer") {
return nil, io.EOF
}
if strings.HasSuffix(err.Error(), "write: broken pipe") {
return nil, io.EOF
}
return nil, err
}

Expand Down
6 changes: 4 additions & 2 deletions go/sqltypes/query_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ limitations under the License.

package sqltypes

import "reflect"
import (
"vitess.io/vitess/go/vt/vterrors"
)

// QueryResponse represents a query response for ExecuteBatch.
type QueryResponse struct {
Expand All @@ -34,7 +36,7 @@ func QueryResponsesEqual(r1, r2 []QueryResponse) bool {
if !r.QueryResult.Equal(r2[i].QueryResult) {
return false
}
if !reflect.DeepEqual(r.QueryError, r2[i].QueryError) {
if !vterrors.Equals(r.QueryError, r2[i].QueryError) {
return false
}
}
Expand Down
10 changes: 5 additions & 5 deletions go/vt/automation/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ func NewScheduler() (*Scheduler, error) {
registeredClusterOperations: defaultClusterOperations,
idGenerator: IDGenerator{},
toBeScheduledClusterOperations: make(chan ClusterOperationInstance, 10),
state: stateNotRunning,
taskCreator: defaultTaskCreator,
pendingOpsWg: &sync.WaitGroup{},
activeClusterOperations: make(map[string]ClusterOperationInstance),
finishedClusterOperations: make(map[string]ClusterOperationInstance),
state: stateNotRunning,
taskCreator: defaultTaskCreator,
pendingOpsWg: &sync.WaitGroup{},
activeClusterOperations: make(map[string]ClusterOperationInstance),
finishedClusterOperations: make(map[string]ClusterOperationInstance),
}

return s, nil
Expand Down
4 changes: 2 additions & 2 deletions go/vt/binlog/binlogplayer/binlog_player_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ var (
InsertID: 0,
Rows: [][]sqltypes.Value{
{
sqltypes.NewVarBinary("MariaDB/0-1-1083"), // pos
sqltypes.NULL, // stop_pos
sqltypes.NewVarBinary("MariaDB/0-1-1083"), // pos
sqltypes.NULL, // stop_pos
sqltypes.NewVarBinary("9223372036854775807"), // max_tps
sqltypes.NewVarBinary("9223372036854775807"), // max_replication_lag
},
Expand Down
16 changes: 4 additions & 12 deletions go/vt/binlog/keyspace_id_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,10 @@ func newKeyspaceIDResolverFactoryV3(ctx context.Context, ts *topo.Server, keyspa
return -1, nil, fmt.Errorf("no vschema definition for table %v", table.Name)
}

// The primary vindex is most likely the sharding key,
// and has to be unique.
if len(tableSchema.ColumnVindexes) == 0 {
return -1, nil, fmt.Errorf("no vindex definition for table %v", table.Name)
}
colVindex := tableSchema.ColumnVindexes[0]
if colVindex.Vindex.Cost() > 1 {
return -1, nil, fmt.Errorf("primary vindex cost is too high for table %v", table.Name)
}
if !colVindex.Vindex.IsUnique() {
// This is impossible, but just checking anyway.
return -1, nil, fmt.Errorf("primary vindex is not unique for table %v", table.Name)
// use the lowest cost unique vindex as the sharding key
colVindex, err := vindexes.FindVindexForSharding(table.Name.String(), tableSchema.ColumnVindexes)
if err != nil {
return -1, nil, err
}

// TODO @rafael - when rewriting the mapping function, this will need to change.
Expand Down
9 changes: 6 additions & 3 deletions go/vt/callinfo/fakecallinfo/fakecallinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ limitations under the License.

package fakecallinfo

import "html/template"
import (
"fmt"
"html/template"
)

// FakeCallInfo gives a fake Callinfo usable in callinfo
type FakeCallInfo struct {
Remote string
Method string
User string
Txt string
Html string
}

Expand All @@ -38,7 +41,7 @@ func (fci *FakeCallInfo) Username() string {

// Text returns the text.
func (fci *FakeCallInfo) Text() string {
return fci.Txt
return fmt.Sprintf("%s:%s(fakeRPC)", fci.Remote, fci.Method)
}

// HTML returns the html.
Expand Down
4 changes: 4 additions & 0 deletions go/vt/dbconfigs/dbconfigs.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ func registerBaseFlags() {
flag.StringVar(&baseConfig.SslCaPath, "db_ssl_ca_path", "", "connection ssl ca path")
flag.StringVar(&baseConfig.SslCert, "db_ssl_cert", "", "connection ssl certificate")
flag.StringVar(&baseConfig.SslKey, "db_ssl_key", "", "connection ssl key")
flag.StringVar(&baseConfig.ServerName, "db_server_name", "", "server name of the DB we are connecting to.")

}

// The flags will change the global singleton
Expand All @@ -124,6 +126,7 @@ func registerPerUserFlags(dbc *userConfig, userKey string) {
flag.StringVar(&dbc.param.SslCaPath, "db-config-"+userKey+"-ssl-ca-path", "", "deprecated: use db_ssl_ca_path")
flag.StringVar(&dbc.param.SslCert, "db-config-"+userKey+"-ssl-cert", "", "deprecated: use db_ssl_cert")
flag.StringVar(&dbc.param.SslKey, "db-config-"+userKey+"-ssl-key", "", "deprecated: use db_ssl_key")
flag.StringVar(&dbc.param.ServerName, "db-config-"+userKey+"-server_name", "", "deprecated: use db_server_name")

flag.StringVar(&dbc.param.DeprecatedDBName, "db-config-"+userKey+"-dbname", "", "deprecated: dbname does not need to be explicitly configured")

Expand Down Expand Up @@ -246,6 +249,7 @@ func Init(defaultSocketFile string) (*DBConfigs, error) {
uc.param.SslCaPath = baseConfig.SslCaPath
uc.param.SslCert = baseConfig.SslCert
uc.param.SslKey = baseConfig.SslKey
uc.param.ServerName = baseConfig.ServerName
}
}
} else {
Expand Down
Loading