]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Fixed a tsan warning in db_stress.cc
authorYueh-Hsuan Chiang <yhchiang@fb.com>
Mon, 28 Sep 2015 19:06:43 +0000 (12:06 -0700)
committerIslam AbdelRahman <tec@fb.com>
Wed, 30 Sep 2015 05:28:45 +0000 (22:28 -0700)
commite29a73b89ecfcdafe9884909ecb3bd24cc8c656e
tree4ada38576ea57b813b1becb9cd86f75bb8d154d0
parent0b7dd9131ff5c503116394937deee314f3eda062
Fixed a tsan warning in db_stress.cc

Summary:
Fixed the following tsan warning in db_stress.cc

  WARNING: ThreadSanitizer: data race (pid=3163194)
  Read of size 8 at 0x7fd1797cb518 by thread T32:
    #0 VerifyDb tools/db_stress.cc:1731 (db_stress+0x000000040674)
    #1 rocksdb::StressTest::ThreadBody(void*) tools/db_stress.cc:1191 (db_stress+0x0000000625a9)
    #2 StartThreadWrapper util/env_posix.cc:1648 (db_stress+0x00000028bbbd)

  Previous write of size 8 at 0x7fd1797cb518 by thread T31:
    #0 VerifyDb tools/db_stress.cc:1726 (db_stress+0x00000004072a)
    #1 rocksdb::StressTest::ThreadBody(void*) tools/db_stress.cc:1191 (db_stress+0x0000000625a9)
    #2 StartThreadWrapper util/env_posix.cc:1648 (db_stress+0x00000028bbbd)

The cause is that in VerifyDb(), the static local const variable long max_key
can be read and written at the same time.  This patch fixed it by making it
non-static.

Test Plan: db_stress

Reviewers: igor, sdong, IslamAbdelRahman, anthony

Reviewed By: anthony

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D47703
tools/db_stress.cc