Giter Club home page Giter Club logo

Comments (11)

aaijazi avatar aaijazi commented on July 24, 2024

Taking this, with the hope of having a quick document or write-up in a few hours.

from vitess.

aaijazi avatar aaijazi commented on July 24, 2024

I've started writing a document, but it's a first draft and probably will take a couple of days to finalize.

@mitiger, if you need something faster than that, I can provide you with a minimal set of commands that need to be run. You can also take a look at test/initial_sharding.py:test_resharding to see what commands are run for the end-to-end test.

from vitess.

mitiger avatar mitiger commented on July 24, 2024

@aaijazi , I hava read initial_sharding.py , and try in my server.

there is a question, when i exec command : "./vtworker -min_healthy_rdonly_endpoints=1 -cell=test SplitDiff test_keyspace/-80"

vttablet logs show :

can't read startPosition: error Table '_vt.blp_checkpoint' doesn't exist (errno 1146) during query: SELECT pos, flags FROM _vt.blp_checkpoint WHERE source_shard_uid=0 in selecting from recovery table SELECT pos, flags FROM _vt.blp_checkpoint WHERE source_shard_uid=0

blp_chekpoint not found , i don't know when table blp_checkpoint create ?

from vitess.

mitiger avatar mitiger commented on July 24, 2024

@aaijazi , please give me the minimal set of commands ,so i can see if some commands lost in my demo.
thanks a lot

from vitess.

aaijazi avatar aaijazi commented on July 24, 2024

@mitiger try adding --strategy=-populate_blp_checkpoint to your vtworker command when doing SplitClone:

./vtworker -min_healthy_rdonly_endpoints=1 -cell=test SplitClone --strategy=-populate_blp_checkpoint test_keyspace/0

I'll get you the minimal set of commands in a few minutes.

from vitess.

mitiger avatar mitiger commented on July 24, 2024

@aaijazi , the command
./vtworker -min_healthy_rdonly_endpoints=1 -cell=test SplitClone --strategy=-populate_blp_checkpoint test_keyspace/0"

take a long time , and not success?
Always print log as follows:
Running:
Copying from: test-0000000003
ETA: 2015-03-03 14:56:01.238102924 +0800 CST
test_table: copy done, copied 200 rows

is it normally?

from vitess.

aaijazi avatar aaijazi commented on July 24, 2024

@mitiger: I haven't tested these exact commands myself, but I think they should you get going.

Preparing source shard

  • Make sure you have a column that you can use as a sharding key on the source shard.
  • Indicate to Vitess what that sharding column is, e.g., vtctl SetKeyspaceShardingInfo -force test_keyspace keyspace_id uint64
  • Make sure you have an rdonly tablet in the source shard

Preparing destination shards

  • Reparent each shard, e.g., vtctl ReparentShard -force test_keyspace/-64 <master tablet alias> so that each destination shard has selected a master tablet.

Cloning the data

  • Copy the schema onto each destination shard: vtctl CopySchemaShard <source rdonly tablet alias> test_keyspace/-64
  • Run a SplitClone vtworker to stream the data from the source to destinations. Example: vtworker -min_healthy_rdonly_endpoints=1 --cell=test SplitClone --strategy=-populate_blp_checkpoint test_keyspace/0

Verify data was copied correctly (optional, but recommended)

  • Run a single SplitDiff vtworker: vtworker -min_healthy_rdonly_endpoints=1 --cell=test SplitDiff test_keyspace/-64
  • If the above is successful, repeat the step for the next destination shard. Make sure that you don't run the commands in parallel, but let each shard's diff run sequentially.

Start serving traffic from destination shard

  • Migrate rdonly traffic: vtctl MigrateServedTypes test_keyspace/0 rdonly
  • If successful, migrate replica traffic: vtctl MigrateServedTypes test_keyspace/0 replica
  • If successful, migrate master traffic: vtctl MigrateServedTypes test_keyspace/0 master

Scrap the source shard

Note: only do these steps if all the above steps were successful.

  • For each tablet in the source shard: vtctl ScrapTablet <source tablet alias>
  • For each tablet in the source shard: vtctl DeleteTablet <source tablet alias>
  • Rebuild serving graph: vtctl RebuildKeyspaceGraph test_keyspace
  • vtctl DeleteShard test_keyspace/0

from vitess.

aaijazi avatar aaijazi commented on July 24, 2024

@mitiger That looks like fairly normal output for the copy command. What makes you say it won't succeed? How many tables/rows were you expecting? How long did it run for?

You can monitor the status of the copy by viewing the status page in your browser. It should also log/print the status every second.

from vitess.

mitiger avatar mitiger commented on July 24, 2024

@aaijazi , in my keyspace , just one table and 200 rows .
this log print then 5 minutes, then i stop it with ctrl + C !!

from vitess.

mitiger avatar mitiger commented on July 24, 2024

@aaijazi i found the table _vt.blp_checkpoint not been created .
and i see the source code , create blp_checkpoint is in command CopySchemaShard ??

i think the reason is here .

from vitess.

aaijazi avatar aaijazi commented on July 24, 2024

@mitiger: if the source shard has the _vt.blp_checkpoint table, then it will be created with the CopySchemaShard command. If the source shard does not have that table, it should be created by the SplitClone command, but only if --strategy=-populate_blp_checkpoint is given.

You might want to try deleting the destination tablets, and then trying the sharding steps again (in case your destination tablets are in a bad state).

If that doesn't succeed, please provide a link to the full logs from the failing operation, and I can try to help track down what's going wrong.

from vitess.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.