You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2016/12/05 23:36:38 UTC

[2/2] kudu git commit: Revert "env: change various file filename() functions to return copies"

Revert "env: change various file filename() functions to return copies"

I didn't end up needing this flexibility in the file cache implementation,
and returning references is cheaper.

This reverts commit e836ac18df2ec2405a61aa7a9a90d61ee30716c5.

Change-Id: Ib920fc9a418dcfdf35ba1b038f288ca2ee98343a
Reviewed-on: http://gerrit.cloudera.org:8080/5318
Tested-by: Kudu Jenkins
Reviewed-by: Dan Burkert <da...@apache.org>


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

Branch: refs/heads/master
Commit: 25d6a49901fd61e004a8943c2c8d28484418a6b1
Parents: 1396691
Author: Adar Dembo <ad...@cloudera.com>
Authored: Thu Dec 1 20:03:27 2016 -0800
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Mon Dec 5 23:25:32 2016 +0000

----------------------------------------------------------------------
 src/kudu/util/env-test.cc  | 2 +-
 src/kudu/util/env.h        | 8 ++++----
 src/kudu/util/env_posix.cc | 8 ++++----
 src/kudu/util/pb_util.cc   | 2 +-
 src/kudu/util/pb_util.h    | 2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/25d6a499/src/kudu/util/env-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/env-test.cc b/src/kudu/util/env-test.cc
index 2a40356..850f336 100644
--- a/src/kudu/util/env-test.cc
+++ b/src/kudu/util/env-test.cc
@@ -395,7 +395,7 @@ class ShortReadRandomAccessFile : public RandomAccessFile {
     return wrapped_->Size(size);
   }
 
-  virtual string filename() const OVERRIDE { return wrapped_->filename(); }
+  virtual const string& filename() const OVERRIDE { return wrapped_->filename(); }
 
   virtual size_t memory_footprint() const OVERRIDE {
     return wrapped_->memory_footprint();

http://git-wip-us.apache.org/repos/asf/kudu/blob/25d6a499/src/kudu/util/env.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/env.h b/src/kudu/util/env.h
index 8d4b196..29878b9 100644
--- a/src/kudu/util/env.h
+++ b/src/kudu/util/env.h
@@ -303,7 +303,7 @@ class SequentialFile {
   virtual Status Skip(uint64_t n) = 0;
 
   // Returns the filename provided when the SequentialFile was constructed.
-  virtual std::string filename() const = 0;
+  virtual const std::string& filename() const = 0;
 };
 
 // A file abstraction for randomly reading the contents of a file.
@@ -328,7 +328,7 @@ class RandomAccessFile {
   virtual Status Size(uint64_t *size) const = 0;
 
   // Returns the filename provided when the RandomAccessFile was constructed.
-  virtual std::string filename() const = 0;
+  virtual const std::string& filename() const = 0;
 
   // Returns the approximate memory usage of this RandomAccessFile including
   // the object itself.
@@ -400,7 +400,7 @@ class WritableFile {
   virtual uint64_t Size() const = 0;
 
   // Returns the filename provided when the WritableFile was constructed.
-  virtual std::string filename() const = 0;
+  virtual const std::string& filename() const = 0;
 
  private:
   // No copying allowed
@@ -507,7 +507,7 @@ class RWFile {
   virtual Status Size(uint64_t* size) const = 0;
 
   // Returns the filename provided when the RWFile was constructed.
-  virtual std::string filename() const = 0;
+  virtual const std::string& filename() const = 0;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(RWFile);

http://git-wip-us.apache.org/repos/asf/kudu/blob/25d6a499/src/kudu/util/env_posix.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/env_posix.cc b/src/kudu/util/env_posix.cc
index 5142989..c7e10c6 100644
--- a/src/kudu/util/env_posix.cc
+++ b/src/kudu/util/env_posix.cc
@@ -268,7 +268,7 @@ class PosixSequentialFile: public SequentialFile {
     return Status::OK();
   }
 
-  virtual string filename() const OVERRIDE { return filename_; }
+  virtual const string& filename() const OVERRIDE { return filename_; }
 };
 
 // pread() based random-access
@@ -307,7 +307,7 @@ class PosixRandomAccessFile: public RandomAccessFile {
     return Status::OK();
   }
 
-  virtual string filename() const OVERRIDE { return filename_; }
+  virtual const string& filename() const OVERRIDE { return filename_; }
 
   virtual size_t memory_footprint() const OVERRIDE {
     return kudu_malloc_usable_size(this) + filename_.capacity();
@@ -443,7 +443,7 @@ class PosixWritableFile : public WritableFile {
     return filesize_;
   }
 
-  virtual string filename() const OVERRIDE { return filename_; }
+  virtual const string& filename() const OVERRIDE { return filename_; }
 
  private:
 
@@ -687,7 +687,7 @@ class PosixRWFile : public RWFile {
     return Status::OK();
   }
 
-  virtual string filename() const OVERRIDE {
+  virtual const string& filename() const OVERRIDE {
     return filename_;
   }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/25d6a499/src/kudu/util/pb_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/pb_util.cc b/src/kudu/util/pb_util.cc
index 8d154d3..d4eba50 100644
--- a/src/kudu/util/pb_util.cc
+++ b/src/kudu/util/pb_util.cc
@@ -661,7 +661,7 @@ Status WritablePBContainerFile::Close() {
   return Status::OK();
 }
 
-string WritablePBContainerFile::filename() const {
+const string& WritablePBContainerFile::filename() const {
   return writer_->filename();
 }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/25d6a499/src/kudu/util/pb_util.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/pb_util.h b/src/kudu/util/pb_util.h
index ace147c..4c2a084 100644
--- a/src/kudu/util/pb_util.h
+++ b/src/kudu/util/pb_util.h
@@ -309,7 +309,7 @@ class WritablePBContainerFile {
   Status Close();
 
   // Returns the path to the container's underlying file handle.
-  std::string filename() const;
+  const std::string& filename() const;
 
  private:
   friend class TestPBUtil;