summaryrefslogtreecommitdiff
path: root/doc/bugs/interrupting_migration_causes_problems.mdwn
blob: 68426e54af92c0bd3a84acb45e7a9567b2c4872c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Killing a migration from WORM to SHA256 with ^C breaks things; future attempts to do the migration fail:

    #!/bin/bash
    
    BASE=/tmp/migrate-bug
    
    set -x
    
    chmod -R +w $BASE
    rm -rf $BASE
    mkdir -p $BASE
    cd $BASE
    
    # create annex
    git init .
    git annex init
    
    # make a big (sparse) file and add it
    dd if=/dev/zero of=bigfile bs=1 count=0 seek=1G
    git annex add --backend WORM bigfile
    git commit -m 'added bigfile'
    
    # look at status
    git annex status
    
    # now migrate it, but kill migration during checksum
    # Simulate ^C by making a new process group and sending SIGINT
    setsid git annex migrate --backend SHA256 bigfile &
    PID=$!
    sleep 1
    kill -INT -$PID
    wait
    
    # look at status
    git annex status
    
    # this migration fails
    git annex migrate --backend SHA256 bigfile
    
    # but fsck says everything's OK
    git annex fsck

The error:

    migrate bigfile 
    git-annex: /tmp/migrate-bug/.git/annex/objects/K9/V1/WORM-s1073741824-m1321566308--bigfile/WORM-s1073741824-m1321566308--bigfile: createLink: already exists (File exists)
    failed
    git-annex: migrate: 1 failed

> Fixed it to delete the stale temp file. [[done]]
> 
> Thanks for making such clear test cases, Jim! --[[Joey]]