Do not print messages to stderr in VersionBuilder (#6948)

Summary:
RocksDB is an embedded library; we should not write to the application's
console. Note: in each case, the same information is returned in the form of a
`Status::Corruption` object.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6948

Test Plan: `make check`

Reviewed By: ajkr

Differential Revision: D21914965

Pulled By: ltamasi

fbshipit-source-id: ae4b66789aa6b659eb8cc2ed4a048187962c86cc
This commit is contained in:
Levi Tamasi 2020-06-05 20:08:51 -07:00 committed by Facebook GitHub Bot
parent 8988f831d8
commit f8c2e5a608

View File

@ -278,7 +278,6 @@ class VersionBuilder::Rep {
TEST_SYNC_POINT_CALLBACK("VersionBuilder::CheckConsistency0", &pair); TEST_SYNC_POINT_CALLBACK("VersionBuilder::CheckConsistency0", &pair);
#endif #endif
if (!level_zero_cmp_(f1, f2)) { if (!level_zero_cmp_(f1, f2)) {
fprintf(stderr, "L0 files are not sorted properly");
return Status::Corruption("L0 files are not sorted properly"); return Status::Corruption("L0 files are not sorted properly");
} }
@ -287,11 +286,6 @@ class VersionBuilder::Rep {
SequenceNumber external_file_seqno = f2->fd.smallest_seqno; SequenceNumber external_file_seqno = f2->fd.smallest_seqno;
if (!(external_file_seqno < f1->fd.largest_seqno || if (!(external_file_seqno < f1->fd.largest_seqno ||
external_file_seqno == 0)) { external_file_seqno == 0)) {
fprintf(stderr,
"L0 file with seqno %" PRIu64 " %" PRIu64
" vs. file with global_seqno %" PRIu64 "\n",
f1->fd.smallest_seqno, f1->fd.largest_seqno,
external_file_seqno);
return Status::Corruption( return Status::Corruption(
"L0 file with seqno " + "L0 file with seqno " +
NumberToString(f1->fd.smallest_seqno) + " " + NumberToString(f1->fd.smallest_seqno) + " " +
@ -301,11 +295,6 @@ class VersionBuilder::Rep {
NumberToString(f1->fd.GetNumber())); NumberToString(f1->fd.GetNumber()));
} }
} else if (f1->fd.smallest_seqno <= f2->fd.smallest_seqno) { } else if (f1->fd.smallest_seqno <= f2->fd.smallest_seqno) {
fprintf(stderr,
"L0 files seqno %" PRIu64 " %" PRIu64 " vs. %" PRIu64
" %" PRIu64 "\n",
f1->fd.smallest_seqno, f1->fd.largest_seqno,
f2->fd.smallest_seqno, f2->fd.largest_seqno);
return Status::Corruption( return Status::Corruption(
"L0 files seqno " + NumberToString(f1->fd.smallest_seqno) + "L0 files seqno " + NumberToString(f1->fd.smallest_seqno) +
" " + NumberToString(f1->fd.largest_seqno) + " " + " " + NumberToString(f1->fd.largest_seqno) + " " +
@ -320,7 +309,6 @@ class VersionBuilder::Rep {
TEST_SYNC_POINT_CALLBACK("VersionBuilder::CheckConsistency1", &pair); TEST_SYNC_POINT_CALLBACK("VersionBuilder::CheckConsistency1", &pair);
#endif #endif
if (!level_nonzero_cmp_(f1, f2)) { if (!level_nonzero_cmp_(f1, f2)) {
fprintf(stderr, "L%d files are not sorted properly", level);
return Status::Corruption("L" + NumberToString(level) + return Status::Corruption("L" + NumberToString(level) +
" files are not sorted properly"); " files are not sorted properly");
} }
@ -328,9 +316,6 @@ class VersionBuilder::Rep {
// Make sure there is no overlap in levels > 0 // Make sure there is no overlap in levels > 0
if (vstorage->InternalComparator()->Compare(f1->largest, if (vstorage->InternalComparator()->Compare(f1->largest,
f2->smallest) >= 0) { f2->smallest) >= 0) {
fprintf(stderr, "L%d have overlapping ranges %s vs. %s\n", level,
(f1->largest).DebugString(true).c_str(),
(f2->smallest).DebugString(true).c_str());
return Status::Corruption( return Status::Corruption(
"L" + NumberToString(level) + " have overlapping ranges " + "L" + NumberToString(level) + " have overlapping ranges " +
(f1->largest).DebugString(true) + " vs. " + (f1->largest).DebugString(true) + " vs. " +