wal: delete old wal files when running out of disk space
Now if the WAL thread fails to preallocate disk space needed to commit a transaction, it will delete old WAL files until it succeeds or it deletes all files that are not needed for local recovery from the oldest checkpoint. After it deletes a file, it notifies the garbage collector via the WAL watcher interface. The latter then deactivates consumers that would need deleted files. The user doesn't see a ENOSPC error if the WAL thread successfully allocates disk space after deleting old files. Here's what's printed to the log when this happens: wal/101/main C> ran out of disk space, try to delete old WAL files wal/101/main I> removed /home/vlad/src/tarantool/test/var/001_replication/master/00000000000000000005.xlog wal/101/main I> removed /home/vlad/src/tarantool/test/var/001_replication/master/00000000000000000006.xlog wal/101/main I> removed /home/vlad/src/tarantool/test/var/001_replication/master/00000000000000000007.xlog main/105/main C> deactivated WAL consumer replica 82d0fa3f-6881-4bc5-a2c0-a0f5dcf80120 at {1: 5} main/105/main C> deactivated WAL consumer replica 98dce0a8-1213-4824-b31e-c7e3c4eaf437 at {1: 7} Closes #3397
Showing
- src/box/box.cc 7 additions, 2 deletionssrc/box/box.cc
- src/box/gc.c 61 additions, 5 deletionssrc/box/gc.c
- src/box/gc.h 31 additions, 0 deletionssrc/box/gc.h
- src/box/wal.c 74 additions, 22 deletionssrc/box/wal.c
- src/box/wal.h 17 additions, 7 deletionssrc/box/wal.h
- src/box/xlog.c 3 additions, 0 deletionssrc/box/xlog.c
- src/box/xlog.h 33 additions, 0 deletionssrc/box/xlog.h
- src/errinj.h 1 addition, 0 deletionssrc/errinj.h
- test/box/errinj.result 10 additions, 8 deletionstest/box/errinj.result
- test/replication/gc_no_space.result 234 additions, 0 deletionstest/replication/gc_no_space.result
- test/replication/gc_no_space.test.lua 103 additions, 0 deletionstest/replication/gc_no_space.test.lua
- test/replication/suite.ini 1 addition, 1 deletiontest/replication/suite.ini
Loading
Please register or sign in to comment