-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Change varbinary to varchar in schemas used in examples folder #17318
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: arthmis <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Signed-off-by: arthmis <[email protected]>
Signed-off-by: arthmis <[email protected]>
…e folder Signed-off-by: arthmis <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @arthmis !
We should also update the website docs to reflect the new column types where they are referenced:
❯ git grep varbinary | grep 22
content/en/docs/22.0/concepts/shard.md:A `varbinary` of arbitrary length can also be mapped as is to a keyspace id. This is what the `binary` vindex does.
content/en/docs/22.0/get-started/local-mac.md: sku varbinary(128),
content/en/docs/22.0/get-started/local-mac.md: description varbinary(128),
content/en/docs/22.0/get-started/local-mac.md: email varbinary(128),
content/en/docs/22.0/get-started/local-mac.md: sku varbinary(128),
content/en/docs/22.0/get-started/local.md: sku varbinary(128),
content/en/docs/22.0/get-started/local.md: description varbinary(128),
content/en/docs/22.0/get-started/local.md: email varbinary(128),
content/en/docs/22.0/get-started/local.md: sku varbinary(128),
content/en/docs/22.0/get-started/operator.md: sku varbinary(128),
content/en/docs/22.0/get-started/operator.md: description varbinary(128),
content/en/docs/22.0/get-started/operator.md: email varbinary(128),
content/en/docs/22.0/get-started/operator.md: sku varbinary(128),
content/en/docs/22.0/reference/features/global-routing.md:| sku | varbinary(128) | YES | | NULL | |
content/en/docs/22.0/reference/features/global-routing.md:| sku | varbinary(128) | NO | PRI | NULL | |
content/en/docs/22.0/reference/features/global-routing.md:| description | varbinary(128) | YES | | NULL | |
content/en/docs/22.0/reference/features/global-routing.md:| email | varbinary(128) | YES | | NULL | |
content/en/docs/22.0/reference/features/global-routing.md:| sku | varbinary(128) | YES | | NULL | |
content/en/docs/22.0/reference/features/global-routing.md:| sku | varbinary(128) | NO | PRI | NULL | |
content/en/docs/22.0/reference/features/global-routing.md:| description | varbinary(128) | YES | | NULL | |
content/en/docs/22.0/reference/programs/vtctldclient/vtctldclient_Materialize/vtctldclient_Materialize_create.md: "create_ddl": "create table sales_by_sku (sku varbinary(128) not null primary key, orders bigint, revenue bigint)"
content/en/docs/22.0/reference/programs/vtctldclient/vtctldclient_Materialize/vtctldclient_Materialize_create.md:vtctldclient --server localhost:15999 materialize --workflow product_sales --target-keyspace commerce create --source-keyspace commerce --table-settings '[{"target_table": "sales_by_sku", "create_ddl": "create table sales_by_sku (sku varbinary(128) not null primary key, orders bigint, revenue bigint)", "source_expression": "select sku, count(*) as orders, sum(price) as revenue from corder group by sku"}]' --cells zone1 --cells zone2 --tablet-types replica
content/en/docs/22.0/reference/vreplication/internal/keys.md: `sku` varbinary(128) DEFAULT NULL,
content/en/docs/22.0/reference/vreplication/materialize.md:vtctldclient --server localhost:15999 Materialize --workflow product_sales --target-keyspace commerce create --source-keyspace commerce --table-settings '[{"target_table": "sales_by_sku", "create_ddl": "create table sales_by_sku (sku varbinary(128) not null primary key, orders bigint, revenue bigint)", "source_expression": "select sku, count(*) as orders, sum(price) as revenue from corder group by sku"}]' --cells zone1 --cells zone2 --tablet-types replica
content/en/docs/22.0/reference/vreplication/materialize.md: "create_ddl": "create table sales_by_sku (sku varbinary(128) not null primary key, orders bigint, revenue bigint)"
content/en/docs/22.0/user-guides/configuration-advanced/createlookupvindex.md:| sku | varbinary(128) | YES | | NULL | |
content/en/docs/22.0/user-guides/configuration-advanced/createlookupvindex.md:| sku | varbinary(128) | NO | PRI | NULL | |
content/en/docs/22.0/user-guides/configuration-advanced/createlookupvindex.md:| keyspace_id | varbinary(128) | YES | | NULL | |
content/en/docs/22.0/user-guides/configuration-advanced/region-sharding.md: `fullname` varbinary(256) DEFAULT NULL,
content/en/docs/22.0/user-guides/configuration-advanced/region-sharding.md: `nationalid` varbinary(256) DEFAULT NULL,
content/en/docs/22.0/user-guides/configuration-advanced/region-sharding.md: `country` varbinary(256) DEFAULT NULL,
content/en/docs/22.0/user-guides/configuration-advanced/region-sharding.md:| keyspace_id | varbinary(128) | YES | | NULL | |
content/en/docs/22.0/user-guides/migration/materialize.md: sku varbinary(128) DEFAULT NULL,
content/en/docs/22.0/user-guides/migration/materialize.md: sku varbinary(128) DEFAULT NULL,
content/en/docs/22.0/user-guides/schema-changes/audit-and-control.md: `sku` varbinary(128) DEFAULT NULL,
content/en/docs/22.0/user-guides/schema-changes/audit-and-control.md: `sku` varbinary(128) DEFAULT NULL,
content/en/docs/22.0/user-guides/schema-changes/audit-and-control.md: `sku` varbinary(128) DEFAULT NULL,
content/en/docs/22.0/user-guides/vschema-guide/lookup-as-primary.md:create table corder_event(corder_event_id bigint, corder_id bigint, ename varchar(128), keyspace_id varbinary(10), primary key(corder_id, corder_event_id));
content/en/docs/22.0/user-guides/vschema-guide/non-unique-lookup.md:create table oname_keyspace_idx(oname varchar(128), corder_id bigint, keyspace_id varbinary(10), primary key(oname, corder_id));
content/en/docs/22.0/user-guides/vschema-guide/unique-lookup.md:create table corder_keyspace_idx(corder_id bigint, keyspace_id varbinary(10), primary key(corder_id));
content/zh/docs/22.0/get-started/kubernetes.md: sku varbinary(128),
content/zh/docs/22.0/get-started/kubernetes.md: description varbinary(128),
content/zh/docs/22.0/get-started/kubernetes.md: email varbinary(128),
content/zh/docs/22.0/get-started/kubernetes.md: sku varbinary(128),
content/zh/docs/22.0/get-started/kubernetes.md:任意长度的`varbinary`也可以按原样映射到keyspace id。这就是`binary`vindex所做的。
content/zh/docs/22.0/get-started/local.md: sku varbinary(128),
content/zh/docs/22.0/get-started/local.md: description varbinary(128),
content/zh/docs/22.0/get-started/local.md: email varbinary(128),
content/zh/docs/22.0/get-started/local.md: sku varbinary(128),
content/zh/docs/22.0/get-started/local.md:任意长度的`varbinary`也可以按原样映射到keyspace id。这就是`binary`vindex所做的。
content/zh/docs/22.0/reference/vitess-api.md:| <code>BYTES</code> | <code>2</code> | BYTES is when an array of bytes is used. This is represented as 'varbinary' in mysql |
content/zh/docs/22.0/schema-management/consistent-lookup.md:The guidance for implementing lookup vindexes has been to create a two-column table. The first column (from column) should match the type of the column of the main table that needs the vindex. The second column (to column) should be a `binary` or a `varbinary` large enough to accommodate the keyspace id.
Are you OK doing that as well? I can help as needed.
Thanks again!
Yes I can update the website docs. |
@arthmis thanks again! One other thing... if we're going to mark this PR as fixing #15997 then we should do the second task listed there as well:
That will impact the docs changes as well. I'm sorry, I was forgetting about these details myself. Does this make sense? |
@mattlord Could you actually show an example of a vindex that needs to change in any of the example docs? I did look through the vindexes in the vschema definitions but i didn't find any references to the columns that were changed. That's why I didn't include it in the PR. I could also be misreading some of the vschemas. So an example would be helpful to me. |
Look at vschema.json and vschema_customer_sharded.json. We want to |
Oh does the type for vindexes need to be changed from so using "vindexes": {
"hash": {
"type": "hash" -> "xxhash"
}
}, And in the rest of that file there is "tables": {
"messages": {
"column_vindexes": [
{
"column": "page",
"name": "hash" // does this need to be changed to xxhash as well?
}
]
} |
No. It is the "name" of the vindex, which is defined here
|
ahh thank you! |
Signed-off-by: arthmis <[email protected]>
So I did update the vindex type to
I only ended up updating 2 files because I assume I only needed to update the vindex for schemas that affected the updated tables. Is that right? Or did I actually have to update everywhere that had a type of |
@arthmis the issue is that the It's really quite simple, replace all instances of |
oh ok yeah how to change it makes sense. I just wasn't sure whether all of it needed to change, based on the description from the issue, because a lot of the instances of |
Signed-off-by: arthmis <[email protected]>
Signed-off-by: arthmis <[email protected]>
Signed-off-by: arthmis <[email protected]>
ok @mattlord I've changed all instances of |
Description
This changes usage of
varbinary
tovarchar
in schemas used in the/examples
folder. Schema fields likekeyspace_id
that usevarbinary
are excluded from the change.Related Issue(s)
This PR fixes #15997
Checklist