Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1e29552
add a planbuilder option to pass through DMLs
demmer Jan 19, 2018
2de23da
add vttablet option to pass through all DMLs
demmer Jan 19, 2018
b204a25
add a separate allowUnsafeDMLs flag
demmer Jan 22, 2018
42b450d
Add new Dockerfile tailored for Kubernetes
derekperkins Dec 20, 2017
6775d26
Overhaul helm chart
derekperkins Jan 20, 2018
85ab5d3
Tweak vitess/k8s Dockerfile
enisoc Jan 23, 2018
489c422
add servenv helper routines for common logic on flag parsing
demmer Jan 23, 2018
d1e5a57
Fix for refreshing schema after update
Jan 23, 2018
cc06faf
ignore /*! mysql-specific */ comment statements
Jan 23, 2018
cd419c9
moved STATUS and VARIABLES to non_reserved_keyword
Jan 23, 2018
2c0aaa9
Fixes test that asserts that changes to vschema are updated correctly…
Jan 23, 2018
b61debd
Allow columns named 'status'
dweitzman Jan 23, 2018
abad1c3
helm: Move chart-specific docs to chart README
enisoc Jan 23, 2018
787ad0d
Merge pull request #3564 from tinyspeck/queryserver-passthrough-dmls
sougou Jan 23, 2018
e9adf37
helm: Tweak chart config.
enisoc Jan 23, 2018
faa0672
Merge pull request #3573 from tinyspeck/handle-positional-arguments
sougou Jan 23, 2018
90a8904
Merge pull request #3574 from tinyspeck/fix-for-topo
sougou Jan 23, 2018
fccc652
Merge pull request #3575 from dweitzman/parse_status
sougou Jan 23, 2018
5a7f4df
Merge pull request #3582 from youtube/helm
enisoc Jan 23, 2018
1b5c48f
Merge pull request #3576 from slanning/comment-queries
sougou Jan 23, 2018
3f86922
v3: instant-commit for autocommit
sougou Jan 17, 2018
3e39b05
Merge pull request #3559 from sougou/autocommit
sougou Jan 24, 2018
849516d
moved STATUS and VARIABLES to non_reserved_keyword
Jan 23, 2018
d81dd28
Merge branch 'non-reserved-keywords' of https://github.com/slanning/v…
Jan 24, 2018
9a7be35
moved STATUS and VARIABLES to non_reserved_keyword
Jan 23, 2018
5dd4913
Merge branch 'non-reserved-keywords' of https://github.com/slanning/v…
Jan 24, 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
74 changes: 73 additions & 1 deletion data/test/tabletserver/exec_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"FullQuery": "select distinct * from a limit :#maxLimit"
}

# grouy by
# group by
"select * from a group by b"
{
"PlanID": "PASS_SELECT",
Expand Down Expand Up @@ -186,6 +186,15 @@
"FullQuery": "insert into b.a(eid, id) values (1, :a)"
}

# insert cross-db
options:PassthroughDMLs
"insert into b.a (eid, id) values (1, :a)"
{
"PlanID": "PASS_DML",
"TableName": "",
"FullQuery": "insert into b.a(eid, id) values (1, :a)"
}

# insert with bind value
"insert into a (eid, id) values (1, :a)"
{
Expand All @@ -196,6 +205,15 @@
"PKValues": [[1], [":a"]]
}

# insert with bind value
options:PassthroughDMLs
"insert into a (eid, id) values (1, :a)"
{
"PlanID": "PASS_DML",
"TableName": "",
"FullQuery": "insert into a(eid, id) values (1, :a)"
}

# default number
"insert into a (id) values (1)"
{
Expand Down Expand Up @@ -307,6 +325,15 @@
"PKValues": [[1], [2]]
}

# upsert multiple unique index
options:PassthroughDMLs
"insert into a (eid, id) values (1, 2) on duplicate key update name = func(a)"
{
"PlanID": "PASS_DML",
"TableName": "",
"FullQuery": "insert into a(eid, id) values (1, 2) on duplicate key update name = func(a)"
}

