gh-ost icon indicating copy to clipboard operation
gh-ost copied to clipboard

add / drop partitions in between before cutover

Open nickelodean opened this issue 5 years ago • 1 comments

while gh-ost is running to add index on partitioned table , can we truncate / add / drop partitions in between before cutover..? I tested truncate and data truncated from original and gh-ost table, but drop/add partitions worked on original table but not on gh-ost table, so will gh-ost fail during cutover due to different table definitions/partitions once it copies all rows of remaining partitions.? or is there a workaround to sqlbin_log off and then drop those partitions from gh-ost table to match the table definition before cutover..?

gh-ost \--assume-master-host=$master \--tungsten \--max-load=Threads_running=75 \--critical-load=Threads_running=1000 \--critical-load-interval-millis=10000 \--critical-load-hibernate-seconds=300 \--chunk-size=1000 \--max-lag-millis=1000 \--conf=$FN \--host=$slave \--database="$database" \--table="mytable" \--verbose \--alter="ADD INDEX idx_testindex (test_id,test_description)" \--cut-over=default \--default-retries=120 \--panic-flag-file=/tmp/ghost.panic.flag \--postpone-cut-over-flag-file=/tmp/ghost.postpone.flag \--initially-drop-ghost-table \--initially-drop-old-table \--exact-rowcount \--cut-over-lock-timeout-seconds=10 \--hooks-path=/root/ghost_hooks/ \--switch-to-rbr \--execute

nickelodean avatar May 19 '21 23:05 nickelodean

Short answer: unsupported and behavior is unpredictable.

Longer answer, it depends on how/where gh-ost is in the copy phase. If gh-ost is has already copied all rows in some partition, and nothing in your app injects new partitions, then, you could drop the partition from the original table -- but you will still find it on the ghost table, so you'll have to drop it on the ghost table -- and if you do that while cut-over takes place, that's a risk for metadata lock/race. I honestly can't predict all possible outcomes.

shlomi-noach avatar May 20 '21 04:05 shlomi-noach