History log of /6.6.0/kv_engine/engines/ep/src/atomic.h (Results 1 - 25 of 81)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v7.0.2, v6.6.3, v7.0.1, v7.0.0, v6.6.2, v6.5.2, v6.6.1, v6.0.5, v6.6.0, v6.5.1, v6.0.4, v6.5.0, v6.0.3, v5.5.4, v5.5.5
# 04c1c8ec 20-Mar-2019 Trond Norbye <trond.norbye@gmail.com>

Remove config.h

Change-Id: I79eb8c762971255db9d36a5f6461a8a6d0f29249
Reviewed-on: http://review.couchbase.org/106517
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Dave

Remove config.h

Change-Id: I79eb8c762971255db9d36a5f6461a8a6d0f29249
Reviewed-on: http://review.couchbase.org/106517
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>

show more ...


Revision tags: v5.5.6, v6.0.1
# 0d5a64fe 13-Dec-2018 Dave Rigby <daver@couchbase.com>

RCPtr: Add move constructor

Add a move constructor to RCPtr; to avoid the need to increment then
immediately decrement the refcount when moving a RCPtr into another.

Includes te

RCPtr: Add move constructor

Add a move constructor to RCPtr; to avoid the need to increment then
immediately decrement the refcount when moving a RCPtr into another.

Includes testcase to verify behavour.

Change-Id: I677710d15db5c2dd60479aa81d094c82c1dd831a
Reviewed-on: http://review.couchbase.org/102798
Reviewed-by: Paolo Cocchi <paolo.cocchi@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


# ee087db5 12-Dec-2018 Richard de Mellow <richard.demellow@couchbase.com>

Move KV-Engine to use "#pragma once" exclusively

Move KV-Engine to use "#pragma once" exclusively over using header
guards using "#ifndef HEADER". For this header_define_once_test.py

Move KV-Engine to use "#pragma once" exclusively

Move KV-Engine to use "#pragma once" exclusively over using header
guards using "#ifndef HEADER". For this header_define_once_test.py
has been updated to FAIL if it does not find "#pragma once". Also
removed engines/default_engine/slabs.h's circular dependency on
engines/default_engine/default_engine_internal.h.

Change-Id: Ic2477e17cb2cb49cb7a28d95f9c003bec2541b3d
Reviewed-on: http://review.couchbase.org/102800
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>

show more ...


Revision tags: v5.5.3, v6.0.0, v5.1.3
# 1c6ea0d1 26-Sep-2018 Dave Rigby <daver@couchbase.com>

Split LockTimer into own header file

Move the LockTimer utility class into it's own header file
(lock_timer.h). This avoids the need for locks.h (which is included in
many places) to

Split LockTimer into own header file

Move the LockTimer utility class into it's own header file
(lock_timer.h). This avoids the need for locks.h (which is included in
many places) to include bucket_logger.h, reducing the number of places
which do need to include bucket_logger.h.

Change-Id: I898ffafd57d061de9c10c6530aa8f348d4f7c184
Reviewed-on: http://review.couchbase.org/99983
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>

show more ...


Revision tags: v5.5.2, v5.5.1
# 90c623cf 13-Jul-2018 Dave Rigby <daver@couchbase.com>

MB-30463: Avoid modifying ptr refcounts when setting freqCounterValue

StoredValue uses a TaggedPtr to store both the (pointer to) Blob, and
the 16bit frequency counter, which in turn is

MB-30463: Avoid modifying ptr refcounts when setting freqCounterValue

StoredValue uses a TaggedPtr to store both the (pointer to) Blob, and
the 16bit frequency counter, which in turn is managed by a
SingleThreadedRCPtr. The result is we store both the ref-counted
pointer and frequency counter in 64bits.

However, to update the frequency counter we must reset() the RCPtr,
which requires (atomically) incrementing and then decrementing it's
refcount. This is unnecessary costly work.

Improve this by exposing the underlying Pointer value in the RCPtr
(which in this instance is a TaggedPtr object); and just directly
changing the tag. While in the general case such a method is
potentially dangerous, it significantly speeds up this operation:

Original asm / perf report (first column is sample count):

_ZN11StoredValue19setFreqCounterValueEt
4 │53e7c0: push %rbx
│53e7c1: mov (%rdi),%rbx
1 │53e7c4: movabs $0xffffffffffff,%rax
2 │53e7ce: shl $0x30,%rsi
│53e7d2: and %rax,%rbx
2 │53e7d5: or %rbx,%rsi
2 │53e7d8: mov %rsi,%rdx
│53e7db: and %rax,%rdx
3 │53e7de: ↓ je 53e7ea <StoredValue::setFreqCounterValue(unsigned short)+0x2a>
632 │53e7e0: lock addl $0x1,(%rdx)
5 │53e7e4: and (%rdi),%rax
│53e7e7: mov %rax,%rbx
1 │53e7ea: test %rbx,%rbx
3 │53e7ed: mov %rsi,(%rdi)
│53e7f0: ↓ jne 53e7f8 <StoredValue::setFreqCounterValue(unsigned short)+0x38>
│53e7f2: pop %rbx
3 │53e7f3: ← retq
│53e7f4: nopl 0x0(%rax)
398 │53e7f8: lock subl $0x1,(%rbx)
1 │53e7fc: ↑ jne 53e7f2 <StoredValue::setFreqCounterValue(unsigned short)+0x32>
│53e7fe: mov %rbx,%rdi
│53e801: → callq 438a30 <Blob::~Blob()>
│53e806: mov %rbx,%rdi
│53e809: pop %rbx
│53e80a: ↓ jmpq 670890 <operator delete(void*)>

New asm / perf report:

_ZN11StoredValue19setFreqCounterValueEt
2 │52725a: mov %si,0x6(%rdi)
8 │52725d: ← retq

Additionally, given the function is only 5 instructions of work; move
the methods back to the header so they can be inlined.

Results in a ~10% speedup of HashTableBench/Find:

----------------------------------------------------------------------
Benchmark Time CPU Iterations
----------------------------------------------------------------------
Before:
HashTableBench/Find/threads:24 76 ns 1592 ns 8832288

After:
HashTableBench/Find/threads:24 68 ns 1455 ns 9645312

Change-Id: I5e28d4f841ec4830bfab12505d6333d7ff62ed8b
Reviewed-on: http://review.couchbase.org/96849
Reviewed-by: Tim Bradgate <tim.bradgate@couchbase.com>
Reviewed-by: Paolo Cocchi <paolo.cocchi@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


Revision tags: v5.1.2, v5.1.1
# 37b6ac98 08-Feb-2018 Trond Norbye <trond.norbye@gmail.com>

Clean up memcached/extension.h

The file includes a number of other (now) obsolete header
files (in addition to that we had a weird intentation).

Fix the missing includes in all

Clean up memcached/extension.h

The file includes a number of other (now) obsolete header
files (in addition to that we had a weird intentation).

Fix the missing includes in all of the other files caused
by removal of these files.

Change-Id: I1cebe8a1d956c161e0d9f218e478c5d1e9663ff1
Reviewed-on: http://review.couchbase.org/89063
Reviewed-by: Daniel Owen <owend@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


# 7169f224 04-Jan-2018 Daniel Owen <owend@couchbase.com>

MB-22010: Fix bool method of TaggedPtr

Experimenting setting a tag using a TaggedPtr within
SingleThreadedRCPtr identified an issue where the bool method of
TaggedPtr returns true if

MB-22010: Fix bool method of TaggedPtr

Experimenting setting a tag using a TaggedPtr within
SingleThreadedRCPtr identified an issue where the bool method of
TaggedPtr returns true if the tag is set, even if the pointer is zero.

This patches changes the TaggedPtr bool method to first clear the tag
before comparing it with zero. It also adds an associated test.

In addition, to make the code more uniform in SingleThreadedRCPtr, when
a pointer comparison is made it uses explict nullptr checks. It also
simplifies pointer checks in the Item class by invoking the
SingleThreadedRCPtr bool method.