# upsert single unique index
"insert into b (eid, id) values (1, 2) on duplicate key update name = func(a)"
{
Expand Down Expand Up @@ -610,6 +637,15 @@
"FullQuery": "replace into b(eid, id) values (1, 2), (3, 4)"
}

# multi-row
options:PassthroughDMLs
"replace into b (eid, id) values (1, 2), (3, 4)"
{
"PlanID": "PASS_DML",
"TableName": "",
"FullQuery": "replace into b(eid, id) values (1, 2), (3, 4)"
}

# single-row with set
"replace into b set eid = 1, id = 2"
{
Expand Down Expand Up @@ -648,6 +684,15 @@
"WhereClause": " where name in ('a', 'b')"
}

# update limit with pk
options:PassthroughDMLs
"update d set foo='foo' where name in ('a', 'b') limit 1"
{
"PlanID": "PASS_DML",
"TableName": "",
"FullQuery": "update d set foo = 'foo' where name in ('a', 'b') limit 1"
}

# update cross-db
"update b.a set name='foo' where eid=1 and id=1"
{
Expand All @@ -657,6 +702,15 @@
"FullQuery": "update b.a set name = 'foo' where eid = 1 and id = 1"
}

# update cross-db
options:PassthroughDMLs
"update b.a set name='foo' where eid=1 and id=1"
{
"PlanID": "PASS_DML",
"TableName": "",
"FullQuery": "update b.a set name = 'foo' where eid = 1 and id = 1"
}

# multi-table update
"update a, b set a.name = 'foo' where a.id = b.id and b.var = 'test'"
{
Expand Down Expand Up @@ -865,6 +919,15 @@
"WhereClause": " where name in ('a', 'b')"
}

# delete limit with pk
options:PassthroughDMLs
"delete from d where name in ('a', 'b') limit 1"
{
"PlanID": "PASS_DML",
"TableName": "",
"FullQuery": "delete from d where name in ('a', 'b') limit 1"
}

# delete cross-db
"delete from b.a where eid=1 and id=1"
{
Expand Down Expand Up @@ -907,6 +970,15 @@
"WhereClause": " where eid = 1 and id = 1"
}

# pk
options:PassthroughDMLs
"delete from a where eid=1 and id=1"
{
"PlanID": "PASS_DML",
"TableName": "",
"FullQuery": "delete from a where eid = 1 and id = 1"
}

