fix db_stress crash caused by buggy kernel warning
Summary: filter the warning out and only print it once. Closes https://github.com/facebook/rocksdb/pull/2137 Differential Revision: D4870925 Pulled By: lightmark fbshipit-source-id: 91b363ce7f70bce88b0780337f408fc4649139b8
This commit is contained in:
parent
6257837d83
commit
ba7da434ae
12
env/io_posix.cc
vendored
12
env/io_posix.cc
vendored
@ -772,13 +772,17 @@ Status PosixWritableFile::Close() {
|
|||||||
fstat(fd_, &file_stats);
|
fstat(fd_, &file_stats);
|
||||||
// After ftruncate, we check whether ftruncate has the correct behavior.
|
// After ftruncate, we check whether ftruncate has the correct behavior.
|
||||||
// If not, we should hack it with FALLOC_FL_PUNCH_HOLE
|
// If not, we should hack it with FALLOC_FL_PUNCH_HOLE
|
||||||
if ((file_stats.st_size + file_stats.st_blksize - 1) /
|
static bool buggy = false;
|
||||||
|
if (!buggy && (file_stats.st_size + file_stats.st_blksize - 1) /
|
||||||
file_stats.st_blksize !=
|
file_stats.st_blksize !=
|
||||||
file_stats.st_blocks / (file_stats.st_blksize / 512)) {
|
file_stats.st_blocks / (file_stats.st_blksize / 512)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Your kernel is buggy (<= 4.0.x) and does not free preallocated"
|
"WARNING: Your kernel is buggy (<= 4.0.x) and does not free"
|
||||||
"blocks on truncate. Hacking around it, but you should upgrade!"
|
"preallocated blocks on truncate. Hacking around it, but you"
|
||||||
"\n");
|
"should upgrade!\n");
|
||||||
|
buggy = true;
|
||||||
|
}
|
||||||
|
if (buggy) {
|
||||||
IOSTATS_TIMER_GUARD(allocate_nanos);
|
IOSTATS_TIMER_GUARD(allocate_nanos);
|
||||||
if (allow_fallocate_) {
|
if (allow_fallocate_) {
|
||||||
fallocate(fd_, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, filesize_,
|
fallocate(fd_, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, filesize_,
|
||||||
|
@ -220,9 +220,10 @@ def blackbox_crash_main(args):
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
line = child.stderr.readline().strip()
|
line = child.stderr.readline().strip()
|
||||||
if line != '':
|
if line != '' and not line.startswith('WARNING'):
|
||||||
run_had_errors = True
|
run_had_errors = True
|
||||||
print('***' + line + '^')
|
print('stderr has error message:')
|
||||||
|
print('***' + line + '***')
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user