You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When moving tables from an unsharded keyspace to a sharded one, the management of sequences during the traffic switch can be cumbersome and challenging -- which is why we added to support to automatically manage this in #13656
However, if one or more of the shards have no records in the table using the sequence then the sequence initialization step will fail as it tries to covert NULL to an int.
Reproduction Steps
git checkout main && make build
pushd ${VTROOT}/examples/local
./101_initial_cluster.sh
mysql < ../common/insert_commerce_data.sql
mysql commerce -e "insert into customer (customer_id, email) values (99999, 'mlord@planetscale.com')" --binary-as-hex=false
vtctldclient --server localhost:15999 CreateKeyspace --durability-policy=semi_sync customer || fail "Failed to create and configure the commerce keyspace"
./301_customer_sharded.sh; ./302_new_shards.sh
sleep 30
vtctldclient ApplySchema --sql-file create_customer_sharded.sql customer
mysql commerce -e "select * from customer order by customer_id" --binary-as-hex=false
mysql commerce -e "select * from customer_seq" --binary-as-hex=false
vtctldclient MoveTables --target-keyspace customer --workflow commerce2customer create --tables 'customer,corder' --source-keyspace commerce
sleep 30
mysql customer -e "select * from customer order by customer_id" --binary-as-hex=false
# Delete the record that is on the 80- shard
primaryuid=$(vtctldclient GetTablets --keyspace customer --tablet-type primary --shard "80-" | awk '{print $1}' | cut -d- -f2 | bc)
command mysql -u root --socket=${VTDATAROOT}/vt_0000000${primaryuid}/mysql.sock --binary-as-hex=false vt_customer -e "delete from vt_customer.customer"
vtctldclient MoveTables --target-keyspace customer --workflow commerce2customer SwitchTraffic --initialize-target-sequences
Binary Version
vtgate version Version: 20.0.0-SNAPSHOT (Git revision af3809949587dd4c03673880ec46365339dfd522 branch 'main') built on Tue Feb 20 07:14:25 EST 2024 by matt@pslord.local using go1.22.0 darwin/arm64
Operating System and Environment details
N/A
Log Fragments
No response
The text was updated successfully, but these errors were encountered:
Overview of the Issue
When moving tables from an unsharded keyspace to a sharded one, the management of sequences during the traffic switch can be cumbersome and challenging -- which is why we added to support to automatically manage this in #13656
However, if one or more of the shards have no records in the table using the sequence then the sequence initialization step will fail as it tries to covert
NULL
to an int.Reproduction Steps
Binary Version
vtgate version Version: 20.0.0-SNAPSHOT (Git revision af3809949587dd4c03673880ec46365339dfd522 branch 'main') built on Tue Feb 20 07:14:25 EST 2024 by matt@pslord.local using go1.22.0 darwin/arm64
Operating System and Environment details
Log Fragments
No response
The text was updated successfully, but these errors were encountered: