Go bindings for the dm-flakey device.
NOTE: It's been moved to etcd-io/bbolt#628
-
AllowWrites
: The device is available for<up interval>
seconds. -
DropWrites
: All write I/O is silently ignored for<down interval>
seconds. Read I/O is handled correctly. -
ErrorWrites
: All write I/O is failed with an error signalled for<down interval>
seconds. Read I/O is handled correctly.
Both <up>
and <down>
interval can be configured by WithIntervalFeatOpt(interval)
.
TODO: ErrorReads
, CorruptBIOByte
, RandomReadCorrupt
, RandomWriteCorrupt
.
- Simulate power failure and cause data loss
// init flakey device named by /dev/mapper/go-dmflakey with empty ext4 filesystem
flakey, _ := InitFlakey("go-dmflakey", workDir, FSTypeEXT4)
flakeyDevice := flakey.DevicePath()
// mount that flakey device into temp dir
args := []string{"mount", flakeyDevice, targetDir}
exec.Command(args[0], args[1:]).Run()
// write file in targetDir without syncfs/fsync/fdatasync
// ...
// drop all write IO created by previous step
flakey.DropWrites()
// remount and allow all write IO to simulate power failure
exec.Command("umount", targetDir)
flakey.AllowWrites()
exec.Command(args[0], args[1:]).Run()
// check the file
- How to cause data loss during
bbolt bench
?
Checkout contrib-test-boltdb.
- What if power failure after pulling image?
It's reproducer for container not starting in few nodes "standard_init_linux.go:219: exec user process caused: exec format error".
Checkout contrib-test-containerd.
The package needs to invoke the following commands to init flakey device:
All of them are supported by most of linux distributions.