]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Misc things for ASSERT_STATUS_CHECKED, also gcc 4.8.5 (#6871) v6.10.2
authorPeter Dillinger <peterd@fb.com>
Sat, 23 May 2020 13:48:40 +0000 (06:48 -0700)
committeranand76 <anand76@devvm1373.frc2.facebook.com>
Fri, 5 Jun 2020 19:49:16 +0000 (12:49 -0700)
Summary:
* Print stack trace on status checked failure
* Make folly_synchronization_distributed_mutex_test a parallel test
* Disable ldb_test.py and rocksdb_dump_test.sh with
  ASSERT_STATUS_CHECKED (broken)
* Fix shadow warning in random_access_file_reader.h reported by gcc
  4.8.5 (ROCKSDB_NO_FBCODE), also https://github.com/facebook/rocksdb/issues/6866
* Work around compiler bug on max_align_t for gcc < 4.9
* Remove an apparently wrong comment in status.h
* Use check_some in Travis config (for proper diagnostic output)
* Fix ignored Status in loop in options_helper.cc
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6871

Test Plan: manual, CI

Reviewed By: ajkr

Differential Revision: D21706619

Pulled By: pdillinger

fbshipit-source-id: daf6364173d6689904eb394461a69a11f5bee2cb

.travis.yml
Makefile
file/random_access_file_reader.h
include/rocksdb/status.h
third-party/folly/folly/lang/Align.h

index 561fbff8a11dfc62957d026d28a200ed1ac66b01..47e0d6a3a90bde2026330a607dc3adc4b2c5bb2c 100644 (file)
@@ -287,6 +287,9 @@ script:
 
       mkdir build && cd build && cmake -DJNI=1 .. -DCMAKE_BUILD_TYPE=Release $OPT && make -j4 rocksdb rocksdbjni
       ;;
+    status_checked)
+      OPT=-DTRAVIS V=1 ASSERT_STATUS_CHECKED=1 make -j4 check_some
+      ;;
     esac
 notifications:
     email:
index abe07c71d783003d02b29858d1be1a2420ba3810..c44c5ab6684dff1e8b7e41aad0b2f147fd5e6167 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -626,10 +626,6 @@ TESTS = \
        timer_test \
        db_with_timestamp_compaction_test \
 
-ifeq ($(USE_FOLLY_DISTRIBUTED_MUTEX),1)
-       TESTS += folly_synchronization_distributed_mutex_test
-endif
-
 PARALLEL_TEST = \
        backupable_db_test \
        db_bloom_filter_test \
@@ -653,6 +649,11 @@ PARALLEL_TEST = \
        write_prepared_transaction_test \
        write_unprepared_transaction_test \
 
+ifeq ($(USE_FOLLY_DISTRIBUTED_MUTEX),1)
+       TESTS += folly_synchronization_distributed_mutex_test
+       PARALLEL_TEST += folly_synchronization_distributed_mutex_test
+endif
+
 # options_settable_test doesn't pass with UBSAN as we use hack in the test
 ifdef COMPILE_WITH_UBSAN
         TESTS := $(shell echo $(TESTS) | sed 's/\boptions_settable_test\b//g')
@@ -972,9 +973,11 @@ check: all
 ifneq ($(PLATFORM), OS_AIX)
        $(PYTHON) tools/check_all_python.py
 ifeq ($(filter -DROCKSDB_LITE,$(OPT)),)
+ifndef ASSERT_STATUS_CHECKED # not yet working with these tests
        $(PYTHON) tools/ldb_test.py
        sh tools/rocksdb_dump_test.sh
 endif
+endif
 endif
        $(MAKE) check-format
        $(MAKE) check-buck-targets
index 5dba52c58b33e30fe368f63726d35a54da9bd4ec..4fee67c92c01ecc1b887020385f320eb83999332 100644 (file)
@@ -62,13 +62,13 @@ class RandomAccessFileReader {
  public:
   explicit RandomAccessFileReader(
       std::unique_ptr<FSRandomAccessFile>&& raf, const std::string& _file_name,
-      Env* env = nullptr, Statistics* stats = nullptr, uint32_t hist_type = 0,
+      Env* _env = nullptr, Statistics* stats = nullptr, uint32_t hist_type = 0,
       HistogramImpl* file_read_hist = nullptr,
       RateLimiter* rate_limiter = nullptr,
       const std::vector<std::shared_ptr<EventListener>>& listeners = {})
       : file_(std::move(raf)),
         file_name_(std::move(_file_name)),
-        env_(env),
+        env_(_env),
         stats_(stats),
         hist_type_(hist_type),
         file_read_hist_(file_read_hist),
index ddddee949acf7e5176cdd308168f6672dd4b4b11..add1f61fe45c5fdd8b9314551b713641e15a2ec5 100644 (file)
 
 #pragma once
 
+#ifdef ROCKSDB_ASSERT_STATUS_CHECKED
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
 #include <string>
+
+#ifdef ROCKSDB_ASSERT_STATUS_CHECKED
+#include "port/stack_trace.h"
+#endif
+
 #include "rocksdb/slice.h"
 
 namespace ROCKSDB_NAMESPACE {
@@ -25,7 +35,16 @@ class Status {
  public:
   // Create a success status.
   Status() : code_(kOk), subcode_(kNone), sev_(kNoError), state_(nullptr) {}
-  ~Status() { delete[] state_; }
+  ~Status() {
+#ifdef ROCKSDB_ASSERT_STATUS_CHECKED
+    if (!checked_) {
+      fprintf(stderr, "Failed to check Status\n");
+      port::PrintStack();
+      abort();
+    }
+#endif  // ROCKSDB_ASSERT_STATUS_CHECKED
+    delete[] state_;
+  }
 
   // Copy the specified status.
   Status(const Status& s);
@@ -362,8 +381,6 @@ inline Status::Status(const Status& s, Severity sev)
   state_ = (s.state_ == nullptr) ? nullptr : CopyState(s.state_);
 }
 inline Status& Status::operator=(const Status& s) {
-  // The following condition catches both aliasing (when this == &s),
-  // and the common case where both s and *this are ok.
   if (this != &s) {
     code_ = s.code_;
     subcode_ = s.subcode_;
index fd00b14ff370e99a9d12c3fb4226f3f22e309328..2a404b91d1f228ddc4940b6801b0732c72e10ecc 100644 (file)
 #include <folly/Portability.h>
 #include <folly/ConstexprMath.h>
 
+// Work around bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56019
+#ifdef __GNUC__
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
+namespace std {
+using ::max_align_t;
+}
+#endif
+#endif
+
 namespace folly {
 
 //  has_extended_alignment