kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [1/3] kudu git commit: cfile-test: pass in IOContext on Open()
Date Wed, 05 Sep 2018 16:00:37 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 224f4792d -> 4fceeae3f


cfile-test: pass in IOContext on Open()

Previously, on certain machines, cfile-test's TestDataCorruption would
fail 100% of the time when attempting to read from a null IOContext. The
passed-in ReaderOptions struct was constructed with the default
constructor, and because no default was set for its io_context member,
this resulted in undefined behavior, which explains why this wasn't
caught in pre-commit.

This patch updates cfile-test to correctly pass in an IOContext, and
assigns a default for ReaderOption's io_context.

Change-Id: Iaed883d26075ed1823882a7f7b18834f39b0732d
Reviewed-on: http://gerrit.cloudera.org:8080/11389
Reviewed-by: Adar Dembo <adar@cloudera.com>
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/17c5d73d
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/17c5d73d
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/17c5d73d

Branch: refs/heads/master
Commit: 17c5d73dcd4902ef7f9e55c1fcaaaf836bda31ba
Parents: 224f479
Author: Andrew Wong <awong@cloudera.com>
Authored: Tue Sep 4 22:24:18 2018 -0700
Committer: Andrew Wong <awong@cloudera.com>
Committed: Wed Sep 5 06:11:47 2018 +0000

----------------------------------------------------------------------
 src/kudu/cfile/cfile-test.cc | 6 ++++--
 src/kudu/cfile/cfile_util.h  | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/17c5d73d/src/kudu/cfile/cfile-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile-test.cc b/src/kudu/cfile/cfile-test.cc
index 0f9efcd..a524155 100644
--- a/src/kudu/cfile/cfile-test.cc
+++ b/src/kudu/cfile/cfile-test.cc
@@ -374,9 +374,11 @@ class TestCFile : public CFileTestBase {
     unique_ptr<ReadableBlock> corrupt_source;
     RETURN_NOT_OK(fs_manager_->OpenBlock(new_id, &corrupt_source));
     unique_ptr<CFileReader> reader;
-    RETURN_NOT_OK(CFileReader::Open(std::move(corrupt_source), ReaderOptions(), &reader));
-    gscoped_ptr<IndexTreeIterator> iter;
+    ReaderOptions opts;
     const fs::IOContext io_context({ "corrupted-dummy-tablet" });
+    opts.io_context = &io_context;
+    RETURN_NOT_OK(CFileReader::Open(std::move(corrupt_source), std::move(opts), &reader));
+    gscoped_ptr<IndexTreeIterator> iter;
     iter.reset(IndexTreeIterator::Create(&io_context, reader.get(), reader->posidx_root()));
     RETURN_NOT_OK(iter->SeekToFirst());
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/17c5d73d/src/kudu/cfile/cfile_util.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile_util.h b/src/kudu/cfile/cfile_util.h
index 1574187..cae4337 100644
--- a/src/kudu/cfile/cfile_util.h
+++ b/src/kudu/cfile/cfile_util.h
@@ -98,7 +98,7 @@ struct ReaderOptions {
   // The IO context of this reader.
   //
   // Default: nullptr
-  const fs::IOContext* io_context;
+  const fs::IOContext* io_context = nullptr;
 
   // The MemTracker that should account for this reader's memory consumption.
   //


Mime
View raw message