• Kirill Smelkov's avatar
    wcfs: Fix crash if on invalidation handledδZ needs to access ZODB · a7bf0311
    Kirill Smelkov authored
    The invalidation logic is generally right, but invalidateBlk -> ΔFtail.BlkRevAt
    was being called with ctx without transaction. As the result it was
    panicking as
    
        panic: transaction: no current transaction
    
        goroutine 41 [running]:
        lab.nexedi.com/kirr/neo/go/transaction.currentTxn({0x9696d8, 0xc0000d8080})
                /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/transaction/transaction.go:59 +0x77
        lab.nexedi.com/kirr/neo/go/transaction.Current(...)
                /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/transaction/api.go:206
        lab.nexedi.com/kirr/neo/go/zodb.(*Connection).checkTxnCtx(...)
                /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/zodb/connection.go:374
        lab.nexedi.com/kirr/neo/go/zodb.(*Connection).Get(0xc00010c640, {0x9696d8, 0xc0000d8080}, 0x4)
                /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/zodb/connection.go:331 +0x73
        lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/zdata.(*ΔFtail).BlkRevAt(0xc000077d40, {0x9696d8, 0xc0000d8080}, 0xc000064f60, 0x0, 0x3e5983329bbd100)
                /home/kirr/src/neo/src/lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/zdata/δftail.go:1140 +0x39d
        main.(*BigFile).invalidateBlk.func1(0xc000164400, {0x9696d8, 0xc0000d8080}, 0xc0005a0000, 0x200000, 0x200000, {0xc0005a0000, 0x200000, 0x200000})
                /home/kirr/src/neo/src/lab.nexedi.com/nexedi/wendelin.core/wcfs/wcfs.go:1089 +0xb8
        main.(*BigFile).invalidateBlk(0xc000164400, {0x9696d8, 0xc0000d8080}, 0x0)
                /home/kirr/src/neo/src/lab.nexedi.com/nexedi/wendelin.core/wcfs/wcfs.go:1105 +0x3bb
        main.(*Root).handleδZ.func3({0x9696d8, 0xc0000d8080})
                /home/kirr/src/neo/src/lab.nexedi.com/nexedi/wendelin.core/wcfs/wcfs.go:898 +0x34
        lab.nexedi.com/kirr/go123/xsync.(*WorkGroup).Go.func1()
                /home/kirr/src/neo/src/lab.nexedi.com/kirr/go123/xsync/xsync.go:86 +0x68
        created by lab.nexedi.com/kirr/go123/xsync.(*WorkGroup).Go
                /home/kirr/src/neo/src/lab.nexedi.com/kirr/go123/xsync/xsync.go:83 +0x92
    
    on any new change to tracked file block whose previous history is not covered by ΔFtail/ΔBtail.
    
    Problem reported by @Francois.
    a7bf0311
wcfs_test.py 68 KB