Change-Id: I784162103cbe35c469f4de87625d29b8e91fa2e9
Reviewed-on: http://review.couchbase.org/87409
Reviewed-by: Dave Rigby <daver@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


Revision tags: v5.0.1
# 46dc1225 08-Dec-2017 Dave Rigby <daver@couchbase.com>

Add exchange() & operator-- to LoggedAtomic<>

Add some additional methods to LoggedAtomic which were missing
(compared to std::atomic).

Also fix operator++() to correctly return

Add exchange() & operator-- to LoggedAtomic<>

Add some additional methods to LoggedAtomic which were missing
(compared to std::atomic).

Also fix operator++() to correctly return a T and not a reference.

Change-Id: Ia16e4999c548ee35593ada84efc2097effb11d73
Reviewed-on: http://review.couchbase.org/86583
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


# 9801c79e 05-Dec-2017 Daniel Owen <owend@couchbase.com>

MB-22010: [5/N] Implement Tagged Pointer for SingleThreadRCPtr

This patch modifies the SingleThreadedRCPtr class, to allow the
TaggedPtr class to be provided as the pointer type. This a

MB-22010: [5/N] Implement Tagged Pointer for SingleThreadRCPtr

This patch modifies the SingleThreadedRCPtr class, to allow the
TaggedPtr class to be provided as the pointer type. This allows
the reference count properities of SingleThreadedRCPtr to be combined
with the tagging properties of TaggedPtr.

Also adds a static helper method to TaggedPtr for setting the tag of
a TaggedPtr that is wrapped inside a Pointer, such as
SingleThreadedRCPtr.

Change-Id: I01b5696c52523fec35626ea18bc34b3c3ba9df9a
Reviewed-on: http://review.couchbase.org/86324
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>

show more ...


# 7098d308 30-Nov-2017 Daniel Owen <owend@couchbase.com>

MB-22010: [3/N] Do not directly refer to a RCValue

As part of the TaggedPtr work we want SingleTheadedRCPtr to be applied
to a TaggedPtr. To achieve this we need to avoid the
Single

MB-22010: [3/N] Do not directly refer to a RCValue

As part of the TaggedPtr work we want SingleTheadedRCPtr to be applied
to a TaggedPtr. To achieve this we need to avoid the
SingleThreadedRCPtr using a static_cast to directly access a RCValue.

This patch introduces a getRCValue function that returns a reference to
a RCValue. This allows all the static_cast<RCValue*> to be removed
from the RCPtr and SingleThreadedRCPtr classes.

Change-Id: I1327a8069b9fa0f7857af959126708c456a34162
Reviewed-on: http://review.couchbase.org/86182
Reviewed-by: Dave Rigby <daver@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


# 8f1b9af4 29-Nov-2017 Dave Rigby <daver@couchbase.com>

MB-26021: SingleThreadedRCPtr: implement Swappable concept

