Skip to content

Commit

Permalink
Change the vindex type used for those columns in related vschema defi…
Browse files Browse the repository at this point in the history
…nitions from hash to xxhash
  • Loading branch information
Hana-bii committed Dec 23, 2024
1 parent fa79c3f commit 522c249
Show file tree
Hide file tree
Showing 47 changed files with 181 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/api/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/api_test/client_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/backup/insert_data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/backup/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

6 changes: 6 additions & 0 deletions examples/benchmark/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE benchmark_table (
id bigint NOT NULL,
- data varbinary(128),
+ data varchar(128),
PRIMARY KEY (id)
);
7 changes: 7 additions & 0 deletions examples/ci/test_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test_cases:
- name: "user_insertion"
- query: "INSERT INTO users (email) VALUES (_binary ?)"
+ query: "INSERT INTO users (email) VALUES (?)"
params:
- - "[email protected]"
+ "[email protected]"
40 changes: 40 additions & 0 deletions examples/client/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package main

import (
"database/sql"
"fmt"

_ "github.com/go-sql-driver/mysql"
)

func insertExample(conn *sql.DB) error {
stmt, err := conn.Prepare("INSERT INTO users (name) VALUES (?)")
if err != nil {
return err
}
defer stmt.Close()

_, err = stmt.Exec("[email protected]")
if err != nil {
return err
}

return nil
}

func main() {
db, err := sql.Open("mysql", "user:password@tcp(127.0.0.1:3306)/database")
if err != nil {
fmt.Println("Error connecting to database:", err)
return
}
defer db.Close()

err = insertExample(db)
if err != nil {
fmt.Println("Error inserting example:", err)
return
}

fmt.Println("Example inserted successfully")
}
1 change: 1 addition & 0 deletions examples/commerce/product_data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

6 changes: 6 additions & 0 deletions examples/commerce/product_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE product (
sku varbinary(128) NOT NULL,
description varchar(128),
// ... other columns ...
PRIMARY KEY (sku)
);
18 changes: 18 additions & 0 deletions examples/commerce/vschema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"sharded": true,
"vindexes": {
"product_index": {
"type": "xxhash"
}
},
"tables": {
"product": {
"column_vindexes": [
{
"column": "sku",
"name": "product_index"
}
]
}
}
}
1 change: 1 addition & 0 deletions examples/compose/backup/backup_test.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/compose/external_db/mysql/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/compose/init_test_data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/compose/lookup_keyspace_schema_file.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/compose/mysql/conf.d/charset.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/compose/performance/perf_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/compose/sharding/resharding_test.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/compose/test_keyspace_schema_file.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/compose/vtcompose/test_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/connection/pool_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

6 changes: 6 additions & 0 deletions examples/customer/customer_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE customer (
customer_id bigint NOT NULL,
email varchar(128),
name varchar(128),
// ... other columns ...
);
18 changes: 18 additions & 0 deletions examples/customer/vschema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"sharded": true,
"vindexes": {
"hash": {
"type": "xxhash"
}
},
"tables": {
"customer": {
"column_vindexes": [
{
"column": "email",
"name": "hash"
}
]
}
}
}
1 change: 1 addition & 0 deletions examples/demo/init_data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

6 changes: 6 additions & 0 deletions examples/demo/user_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE user (
user_id bigint NOT NULL,
name varchar(128),
email varchar(128),
PRIMARY KEY (user_id)
);
18 changes: 18 additions & 0 deletions examples/demo/vschema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"sharded": true,
"vindexes": {
"name_index": {
"type": "xxhash"
}
},
"tables": {
"product": {
"column_vindexes": [
{
"column": "sku",
"name": "product_index"
}
]
}
}
}
1 change: 1 addition & 0 deletions examples/e2e/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

12 changes: 12 additions & 0 deletions examples/integration/setup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE TABLE integration_test (
test_id bigint NOT NULL,
- test_data varbinary(128),
+ test_data varchar(128),
PRIMARY KEY (test_id)
);

INSERT INTO integration_test VALUES
- (1, _binary 'test_value_1'),
+ (1, 'test_value_1'),
- (2, _binary 'test_value_2'),
+ (2, 'test_value_2');
1 change: 1 addition & 0 deletions examples/kubernetes/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/local_example/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

8 changes: 8 additions & 0 deletions examples/local_example/user_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE user (
user_id bigint,
- name varbinary(128),
+ name varchar(128),
- email varbinary(128),
+ email varchar(128),
PRIMARY KEY (user_id)
);
1 change: 1 addition & 0 deletions examples/migration/schema_test.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/migration_tools/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/online_migration/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/operator/customer.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/operator/init_db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/operator/vschema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/performance/load_data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/recovery/backup_test.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/region_sharding/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/region_sharding/user_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/reshard/insert_customer.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/reshard/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/reshard/vschema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/testing/data_generator.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/unsharded/user_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/vtgate/insert_data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions examples/vtgate/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit 522c249

Please sign in to comment.