# partial pk
"delete from a where eid=1"
{
Expand Down
4 changes: 2 additions & 2 deletions data/test/vtexplain/multi-output/deletesharded-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ delete from music_extra where id=1

1 ks_sharded/-40: begin
1 ks_sharded/-40: delete from music_extra where id in (1) /* vtgate:: keyspace_id:166b40b44aba4bd6 */
2 ks_sharded/-40: commit
1 ks_sharded/-40: commit

----------------------------------------------------------------------
delete from music_extra where id=1 and extra='abc'

1 ks_sharded/-40: begin
1 ks_sharded/-40: select id from music_extra where id = 1 and extra = 'abc' limit 10001 for update /* vtgate:: keyspace_id:166b40b44aba4bd6 */
1 ks_sharded/-40: delete from music_extra where id in (1) /* vtgate:: keyspace_id:166b40b44aba4bd6 */
2 ks_sharded/-40: commit
1 ks_sharded/-40: commit

----------------------------------------------------------------------
delete from user where id=1
Expand Down
10 changes: 5 additions & 5 deletions data/test/vtexplain/multi-output/unsharded-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,36 @@ insert into t1 (id,intval,floatval) values (1,2,3.14)

1 ks_unsharded/-: begin
1 ks_unsharded/-: insert into t1(id, intval, floatval) values (1, 2, 3.14)
2 ks_unsharded/-: commit
1 ks_unsharded/-: commit

----------------------------------------------------------------------
update t1 set intval = 10

1 ks_unsharded/-: begin
1 ks_unsharded/-: select id from t1 limit 10001 for update
1 ks_unsharded/-: update t1 set intval = 10 where id in (1)
2 ks_unsharded/-: commit
1 ks_unsharded/-: commit

----------------------------------------------------------------------
update t1 set floatval = 9.99

1 ks_unsharded/-: begin
1 ks_unsharded/-: select id from t1 limit 10001 for update
1 ks_unsharded/-: update t1 set floatval = 9.99 where id in (1)
2 ks_unsharded/-: commit
1 ks_unsharded/-: commit

----------------------------------------------------------------------
delete from t1 where id = 100

1 ks_unsharded/-: begin
1 ks_unsharded/-: delete from t1 where id in (100)
2 ks_unsharded/-: commit
1 ks_unsharded/-: commit

----------------------------------------------------------------------
insert into t1 (id,intval,floatval) values (1,2,3.14) on duplicate key update intval=3, floatval=3.14

1 ks_unsharded/-: begin
1 ks_unsharded/-: insert into t1(id, intval, floatval) values (1, 2, 3.14) on duplicate key update intval = 3, floatval = 3.14
2 ks_unsharded/-: commit
1 ks_unsharded/-: commit

----------------------------------------------------------------------
4 changes: 2 additions & 2 deletions data/test/vtexplain/multi-output/updatesharded-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ update user set nickname='alice' where id=1

1 ks_sharded/-40: begin
1 ks_sharded/-40: update user set nickname = 'alice' where id in (1) /* vtgate:: keyspace_id:166b40b44aba4bd6 */
2 ks_sharded/-40: commit
1 ks_sharded/-40: commit

----------------------------------------------------------------------
update user set nickname='alice' where name='alice'
Expand All @@ -21,7 +21,7 @@ update user set pet='fido' where id=1

1 ks_sharded/-40: begin
1 ks_sharded/-40: update user set pet = 'fido' where id in (1) /* vtgate:: keyspace_id:166b40b44aba4bd6 */
2 ks_sharded/-40: commit
1 ks_sharded/-40: commit

----------------------------------------------------------------------
update user set name='alicia' where id=1
Expand Down
58 changes: 58 additions & 0 deletions docker/k8s/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FROM vitess/base AS base

FROM debian:stretch-slim

# Set up Vitess environment (just enough to run pre-built Go binaries)
ENV VTROOT /vt
ENV VTDATAROOT /vtdataroot
ENV VTTOP /vt/src/github.com/youtube/vitess

# Prepare directory structure.
RUN mkdir -p /vt && \
mkdir -p /vt/bin && \
mkdir -p /vt/config && \
mkdir -p /vt/web && \
mkdir -p /vtdataroot/tabletdata

# Copy CA certs for https calls
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

# Copy binaries
COPY --from=base /vt/bin/mysqlctld /vt/bin/
COPY --from=base /vt/bin/vtctld /vt/bin/
COPY --from=base /vt/bin/vtctl /vt/bin/
COPY --from=base /vt/bin/vtgate /vt/bin/
COPY --from=base /vt/bin/vttablet /vt/bin/
COPY --from=base /vt/bin/vtworker /vt/bin/

# copy web admin files
COPY --from=base $VTTOP/web /vt/web/

# copy vitess config
COPY --from=base $VTTOP/config/init_db.sql /vt/config/

# mysql flavor files for db specific .cnf settings
COPY --from=base $VTTOP/config/mycnf/master_mysql56.cnf /vt/config/mycnf/
COPY --from=base $VTTOP/config/mycnf/master_mariadb.cnf /vt/config/mycnf/

# settings for different types of instances
COPY --from=base $VTTOP/config/mycnf/default.cnf /vt/config/mycnf/
COPY --from=base $VTTOP/config/mycnf/master.cnf /vt/config/mycnf/
COPY --from=base $VTTOP/config/mycnf/replica.cnf /vt/config/mycnf/
COPY --from=base $VTTOP/config/mycnf/rdonly.cnf /vt/config/mycnf/
COPY --from=base $VTTOP/config/mycnf/backup.cnf /vt/config/mycnf/

# settings to support rbr
COPY --from=base $VTTOP/config/mycnf/rbr.cnf /vt/config/mycnf/

# add vitess user and add permissions
RUN groupadd -r --gid 999 vitess && useradd -r -g vitess --uid 999 vitess && \
chown -R vitess:vitess /vt;

# TODO: remove when https://github.com/youtube/vitess/issues/3553 is fixed
RUN apt-get update && \
apt-get upgrade -qq && \
apt-get install mysql-client -qq --no-install-recommends && \
apt-get autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
9 changes: 1 addition & 8 deletions go/cmd/automation_server/automation_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package main

import (
"flag"
"fmt"
"net"
"os"
Expand All @@ -34,13 +33,7 @@ func init() {
}

func main() {

flag.Parse()

if *servenv.Version {
servenv.AppVersion.Print()
os.Exit(0)
}
servenv.ParseFlags("automation_server")

fmt.Println("Automation Server, listening on:", *servenv.Port)

Expand Down
8 changes: 1 addition & 7 deletions go/cmd/l2vtgate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package main
import (
"flag"
"math/rand"
"os"
"strings"
"time"

Expand Down Expand Up @@ -55,14 +54,9 @@ func init() {
func main() {
defer exit.Recover()

flag.Parse()
servenv.ParseFlags("l2vtgate")
servenv.Init()

if *servenv.Version {
servenv.AppVersion.Print()
os.Exit(0)
}

ts := topo.Open()
defer ts.Close()

Expand Down
7 changes: 1 addition & 6 deletions go/cmd/mysqlctld/mysqlctld.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ func main() {
// mysqlctld only starts and stops mysql, only needs dba.
dbconfigFlags := dbconfigs.DbaConfig
dbconfigs.RegisterFlags(dbconfigFlags)
flag.Parse()

if *servenv.Version {
servenv.AppVersion.Print()
os.Exit(0)
}
servenv.ParseFlags("mysqlctld")

// We'll register this OnTerm handler before mysqld starts, so we get notified
// if mysqld dies on its own without us (or our RPC client) telling it to.
Expand Down
14 changes: 1 addition & 13 deletions go/cmd/vtcombo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ package main

import (
"flag"
"os"
"strings"
"time"

Expand Down Expand Up @@ -67,18 +66,7 @@ func main() {
dbconfigs.FilteredConfig | dbconfigs.ReplConfig
dbconfigs.RegisterFlags(dbconfigFlags)
mysqlctl.RegisterFlags()
flag.Parse()

if *servenv.Version {
servenv.AppVersion.Print()
os.Exit(0)
}

if len(flag.Args()) > 0 {
flag.Usage()
log.Errorf("vtcombo doesn't take any positional arguments")
exit.Return(1)
}
servenv.ParseFlags("vtcombo")

// parse the input topology
tpb := &vttestpb.VTTestTopology{}
Expand Down
14 changes: 1 addition & 13 deletions go/cmd/vtctl/vtctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,7 @@ func main() {
defer exit.RecoverAll()
defer logutil.Flush()

flag.Parse()
args := flag.Args()

if *servenv.Version {
servenv.AppVersion.Print()
os.Exit(0)
}

if len(args) == 0 {
flag.Usage()
exit.Return(1)
}

args := servenv.ParseFlagsWithArgs("vtctl")
action := args[0]

startMsg := fmt.Sprintf("USER=%v SUDO_USER=%v %v", os.Getenv("USER"), os.Getenv("SUDO_USER"), strings.Join(os.Args, " "))
Expand Down
Loading