Make SingleThreadedRCPtr support Swappable[1]. This allows std::sort
(and other algorithms to exchange two STRCPtrs without mod

MB-26021: SingleThreadedRCPtr: implement Swappable concept

Make SingleThreadedRCPtr support Swappable[1]. This allows std::sort
(and other algorithms to exchange two STRCPtrs without modifying the
refcounts.

Running a benchmark using CompareQueuedItemsBySeqnoAndKey as a
comparator, shows a 8% reduction in runtime:

Before:
Run on (8 X 2300 MHz CPU s)
2017-11-29 13:16:39
--------------------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------------------
BM_CompareQueuedItemsBySeqnoAndKey 2625473 ns 2623663 ns 282

After:

Run on (8 X 2300 MHz CPU s)
2017-11-29 13:45:51
--------------------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------------------
BM_CompareQueuedItemsBySeqnoAndKey 2418255 ns 2417758 ns 285

[1]: http://en.cppreference.com/w/cpp/concept/Swappable

Change-Id: I582c2b37d32a20516cecb9cc3200e42dbc6c90b4
Reviewed-on: http://review.couchbase.org/86125
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Daniel Owen <owend@couchbase.com>

show more ...


# 568357e7 29-Nov-2017 Dave Rigby <daver@couchbase.com>

MB-26021: SingleThreadedRCPtr: Add move-{assignment,construction} operators

Allows std::sort to optimize swapping items in a container of RCPtrs.

Running a benchmark using CompareQu

MB-26021: SingleThreadedRCPtr: Add move-{assignment,construction} operators

Allows std::sort to optimize swapping items in a container of RCPtrs.

Running a benchmark using CompareQueuedItemsBySeqnoAndKey as a comparator, shows
a 22% reduction in runtime:

Before:
Run on (8 X 2300 MHz CPU s)
2017-11-28 15:48:54
--------------------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------------------
BM_CompareQueuedItemsBySeqnoAndKey 3368195 ns 3365729 ns 221

After:
Run on (8 X 2300 MHz CPU s)
2017-11-29 13:16:39
--------------------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------------------
BM_CompareQueuedItemsBySeqnoAndKey 2625473 ns 2623663 ns 282

Change-Id: I1a55be2d299366d10cd8e2277e1cf571ec4a583e
Reviewed-on: http://review.couchbase.org/86124
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Daniel Owen <owend@couchbase.com>

show more ...


Revision tags: v5.1.0, v5.0.0
# ef22f9b0 25-May-2017 Dave Rigby <daver@couchbase.com>

Move ep-engine to engines/ep


# 27ea3fea 19-Apr-2017 olivermd <oliver.downard@couchbase.com>

MB-23263: DefragmenterVisitor: Check blob refcount

This patch adds the facility to check the refcount value of a
SingleThreadedRCPTR and uses this to ensure that the refcount of the

MB-23263: DefragmenterVisitor: Check blob refcount

This patch adds the facility to check the refcount value of a
SingleThreadedRCPTR and uses this to ensure that the refcount of the
blob is less than 2 before the defragmenter reallocates it. This is to
ensure that we do not end up just creating a copy of the blob thus
increasing memory usage which would be the opposite of what you would
expect from the defragmenter.

It's worth noting that it appears as though something could create
another reference to the blob without holding the hashtable lock. This
could lead to a soft data race on the refcount. This means that we
cannot give a hard guarantee that the defragmenter doesn't duplicate the
blob, just that it will in most cases. The case where it won't will be
where the other thing creating the reference doesn't hold the hash
bucket lock and happens to create a reference after refcount is read but
before the blob is reallocated, which seems rare.

Change-Id: I3a8b8812ac039445451952384cb5b40ce8b433cb
Reviewed-on: http://review.couchbase.org/76958
Reviewed-by: Dave Rigby <daver@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


# 4a1704d4 05-Apr-2017 Dave Rigby <daver@couchbase.com>

RCPtr: Add dynamic_pointer_cast

Allows dynamic cast from one RCPtr instantiation to another. Based on
same function for std::shared_ptr.

Change-Id: Idc8723ea90dfd2843a3c5b602f5e

RCPtr: Add dynamic_pointer_cast

Allows dynamic cast from one RCPtr instantiation to another. Based on
same function for std::shared_ptr.

Change-Id: Idc8723ea90dfd2843a3c5b602f5e42fad7a36613
Reviewed-on: http://review.couchbase.org/76552
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: James Harrison <james.harrison@couchbase.com>
Reviewed-by: Daniel Owen <owend@couchbase.com>

show more ...


Revision tags: v4.6.2_ep
# 0bc70e5b 15-Mar-2017 Dave Rigby <daver@couchbase.com>

SingleThreadedRCPtr: Add move constructor from unique_ptr<>

Add a move constructor to SingleThreadedRCPtr which allows moving from
a unique_ptr. This improves interopability between our

SingleThreadedRCPtr: Add move constructor from unique_ptr<>

Add a move constructor to SingleThreadedRCPtr which allows moving from
a unique_ptr. This improves interopability between our custom
ref-counted ptr and unique_ptr.

Change-Id: Ib0a2caf532ec525260b2713868ed001f5d1f5eae
Reviewed-on: http://review.couchbase.org/75215
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Daniel Owen <owend@couchbase.com>
Reviewed-by: Manu Dhundi <manu@couchbase.com>

show more ...


Revision tags: v4.6.2_mc, v4.6.1_ep
# 11d62689 09-Feb-2017 Dave Rigby <daver@couchbase.com>

Cleanup #include usage in headers

'Include what you use':

- remove unnecessary #include directives from source files, focusing
on removing from header files (where they can ca

Cleanup #include usage in headers

'Include what you use':

- remove unnecessary #include directives from source files, focusing
on removing from header files (where they can cause unnecessary
rebuilding.

- Move #includes from .h to .cc where applicable.

- Use forward declarions instead of #include'ing the whole header
where possible.

- Remove unnecessary inlining of non-hot / non-trivial code by moving
to .cc files.

Change-Id: I35a757fe92e637ce47454ef84332e89ec94937d3
Reviewed-on: http://review.couchbase.org/73457
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Build Bot <build@couchbase.com>

show more ...


# de19498a 24-Jan-2017 olivermd <oliver.downard@couchbase.com>

MB-22015: Replace new with make_STRCptr in warmup

Provides the nessecary copy constructor to allow for an implicit
conversion from SingleThreadedRCPtr<Derived> to
SingleThreadedRCPtr

MB-22015: Replace new with make_STRCptr in warmup

Provides the nessecary copy constructor to allow for an implicit
conversion from SingleThreadedRCPtr<Derived> to
SingleThreadedRCPtr<Base>.

Adds a make_STRCptr function to allow for the creation of
SingleThreadedRCPtrs in a way that avoids directly using 'new'.

Change-Id: I9d7359fa691bce1d8e1164e9dee505b1a6232231
Reviewed-on: http://review.couchbase.org/72404
Reviewed-by: Dave Rigby <daver@couchbase.com>
Tested-by: buildbot <build@couchbase.com>

show more ...


# f3dcd5be 22-Dec-2016 Manu Dhundi <manu@couchbase.com>

LoggedAtomic: Add compare_exchange_strong() and pre-increment operator

Change-Id: I18ed43a8fd4f2691afa6e42c49a85fb0d9fcfc05
Reviewed-on: http://review.couchbase.org/71099
Reviewed-by

LoggedAtomic: Add compare_exchange_strong() and pre-increment operator

Change-Id: I18ed43a8fd4f2691afa6e42c49a85fb0d9fcfc05
Reviewed-on: http://review.couchbase.org/71099
Reviewed-by: Manu Dhundi <manu@couchbase.com>
Tested-by: buildbot <build@couchbase.com>

show more ...


Revision tags: v4.6.0_ep
# b028e804 28-Nov-2016 WillGardner <willg@rdner.io>

Convert SpinLock to BasicLockable, remove SpinLockHolder

This patch adjusts SpinLock to allow to implement BasicLockable
allowing it to be locked by a std::lock_guard. Also removes
S

Convert SpinLock to BasicLockable, remove SpinLockHolder

This patch adjusts SpinLock to allow to implement BasicLockable
allowing it to be locked by a std::lock_guard. Also removes
SpinLockHolder and converts all uses to std::lock_guard (Just an
alias wouldn't work as SpinLockHolder passes by pointer rather
than reference).

Change-Id: Ic415407d3f10da188482b720adb48cb475c8decb
Reviewed-on: http://review.couchbase.org/70405
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>

show more ...


Revision tags: v4.5.1-MP1_mc, v4.6.0-DP_mc, v4.6.0-DP_ep
# 2252bb7a 19-Oct-2016 Dave Rigby <daver@couchbase.com>

LoggedAtomic: Expand set of operations supported, serialize logging

Add support for increment & decrement (fetch_{add,sub}), assignment
and conversion to T.

Also add a mutex to

LoggedAtomic: Expand set of operations supported, serialize logging

Add support for increment & decrement (fetch_{add,sub}), assignment
and conversion to T.

Also add a mutex to serialize access to stderr, to prevent corruption
in log messages.

Change-Id: I0a617f702a22d287fb87bd1001ee0300b6551b9e
Reviewed-on: http://review.couchbase.org/69009
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Daniel Owen <owend@couchbase.com>
Reviewed-by: Jim Walker <jim@couchbase.com>
Reviewed-by: Will Gardner <willg@rdner.io>

show more ...


# dd3e745f 23-Sep-2016 Dave Rigby <daver@couchbase.com>

Add LoggedAtomic<> debug class

A Debugging wrapper around std::atomic which print all accesses to the
atomic value to stderr.

Drop-in compatible with AtomicValue for simple use-

Add LoggedAtomic<> debug class

A Debugging wrapper around std::atomic which print all accesses to the
atomic value to stderr.

Drop-in compatible with AtomicValue for simple use-cases - currently
only implements load() / store().

Change-Id: I78cec4d8bad55588900573f201d81a38f16f97ee
Reviewed-on: http://review.couchbase.org/67944
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Daniel Owen <owend@couchbase.com>

show more ...


Revision tags: v4.5.1-MP1_ep, v4.1.2-MP2_mc, v4.5.1_mc, v4.6.0_mc, v4.1.2-MP1_ep, v3.1.6_ep, v4.5.0_mc, v4.5.0_ep, v4.1.1_ep, v3.1.5_ep, v4.1.1_mc
# 66bb41ad 04-Mar-2016 Dave Rigby <daver@couchbase.com>

Remove AtomicValue and Mutex defines

We already removed our own custom AtomicValue and Mutex classes when
we moved to C++11; replacing them with #defines to std::atomic and
std::mute

Remove AtomicValue and Mutex defines

We already removed our own custom AtomicValue and Mutex classes when
we moved to C++11; replacing them with #defines to std::atomic and
std::mutex respectively. This patch completes that changover, using
the underlying types directly so it's easier to see what is actually
being used.

Change-Id: If3f717f766727042cd81ae7b8c65f9a19934f2fa
Reviewed-on: http://review.couchbase.org/60925
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Will Gardner <will.gardner@couchbase.com>

show more ...


Revision tags: v3.1.4_ep, v3.1.4_mc, v3.1.5_mc, v3.1.3_ep, v4.1.0_ep
# 44137813 05-Nov-2015 Dave Rigby <daver@couchbase.com>

Simplify common.h: add utility.h [2/3]

Create a new utility.h header file and move some of the functions /
macros which virtually everyone uses to there. utility.h has
significantly

Simplify common.h: add utility.h [2/3]

Create a new utility.h header file and move some of the functions /
macros which virtually everyone uses to there. utility.h has
significantly fewer dependancies, and such is much cheaper to include
than common.h

Update users of these functions / macros (DISALLOW_COPY_ON_ASSIGN, LOG
etc) to use utility.h instead of common.h

Change-Id: I3f93435c82950bd2a20b416af2b2e5011a931e04
Reviewed-on: http://review.couchbase.org/56704
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: abhinav dangeti <abhinav@couchbase.com>
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>

show more ...


Revision tags: v3.1.2_ep, v4.1.0_mc, v3.1.2_mc, v3.1.1_mc, v3.1.1_ep, v4.0.0_ep, v4.0.0_mc, v3.1.0_ep, v3.1.0_mc, v3.1.6_mc
# daa227e6 11-Jun-2015 Dave Rigby <daver@couchbase.com>

MB-15292: Make CouchbaseAtomic::store() atomic

As identified by ThreadSantizer:

WARNING: ThreadSanitizer: data race (pid=59833)
Write of size 8 at 0x7d240000d3f0 by thread T8:

MB-15292: Make CouchbaseAtomic::store() atomic

As identified by ThreadSantizer:

WARNING: ThreadSanitizer: data race (pid=59833)
Write of size 8 at 0x7d240000d3f0 by thread T8:
#0 CouchbaseAtomic<unsigned long>::store(unsigned long const&, memory_order) /root/couchbase-3.0/ep-engine/src/atomic.h:84 (ep.so+0x0000000414ef)
#1 CouchbaseAtomic<unsigned long>::operator=(unsigned long const&) /root/couchbase-3.0/ep-engine/src/atomic.h:105 (ep.so+0x0000000401f5)
#2 Warmup::scheduleEstimateDatabaseItemCount() /root/couchbase-3.0/ep-engine/src/warmup.cc:500 (ep.so+0x000000277991)
#3 Warmup::step() /root/couchbase-3.0/ep-engine/src/warmup.cc:816 (ep.so+0x000000275124)
#4 Warmup::transition(int, bool) /root/couchbase-3.0/ep-engine/src/warmup.cc:853 (ep.so+0x0000002754ff)
#5 Warmup::createVBuckets(unsigned short) /root/couchbase-3.0/ep-engine/src/warmup.cc:491 (ep.so+0x00000027785f)
#6 WarmupCreateVBuckets::run() /root/couchbase-3.0/ep-engine/src/warmup.h:234 (ep.so+0x00000028cde9)
#7 ExecutorThread::run() /root/couchbase-3.0/ep-engine/src/executorthread.cc:110 (ep.so+0x0000001a2581)
#8 launch_executor_thread(void*) /root/couchbase-3.0/ep-engine/src/executorthread.cc:34 (ep.so+0x0000001a1a5a)
#9 platform_thread_wrap /root/couchbase-3.0/platform/src/cb_pthreads.c:19 (libplatform.so.0.1.0+0x000000002f14)

Previous atomic write of size 8 at 0x7d240000d3f0 by main thread (mutexes: write M670470284968504712):
#0 __tsan_atomic64_fetch_add <null>:0 (engine_testapp+0x00000008cb48)
#1 CouchbaseAtomic<unsigned long>::load(memory_order) const /root/couchbase-3.0/ep-engine/src/atomic.h:77 (ep.so+0x0000000446b4)
#2 CouchbaseAtomic<unsigned long>::operator unsigned long() const /root/couchbase-3.0/ep-engine/src/atomic.h:101 (ep.so+0x000000044575)
#3 Warmup::addStats(void (*)(char const*, unsigned short, char const*, unsigned int, void const*), void const*) const /root/couchbase-3.0/ep-engine/src/warmup.cc:901 (ep.so+0x00000027d4ea)
#4 EventuallyPersistentEngine::getStats(void const*, char const*, int, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) /root/couchbase-3.0/ep-engine/src/ep_engine.cc:4405 (ep.so+0x0000001155a9)
#5 EvpGetStats(engine_interface*, void const*, char const*, int, void (*)(char const*, unsigned short, char const*, unsigned int, void const*)) /root/couchbase-3.0/ep-engine/src/ep_engine.cc:214 (ep.so+0x0000000fa102)
#6 mock_get_stats /root/couchbase-3.0/memcached/programs/engine_testapp/engine_testapp.c:194 (engine_testapp+0x0000000aeecd)
#7 wait_for_warmup_complete(engine_interface*, engine_interface_v1*) /root/couchbase-3.0/ep-engine/tests/ep_test_apis.cc:864 (ep_perfsuite.so+0x00000001b1cb)
#8 test_setup(engine_interface*, engine_interface_v1*) /root/couchbase-3.0/ep-engine/tests/ep_testsuite_common.cc:128 (ep_perfsuite.so+0x00000000dc03)
#9 execute_test /root/couchbase-3.0/memcached/programs/engine_testapp/engine_testapp.c:1037 (engine_testapp+0x0000000ab85a)
#10 main /root/couchbase-3.0/memcached/programs/engine_testapp/engine_testapp.c:1296 (engine_testapp+0x0000000a9a19)

Change-Id: I260942712ca471c0d2e0fa3ebc4793d694f9b237
Reviewed-on: http://review.couchbase.org/51973
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Jim Walker <jim@couchbase.com>
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>

show more ...


1234