You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2016/06/22 20:21:44 UTC
[1/2] incubator-kudu git commit: tablet: fix sloppiness around atomic
mutation lists
Repository: incubator-kudu
Updated Branches:
refs/heads/master 0bb59836f -> 4983a7982
tablet: fix sloppiness around atomic mutation lists
Previously we had some TSAN suppressions around our handling of
the Mutation linked lists. This removes them and does the appropriate
Acquire_Loads that we were missing.
In practice I don't think we were hitting any bugs due to this, but
it's hard to know -- maybe this was a cause of some recent crashes?
Either way, fewer suppressions is better.
Change-Id: Idf4e404abd2729660a38841759d3894c4af5eb20
Reviewed-on: http://gerrit.cloudera.org:8080/3410
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/869d5205
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/869d5205
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/869d5205
Branch: refs/heads/master
Commit: 869d5205fde17ea53f75e85e5c3df9952430ec67
Parents: 0bb5983
Author: Todd Lipcon <to...@cloudera.com>
Authored: Mon Jun 20 11:52:05 2016 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Wed Jun 22 20:18:19 2016 +0000
----------------------------------------------------------------------
build-support/tsan-suppressions.txt | 9 ---------
src/kudu/tablet/compaction.cc | 2 +-
src/kudu/tablet/memrowset.cc | 12 ++++++++----
src/kudu/tablet/memrowset.h | 6 ++++++
src/kudu/tablet/mutation.cc | 2 +-
src/kudu/tablet/mutation.h | 9 +++++++++
6 files changed, 25 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/869d5205/build-support/tsan-suppressions.txt
----------------------------------------------------------------------
diff --git a/build-support/tsan-suppressions.txt b/build-support/tsan-suppressions.txt
index da89ecd..059d55f 100644
--- a/build-support/tsan-suppressions.txt
+++ b/build-support/tsan-suppressions.txt
@@ -40,15 +40,6 @@ race:epoll_ctl
# a lot of stress testing.
race:concurrent_btree.h
-# We're currently a little lax on using atomic instructions for mutations where
-# we might need to. There are possible bugs lurking here, though likely we are
-# hiding behind x86 TSO for now.
-race:kudu::tablet::ApplyMutationsAndGenerateUndos
-race:kudu::tablet::MemRowSet::Iterator::ApplyMutationsToProjectedRow
-race:kudu::tablet::MemRowSet::Iterator::FetchRows
-race:kudu::tablet::Mutation::*
-race:kudu::RowChangeListDecoder::Init
-
# GLog's fatal signal handler isn't signal-safe -- it allocates memory.
# This isn't great, but nothing we can do about it. See
# https://code.google.com/p/google-glog/issues/detail?id=191
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/869d5205/src/kudu/tablet/compaction.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/compaction.cc b/src/kudu/tablet/compaction.cc
index b2204bf..8f4a131 100644
--- a/src/kudu/tablet/compaction.cc
+++ b/src/kudu/tablet/compaction.cc
@@ -629,7 +629,7 @@ Status ApplyMutationsAndGenerateUndos(const MvccSnapshot& snap,
for (const Mutation *redo_mut = src_row.redo_head;
redo_mut != nullptr;
- redo_mut = redo_mut->next()) {
+ redo_mut = redo_mut->acquire_next()) {
// Skip anything not committed.
if (!snap.IsCommitted(redo_mut->timestamp())) {
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/869d5205/src/kudu/tablet/memrowset.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/memrowset.cc b/src/kudu/tablet/memrowset.cc
index 04a4467..8a51e24 100644
--- a/src/kudu/tablet/memrowset.cc
+++ b/src/kudu/tablet/memrowset.cc
@@ -492,9 +492,11 @@ Status MemRowSet::Iterator::FetchRows(RowBlock* dst, size_t* fetched) {
} else {
RETURN_NOT_OK(projector_->ProjectRowForRead(row, &dst_row, dst->arena()));
+ Mutation* redo_head = reinterpret_cast<Mutation*>(
+ base::subtle::Acquire_Load(reinterpret_cast<AtomicWord*>(&row.header_->redo_head)));
// Roll-forward MVCC for committed updates.
RETURN_NOT_OK(ApplyMutationsToProjectedRow(
- row.header_->redo_head, &dst_row, dst->arena()));
+ redo_head, &dst_row, dst->arena()));
}
} else {
// This row was not yet committed in the current MVCC snapshot
@@ -528,7 +530,7 @@ Status MemRowSet::Iterator::ApplyMutationsToProjectedRow(
for (const Mutation *mut = mutation_head;
mut != nullptr;
- mut = mut->next_) {
+ mut = mut->acquire_next()) {
if (!mvcc_snap_.IsCommitted(mut->timestamp_)) {
// Transaction which wasn't committed yet in the reader's snapshot.
continue;
@@ -590,13 +592,15 @@ Status MemRowSet::Iterator::GetCurrentRow(RowBlockRow* dst_row,
*insertion_timestamp = src_row.insertion_timestamp();
// Project the RowChangeList if required
- *redo_head = src_row.redo_head();
+ *redo_head = src_row.acquire_redo_head();
if (!delta_projector_.is_identity()) {
DCHECK(mutation_arena != nullptr);
Mutation *prev_redo = nullptr;
*redo_head = nullptr;
- for (const Mutation *mut = src_row.redo_head(); mut != nullptr; mut = mut->next()) {
+ for (const Mutation *mut = src_row.redo_head();
+ mut != nullptr;
+ mut = mut->acquire_next()) {
RETURN_NOT_OK(RowChangeListDecoder::ProjectUpdate(delta_projector_,
mut->changelist(),
&delta_buf_));
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/869d5205/src/kudu/tablet/memrowset.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/memrowset.h b/src/kudu/tablet/memrowset.h
index 364e3df..d964211 100644
--- a/src/kudu/tablet/memrowset.h
+++ b/src/kudu/tablet/memrowset.h
@@ -76,6 +76,12 @@ class MRSRow {
Timestamp insertion_timestamp() const { return header_->insertion_timestamp; }
Mutation* redo_head() { return header_->redo_head; }
+
+ // Load 'redo_head' with an 'Acquire' memory barrier.
+ Mutation* acquire_redo_head() {
+ return reinterpret_cast<Mutation*>(
+ base::subtle::Acquire_Load(reinterpret_cast<AtomicWord*>(&header_->redo_head)));
+ }
const Mutation* redo_head() const { return header_->redo_head; }
const Slice &row_slice() const { return row_slice_; }
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/869d5205/src/kudu/tablet/mutation.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/mutation.cc b/src/kudu/tablet/mutation.cc
index a6d2237..79be724 100644
--- a/src/kudu/tablet/mutation.cc
+++ b/src/kudu/tablet/mutation.cc
@@ -39,7 +39,7 @@ string Mutation::StringifyMutationList(const Schema &schema, const Mutation *hea
ret.append(head->changelist().ToString(schema));
ret.append(")");
- head = head->next();
+ head = head->acquire_next();
}
ret.append("]");
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/869d5205/src/kudu/tablet/mutation.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/mutation.h b/src/kudu/tablet/mutation.h
index 7bdd959..1eb73ca 100644
--- a/src/kudu/tablet/mutation.h
+++ b/src/kudu/tablet/mutation.h
@@ -52,6 +52,15 @@ class Mutation {
Timestamp timestamp() const { return timestamp_; }
const Mutation *next() const { return next_; }
+
+ // Same as 'next()' but loads with 'Acquire' ordering semantics.
+ // This must be used when traversing the mutation list associated with
+ // an in-memory store.
+ const Mutation* acquire_next() const {
+ return reinterpret_cast<const Mutation*>(base::subtle::Acquire_Load(
+ reinterpret_cast<const AtomicWord*>(&next_)));
+ }
+
void set_next(Mutation *next) {
next_ = next;
}
[2/2] incubator-kudu git commit: tsan: remove two old suppressions
Posted by to...@apache.org.
tsan: remove two old suppressions
This removes two TSAN suppressions which have been in the list since the
very first TSAN commit. I went back and looked at that code review and
can't find any explanation for them, and initial local testing with them
removed doesn't seem to turn anything up.
Maybe we've since addressed these and just didn't remove them. Let's
remove them, and if we start to see any TSAN flakes due to them, we can
add them back with an appropriate comment explaining why they're
required.
Change-Id: I25354ce37300ba495aa73909b6a2ba3672f22906
Reviewed-on: http://gerrit.cloudera.org:8080/3411
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/4983a798
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/4983a798
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/4983a798
Branch: refs/heads/master
Commit: 4983a79827a8b674fe139250b7171d361e1b47b9
Parents: 869d520
Author: Todd Lipcon <to...@cloudera.com>
Authored: Mon Jun 20 11:55:27 2016 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Wed Jun 22 20:18:25 2016 +0000
----------------------------------------------------------------------
build-support/tsan-suppressions.txt | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/4983a798/build-support/tsan-suppressions.txt
----------------------------------------------------------------------
diff --git a/build-support/tsan-suppressions.txt b/build-support/tsan-suppressions.txt
index 059d55f..e492b65 100644
--- a/build-support/tsan-suppressions.txt
+++ b/build-support/tsan-suppressions.txt
@@ -14,8 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-race:_dl_deallocate_tls
-race:kudu::tablet::ScopedRowLock::Release
# libunwind uses some double-checked locking which isn't perfectly safe.
# Reported at http://savannah.nongnu.org/bugs/index.php?42677