Skip to content

Instantly share code, notes, and snippets.

View mattlord's full-sized avatar
😶‍🌫️

Matt Lord mattlord

😶‍🌫️
View GitHub Profile
diff --git a/go/vt/sqlparser/ast_funcs.go b/go/vt/sqlparser/ast_funcs.go
index 290c57f9d9..e9af5c03fe 100644
--- a/go/vt/sqlparser/ast_funcs.go
+++ b/go/vt/sqlparser/ast_funcs.go
@@ -2135,6 +2135,14 @@ func RemoveKeyspace(in SQLNode) {
}, in)
}
+// RemoveSpecificKeyspace removes the keyspace qualifier from all ColName and TableName
+// when it matches the keyspace provided
@mattlord
mattlord / cobra_docs_improvements.diff
Last active October 16, 2024 13:05
This addresses the creation of unwanted backup files using the BSD sed and it changes the commit hash notations so that they are ONLY added to the binary's parent page.
diff --git a/go/cmd/internal/docgen/docgen.go b/go/cmd/internal/docgen/docgen.go
index eea935ed39..a5c42c5435 100644
--- a/go/cmd/internal/docgen/docgen.go
+++ b/go/cmd/internal/docgen/docgen.go
@@ -75,7 +75,7 @@ func GenerateMarkdownTree(cmd *cobra.Command, dir string) error {
}
recursivelyDisableAutoGenTags(cmd)
- if err := doc.GenMarkdownTreeCustom(cmd, dir, frontmatterFilePrepender(sha), linkHandler); err != nil {
+ if err := doc.GenMarkdownTreeCustom(cmd, dir, frontmatterFilePrepender(cmd.Name(), sha), linkHandler); err != nil {
@mattlord
mattlord / etcd_topo_decode.md
Created August 6, 2024 21:25
etcdctl topo read and decode example
cd examples/local

./101_initial_cluster.sh; ./201_customer_tablets.sh

❯ etcdctl get --prefix -w protobuf /vitess/zone1/tablets | protoc --proto_path=${HOME}/git/vitess/proto --decode=topodata.Keyspace topodata.proto | grep -E '^  1:|^    16:'
  1: 14841639068965178418
  1: "/vitess/zone1/tablets/zone1-0000000100/Tablet"
    16: 255
 1: "/vitess/zone1/tablets/zone1-0000000101/Tablet"
@mattlord
mattlord / vstream_vevent_enum_test.md
Last active December 6, 2023 23:05
VStream VEvent Test of ENUMs

Setup the test env:

git checkout main && make build

pushd examples/local

./101_initial_cluster.sh

mysql < ../common/insert_commerce_data.sql
@mattlord
mattlord / demo.sh
Last active November 4, 2023 15:31
KubeCon NA 2023 Vitess Data Migration Demo
#!/bin/bash
set -o pipefail
export SKIP_VTADMIN=1
function display () {
echo -e "\033[33m${1}\033[0m"
}
@mattlord
mattlord / proto_examples.txt
Last active January 25, 2024 17:34
vtctlclient and etcdctl examples
❯ vtctldclient GetTablets
zone1-0000000100 commerce 0 replica localhost:15100 localhost:17100 [] <null>
zone1-0000000101 commerce 0 primary localhost:15101 localhost:17101 [] 2023-09-28T16:37:49Z
zone1-0000000102 commerce 0 rdonly localhost:15102 localhost:17102 [] <null>
zone1-0000000200 customer 0 primary localhost:15200 localhost:17200 [] 2023-09-28T16:39:19Z
zone1-0000000201 customer 0 replica localhost:15201 localhost:17201 [] <null>
zone1-0000000202 customer 0 rdonly localhost:15202 localhost:17202 [] <null>
❯ etcdctl get --prefix /vitess/zone1/tablets/zone1-0000000100/Tablet -w protobuf | protoc --proto_path=${HOME}/git/vitess/proto --decode=topodata.Keyspace topodata.proto
1 {
@mattlord
mattlord / grpc_examples.md
Last active May 2, 2024 12:12
grpcurl examples with Vitess
❯ grpcurl -plaintext -format json -import-path ${VTROOT}/proto -proto vtgateservice.proto \
  -H 'username: guser1'  -H 'password: gpass1' \
  -d '{"tablet_type":"RDONLY", "vgtid":{ "shard_gtids": [{"keyspace":"", "shard":"", "gtid":"current"}]} }' \
  localhost:15306 vtgateservice.Vitess/VStream
❯ grpcurl -plaintext -format json -import-path ${VTROOT}/proto -proto ${VTROOT}/proto/vtctlservice.proto \
  -d '{"keyspace":"commerce", "sql":"create table t1 (id int)", "ddl_strategy":"direct"}' \
@mattlord
mattlord / buffer_test.md
Last active January 25, 2024 17:34
buffering test

Test Case:

export SKIP_VTADMIN=1
pushd ${VTROOT}/examples/local

sed -i "" '42i\
  --enable_buffer \\
' ../common/scripts/vtgate-up.sh

sed -i "" -e "s/semi_sync/none/g" 101_initial_cluster.sh
#!/bin/bash
#
# From within ./examples/local/
#
pushd "${VTROOT}/examples/local"
source ../common/env.sh
CELL=zone1 ../common/scripts/etcd-up.sh