Skip to content

Commit

Permalink
Merge pull request vitessio#1742 from sougou/rowcache
Browse files Browse the repository at this point in the history
Rowcache deprecation
  • Loading branch information
sougou committed May 31, 2016
2 parents 7a7b248 + afa884f commit 25542cd
Show file tree
Hide file tree
Showing 71 changed files with 673 additions and 6,703 deletions.
750 changes: 148 additions & 602 deletions data/test/tabletserver/exec_cases.txt

Large diffs are not rendered by default.

47 changes: 3 additions & 44 deletions data/test/tabletserver/schema_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
0,
1
],
"Type": 1
"Type": 0
},
{
"Name": "b",
Expand Down Expand Up @@ -306,52 +306,11 @@
"PKColumns": [
0
],
"Type": 1
},
{
"Name": "e",
"Columns": [
{
"Name": "eid",
"Category": 1,
"IsAuto": false,
"Default": 0
},
{
"Name": "id",
"Category": 1,
"IsAuto": false,
"Default": 0
}
],
"Indexes": [
{
"Name": "PRIMARY",
"Columns": [
"eid",
"id"
],
"Cardinality": [
1,
1
],
"DataColumns": [
"eid",
"id"
]
}
],
"PKColumns": [
0,
1,
0,
1
],
"Type": 2
"Type": 0
},
{
"Name": "seq",
"Type": 3
"Type": 1
},
{
"Name": "dual",
Expand Down
4 changes: 0 additions & 4 deletions data/test/tabletserver/stream_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
"select * from a for update"
"select with lock not allowed for streaming"

# select from dual"
"select 1 from dual"
"select from dual not allowed for streaming"

# union
"select * from a union select * from b"
{
Expand Down
3 changes: 0 additions & 3 deletions examples/kubernetes/vttablet-pod-benchmarking-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ spec:
-queryserver-config-transaction-cap 300
-queryserver-config-schema-reload-time 1
-queryserver-config-pool-size 100
-enable-rowcache
-enable_replication_reporter
-rowcache-bin /usr/bin/memcached
-rowcache-socket $VTDATAROOT/{{tablet_subdir}}/memcache.sock" vitess
env:
- name: GOMAXPROCS
value: "16"
Expand Down
3 changes: 0 additions & 3 deletions examples/kubernetes/vttablet-pod-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,8 @@ spec:
-db-config-filtered-uname vt_filtered
-db-config-filtered-dbname vt_{{keyspace}}
-db-config-filtered-charset utf8
-enable-rowcache
-enable_semi_sync
-enable_replication_reporter
-rowcache-bin /usr/bin/memcached
-rowcache-socket $VTDATAROOT/{{tablet_subdir}}/memcache.sock
-restore_from_backup {{backup_flags}}" vitess
- name: mysql
image: vitess/lite
Expand Down
3 changes: 0 additions & 3 deletions examples/local/vttablet-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,8 @@ for uid_index in $uids; do
-init_shard $shard \
-target_tablet_type $tablet_type \
-health_check_interval 5s \
-enable-rowcache \
-enable_semi_sync \
-enable_replication_reporter \
-rowcache-bin $memcached_path \
-rowcache-socket $VTDATAROOT/$tablet_dir/memcache.sock \
-backup_storage_implementation file \
-file_backup_storage_root $VTDATAROOT/backups \
-restore_from_backup \
Expand Down
1 change: 0 additions & 1 deletion go/cmd/vttablet/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ var (
<td width="25%" border="">
<a href="/healthz">Health Check</a></br>
<a href="/debug/health">Query Service Health Check</a></br>
<a href="/debug/memcache/">Memcache</a></br>
<a href="/streamqueryz">Current Stream Queries</a></br>
</td>
</tr>
Expand Down
5 changes: 1 addition & 4 deletions go/cmd/vttablet/vttablet.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@ import (

// import mysql to register mysql connection function
_ "github.com/youtube/vitess/go/mysql"
// import memcache to register memcache connection function
_ "github.com/youtube/vitess/go/memcache"
)

var (
enforceTableACLConfig = flag.Bool("enforce-tableacl-config", false, "if this flag is true, vttablet will fail to start if a valid tableacl config does not exist")
tableAclConfig = flag.String("table-acl-config", "", "path to table access checker config file")
tabletPath = flag.String("tablet-path", "", "tablet alias")
overridesFile = flag.String("schema-override", "", "schema overrides file")

agent *tabletmanager.ActionAgent
)
Expand Down Expand Up @@ -123,7 +120,7 @@ func main() {
if servenv.GRPCPort != nil {
gRPCPort = int32(*servenv.GRPCPort)
}
agent, err = tabletmanager.NewActionAgent(context.Background(), mysqld, qsc, tabletAlias, dbcfgs, mycnf, int32(*servenv.Port), gRPCPort, *overridesFile)
agent, err = tabletmanager.NewActionAgent(context.Background(), mysqld, qsc, tabletAlias, dbcfgs, mycnf, int32(*servenv.Port), gRPCPort)
if err != nil {
log.Error(err)
exit.Return(1)
Expand Down
2 changes: 1 addition & 1 deletion go/vt/mysqlctl/mycnf.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type Mycnf struct {
RelayLogInfoPath string

// BinLogPath is the base path for binlogs
// (used by vt software for binlog streaming and rowcache invalidation)
// (used by vt software for binlog streaming)
BinLogPath string

// MasterInfoFile is the master.info file location.
Expand Down
26 changes: 10 additions & 16 deletions go/vt/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ import (
querypb "github.com/youtube/vitess/go/vt/proto/query"
)

// Cache types
// Table types
const (
CacheNone = 0
CacheRW = 1
CacheW = 2
Sequence = 3
NoType = iota
Sequence
)

// TypeNames allows to fetch a the type name for a table.
// Count must match the number of table types.
var TypeNames = []string{
"none",
"sequence",
}

// TableColumn contains info about a table's column.
type TableColumn struct {
Name cistring.CIString
Expand Down Expand Up @@ -52,17 +57,6 @@ func NewTable(name string) *Table {
}
}

// IsCached returns true if the table has a rowcache association.
func (ta *Table) IsCached() bool {
return ta.Type == CacheRW || ta.Type == CacheW
}

// IsReadCached returns true if the rowcache can be used for reads.
// TODO(sougou): remove after deprecating schema overrides.
func (ta *Table) IsReadCached() bool {
return ta.Type == CacheRW
}

// AddColumn adds a column to the Table.
func (ta *Table) AddColumn(name string, columnType querypb.Type, defval sqltypes.Value, extra string) {
index := len(ta.Columns)
Expand Down
19 changes: 0 additions & 19 deletions go/vt/sqlparser/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ func GetTableName(node SimpleTableExpr) string {
return ""
}

// GetColName returns the column name, only if
// it's a simple expression. Otherwise, it returns "".
func GetColName(node Expr) ColIdent {
if n, ok := node.(*ColName); ok {
return n.Name
}
return ColIdent{}
}

// IsColName returns true if the ValExpr is a *ColName.
func IsColName(node ValExpr) bool {
_, ok := node.(*ColName)
Expand All @@ -56,16 +47,6 @@ func IsNull(node ValExpr) bool {
return false
}

// HasINClause returns true if any of the conditions has an IN clause.
func HasINClause(conditions []BoolExpr) bool {
for _, node := range conditions {
if c, ok := node.(*ComparisonExpr); ok && c.Operator == InStr {
return true
}
}
return false
}

// IsSimpleTuple returns true if the ValExpr is a ValTuple that
// contains simple values or if it's a list arg.
func IsSimpleTuple(node ValExpr) bool {
Expand Down
59 changes: 8 additions & 51 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ package sqlparser

import (
"errors"
"fmt"
"strconv"
"strings"

"github.com/youtube/vitess/go/cistring"
Expand Down Expand Up @@ -539,17 +537,19 @@ func (node Nextval) WalkSubtree(visit Visit) error {
}

// Columns represents an insert column list.
// The syntax for Columns is a subset of SelectExprs.
// So, it's castable to a SelectExprs and can be analyzed
// as such.
type Columns []SelectExpr
type Columns []ColIdent

// Format formats the node.
func (node Columns) Format(buf *TrackedBuffer) {
if node == nil {
return
}
buf.Myprintf("(%v)", SelectExprs(node))
prefix := "("
for _, n := range node {
buf.Myprintf("%s%v", prefix, n)
prefix = ", "
}
buf.WriteString(")")
}

// WalkSubtree walks the nodes of the subtree
Expand Down Expand Up @@ -1582,49 +1582,6 @@ func (node *Limit) WalkSubtree(visit Visit) error {
)
}

// Limits returns the values of the LIMIT clause as interfaces.
// The returned values can be nil for absent field, string for
// bind variable names, or int64 for an actual number.
// Otherwise, it's an error.
func (node *Limit) Limits() (offset, rowcount interface{}, err error) {
if node == nil {
return nil, nil, nil
}
switch v := node.Offset.(type) {
case NumVal:
o, err := strconv.ParseInt(string(v), 0, 64)
if err != nil {
return nil, nil, err
}
if o < 0 {
return nil, nil, fmt.Errorf("negative offset: %d", o)
}
offset = o
case ValArg:
offset = string(v)
case nil:
// pass
default:
return nil, nil, fmt.Errorf("unexpected node for offset: %+v", v)
}
switch v := node.Rowcount.(type) {
case NumVal:
rc, err := strconv.ParseInt(string(v), 0, 64)
if err != nil {
return nil, nil, err
}
if rc < 0 {
return nil, nil, fmt.Errorf("negative limit: %d", rc)
}
rowcount = rc
case ValArg:
rowcount = string(v)
default:
return nil, nil, fmt.Errorf("unexpected node for rowcount: %+v", v)
}
return offset, rowcount, nil
}

// Values represents a VALUES clause.
type Values []RowTuple

Expand Down Expand Up @@ -1680,7 +1637,7 @@ func (node UpdateExprs) WalkSubtree(visit Visit) error {

// UpdateExpr represents an update expression.
type UpdateExpr struct {
Name *ColName
Name ColIdent
Expr ValExpr
}

Expand Down
Loading

0 comments on commit 25542cd

Please sign in to comment.