You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2017/08/10 00:05:07 UTC
[1/6] kudu git commit: remove 'using std::...' and other from header
files
Repository: kudu
Updated Branches:
refs/heads/master b0839fcdb -> 154b07de7
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/ts_tablet_manager.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/ts_tablet_manager.h b/src/kudu/tserver/ts_tablet_manager.h
index 5883771..d4c7c63 100644
--- a/src/kudu/tserver/ts_tablet_manager.h
+++ b/src/kudu/tserver/ts_tablet_manager.h
@@ -198,7 +198,7 @@ class TSTabletManager : public tserver::TabletReplicaLookupIf {
};
// Standard log prefix, given a tablet id.
- static std::string LogPrefix(const string& tablet_id, FsManager *fs_manager);
+ static std::string LogPrefix(const std::string& tablet_id, FsManager *fs_manager);
std::string LogPrefix(const std::string& tablet_id) const {
return LogPrefix(tablet_id, fs_manager_);
}
@@ -329,7 +329,7 @@ class TSTabletManager : public tserver::TabletReplicaLookupIf {
class TransitionInProgressDeleter : public RefCountedThreadSafe<TransitionInProgressDeleter> {
public:
TransitionInProgressDeleter(TransitionInProgressMap* map, rw_spinlock* lock,
- string entry);
+ std::string entry);
private:
friend class RefCountedThreadSafe<TransitionInProgressDeleter>;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/tserver-path-handlers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tserver-path-handlers.cc b/src/kudu/tserver/tserver-path-handlers.cc
index 10c425a..329d640 100644
--- a/src/kudu/tserver/tserver-path-handlers.cc
+++ b/src/kudu/tserver/tserver-path-handlers.cc
@@ -57,7 +57,9 @@ using kudu::tablet::TabletStatePB;
using kudu::tablet::TabletStatusPB;
using kudu::tablet::Transaction;
using std::endl;
+using std::map;
using std::shared_ptr;
+using std::string;
using std::vector;
using strings::Substitute;
@@ -195,7 +197,7 @@ void TabletServerPathHandlers::HandleTabletsPage(const Webserver::WebRequest& re
// For assigning ids to table divs;
int i = 0;
auto generate_table = [this, &i](const vector<scoped_refptr<TabletReplica>>& replicas,
- ostream* output) {
+ std::ostream* output) {
i++;
*output << "<h4>Summary</h4>\n";
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/twitter-demo/insert_consumer.cc
----------------------------------------------------------------------
diff --git a/src/kudu/twitter-demo/insert_consumer.cc b/src/kudu/twitter-demo/insert_consumer.cc
index 361b8bd..1d5a0c6 100644
--- a/src/kudu/twitter-demo/insert_consumer.cc
+++ b/src/kudu/twitter-demo/insert_consumer.cc
@@ -36,13 +36,15 @@
#include "kudu/twitter-demo/twitter-schema.h"
#include "kudu/util/status.h"
-namespace kudu {
-namespace twitter_demo {
-
using kudu::client::KuduInsert;
using kudu::client::KuduClient;
using kudu::client::KuduSession;
using kudu::client::KuduTableCreator;
+using std::string;
+using std::vector;
+
+namespace kudu {
+namespace twitter_demo {
InsertConsumer::InsertConsumer(client::sp::shared_ptr<KuduClient> client)
: initted_(false),
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/twitter-demo/parser-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/twitter-demo/parser-test.cc b/src/kudu/twitter-demo/parser-test.cc
index 2870864..4c84054 100644
--- a/src/kudu/twitter-demo/parser-test.cc
+++ b/src/kudu/twitter-demo/parser-test.cc
@@ -26,6 +26,9 @@
#include "kudu/util/test_util.h"
#include "kudu/util/status.h"
+using std::string;
+using std::vector;
+
namespace kudu {
namespace twitter_demo {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/twitter-demo/parser.cc
----------------------------------------------------------------------
diff --git a/src/kudu/twitter-demo/parser.cc b/src/kudu/twitter-demo/parser.cc
index 20a82f4..73b8a13 100644
--- a/src/kudu/twitter-demo/parser.cc
+++ b/src/kudu/twitter-demo/parser.cc
@@ -71,7 +71,7 @@ static Status ParseTweet(const JsonReader& r,
return Status::OK();
}
-Status TwitterEventParser::Parse(const string& json, TwitterEvent* event) {
+Status TwitterEventParser::Parse(const std::string& json, TwitterEvent* event) {
JsonReader r(json);
RETURN_NOT_OK(r.Init());
const rapidjson::Value* delete_obj;
@@ -83,7 +83,7 @@ Status TwitterEventParser::Parse(const string& json, TwitterEvent* event) {
return ParseDelete(r, delete_obj, event);
}
-string TwitterEventParser::ReformatTime(const string& twitter_time) {
+std::string TwitterEventParser::ReformatTime(const std::string& twitter_time) {
struct tm t;
memset(&t, 0, sizeof(t));
// Example: Wed Aug 14 06:31:07 +0000 2013
@@ -95,7 +95,7 @@ string TwitterEventParser::ReformatTime(const string& twitter_time) {
char buf[100];
size_t n = strftime(buf, arraysize(buf), "%Y%m%d%H%M%S", &t);
CHECK_GT(n, 0);
- return string(buf);
+ return buf;
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/twitter-demo/twitter-schema.h
----------------------------------------------------------------------
diff --git a/src/kudu/twitter-demo/twitter-schema.h b/src/kudu/twitter-demo/twitter-schema.h
index acfc851..d54d51c 100644
--- a/src/kudu/twitter-demo/twitter-schema.h
+++ b/src/kudu/twitter-demo/twitter-schema.h
@@ -24,13 +24,11 @@
namespace kudu {
namespace twitter_demo {
-using client::KuduColumnSchema;
-using client::KuduSchema;
-using client::KuduSchemaBuilder;
+inline client::KuduSchema CreateTwitterSchema() {
+ using client::KuduColumnSchema;
-inline KuduSchema CreateTwitterSchema() {
- KuduSchema s;
- KuduSchemaBuilder b;
+ client::KuduSchema s;
+ client::KuduSchemaBuilder b;
b.AddColumn("tweet_id")->Type(KuduColumnSchema::INT64)->NotNull()->PrimaryKey();
b.AddColumn("text")->Type(KuduColumnSchema::STRING)->NotNull();
b.AddColumn("source")->Type(KuduColumnSchema::STRING)->NotNull();
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/twitter-demo/twitter_streamer.cc
----------------------------------------------------------------------
diff --git a/src/kudu/twitter-demo/twitter_streamer.cc b/src/kudu/twitter-demo/twitter_streamer.cc
index 99a1cb0..2d94515 100644
--- a/src/kudu/twitter-demo/twitter_streamer.cc
+++ b/src/kudu/twitter-demo/twitter_streamer.cc
@@ -32,6 +32,7 @@
#include "kudu/util/status.h"
using std::string;
+using std::thread;
const char* kTwitterUrl = "https://stream.twitter.com/1.1/statuses/sample.json";
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/twitter-demo/twitter_streamer.h
----------------------------------------------------------------------
diff --git a/src/kudu/twitter-demo/twitter_streamer.h b/src/kudu/twitter-demo/twitter_streamer.h
index df292bd..e134e39 100644
--- a/src/kudu/twitter-demo/twitter_streamer.h
+++ b/src/kudu/twitter-demo/twitter_streamer.h
@@ -24,8 +24,6 @@
#include "kudu/util/slice.h"
#include "kudu/util/status.h"
-using std::thread;
-
namespace kudu {
namespace twitter_demo {
@@ -51,7 +49,7 @@ class TwitterStreamer {
Status DoStreaming();
size_t DataReceived(const Slice& data);
- thread thread_;
+ std::thread thread_;
std::mutex lock_;
Status stream_status_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/cache-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/cache-test.cc b/src/kudu/util/cache-test.cc
index 7319cf9..eed72ad 100644
--- a/src/kudu/util/cache-test.cc
+++ b/src/kudu/util/cache-test.cc
@@ -82,8 +82,8 @@ class CacheTest : public KuduTest,
}
void Insert(int key, int value, int charge = 1) {
- string key_str = EncodeInt(key);
- string val_str = EncodeInt(value);
+ std::string key_str = EncodeInt(key);
+ std::string val_str = EncodeInt(value);
Cache::PendingHandle* handle = CHECK_NOTNULL(cache_->Allocate(key_str, val_str.size(), charge));
memcpy(cache_->MutableValue(handle), val_str.data(), val_str.size());
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/cache.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/cache.cc b/src/kudu/util/cache.cc
index 4700fb3..d65d277 100644
--- a/src/kudu/util/cache.cc
+++ b/src/kudu/util/cache.cc
@@ -35,6 +35,10 @@ DEFINE_bool(cache_force_single_shard, false,
"Override all cache implementations to use just one shard");
TAG_FLAG(cache_force_single_shard, hidden);
+using std::shared_ptr;
+using std::string;
+using std::vector;
+
namespace kudu {
class MetricEntity;
@@ -44,9 +48,6 @@ Cache::~Cache() {
namespace {
-using std::shared_ptr;
-using std::vector;
-
typedef simple_spinlock MutexType;
// LRU cache implementation
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/compression/compression_codec.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/compression/compression_codec.cc b/src/kudu/util/compression/compression_codec.cc
index 4995023..41dcae2 100644
--- a/src/kudu/util/compression/compression_codec.cc
+++ b/src/kudu/util/compression/compression_codec.cc
@@ -263,7 +263,7 @@ Status GetCompressionCodec(CompressionType compression,
}
CompressionType GetCompressionCodecType(const std::string& name) {
- string uname;
+ std::string uname;
ToUpperCase(name, &uname);
if (uname == "SNAPPY")
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/crc-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/crc-test.cc b/src/kudu/util/crc-test.cc
index 2c6db4b..3c46230 100644
--- a/src/kudu/util/crc-test.cc
+++ b/src/kudu/util/crc-test.cc
@@ -46,7 +46,7 @@ class CrcTest : public KuduTest {
// Basic functionality test.
TEST_F(CrcTest, TestCRC32C) {
- const string test_data("abcdefgh");
+ const std::string test_data("abcdefgh");
const uint64_t kExpectedCrc = 0xa9421b7; // Known value from crcutil usage test program.
Crc* crc32c = GetCrc32cInstance();
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/debug-util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/debug-util.cc b/src/kudu/util/debug-util.cc
index a9e0dc6..1f2b035 100644
--- a/src/kudu/util/debug-util.cc
+++ b/src/kudu/util/debug-util.cc
@@ -35,6 +35,9 @@
#include "kudu/util/monotime.h"
#include "kudu/util/thread.h"
+using std::string;
+using std::vector;
+
#if defined(__APPLE__)
typedef sig_t sighandler_t;
#endif
@@ -67,7 +70,7 @@ extern int GetStackTrace(void** result, int max_depth, int skip_count);
bool Symbolize(void *pc, char *out, int out_size);
namespace glog_internal_namespace_ {
-extern void DumpStackTraceToString(std::string *s);
+extern void DumpStackTraceToString(string *s);
} // namespace glog_internal_namespace_
} // namespace google
@@ -307,16 +310,16 @@ Status ListThreads(vector<pid_t> *tids) {
return Status::OK();
}
-std::string GetStackTrace() {
- std::string s;
+string GetStackTrace() {
+ string s;
google::glog_internal_namespace_::DumpStackTraceToString(&s);
return s;
}
-std::string GetStackTraceHex() {
+string GetStackTraceHex() {
char buf[1024];
HexStackTraceToString(buf, 1024);
- return std::string(buf);
+ return buf;
}
void HexStackTraceToString(char* buf, size_t size) {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/debug/trace_event_impl.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/debug/trace_event_impl.cc b/src/kudu/util/debug/trace_event_impl.cc
index 5755e30..1d72a24 100644
--- a/src/kudu/util/debug/trace_event_impl.cc
+++ b/src/kudu/util/debug/trace_event_impl.cc
@@ -45,6 +45,7 @@ using base::SpinLockHolder;
using strings::SubstituteAndAppend;
using std::string;
+using std::vector;
__thread TraceLog::PerThreadInfo* TraceLog::thread_local_info_ = nullptr;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/env-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/env-test.cc b/src/kudu/util/env-test.cc
index f5bff38..4e3ed9f 100644
--- a/src/kudu/util/env-test.cc
+++ b/src/kudu/util/env-test.cc
@@ -60,6 +60,7 @@ DECLARE_string(env_inject_eio_globs);
namespace kudu {
+using std::pair;
using std::shared_ptr;
using std::string;
using std::unique_ptr;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/env_posix.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/env_posix.cc b/src/kudu/util/env_posix.cc
index 588b4b3..f4a3388 100644
--- a/src/kudu/util/env_posix.cc
+++ b/src/kudu/util/env_posix.cc
@@ -69,6 +69,14 @@
#include <sys/vfs.h>
#endif // defined(__APPLE__)
+using base::subtle::Atomic64;
+using base::subtle::Barrier_AtomicIncrement;
+using std::accumulate;
+using std::string;
+using std::unique_ptr;
+using std::vector;
+using strings::Substitute;
+
// Copied from falloc.h. Useful for older kernels that lack support for
// hole punching; fallocate(2) will return EOPNOTSUPP.
#ifndef FALLOC_FL_KEEP_SIZE
@@ -178,14 +186,6 @@ DEFINE_string(env_inject_eio_globs, "*",
"I/O will fail. By default, all files may cause a failure.");
TAG_FLAG(env_inject_eio_globs, hidden);
-using base::subtle::Atomic64;
-using base::subtle::Barrier_AtomicIncrement;
-using std::accumulate;
-using std::string;
-using std::unique_ptr;
-using std::vector;
-using strings::Substitute;
-
static __thread uint64_t thread_local_id;
static Atomic64 cur_thread_local_id_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/env_util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/env_util-test.cc b/src/kudu/util/env_util-test.cc
index 78bb006..61a4e3e 100644
--- a/src/kudu/util/env_util-test.cc
+++ b/src/kudu/util/env_util-test.cc
@@ -39,6 +39,7 @@ DECLARE_int64(disk_reserved_bytes_free_for_testing);
using std::string;
using std::unique_ptr;
using std::unordered_set;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/env_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/env_util.cc b/src/kudu/util/env_util.cc
index e9117a4..c6e0f50 100644
--- a/src/kudu/util/env_util.cc
+++ b/src/kudu/util/env_util.cc
@@ -67,6 +67,7 @@ TAG_FLAG(disk_reserved_override_prefix_2_bytes_free_for_testing, unsafe);
TAG_FLAG(disk_reserved_override_prefix_1_bytes_free_for_testing, runtime);
TAG_FLAG(disk_reserved_override_prefix_2_bytes_free_for_testing, runtime);
+using std::pair;
using std::shared_ptr;
using std::string;
using std::unique_ptr;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/failure_detector.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/failure_detector.cc b/src/kudu/util/failure_detector.cc
index baa29ed..8e2a6ae 100644
--- a/src/kudu/util/failure_detector.cc
+++ b/src/kudu/util/failure_detector.cc
@@ -29,11 +29,12 @@
#include "kudu/util/status.h"
#include "kudu/util/thread.h"
-namespace kudu {
-
+using std::string;
using std::unordered_map;
using strings::Substitute;
+namespace kudu {
+
const int64_t RandomizedFailureMonitor::kMinWakeUpTimeMillis = 10;
TimedFailureDetector::TimedFailureDetector(MonoDelta failure_period)
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/file_cache-stress-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/file_cache-stress-test.cc b/src/kudu/util/file_cache-stress-test.cc
index 807d85e..0402bdc 100644
--- a/src/kudu/util/file_cache-stress-test.cc
+++ b/src/kudu/util/file_cache-stress-test.cc
@@ -71,6 +71,7 @@ DECLARE_bool(cache_force_single_shard);
using std::deque;
using std::shared_ptr;
+using std::string;
using std::thread;
using std::unique_ptr;
using std::unordered_map;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/flags.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/flags.cc b/src/kudu/util/flags.cc
index 6b57f54..19d5b4f 100644
--- a/src/kudu/util/flags.cc
+++ b/src/kudu/util/flags.cc
@@ -50,6 +50,7 @@ using std::endl;
using std::string;
using std::stringstream;
using std::unordered_set;
+using std::vector;
using strings::Substitute;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/group_varint-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/group_varint-test.cc b/src/kudu/util/group_varint-test.cc
index c5ff410..e8f4bfa 100644
--- a/src/kudu/util/group_varint-test.cc
+++ b/src/kudu/util/group_varint-test.cc
@@ -41,7 +41,7 @@ static void DoTestRoundTripGVI32(
// so append some extra padding data to ensure that it's not reading
// uninitialized memory. The SSE implementation uses 128-bit reads
// and the non-SSE one uses 32-bit reads.
- buf.append(string(use_sse ? 16 : 4, 'x'));
+ buf.append(std::string(use_sse ? 16 : 4, 'x'));
uint32_t ret[4];
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/interval_tree-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/interval_tree-test.cc b/src/kudu/util/interval_tree-test.cc
index 0386dab..b547595 100644
--- a/src/kudu/util/interval_tree-test.cc
+++ b/src/kudu/util/interval_tree-test.cc
@@ -32,8 +32,9 @@
#include "kudu/util/interval_tree-inl.h"
#include "kudu/util/test_util.h"
-using std::vector;
+using std::pair;
using std::string;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/kernel_stack_watchdog.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/kernel_stack_watchdog.cc b/src/kudu/util/kernel_stack_watchdog.cc
index 829431f..a7097d8 100644
--- a/src/kudu/util/kernel_stack_watchdog.cc
+++ b/src/kudu/util/kernel_stack_watchdog.cc
@@ -37,6 +37,7 @@ DEFINE_int32(hung_task_check_interval_ms, 200,
TAG_FLAG(hung_task_check_interval_ms, hidden);
using std::lock_guard;
+using std::string;
using strings::Substitute;
namespace kudu {
@@ -66,13 +67,13 @@ KernelStackWatchdog::~KernelStackWatchdog() {
void KernelStackWatchdog::SaveLogsForTests(bool save_logs) {
lock_guard<simple_spinlock> l(log_lock_);
if (save_logs) {
- log_collector_.reset(new vector<string>());
+ log_collector_.reset(new std::vector<string>());
} else {
log_collector_.reset();
}
}
-vector<string> KernelStackWatchdog::LoggedMessagesForTests() const {
+std::vector<string> KernelStackWatchdog::LoggedMessagesForTests() const {
lock_guard<simple_spinlock> l(log_lock_);
CHECK(log_collector_) << "Must call SaveLogsForTests(true) first";
return *log_collector_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/knapsack_solver-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/knapsack_solver-test.cc b/src/kudu/util/knapsack_solver-test.cc
index 787fcd1..00b04cd 100644
--- a/src/kudu/util/knapsack_solver-test.cc
+++ b/src/kudu/util/knapsack_solver-test.cc
@@ -24,6 +24,7 @@
#include "kudu/util/stopwatch.h"
#include "kudu/util/test_util.h"
+using std::string;
using std::vector;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/locks.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/locks.cc b/src/kudu/util/locks.cc
index bcb7201..2fe9661 100644
--- a/src/kudu/util/locks.cc
+++ b/src/kudu/util/locks.cc
@@ -21,6 +21,10 @@
namespace kudu {
+using base::subtle::Acquire_CompareAndSwap;
+using base::subtle::NoBarrier_Load;
+using base::subtle::Release_Store;
+
size_t percpu_rwlock::memory_footprint_excluding_this() const {
// Because locks_ is a dynamic array of non-trivially-destructable types,
// the returned pointer from new[] isn't guaranteed to point at the start of
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/locks.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/locks.h b/src/kudu/util/locks.h
index 36d6984..f4ab4a7 100644
--- a/src/kudu/util/locks.h
+++ b/src/kudu/util/locks.h
@@ -31,10 +31,6 @@
namespace kudu {
-using base::subtle::Acquire_CompareAndSwap;
-using base::subtle::NoBarrier_Load;
-using base::subtle::Release_Store;
-
// Wrapper around the Google SpinLock class to adapt it to the method names
// expected by Boost.
class simple_spinlock {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/maintenance_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/maintenance_manager-test.cc b/src/kudu/util/maintenance_manager-test.cc
index 07f7f22..9e9654e 100644
--- a/src/kudu/util/maintenance_manager-test.cc
+++ b/src/kudu/util/maintenance_manager-test.cc
@@ -32,6 +32,7 @@
#include "kudu/util/thread.h"
using std::shared_ptr;
+using std::string;
using std::vector;
using strings::Substitute;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/maintenance_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/maintenance_manager.cc b/src/kudu/util/maintenance_manager.cc
index 212c123..747efad 100644
--- a/src/kudu/util/maintenance_manager.cc
+++ b/src/kudu/util/maintenance_manager.cc
@@ -144,7 +144,7 @@ MaintenanceManager::~MaintenanceManager() {
Shutdown();
}
-Status MaintenanceManager::Init(string server_uuid) {
+Status MaintenanceManager::Init(std::string server_uuid) {
server_uuid_ = std::move(server_uuid);
RETURN_NOT_OK(Thread::Create("maintenance", "maintenance_scheduler",
boost::bind(&MaintenanceManager::RunSchedulerThread, this),
@@ -385,7 +385,7 @@ MaintenanceOp* MaintenanceManager::FindBestOp() {
double capacity_pct;
if (memory_pressure_func_(&capacity_pct)) {
if (!most_mem_anchored_op) {
- string msg = StringPrintf("we have exceeded our soft memory limit "
+ std::string msg = StringPrintf("we have exceeded our soft memory limit "
"(current capacity is %.2f%%). However, there are no ops currently "
"runnable which would free memory.", capacity_pct);
LOG_WITH_PREFIX(INFO) << msg;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/memcmpable_varint-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/memcmpable_varint-test.cc b/src/kudu/util/memcmpable_varint-test.cc
index 3e5b5e0..8342937 100644
--- a/src/kudu/util/memcmpable_varint-test.cc
+++ b/src/kudu/util/memcmpable_varint-test.cc
@@ -34,6 +34,10 @@ ostream &operator <<(ostream &os, const pair<T1, T2> &pair) {
}
}
+using std::make_pair;
+using std::pair;
+using std::vector;
+
namespace kudu {
class TestMemcmpableVarint : public KuduTest {
@@ -94,12 +98,12 @@ TEST_F(TestMemcmpableVarint, TestCompositeKeys) {
buf2.clear();
pair<uint64_t, uint64_t> p1 =
- make_pair(Rand64WithRandomBitLength(), Rand64WithRandomBitLength());
+ make_pair(Rand64WithRandomBitLength(), Rand64WithRandomBitLength());
PutMemcmpableVarint64(&buf1, p1.first);
PutMemcmpableVarint64(&buf1, p1.second);
pair<uint64_t, uint64_t> p2 =
- make_pair(Rand64WithRandomBitLength(), Rand64WithRandomBitLength());
+ make_pair(Rand64WithRandomBitLength(), Rand64WithRandomBitLength());
PutMemcmpableVarint64(&buf2, p2.first);
PutMemcmpableVarint64(&buf2, p2.second);
@@ -119,11 +123,13 @@ TEST_F(TestMemcmpableVarint, TestCompositeKeys) {
// tests "interesting" values -- i.e values around the boundaries of where
// the encoding changes its number of bytes.
TEST_F(TestMemcmpableVarint, TestInterestingCompositeKeys) {
- vector<uint64_t> interesting_values = { 0, 1, 240, // 1 byte
- 241, 2000, 2287, // 2 bytes
- 2288, 40000, 67823, // 3 bytes
- 67824, 1ULL << 23, (1ULL << 24) - 1, // 4 bytes
- 1ULL << 24, 1ULL << 30, (1ULL << 32) - 1 }; // 5 bytes
+ const vector<uint64_t> interesting_values = {
+ 0, 1, 240, // 1 byte
+ 241, 2000, 2287, // 2 bytes
+ 2288, 40000, 67823, // 3 bytes
+ 67824, 1ULL << 23, (1ULL << 24) - 1, // 4 bytes
+ 1ULL << 24, 1ULL << 30, (1ULL << 32) - 1, // 5 bytes
+ };
faststring buf1;
faststring buf2;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/memory/arena-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/memory/arena-test.cc b/src/kudu/util/memory/arena-test.cc
index fc3a64d..e476560 100644
--- a/src/kudu/util/memory/arena-test.cc
+++ b/src/kudu/util/memory/arena-test.cc
@@ -34,6 +34,7 @@ DEFINE_int32(alloc_size, 4, "number of bytes in each allocation");
namespace kudu {
using std::shared_ptr;
+using std::string;
using std::thread;
using std::vector;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/memory/arena.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/memory/arena.h b/src/kudu/util/memory/arena.h
index 1c98564..1db5585 100644
--- a/src/kudu/util/memory/arena.h
+++ b/src/kudu/util/memory/arena.h
@@ -42,8 +42,6 @@
#include "kudu/util/mutex.h"
#include "kudu/util/slice.h"
-using std::allocator;
-
namespace kudu {
template<bool THREADSAFE> struct ArenaTraits;
@@ -184,7 +182,7 @@ class ArenaBase {
}
BufferAllocator* const buffer_allocator_;
- vector<std::unique_ptr<Component> > arena_;
+ std::vector<std::unique_ptr<Component> > arena_;
// The current component to allocate from.
// Use AcquireLoadCurrent and ReleaseStoreCurrent to load/store.
@@ -223,7 +221,7 @@ template<class T, bool THREADSAFE> class ArenaAllocator {
~ArenaAllocator() { }
- pointer allocate(size_type n, allocator<void>::const_pointer /*hint*/ = 0) {
+ pointer allocate(size_type n, std::allocator<void>::const_pointer /*hint*/ = 0) {
return reinterpret_cast<T*>(arena_->AllocateBytes(n * sizeof(T)));
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/memory/memory.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/memory/memory.h b/src/kudu/util/memory/memory.h
index eabc142..ffe0a7c 100644
--- a/src/kudu/util/memory/memory.h
+++ b/src/kudu/util/memory/memory.h
@@ -47,15 +47,6 @@
#include "kudu/gutil/macros.h"
#include "kudu/gutil/singleton.h"
-using std::copy;
-using std::max;
-using std::min;
-using std::numeric_limits;
-using std::reverse;
-using std::sort;
-using std::swap;
-using std::vector;
-
namespace kudu {
class BufferAllocator;
@@ -184,7 +175,7 @@ class BufferAllocator {
// For unbounded allocators (like raw HeapBufferAllocator) this is the highest
// size_t value possible.
// TODO(user): consider making pure virtual.
- virtual size_t Available() const { return numeric_limits<size_t>::max(); }
+ virtual size_t Available() const { return std::numeric_limits<size_t>::max(); }
protected:
friend class Buffer;
@@ -259,7 +250,7 @@ class HeapBufferAllocator : public BufferAllocator {
}
virtual size_t Available() const OVERRIDE {
- return numeric_limits<size_t>::max();
+ return std::numeric_limits<size_t>::max();
}
private:
@@ -335,7 +326,7 @@ class Mediator {
virtual void Free(size_t amount) = 0;
// TODO(user): consider making pure virtual.
- virtual size_t Available() const { return numeric_limits<size_t>::max(); }
+ virtual size_t Available() const { return std::numeric_limits<size_t>::max(); }
};
// Optionally thread-safe skeletal implementation of a 'quota' abstraction,
@@ -449,7 +440,7 @@ class MediatingBufferAllocator : public BufferAllocator {
virtual ~MediatingBufferAllocator() {}
virtual size_t Available() const OVERRIDE {
- return min(delegate_->Available(), mediator_->Available());
+ return std::min(delegate_->Available(), mediator_->Available());
}
private:
@@ -540,7 +531,7 @@ class SoftQuotaBypassingBufferAllocator : public BufferAllocator {
const size_t usage = allocator_.GetUsage();
size_t available = allocator_.Available();
if (bypassed_amount_ > usage) {
- available = max(bypassed_amount_ - usage, available);
+ available = std::max(bypassed_amount_ - usage, available);
}
return available;
}
@@ -552,7 +543,7 @@ class SoftQuotaBypassingBufferAllocator : public BufferAllocator {
// with increased minimal size is more likely to fail because of exceeding
// hard quota, so we also fall back to the original minimal size.
size_t AdjustMinimal(size_t requested, size_t minimal) const {
- return min(requested, max(minimal, Available()));
+ return std::min(requested, std::max(minimal, Available()));
}
virtual Buffer* AllocateInternal(size_t requested,
size_t minimal,
@@ -854,7 +845,7 @@ class OwningBufferAllocator : public BufferAllocator {
// Not using PointerVector here because we want to guarantee certain order of
// deleting elements (starting from the ones added last).
- vector<OwnedType*> owned_;
+ std::vector<OwnedType*> owned_;
BufferAllocator* delegate_;
};
@@ -918,7 +909,7 @@ size_t Quota<thread_safe>::Allocate(const size_t requested,
size_t allocation;
if (usage_ > quota || minimal > quota - usage_) {
// OOQ (Out of quota).
- if (!enforced() && minimal <= numeric_limits<size_t>::max() - usage_) {
+ if (!enforced() && minimal <= std::numeric_limits<size_t>::max() - usage_) {
// The quota is unenforced and the value of "minimal" won't cause an
// overflow. Perform a minimal allocation.
allocation = minimal;
@@ -934,7 +925,7 @@ size_t Quota<thread_safe>::Allocate(const size_t requested,
<< ((allocation == 0) ? "Did not allocate any memory."
: "Allocated the minimal value requested.");
} else {
- allocation = min(requested, quota - usage_);
+ allocation = std::min(requested, quota - usage_);
}
usage_ += allocation;
return allocation;
@@ -946,7 +937,7 @@ void Quota<thread_safe>::Free(size_t amount) {
usage_ -= amount;
// threads allocate/free memory concurrently via the same Quota object that is
// not protected with a mutex (thread_safe == false).
- if (usage_ > (numeric_limits<size_t>::max() - (1 << 28))) {
+ if (usage_ > (std::numeric_limits<size_t>::max() - (1 << 28))) {
LOG(ERROR) << "Suspiciously big usage_ value: " << usage_
<< " (could be a result size_t wrapping around below 0, "
<< "for example as a result of race condition).";
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/mt-metrics-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/mt-metrics-test.cc b/src/kudu/util/mt-metrics-test.cc
index b4512fb..c333215 100644
--- a/src/kudu/util/mt-metrics-test.cc
+++ b/src/kudu/util/mt-metrics-test.cc
@@ -40,6 +40,7 @@ METRIC_DEFINE_entity(test_entity);
namespace kudu {
using debug::ScopedLeakCheckDisabler;
+using std::string;
using std::vector;
class MultiThreadedMetricsTest : public KuduTest {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/net/net_util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/net_util-test.cc b/src/kudu/util/net/net_util-test.cc
index c77b054..3316316 100644
--- a/src/kudu/util/net/net_util-test.cc
+++ b/src/kudu/util/net/net_util-test.cc
@@ -29,6 +29,9 @@
#include "kudu/util/status.h"
#include "kudu/util/test_util.h"
+using std::string;
+using std::vector;
+
namespace kudu {
class NetUtilTest : public KuduTest {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/net/net_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/net_util.cc b/src/kudu/util/net/net_util.cc
index dbd1285..94dbb02 100644
--- a/src/kudu/util/net/net_util.cc
+++ b/src/kudu/util/net/net_util.cc
@@ -59,6 +59,7 @@ DEFINE_bool(fail_dns_resolution, false, "Whether to fail all dns resolution, for
TAG_FLAG(fail_dns_resolution, hidden);
using std::function;
+using std::string;
using std::unordered_set;
using std::unique_ptr;
using std::vector;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/net/sockaddr.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/sockaddr.cc b/src/kudu/util/net/sockaddr.cc
index ed249c7..0379382 100644
--- a/src/kudu/util/net/sockaddr.cc
+++ b/src/kudu/util/net/sockaddr.cc
@@ -32,10 +32,11 @@
#include "kudu/util/net/net_util.h"
#include "kudu/util/stopwatch.h"
-namespace kudu {
-
+using std::string;
using strings::Substitute;
+namespace kudu {
+
///
/// Sockaddr
///
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/net/socket.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/net/socket.cc b/src/kudu/util/net/socket.cc
index ac28b64..748c773 100644
--- a/src/kudu/util/net/socket.cc
+++ b/src/kudu/util/net/socket.cc
@@ -276,7 +276,7 @@ Status Socket::GetSocketAddress(Sockaddr *cur_addr) const {
DCHECK_GE(fd_, 0);
if (::getsockname(fd_, (struct sockaddr *)&sin, &len) == -1) {
int err = errno;
- return Status::NetworkError(string("getsockname error: ") +
+ return Status::NetworkError(std::string("getsockname error: ") +
ErrnoToString(err), Slice(), err);
}
*cur_addr = sin;
@@ -289,7 +289,7 @@ Status Socket::GetPeerAddress(Sockaddr *cur_addr) const {
DCHECK_GE(fd_, 0);
if (::getpeername(fd_, (struct sockaddr *)&sin, &len) == -1) {
int err = errno;
- return Status::NetworkError(string("getpeername error: ") +
+ return Status::NetworkError(std::string("getpeername error: ") +
ErrnoToString(err), Slice(), err);
}
*cur_addr = sin;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/nvm_cache.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/nvm_cache.cc b/src/kudu/util/nvm_cache.cc
index 678aa87..7346f21 100644
--- a/src/kudu/util/nvm_cache.cc
+++ b/src/kudu/util/nvm_cache.cc
@@ -67,6 +67,7 @@ class MetricEntity;
namespace {
using std::shared_ptr;
+using std::string;
using std::vector;
typedef simple_spinlock MutexType;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/object_pool.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/object_pool.h b/src/kudu/util/object_pool.h
index 147363f..64d4b5c 100644
--- a/src/kudu/util/object_pool.h
+++ b/src/kudu/util/object_pool.h
@@ -27,8 +27,6 @@
namespace kudu {
-using base::ManualConstructor;
-
template<class T>
class ReturnToPool;
@@ -72,14 +70,14 @@ class ObjectPool {
// Construct a new object instance from the pool.
T *Construct() {
- ManualConstructor<T> *obj = GetObject();
+ base::ManualConstructor<T> *obj = GetObject();
obj->Init();
return obj->get();
}
template<class Arg1>
T *Construct(Arg1 arg1) {
- ManualConstructor<T> *obj = GetObject();
+ base::ManualConstructor<T> *obj = GetObject();
obj->Init(arg1);
return obj->get();
}
@@ -89,7 +87,7 @@ class ObjectPool {
void Destroy(T *t) {
CHECK_NOTNULL(t);
ListNode *node = static_cast<ListNode *>(
- reinterpret_cast<ManualConstructor<T> *>(t));
+ reinterpret_cast<base::ManualConstructor<T> *>(t));
node->Destroy();
@@ -108,7 +106,7 @@ class ObjectPool {
}
private:
- class ListNode : ManualConstructor<T> {
+ class ListNode : base::ManualConstructor<T> {
friend class ObjectPool<T>;
ListNode *next_on_free_list;
@@ -118,7 +116,7 @@ class ObjectPool {
};
- ManualConstructor<T> *GetObject() {
+ base::ManualConstructor<T> *GetObject() {
if (free_list_head_ != NULL) {
ListNode *tmp = free_list_head_;
free_list_head_ = tmp->next_on_free_list;
@@ -126,7 +124,7 @@ class ObjectPool {
DCHECK(tmp->is_on_freelist);
tmp->is_on_freelist = false;
- return static_cast<ManualConstructor<T> *>(tmp);
+ return static_cast<base::ManualConstructor<T> *>(tmp);
}
auto new_node = new ListNode();
new_node->next_on_free_list = NULL;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/oid_generator.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/oid_generator.cc b/src/kudu/util/oid_generator.cc
index 580463c..4e558bf 100644
--- a/src/kudu/util/oid_generator.cc
+++ b/src/kudu/util/oid_generator.cc
@@ -26,6 +26,7 @@
#include "kudu/gutil/strings/substitute.h"
#include "kudu/util/status.h"
+using std::string;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/os-util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/os-util.cc b/src/kudu/util/os-util.cc
index 9ea7e08..5fedc4d 100644
--- a/src/kudu/util/os-util.cc
+++ b/src/kudu/util/os-util.cc
@@ -40,6 +40,8 @@
using std::ifstream;
using std::istreambuf_iterator;
using std::ostringstream;
+using std::string;
+using std::vector;
using strings::Split;
using strings::Substitute;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/pb_util.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/pb_util.h b/src/kudu/util/pb_util.h
index 8e8a65e..fc2a0a5 100644
--- a/src/kudu/util/pb_util.h
+++ b/src/kudu/util/pb_util.h
@@ -53,8 +53,6 @@ class RWFile;
namespace pb_util {
-using google::protobuf::MessageLite;
-
enum SyncMode {
SYNC,
NO_SYNC
@@ -75,28 +73,29 @@ enum class FileState {
extern const int kPBContainerMinimumValidLength;
// See MessageLite::AppendToString
-void AppendToString(const MessageLite &msg, faststring *output);
+void AppendToString(const google::protobuf::MessageLite &msg, faststring *output);
// See MessageLite::AppendPartialToString
-void AppendPartialToString(const MessageLite &msg, faststring *output);
+void AppendPartialToString(const google::protobuf::MessageLite &msg, faststring *output);
// See MessageLite::SerializeToString.
-void SerializeToString(const MessageLite &msg, faststring *output);
+void SerializeToString(const google::protobuf::MessageLite &msg, faststring *output);
// See MessageLite::ParseFromZeroCopyStream
-Status ParseFromSequentialFile(MessageLite *msg, SequentialFile *rfile);
+Status ParseFromSequentialFile(google::protobuf::MessageLite *msg, SequentialFile *rfile);
// Similar to MessageLite::ParseFromArray, with the difference that it returns
// Status::Corruption() if the message could not be parsed.
-Status ParseFromArray(MessageLite* msg, const uint8_t* data, uint32_t length);
+Status ParseFromArray(google::protobuf::MessageLite* msg, const uint8_t* data, uint32_t length);
// Load a protobuf from the given path.
-Status ReadPBFromPath(Env* env, const std::string& path, MessageLite* msg);
+Status ReadPBFromPath(Env* env, const std::string& path, google::protobuf::MessageLite* msg);
// Serialize a protobuf to the given path.
//
// If SyncMode SYNC is provided, ensures the changes are made durable.
-Status WritePBToPath(Env* env, const std::string& path, const MessageLite& msg, SyncMode sync);
+Status WritePBToPath(Env* env, const std::string& path,
+ const google::protobuf::MessageLite& msg, SyncMode sync);
// Truncate any 'bytes' or 'string' fields of this message to max_len.
// The text "<truncated>" is appended to any such truncated fields.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/protoc-gen-insertions.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/protoc-gen-insertions.cc b/src/kudu/util/protoc-gen-insertions.cc
index d8769aa..cd87c87 100644
--- a/src/kudu/util/protoc-gen-insertions.cc
+++ b/src/kudu/util/protoc-gen-insertions.cc
@@ -30,6 +30,7 @@
using google::protobuf::io::ZeroCopyOutputStream;
using google::protobuf::io::Printer;
+using std::string;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/random-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/random-test.cc b/src/kudu/util/random-test.cc
index b40e90c..0528b93 100644
--- a/src/kudu/util/random-test.cc
+++ b/src/kudu/util/random-test.cc
@@ -23,6 +23,10 @@
#include "kudu/util/random.h"
#include "kudu/util/test_util.h"
+using std::numeric_limits;
+using std::unordered_set;
+using std::vector;
+
namespace kudu {
class RandomTest : public KuduTest {
@@ -62,10 +66,10 @@ TEST_F(RandomTest, TestNormalDist) {
// This test reflects that, and if we change the RNG algo this test should also change.
TEST_F(RandomTest, TestUseOfBits) {
// For Next32():
- uint32_t ones32 = std::numeric_limits<uint32_t>::max();
+ uint32_t ones32 = numeric_limits<uint32_t>::max();
uint32_t zeroes32 = 0;
// For Next64():
- uint64_t ones64 = std::numeric_limits<uint64_t>::max();
+ uint64_t ones64 = numeric_limits<uint64_t>::max();
uint64_t zeroes64 = 0;
for (int i = 0; i < 10000000; i++) {
@@ -81,8 +85,8 @@ TEST_F(RandomTest, TestUseOfBits) {
// At the end, we should have flipped 31 and 64 bits, respectively. One
// detail of the current RNG impl is that Next32() always returns a number
// with MSB set to 0.
- uint32_t expected_bits_31 = std::numeric_limits<uint32_t>::max() >> 1;
- uint64_t expected_bits_64 = std::numeric_limits<uint64_t>::max();
+ uint32_t expected_bits_31 = numeric_limits<uint32_t>::max() >> 1;
+ uint64_t expected_bits_64 = numeric_limits<uint64_t>::max();
ASSERT_EQ(0, ones32);
ASSERT_EQ(expected_bits_31, zeroes32);
@@ -110,7 +114,7 @@ TEST_F(RandomTest, TestReservoirSample) {
// Run 1000 trials selecting 5 elements.
vector<int> results;
vector<int> counts(population.size());
- std::unordered_set<int> avoid;
+ unordered_set<int> avoid;
for (int trial = 0; trial < 1000; trial++) {
rng_.ReservoirSample(population, 5, avoid, &results);
for (int result : results) {
@@ -151,7 +155,7 @@ TEST_F(RandomTest, TestReservoirSamplePopulationTooSmall) {
}
vector<int> results;
- std::unordered_set<int> avoid;
+ unordered_set<int> avoid;
rng_.ReservoirSample(population, 20, avoid, &results);
ASSERT_EQ(population.size(), results.size());
ASSERT_EQ(population, results);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/spinlock_profiling-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/spinlock_profiling-test.cc b/src/kudu/util/spinlock_profiling-test.cc
index 4960c0f..54d8327 100644
--- a/src/kudu/util/spinlock_profiling-test.cc
+++ b/src/kudu/util/spinlock_profiling-test.cc
@@ -52,7 +52,7 @@ TEST_F(SpinLockProfilingTest, TestSpinlockProfiling) {
ADOPT_TRACE(t.get());
gutil::SubmitSpinLockProfileData(&lock, 4000000);
}
- string result = t->DumpToString();
+ std::string result = t->DumpToString();
LOG(INFO) << "trace: " << result;
ASSERT_STR_CONTAINS(result, "\"spinlock_wait_cycles\":4000000");
// We can't assert more specifically because the CyclesPerSecond
@@ -71,7 +71,7 @@ TEST_F(SpinLockProfilingTest, TestStackCollection) {
std::ostringstream str;
int64_t dropped = 0;
FlushSynchronizationProfile(&str, &dropped);
- string s = str.str();
+ std::string s = str.str();
ASSERT_STR_CONTAINS(s, "12345\t1 @ ");
ASSERT_EQ(0, dropped);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/stopwatch.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/stopwatch.h b/src/kudu/util/stopwatch.h
index ea9a1be..66d54d1 100644
--- a/src/kudu/util/stopwatch.h
+++ b/src/kudu/util/stopwatch.h
@@ -316,7 +316,7 @@ class LogTiming {
const char *file_;
const int line_;
const google::LogSeverity severity_;
- const string prefix_;
+ const std::string prefix_;
const std::string description_;
const int64_t max_expected_millis_;
const bool should_print_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/thread.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/thread.cc b/src/kudu/util/thread.cc
index 3e3de98..540483a 100644
--- a/src/kudu/util/thread.cc
+++ b/src/kudu/util/thread.cc
@@ -59,6 +59,8 @@ using std::endl;
using std::map;
using std::ostringstream;
using std::shared_ptr;
+using std::string;
+using std::vector;
using strings::Substitute;
METRIC_DEFINE_gauge_uint64(server, threads_started,
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/threadpool.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/threadpool.cc b/src/kudu/util/threadpool.cc
index d133b4b..fb76b7d 100644
--- a/src/kudu/util/threadpool.cc
+++ b/src/kudu/util/threadpool.cc
@@ -166,7 +166,7 @@ void ThreadPoolToken::Shutdown() {
// outside the lock, in case there are concurrent threads wanting to access
// the ThreadPool. The task's destructors may acquire locks, etc, so this
// also prevents lock inversions.
- deque<ThreadPool::Task> to_release = std::move(entries_);
+ std::deque<ThreadPool::Task> to_release = std::move(entries_);
pool_->total_queued_tasks_ -= to_release.size();
switch (state()) {
@@ -319,7 +319,7 @@ ThreadPool::ThreadPool(const ThreadPoolBuilder& builder)
total_queued_tasks_(0),
tokenless_(NewToken(ExecutionMode::CONCURRENT)),
metrics_(builder.metrics_) {
- string prefix = !builder.trace_metric_prefix_.empty() ?
+ std::string prefix = !builder.trace_metric_prefix_.empty() ?
builder.trace_metric_prefix_ : builder.name_;
queue_time_trace_metric_name_ = TraceMetrics::InternName(
@@ -369,7 +369,7 @@ void ThreadPool::Shutdown() {
// wanting to access the ThreadPool. The task's destructors may acquire
// locks, etc, so this also prevents lock inversions.
queue_.clear();
- deque<deque<Task>> to_release;
+ std::deque<std::deque<Task>> to_release;
for (auto* t : tokens_) {
if (!t->entries_.empty()) {
to_release.emplace_back(std::move(t->entries_));
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/util/trace.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/trace.cc b/src/kudu/util/trace.cc
index 698c915..2408736 100644
--- a/src/kudu/util/trace.cc
+++ b/src/kudu/util/trace.cc
@@ -32,10 +32,13 @@
#include "kudu/util/memory/arena.h"
#include "kudu/util/jsonwriter.h"
-namespace kudu {
-
+using std::pair;
+using std::string;
+using std::vector;
using strings::internal::SubstituteArg;
+namespace kudu {
+
__thread Trace* Trace::threadlocal_trace_;
Trace::Trace()
[6/6] kudu git commit: remove 'using std::...' and other from header
files
Posted by al...@apache.org.
remove 'using std::...' and other from header files
Adding 'using ...' into header files is not a good idea. In particular,
it confuses the include-what-you-use tool so it gives strange and
incorrect suggestions. Most likely, there is a bug in the tool as is,
but let's at least not contradict our C++ style guide and remove those
'using ...' from the header files.
This patch does not contain any functional changes.
Change-Id: Iea777af2d881abdb593f9e6f667e613cca8b2fd3
Reviewed-on: http://gerrit.cloudera.org:8080/7628
Reviewed-by: Dan Burkert <da...@apache.org>
Tested-by: Alexey Serbin <as...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/154b07de
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/154b07de
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/154b07de
Branch: refs/heads/master
Commit: 154b07de73ca2b949fceacef6798411dc4a3c6eb
Parents: b0839fc
Author: Alexey Serbin <al...@apache.org>
Authored: Tue Aug 8 14:11:52 2017 -0700
Committer: Alexey Serbin <as...@cloudera.com>
Committed: Thu Aug 10 00:01:03 2017 +0000
----------------------------------------------------------------------
.../benchmarks/tpch/line_item_tsv_importer.h | 6 +-
src/kudu/benchmarks/tpch/rpc_line_item_dao.cc | 3 +
src/kudu/benchmarks/tpch/tpch1.cc | 6 +-
src/kudu/benchmarks/tpch/tpch_real_world.cc | 3 +
src/kudu/benchmarks/wal_hiccup.cc | 1 +
src/kudu/cfile/binary_prefix_block.cc | 1 +
src/kudu/cfile/block_pointer.h | 7 +-
src/kudu/cfile/bloomfile-test-base.h | 7 +-
src/kudu/cfile/bloomfile-test.cc | 1 +
src/kudu/cfile/bloomfile.cc | 2 +
src/kudu/cfile/cfile-test-base.h | 10 +-
src/kudu/cfile/cfile-test.cc | 2 +
src/kudu/cfile/cfile_reader.cc | 4 +-
src/kudu/cfile/cfile_reader.h | 6 +-
src/kudu/cfile/cfile_writer.cc | 2 +
src/kudu/cfile/cfile_writer.h | 13 +-
src/kudu/cfile/encoding-test.cc | 13 +-
src/kudu/cfile/index-test.cc | 7 +-
src/kudu/cfile/index_block.cc | 8 +-
src/kudu/cfile/index_block.h | 7 +-
src/kudu/cfile/index_btree.cc | 2 +
src/kudu/cfile/mt-bloomfile-test.cc | 2 +-
src/kudu/cfile/plain_block.h | 2 +-
src/kudu/cfile/type_encodings.cc | 9 +-
src/kudu/client/batcher.cc | 2 +
src/kudu/client/client-test-util.cc | 6 +-
src/kudu/client/meta_cache.cc | 1 +
src/kudu/client/scanner-internal.h | 2 +-
src/kudu/client/schema.cc | 1 +
src/kudu/client/table-internal.cc | 2 +
src/kudu/clock/hybrid_clock-test.cc | 4 +-
src/kudu/clock/hybrid_clock.cc | 7 +-
src/kudu/clock/logical_clock.cc | 3 +-
src/kudu/codegen/row_projector.h | 4 +-
src/kudu/common/column_predicate-test.cc | 2 +
src/kudu/common/column_predicate.cc | 1 +
src/kudu/common/encoded_key-test.cc | 2 +
src/kudu/common/encoded_key.cc | 1 +
src/kudu/common/encoded_key.h | 8 +-
src/kudu/common/generic_iterators-test.cc | 2 +
src/kudu/common/generic_iterators.cc | 3 +-
src/kudu/common/generic_iterators.h | 12 +-
src/kudu/common/iterator.h | 2 +-
src/kudu/common/key_encoder.cc | 2 +-
src/kudu/common/key_util-test.cc | 4 +-
src/kudu/common/partial_row-test.cc | 2 +
src/kudu/common/partial_row.cc | 1 +
src/kudu/common/partition.cc | 2 +-
src/kudu/common/partition.h | 2 +-
src/kudu/common/partition_pruner.cc | 2 +-
src/kudu/common/row.h | 19 +--
src/kudu/common/row_changelist-test.cc | 5 +-
src/kudu/common/row_changelist.cc | 1 +
src/kudu/common/row_changelist.h | 2 +-
src/kudu/common/row_operations-test.cc | 2 +
src/kudu/common/row_operations.cc | 1 +
src/kudu/common/scan_spec-test.cc | 2 +
src/kudu/common/scan_spec.cc | 1 +
src/kudu/common/scan_spec.h | 4 +-
src/kudu/common/schema-test.cc | 1 +
src/kudu/common/schema.cc | 6 +-
src/kudu/common/schema.h | 74 +++++-----
src/kudu/common/timestamp.cc | 2 +-
src/kudu/common/types.cc | 1 +
src/kudu/common/types.h | 41 +++---
src/kudu/common/wire_protocol-test-util.h | 2 +-
src/kudu/common/wire_protocol-test.cc | 1 +
src/kudu/common/wire_protocol.cc | 3 +-
src/kudu/common/wire_protocol.h | 4 +-
src/kudu/consensus/consensus-test-util.h | 30 ++--
src/kudu/consensus/consensus_peers-test.cc | 1 +
src/kudu/consensus/consensus_peers.cc | 6 +-
src/kudu/consensus/consensus_queue-test.cc | 2 +
src/kudu/consensus/consensus_queue.cc | 4 +-
src/kudu/consensus/log-test-base.h | 94 ++++++------
src/kudu/consensus/log-test.cc | 5 +
src/kudu/consensus/log.h | 6 +-
src/kudu/consensus/log_anchor_registry-test.cc | 1 +
src/kudu/consensus/log_cache-test.cc | 2 +
src/kudu/consensus/log_cache.cc | 2 +
src/kudu/consensus/log_index.cc | 1 +
src/kudu/consensus/log_reader.cc | 2 +
src/kudu/consensus/log_util.cc | 3 +-
src/kudu/consensus/mt-log-test.cc | 3 +
src/kudu/consensus/quorum_util.cc | 7 +-
src/kudu/consensus/raft_consensus.cc | 4 +-
.../consensus/raft_consensus_quorum-test.cc | 8 +-
src/kudu/consensus/time_manager-test.cc | 4 +-
src/kudu/consensus/time_manager.cc | 7 +-
src/kudu/fs/block_manager.h | 2 +-
src/kudu/fs/data_dirs.cc | 1 +
src/kudu/fs/data_dirs.h | 8 +-
src/kudu/fs/fs-test-util.h | 2 +-
src/kudu/fs/fs_manager.cc | 4 +-
src/kudu/gutil/int128.h | 1 -
src/kudu/gutil/map-util.h | 38 +++--
src/kudu/gutil/stl_util.h | 47 +++---
src/kudu/gutil/stringprintf.cc | 4 +-
src/kudu/gutil/stringprintf.h | 12 +-
src/kudu/gutil/strings/escaping.cc | 6 +-
src/kudu/gutil/strings/escaping.h | 118 ++++++++-------
src/kudu/gutil/strings/human_readable.cc | 2 +
src/kudu/gutil/strings/human_readable.h | 37 +++--
src/kudu/gutil/strings/join.cc | 5 +
src/kudu/gutil/strings/join.h | 122 ++++++++--------
src/kudu/gutil/strings/numbers.h | 120 ++++++++--------
src/kudu/gutil/strings/serialize.h | 88 ++++++------
src/kudu/gutil/strings/split.cc | 12 +-
src/kudu/gutil/strings/split.h | 144 +++++++++----------
src/kudu/gutil/strings/split_internal.h | 17 +--
src/kudu/gutil/strings/strcat.cc | 2 +
src/kudu/gutil/strings/strcat.h | 67 +++++----
src/kudu/gutil/strings/stringpiece.h | 2 +-
src/kudu/gutil/strings/strip.h | 43 +++---
src/kudu/gutil/strings/substitute.cc | 2 +
src/kudu/gutil/strings/substitute.h | 9 +-
src/kudu/gutil/strings/util.h | 34 ++---
src/kudu/gutil/strtoint.h | 5 +-
src/kudu/gutil/type_traits.h | 2 -
src/kudu/gutil/walltime.cc | 8 +-
src/kudu/gutil/walltime.h | 1 -
src/kudu/integration-tests/all_types-itest.cc | 1 +
src/kudu/integration-tests/alter_table-test.cc | 1 +
.../client-negotiation-failover-itest.cc | 2 +-
.../integration-tests/client-stress-test.cc | 2 +
src/kudu/integration-tests/cluster_itest_util.h | 4 +-
src/kudu/integration-tests/cluster_verifier.cc | 2 +-
src/kudu/integration-tests/cluster_verifier.h | 4 +-
.../create-table-stress-test.cc | 2 +
.../integration-tests/disk_reservation-itest.cc | 1 +
.../exactly_once_writes-itest.cc | 7 +-
.../integration-tests/external_mini_cluster.cc | 1 +
.../flex_partitioning-itest.cc | 2 +
.../integration-tests/internal_mini_cluster.cc | 4 +-
.../integration-tests/linked_list-test-util.h | 17 +--
src/kudu/integration-tests/linked_list-test.cc | 2 +
.../integration-tests/master_migration-itest.cc | 1 +
.../master_replication-itest.cc | 1 +
.../integration-tests/raft_consensus-itest.cc | 3 +
src/kudu/integration-tests/security-itest.cc | 1 +
src/kudu/integration-tests/tablet_copy-itest.cc | 2 +-
src/kudu/integration-tests/test_workload.cc | 6 +-
src/kudu/integration-tests/ts_itest-base.h | 112 +++++++--------
src/kudu/integration-tests/ts_recovery-itest.cc | 3 +-
.../ts_tablet_manager-itest.cc | 2 +
.../update_scan_delta_compact-test.cc | 3 +
src/kudu/master/catalog_manager-test.cc | 6 +-
src/kudu/master/catalog_manager.cc | 3 +-
src/kudu/master/catalog_manager.h | 4 +-
src/kudu/master/master-path-handlers.cc | 2 +-
src/kudu/master/master-test-util.h | 2 +-
src/kudu/master/master-test.cc | 5 +
src/kudu/master/master.cc | 1 +
src/kudu/master/sys_catalog-test.cc | 1 +
src/kudu/master/sys_catalog.cc | 3 +-
src/kudu/master/sys_catalog.h | 2 +-
src/kudu/master/ts_descriptor.cc | 2 +
src/kudu/rpc/exactly_once_rpc-test.cc | 1 +
src/kudu/rpc/inbound_call.cc | 1 +
src/kudu/rpc/mt-rpc-test.cc | 1 +
src/kudu/rpc/negotiation-test.cc | 1 +
src/kudu/rpc/negotiation.cc | 1 +
src/kudu/rpc/outbound_call.cc | 2 +
src/kudu/rpc/remote_method.cc | 2 +-
src/kudu/rpc/request_tracker.cc | 3 +-
src/kudu/rpc/result_tracker.cc | 3 +
src/kudu/rpc/result_tracker.h | 2 +-
src/kudu/rpc/retriable_rpc.h | 2 +-
src/kudu/rpc/rpc-test-base.h | 8 +-
src/kudu/rpc/rpc.cc | 1 +
src/kudu/rpc/rpc_context.cc | 1 +
src/kudu/rpc/rpc_stub-test.cc | 2 +
src/kudu/rpc/rpcz_store.cc | 5 +-
src/kudu/rpc/sasl_common.cc | 1 +
src/kudu/rpc/sasl_common.h | 4 +-
src/kudu/rpc/server_negotiation.cc | 1 +
src/kudu/rpc/service_pool.cc | 2 +
src/kudu/security/cert-test.cc | 1 +
src/kudu/security/cert.cc | 1 +
src/kudu/security/openssl_util.cc | 1 +
src/kudu/security/openssl_util.h | 2 +-
src/kudu/security/openssl_util_bio.h | 6 +-
src/kudu/security/simple_acl.cc | 1 +
src/kudu/security/test/mini_kdc.cc | 1 +
src/kudu/security/tls_context.cc | 1 +
src/kudu/security/token-test.cc | 2 +
src/kudu/server/default-path-handlers.cc | 1 +
src/kudu/server/pprof-path-handlers.cc | 1 +
src/kudu/server/rpc_server-test.cc | 1 +
src/kudu/server/rpcz-path-handler.cc | 1 +
src/kudu/server/tracing-path-handlers.cc | 1 +
src/kudu/server/webserver-test.cc | 1 +
src/kudu/server/webui_util.cc | 1 +
.../tablet/all_types-scan-correctness-test.cc | 2 +
src/kudu/tablet/cbtree-test.cc | 9 +-
src/kudu/tablet/cfile_set-test.cc | 2 +
src/kudu/tablet/cfile_set.cc | 6 +
src/kudu/tablet/cfile_set.h | 36 +++--
src/kudu/tablet/compaction-test.cc | 2 +
src/kudu/tablet/compaction.cc | 3 +
src/kudu/tablet/compaction.h | 16 ++-
src/kudu/tablet/compaction_policy.cc | 4 +-
src/kudu/tablet/composite-pushdown-test.cc | 3 +
src/kudu/tablet/concurrent_btree.h | 10 +-
src/kudu/tablet/delta_compaction.cc | 1 +
src/kudu/tablet/delta_iterator_merger.h | 6 +-
src/kudu/tablet/delta_key.h | 2 +-
src/kudu/tablet/delta_stats.cc | 1 +
src/kudu/tablet/delta_store.cc | 1 +
src/kudu/tablet/delta_store.h | 6 +-
src/kudu/tablet/delta_tracker.cc | 2 +
src/kudu/tablet/delta_tracker.h | 8 +-
src/kudu/tablet/deltafile-test.cc | 2 +
src/kudu/tablet/deltafile.cc | 2 +
src/kudu/tablet/deltafile.h | 13 +-
src/kudu/tablet/deltamemstore-test.cc | 2 +
src/kudu/tablet/deltamemstore.cc | 2 +
src/kudu/tablet/deltamemstore.h | 8 +-
src/kudu/tablet/diskrowset-test-base.h | 26 ++--
src/kudu/tablet/diskrowset-test.cc | 2 +
src/kudu/tablet/diskrowset.cc | 1 +
src/kudu/tablet/key_value_test_schema.h | 4 +-
src/kudu/tablet/local_tablet_writer.h | 2 +-
src/kudu/tablet/lock_manager-test.cc | 3 +-
src/kudu/tablet/lock_manager.cc | 2 +
src/kudu/tablet/major_delta_compaction-test.cc | 2 +
src/kudu/tablet/memrowset-test.cc | 2 +
src/kudu/tablet/memrowset.cc | 2 +
src/kudu/tablet/memrowset.h | 8 +-
src/kudu/tablet/mock-rowsets.h | 2 +-
.../tablet/mt-rowset_delta_compaction-test.cc | 1 +
src/kudu/tablet/multi_column_writer.cc | 2 +-
src/kudu/tablet/mutation.cc | 4 +-
src/kudu/tablet/mutation.h | 2 +-
src/kudu/tablet/mvcc.cc | 5 +-
src/kudu/tablet/mvcc.h | 4 +-
src/kudu/tablet/row_op.cc | 2 +-
src/kudu/tablet/rowset.cc | 2 +
src/kudu/tablet/rowset.h | 10 +-
src/kudu/tablet/rowset_info.cc | 1 +
src/kudu/tablet/rowset_metadata.cc | 2 +-
src/kudu/tablet/rowset_metadata.h | 4 +-
src/kudu/tablet/rowset_tree-test.cc | 1 +
src/kudu/tablet/rowset_tree.cc | 1 +
src/kudu/tablet/svg_dump.cc | 1 +
src/kudu/tablet/tablet-harness.h | 14 +-
src/kudu/tablet/tablet-pushdown-test.cc | 3 +
src/kudu/tablet/tablet-schema-test.cc | 3 +
src/kudu/tablet/tablet-test-base.h | 42 +++---
src/kudu/tablet/tablet-test-util.h | 46 +++---
src/kudu/tablet/tablet-test.cc | 2 +
src/kudu/tablet/tablet.cc | 2 +
src/kudu/tablet/tablet.h | 6 +-
src/kudu/tablet/tablet_bootstrap.cc | 1 +
src/kudu/tablet/tablet_history_gc-test.cc | 3 +
src/kudu/tablet/tablet_metadata.cc | 2 +
src/kudu/tablet/tablet_mm_ops-test.cc | 4 +-
src/kudu/tablet/tablet_replica-test.cc | 1 +
src/kudu/tablet/tablet_replica.cc | 2 +
.../transactions/alter_schema_transaction.cc | 1 +
.../tablet/transactions/transaction_driver.cc | 1 +
.../tablet/transactions/transaction_tracker.cc | 1 +
.../tablet/transactions/write_transaction.cc | 2 +
src/kudu/tools/color.cc | 4 +-
src/kudu/tools/ksck-test.cc | 1 +
src/kudu/tools/ksck.cc | 2 +
src/kudu/tools/ksck.h | 14 +-
src/kudu/tools/kudu-admin-test.cc | 2 +-
src/kudu/tools/kudu-tool-test.cc | 2 +
src/kudu/tools/kudu-ts-cli-test.cc | 2 +
src/kudu/tools/tool_action.cc | 1 +
src/kudu/tools/tool_action_local_replica.cc | 4 +-
src/kudu/tools/tool_action_master.cc | 1 +
src/kudu/tools/tool_action_pbc.cc | 1 +
src/kudu/tools/tool_action_tserver.cc | 1 +
src/kudu/tserver/heartbeater.cc | 2 +
src/kudu/tserver/scanners.cc | 2 +
src/kudu/tserver/scanners.h | 2 +-
src/kudu/tserver/tablet_copy-test-base.h | 4 +-
src/kudu/tserver/tablet_copy_client-test.cc | 2 +
src/kudu/tserver/tablet_copy_service-test.cc | 2 +
src/kudu/tserver/tablet_copy_service.cc | 2 +
src/kudu/tserver/tablet_copy_service.h | 2 +-
.../tserver/tablet_copy_source_session-test.cc | 1 +
src/kudu/tserver/tablet_copy_source_session.cc | 2 +
src/kudu/tserver/tablet_server-test-base.h | 22 +--
src/kudu/tserver/tablet_server-test.cc | 1 +
src/kudu/tserver/tablet_server.cc | 1 +
src/kudu/tserver/tablet_service.cc | 1 +
src/kudu/tserver/ts_tablet_manager-test.cc | 3 +
src/kudu/tserver/ts_tablet_manager.h | 4 +-
src/kudu/tserver/tserver-path-handlers.cc | 4 +-
src/kudu/twitter-demo/insert_consumer.cc | 8 +-
src/kudu/twitter-demo/parser-test.cc | 3 +
src/kudu/twitter-demo/parser.cc | 6 +-
src/kudu/twitter-demo/twitter-schema.h | 10 +-
src/kudu/twitter-demo/twitter_streamer.cc | 1 +
src/kudu/twitter-demo/twitter_streamer.h | 4 +-
src/kudu/util/cache-test.cc | 4 +-
src/kudu/util/cache.cc | 7 +-
src/kudu/util/compression/compression_codec.cc | 2 +-
src/kudu/util/crc-test.cc | 2 +-
src/kudu/util/debug-util.cc | 13 +-
src/kudu/util/debug/trace_event_impl.cc | 1 +
src/kudu/util/env-test.cc | 1 +
src/kudu/util/env_posix.cc | 16 +--
src/kudu/util/env_util-test.cc | 1 +
src/kudu/util/env_util.cc | 1 +
src/kudu/util/failure_detector.cc | 5 +-
src/kudu/util/file_cache-stress-test.cc | 1 +
src/kudu/util/flags.cc | 1 +
src/kudu/util/group_varint-test.cc | 2 +-
src/kudu/util/interval_tree-test.cc | 3 +-
src/kudu/util/kernel_stack_watchdog.cc | 5 +-
src/kudu/util/knapsack_solver-test.cc | 1 +
src/kudu/util/locks.cc | 4 +
src/kudu/util/locks.h | 4 -
src/kudu/util/maintenance_manager-test.cc | 1 +
src/kudu/util/maintenance_manager.cc | 4 +-
src/kudu/util/memcmpable_varint-test.cc | 20 ++-
src/kudu/util/memory/arena-test.cc | 1 +
src/kudu/util/memory/arena.h | 6 +-
src/kudu/util/memory/memory.h | 29 ++--
src/kudu/util/mt-metrics-test.cc | 1 +
src/kudu/util/net/net_util-test.cc | 3 +
src/kudu/util/net/net_util.cc | 1 +
src/kudu/util/net/sockaddr.cc | 5 +-
src/kudu/util/net/socket.cc | 4 +-
src/kudu/util/nvm_cache.cc | 1 +
src/kudu/util/object_pool.h | 14 +-
src/kudu/util/oid_generator.cc | 1 +
src/kudu/util/os-util.cc | 2 +
src/kudu/util/pb_util.h | 17 ++-
src/kudu/util/protoc-gen-insertions.cc | 1 +
src/kudu/util/random-test.cc | 16 ++-
src/kudu/util/spinlock_profiling-test.cc | 4 +-
src/kudu/util/stopwatch.h | 2 +-
src/kudu/util/thread.cc | 2 +
src/kudu/util/threadpool.cc | 6 +-
src/kudu/util/trace.cc | 7 +-
340 files changed, 1377 insertions(+), 1169 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/benchmarks/tpch/line_item_tsv_importer.h
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/tpch/line_item_tsv_importer.h b/src/kudu/benchmarks/tpch/line_item_tsv_importer.h
index 6045286..517b522 100644
--- a/src/kudu/benchmarks/tpch/line_item_tsv_importer.h
+++ b/src/kudu/benchmarks/tpch/line_item_tsv_importer.h
@@ -36,7 +36,7 @@ static const char* const kPipeSeparator = "|";
// Utility class used to parse the lineitem tsv file
class LineItemTsvImporter {
public:
- explicit LineItemTsvImporter(const string &path) : in_(path.c_str()),
+ explicit LineItemTsvImporter(const std::string &path) : in_(path.c_str()),
updated_(false) {
CHECK(in_.is_open()) << "not able to open input file: " << path;
}
@@ -127,8 +127,8 @@ class LineItemTsvImporter {
CHECK_OK(row->SetDouble(col_idx, number));
}
std::ifstream in_;
- vector<StringPiece> columns_;
- string line_, tmp_;
+ std::vector<StringPiece> columns_;
+ std::string line_, tmp_;
bool updated_, done_;
};
} // namespace kudu
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/benchmarks/tpch/rpc_line_item_dao.cc
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/tpch/rpc_line_item_dao.cc b/src/kudu/benchmarks/tpch/rpc_line_item_dao.cc
index 4b5e7d5..e0574ae 100644
--- a/src/kudu/benchmarks/tpch/rpc_line_item_dao.cc
+++ b/src/kudu/benchmarks/tpch/rpc_line_item_dao.cc
@@ -37,6 +37,9 @@
DEFINE_bool(tpch_cache_blocks_when_scanning, true,
"Whether the scanners should cache the blocks that are read or not");
+using std::string;
+using std::vector;
+
namespace kudu {
using client::KuduInsert;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/benchmarks/tpch/tpch1.cc
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/tpch/tpch1.cc b/src/kudu/benchmarks/tpch/tpch1.cc
index 369a08e..816afc9 100644
--- a/src/kudu/benchmarks/tpch/tpch1.cc
+++ b/src/kudu/benchmarks/tpch/tpch1.cc
@@ -95,14 +95,16 @@ DEFINE_int32(tpch_max_batch_size, 1000,
DEFINE_string(table_name, "lineitem",
"The table name to write/read");
+using std::string;
+using std::unordered_map;
+using std::vector;
+
namespace kudu {
using client::KuduColumnSchema;
using client::KuduRowResult;
using client::KuduSchema;
-using std::unordered_map;
-
struct Result {
int32_t l_quantity;
double l_extendedprice;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/benchmarks/tpch/tpch_real_world.cc
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/tpch/tpch_real_world.cc b/src/kudu/benchmarks/tpch/tpch_real_world.cc
index 6374132..291e721 100644
--- a/src/kudu/benchmarks/tpch/tpch_real_world.cc
+++ b/src/kudu/benchmarks/tpch/tpch_real_world.cc
@@ -103,6 +103,9 @@ DEFINE_string(tpch_partition_strategy, "range",
"tablets. This is less ideal, but more faithfully represents a lot of write "
"workloads.");
+using std::string;
+using std::vector;
+
namespace kudu {
using client::KuduRowResult;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/benchmarks/wal_hiccup.cc
----------------------------------------------------------------------
diff --git a/src/kudu/benchmarks/wal_hiccup.cc b/src/kudu/benchmarks/wal_hiccup.cc
index e1525c8..faf5e5d 100644
--- a/src/kudu/benchmarks/wal_hiccup.cc
+++ b/src/kudu/benchmarks/wal_hiccup.cc
@@ -56,6 +56,7 @@ DEFINE_bool(page_align_wal_writes, false,
"write to the fake WAL with exactly 4KB writes to never cross pages");
using std::string;
+using std::vector;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/binary_prefix_block.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/binary_prefix_block.cc b/src/kudu/cfile/binary_prefix_block.cc
index 97749bc..0895f36 100644
--- a/src/kudu/cfile/binary_prefix_block.cc
+++ b/src/kudu/cfile/binary_prefix_block.cc
@@ -35,6 +35,7 @@ namespace kudu {
namespace cfile {
using kudu::coding::AppendGroupVarInt32;
+using std::string;
using strings::Substitute;
////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/block_pointer.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/block_pointer.h b/src/kudu/cfile/block_pointer.h
index 3e29f17..0c4554c 100644
--- a/src/kudu/cfile/block_pointer.h
+++ b/src/kudu/cfile/block_pointer.h
@@ -26,9 +26,8 @@
#include "kudu/util/coding.h"
#include "kudu/util/status.h"
-namespace kudu { namespace cfile {
-
-using std::string;
+namespace kudu {
+namespace cfile {
class BlockPointer {
public:
@@ -46,7 +45,7 @@ class BlockPointer {
offset_(offset),
size_(size) {}
- string ToString() const {
+ std::string ToString() const {
return strings::Substitute("offset=$0 size=$1", offset_, size_);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/bloomfile-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/bloomfile-test-base.h b/src/kudu/cfile/bloomfile-test-base.h
index 774de92..ea88136 100644
--- a/src/kudu/cfile/bloomfile-test-base.h
+++ b/src/kudu/cfile/bloomfile-test-base.h
@@ -40,9 +40,6 @@ DEFINE_bool(benchmark_should_hit, false, "Set to true for the benchmark to query
namespace kudu {
namespace cfile {
-using fs::ReadableBlock;
-using fs::WritableBlock;
-
static const int kKeyShift = 2;
class BloomFileTestBase : public KuduTest {
@@ -70,7 +67,7 @@ class BloomFileTestBase : public KuduTest {
}
void WriteTestBloomFile() {
- std::unique_ptr<WritableBlock> sink;
+ std::unique_ptr<fs::WritableBlock> sink;
ASSERT_OK(fs_manager_->CreateNewBlock({}, &sink));
block_id_ = sink->id();
@@ -90,7 +87,7 @@ class BloomFileTestBase : public KuduTest {
}
Status OpenBloomFile() {
- std::unique_ptr<ReadableBlock> source;
+ std::unique_ptr<fs::ReadableBlock> source;
RETURN_NOT_OK(fs_manager_->OpenBlock(block_id_, &source));
return BloomFileReader::Open(std::move(source), ReaderOptions(), &bfr_);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/bloomfile-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/bloomfile-test.cc b/src/kudu/cfile/bloomfile-test.cc
index 57e1ee2..6b385a9 100644
--- a/src/kudu/cfile/bloomfile-test.cc
+++ b/src/kudu/cfile/bloomfile-test.cc
@@ -24,6 +24,7 @@ namespace kudu {
namespace cfile {
using fs::CountingReadableBlock;
+using fs::ReadableBlock;
using std::unique_ptr;
class BloomFileTest : public BloomFileTestBase {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/bloomfile.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/bloomfile.cc b/src/kudu/cfile/bloomfile.cc
index 7d69ac1..5fa1665 100644
--- a/src/kudu/cfile/bloomfile.cc
+++ b/src/kudu/cfile/bloomfile.cc
@@ -33,7 +33,9 @@
DECLARE_bool(cfile_lazy_open);
+using std::string;
using std::unique_ptr;
+using std::vector;
namespace kudu {
namespace cfile {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/cfile-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile-test-base.h b/src/kudu/cfile/cfile-test-base.h
index fa49a99..c4240fe 100644
--- a/src/kudu/cfile/cfile-test-base.h
+++ b/src/kudu/cfile/cfile-test-base.h
@@ -42,10 +42,6 @@ DEFINE_int32(cfile_test_block_size, 1024,
"Default is low to stress code, but can be set higher for "
"performance testing");
-using kudu::fs::ReadableBlock;
-using kudu::fs::WritableBlock;
-using std::unique_ptr;
-
namespace kudu {
namespace cfile {
@@ -349,7 +345,7 @@ class CFileTestBase : public KuduTest {
int num_entries,
uint32_t flags,
BlockId* block_id) {
- unique_ptr<WritableBlock> sink;
+ std::unique_ptr<fs::WritableBlock> sink;
ASSERT_OK(fs_manager_->CreateNewBlock({}, &sink));
*block_id = sink->id();
WriterOptions opts;
@@ -463,9 +459,9 @@ void ReadBinaryFile(CFileIterator* iter, int* count) {
void TimeReadFile(FsManager* fs_manager, const BlockId& block_id, size_t *count_ret) {
Status s;
- unique_ptr<fs::ReadableBlock> source;
+ std::unique_ptr<fs::ReadableBlock> source;
ASSERT_OK(fs_manager->OpenBlock(block_id, &source));
- unique_ptr<CFileReader> reader;
+ std::unique_ptr<CFileReader> reader;
ASSERT_OK(CFileReader::Open(std::move(source), ReaderOptions(), &reader));
gscoped_ptr<CFileIterator> iter;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/cfile-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile-test.cc b/src/kudu/cfile/cfile-test.cc
index dc29a62..4afb5a4 100644
--- a/src/kudu/cfile/cfile-test.cc
+++ b/src/kudu/cfile/cfile-test.cc
@@ -50,7 +50,9 @@ METRIC_DECLARE_counter(block_cache_hits_caching);
METRIC_DECLARE_entity(server);
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/cfile_reader.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile_reader.cc b/src/kudu/cfile/cfile_reader.cc
index bc00359..93c0788 100644
--- a/src/kudu/cfile/cfile_reader.cc
+++ b/src/kudu/cfile/cfile_reader.cc
@@ -56,8 +56,10 @@ DEFINE_bool(cfile_verify_checksums, true,
TAG_FLAG(cfile_verify_checksums, evolving);
using kudu::fs::ReadableBlock;
-using strings::Substitute;
+using std::string;
using std::unique_ptr;
+using std::vector;
+using strings::Substitute;
namespace kudu {
namespace cfile {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/cfile_reader.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile_reader.h b/src/kudu/cfile/cfile_reader.h
index f7a108c..1517771 100644
--- a/src/kudu/cfile/cfile_reader.h
+++ b/src/kudu/cfile/cfile_reader.h
@@ -110,7 +110,7 @@ class CFileReader {
//
// Note that this implementation is currently O(n), so should not be used
// in a hot path.
- bool GetMetadataEntry(const string &key, string *val);
+ bool GetMetadataEntry(const std::string &key, std::string *val);
// Can be called before Init().
uint64_t file_size() const {
@@ -428,7 +428,7 @@ class CFileIterator : public ColumnIterator {
return first_row_idx() + num_rows_in_block_ - 1;
}
- string ToString() const;
+ std::string ToString() const;
};
// Seek the given PreparedBlock to the given index within it.
@@ -468,7 +468,7 @@ class CFileIterator : public ColumnIterator {
// Data blocks that contain data relevant to the currently Prepared
// batch of rows.
// These pointers are allocated from the prepared_block_pool_ below.
- vector<PreparedBlock *> prepared_blocks_;
+ std::vector<PreparedBlock *> prepared_blocks_;
ObjectPool<PreparedBlock> prepared_block_pool_;
typedef ObjectPool<PreparedBlock>::scoped_ptr pblock_pool_scoped_ptr;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/cfile_writer.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile_writer.cc b/src/kudu/cfile/cfile_writer.cc
index 5ca7f3d..cfc934a 100644
--- a/src/kudu/cfile/cfile_writer.cc
+++ b/src/kudu/cfile/cfile_writer.cc
@@ -71,8 +71,10 @@ using google::protobuf::RepeatedPtrField;
using kudu::fs::ScopedWritableBlockCloser;
using kudu::fs::WritableBlock;
using std::accumulate;
+using std::pair;
using std::string;
using std::unique_ptr;
+using std::vector;
namespace kudu {
namespace cfile {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/cfile_writer.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/cfile_writer.h b/src/kudu/cfile/cfile_writer.h
index 5766684..8b6ac57 100644
--- a/src/kudu/cfile/cfile_writer.h
+++ b/src/kudu/cfile/cfile_writer.h
@@ -22,7 +22,6 @@
#include <memory>
#include <string>
-#include <unordered_map>
#include <utility>
#include <vector>
@@ -46,7 +45,6 @@ namespace kudu {
class Arena;
namespace cfile {
-using std::unordered_map;
class BlockPointer;
class BTreeInfoPB;
@@ -142,7 +140,7 @@ class CFileWriter {
//
// validx_prev should be a Slice pointing to the last key of the previous block.
// It will be used to optimize the value index entry for the block.
- Status AppendRawBlock(const vector<Slice> &data_slices,
+ Status AppendRawBlock(const std::vector<Slice> &data_slices,
size_t ordinal_pos,
const void *validx_curr,
const Slice &validx_prev,
@@ -168,7 +166,8 @@ class CFileWriter {
std::string ToString() const { return block_->id().ToString(); }
// Wrapper for AddBlock() to append the dictionary block to the end of a Cfile.
- Status AppendDictBlock(const vector<Slice> &data_slices, BlockPointer *block_ptr,
+ Status AppendDictBlock(const std::vector<Slice> &data_slices,
+ BlockPointer *block_ptr,
const char *name_for_log) {
return AddBlock(data_slices, block_ptr, name_for_log);
}
@@ -181,11 +180,11 @@ class CFileWriter {
// Append the given block into the file.
//
// Sets *block_ptr to correspond to the newly inserted block.
- Status AddBlock(const vector<Slice> &data_slices,
+ Status AddBlock(const std::vector<Slice> &data_slices,
BlockPointer *block_ptr,
const char *name_for_log);
- Status WriteRawData(const vector<Slice>& data);
+ Status WriteRawData(const std::vector<Slice>& data);
Status FinishCurDataBlock();
@@ -222,7 +221,7 @@ class CFileWriter {
faststring tmp_buf_;
// Metadata which has been added to the writer but not yet flushed.
- vector<pair<string, string> > unflushed_metadata_;
+ std::vector<std::pair<std::string, std::string> > unflushed_metadata_;
gscoped_ptr<BlockBuilder> data_block_;
gscoped_ptr<IndexTreeBuilder> posidx_builder_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/encoding-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/encoding-test.cc b/src/kudu/cfile/encoding-test.cc
index 7c12854..8dfd602 100644
--- a/src/kudu/cfile/encoding-test.cc
+++ b/src/kudu/cfile/encoding-test.cc
@@ -42,6 +42,7 @@
#include "kudu/util/test_macros.h"
#include "kudu/util/test_util.h"
+using std::string;
using std::unique_ptr;
using std::vector;
@@ -77,7 +78,7 @@ class TestEncoding : public KuduTest {
int num_items,
const char *fmt_str) {
vector<unique_ptr<string>> to_insert;
- std::vector<Slice> slices;
+ vector<Slice> slices;
for (uint i = 0; i < num_items; i++) {
to_insert.emplace_back(new string(StringPrintf(fmt_str, i)));
slices.emplace_back(to_insert.back()->data());
@@ -416,7 +417,7 @@ class TestEncoding : public KuduTest {
ASSERT_EQ(kOrdinalPosBase, pbd.GetFirstRowId());
ASSERT_EQ(0, pbd.GetCurrentIndex());
- std::vector<CppType> decoded;
+ vector<CppType> decoded;
decoded.resize(size);
ColumnBlock dst_block(GetTypeInfo(Type), nullptr, &decoded[0], size, &arena_);
@@ -496,7 +497,7 @@ class TestEncoding : public KuduTest {
srand(123);
- std::vector<CppType> to_insert;
+ vector<CppType> to_insert;
Random rd(SeedRandom());
for (int i = 0; i < 10003; i++) {
int64_t val = rd.Next64() % std::numeric_limits<CppType>::max();
@@ -532,7 +533,7 @@ class TestEncoding : public KuduTest {
ASSERT_EQ(kOrdinalPosBase, ibd.GetFirstRowId());
- std::vector<CppType> decoded;
+ vector<CppType> decoded;
decoded.resize(to_insert.size());
ColumnBlock dst_block(GetTypeInfo(IntType), nullptr,
@@ -598,7 +599,7 @@ class TestEncoding : public KuduTest {
srand(123);
- std::vector<uint8_t> to_insert;
+ vector<uint8_t> to_insert;
for (int i = 0; i < 10003; ) {
int run_size = random() % 100;
bool val = random() % 2;
@@ -619,7 +620,7 @@ class TestEncoding : public KuduTest {
ASSERT_EQ(kOrdinalPosBase, bd.GetFirstRowId());
- std::vector<uint8_t> decoded;
+ vector<uint8_t> decoded;
decoded.resize(to_insert.size());
ColumnBlock dst_block(GetTypeInfo(BOOL), nullptr,
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/index-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/index-test.cc b/src/kudu/cfile/index-test.cc
index c245d51..f0d457c 100644
--- a/src/kudu/cfile/index-test.cc
+++ b/src/kudu/cfile/index-test.cc
@@ -15,6 +15,8 @@
// specific language governing permissions and limitations
// under the License.
+#include <string>
+
#include <gtest/gtest.h>
#include "kudu/cfile/cfile_writer.h"
@@ -24,10 +26,11 @@
#include "kudu/util/status.h"
#include "kudu/util/test_macros.h"
-namespace kudu { namespace cfile {
+namespace kudu {
+namespace cfile {
Status SearchInReaderString(const IndexBlockReader &reader,
- string search_key,
+ std::string search_key,
BlockPointer *ptr, Slice *match) {
static faststring dst;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/index_block.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/index_block.cc b/src/kudu/cfile/index_block.cc
index 9ce3888..904be7e 100644
--- a/src/kudu/cfile/index_block.cc
+++ b/src/kudu/cfile/index_block.cc
@@ -15,8 +15,11 @@
// specific language governing permissions and limitations
// under the License.
-#include "kudu/cfile/cfile_writer.h"
#include "kudu/cfile/index_block.h"
+
+#include <string>
+
+#include "kudu/cfile/cfile_writer.h"
#include "kudu/gutil/strings/substitute.h"
#include "kudu/util/pb_util.h"
#include "kudu/util/protobuf_util.h"
@@ -146,7 +149,8 @@ Status IndexBlockReader::Parse(const Slice &data) {
size_t max_size = trailer_size_ptr - data_.data();
if (trailer_size <= 0 ||
trailer_size > max_size) {
- string err = strings::Substitute("invalid index block trailer size: $0", trailer_size);
+ std::string err = strings::Substitute(
+ "invalid index block trailer size: $0", trailer_size);
return Status::Corruption(err);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/index_block.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/index_block.h b/src/kudu/cfile/index_block.h
index 139ccf6..1817b66 100644
--- a/src/kudu/cfile/index_block.h
+++ b/src/kudu/cfile/index_block.h
@@ -19,7 +19,6 @@
#define KUDU_CFILE_INDEX_BLOCK_H
#include <glog/logging.h>
-#include <string>
#include <vector>
#include "kudu/common/types.h"
@@ -32,10 +31,6 @@
namespace kudu {
namespace cfile {
-using std::string;
-using std::vector;
-using kudu::DataTypeTraits;
-
// Forward decl.
class IndexBlockIterator;
@@ -94,7 +89,7 @@ class IndexBlockBuilder {
bool is_leaf_;
faststring buffer_;
- vector<uint32_t> entry_offsets_;
+ std::vector<uint32_t> entry_offsets_;
};
class IndexBlockReader {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/index_btree.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/index_btree.cc b/src/kudu/cfile/index_btree.cc
index c31c915..54d8739 100644
--- a/src/kudu/cfile/index_btree.cc
+++ b/src/kudu/cfile/index_btree.cc
@@ -24,6 +24,8 @@
#include "kudu/common/key_encoder.h"
#include "kudu/util/debug-util.h"
+using std::vector;
+
namespace kudu {
namespace cfile {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/mt-bloomfile-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/mt-bloomfile-test.cc b/src/kudu/cfile/mt-bloomfile-test.cc
index 91b03d3..ac0bd98 100644
--- a/src/kudu/cfile/mt-bloomfile-test.cc
+++ b/src/kudu/cfile/mt-bloomfile-test.cc
@@ -33,7 +33,7 @@ TEST_F(MTBloomFileTest, Benchmark) {
ASSERT_NO_FATAL_FAILURE(WriteTestBloomFile());
ASSERT_OK(OpenBloomFile());
- vector<scoped_refptr<kudu::Thread> > threads;
+ std::vector<scoped_refptr<kudu::Thread> > threads;
for (int i = 0; i < FLAGS_benchmark_num_threads; i++) {
scoped_refptr<kudu::Thread> new_thread;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/plain_block.h
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/plain_block.h b/src/kudu/cfile/plain_block.h
index 9fcca2f..a878e58 100644
--- a/src/kudu/cfile/plain_block.h
+++ b/src/kudu/cfile/plain_block.h
@@ -132,7 +132,7 @@ class PlainBlockDecoder final : public BlockDecoder {
if (data_.size() != kPlainBlockHeaderSize + num_elems_ * size_of_type) {
return Status::Corruption(
- string("unexpected data size. ") + "\nFirst 100 bytes: "
+ std::string("unexpected data size. ") + "\nFirst 100 bytes: "
+ HexDump(
Slice(data_.data(),
(data_.size() < 100 ? data_.size() : 100))));
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/type_encodings.cc
----------------------------------------------------------------------
diff --git a/src/kudu/cfile/type_encodings.cc b/src/kudu/cfile/type_encodings.cc
index 4cc9e7c..85035c6 100644
--- a/src/kudu/cfile/type_encodings.cc
+++ b/src/kudu/cfile/type_encodings.cc
@@ -32,12 +32,13 @@
#include "kudu/common/types.h"
#include "kudu/gutil/strings/substitute.h"
-namespace kudu {
-namespace cfile {
-
-using std::unordered_map;
+using std::make_pair;
+using std::pair;
using std::shared_ptr;
+using std::unordered_map;
+namespace kudu {
+namespace cfile {
template<DataType Type, EncodingType Encoding>
struct DataTypeEncodingTraits {};
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/client/batcher.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/batcher.cc b/src/kudu/client/batcher.cc
index 6999835..2fe4bf0 100644
--- a/src/kudu/client/batcher.cc
+++ b/src/kudu/client/batcher.cc
@@ -59,8 +59,10 @@
using std::pair;
using std::set;
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
using std::unordered_map;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/client/client-test-util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/client-test-util.cc b/src/kudu/client/client-test-util.cc
index 32a4020..c44e813 100644
--- a/src/kudu/client/client-test-util.cc
+++ b/src/kudu/client/client-test-util.cc
@@ -17,6 +17,7 @@
#include "kudu/client/client-test-util.h"
+#include <string>
#include <vector>
#include <glog/logging.h>
@@ -26,13 +27,16 @@
#include "kudu/util/test_macros.h"
#include "kudu/util/test_util.h"
+using std::string;
+using std::vector;
+
namespace kudu {
namespace client {
void LogSessionErrorsAndDie(const sp::shared_ptr<KuduSession>& session,
const Status& s) {
CHECK(!s.ok());
- std::vector<KuduError*> errors;
+ vector<KuduError*> errors;
ElementDeleter d(&errors);
bool overflow;
session->GetPendingErrors(&errors, &overflow);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/client/meta_cache.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/meta_cache.cc b/src/kudu/client/meta_cache.cc
index 5c57356..fecac55 100644
--- a/src/kudu/client/meta_cache.cc
+++ b/src/kudu/client/meta_cache.cc
@@ -50,6 +50,7 @@ using std::map;
using std::set;
using std::shared_ptr;
using std::string;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/client/scanner-internal.h
----------------------------------------------------------------------
diff --git a/src/kudu/client/scanner-internal.h b/src/kudu/client/scanner-internal.h
index 4ca99f2..1100408 100644
--- a/src/kudu/client/scanner-internal.h
+++ b/src/kudu/client/scanner-internal.h
@@ -281,7 +281,7 @@ class KuduScanBatch::Data {
return KuduRowResult(projection_, &direct_data_[offset]);
}
- void ExtractRows(vector<KuduScanBatch::RowPtr>* rows);
+ void ExtractRows(std::vector<KuduScanBatch::RowPtr>* rows);
void Clear();
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/client/schema.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/schema.cc b/src/kudu/client/schema.cc
index bcf24b6..9ffb1a4 100644
--- a/src/kudu/client/schema.cc
+++ b/src/kudu/client/schema.cc
@@ -40,6 +40,7 @@ MAKE_ENUM_LIMITS(kudu::client::KuduColumnSchema::DataType,
kudu::client::KuduColumnSchema::INT8,
kudu::client::KuduColumnSchema::BOOL);
+using std::string;
using std::unordered_map;
using std::vector;
using strings::Substitute;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/client/table-internal.cc
----------------------------------------------------------------------
diff --git a/src/kudu/client/table-internal.cc b/src/kudu/client/table-internal.cc
index b3f3258..ebed838 100644
--- a/src/kudu/client/table-internal.cc
+++ b/src/kudu/client/table-internal.cc
@@ -19,6 +19,8 @@
#include <string>
+using std::string;
+
namespace kudu {
namespace client {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/clock/hybrid_clock-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/clock/hybrid_clock-test.cc b/src/kudu/clock/hybrid_clock-test.cc
index caea024..baed9d8 100644
--- a/src/kudu/clock/hybrid_clock-test.cc
+++ b/src/kudu/clock/hybrid_clock-test.cc
@@ -16,6 +16,8 @@
// under the License.
#include <algorithm>
+#include <vector>
+
#include <glog/logging.h>
#include <gtest/gtest.h>
@@ -266,7 +268,7 @@ void StresserThread(HybridClock* clock, AtomicBool* stop) {
// Regression test for KUDU-953: if threads are updating and polling the
// clock concurrently, the clock should still never run backwards.
TEST_F(HybridClockTest, TestClockDoesntGoBackwardsWithUpdates) {
- vector<scoped_refptr<kudu::Thread> > threads;
+ std::vector<scoped_refptr<kudu::Thread> > threads;
AtomicBool stop(false);
for (int i = 0; i < 4; i++) {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/clock/hybrid_clock.cc
----------------------------------------------------------------------
diff --git a/src/kudu/clock/hybrid_clock.cc b/src/kudu/clock/hybrid_clock.cc
index f62b3f5..4841814 100644
--- a/src/kudu/clock/hybrid_clock.cc
+++ b/src/kudu/clock/hybrid_clock.cc
@@ -37,6 +37,10 @@
#include "kudu/util/metrics.h"
#include "kudu/util/status.h"
+using kudu::Status;
+using std::string;
+using strings::Substitute;
+
DEFINE_int32(max_clock_sync_error_usec, 10 * 1000 * 1000, // 10 secs
"Maximum allowed clock synchronization error as reported by NTP "
"before the server will abort.");
@@ -71,9 +75,6 @@ METRIC_DEFINE_gauge_uint64(server, hybrid_clock_error,
kudu::MetricUnit::kMicroseconds,
"Server clock maximum error.");
-using kudu::Status;
-using strings::Substitute;
-
namespace kudu {
namespace clock {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/clock/logical_clock.cc
----------------------------------------------------------------------
diff --git a/src/kudu/clock/logical_clock.cc b/src/kudu/clock/logical_clock.cc
index 8be4843..dc6c6ef 100644
--- a/src/kudu/clock/logical_clock.cc
+++ b/src/kudu/clock/logical_clock.cc
@@ -35,6 +35,7 @@ METRIC_DEFINE_gauge_uint64(server, logical_clock_timestamp,
using base::subtle::Atomic64;
using base::subtle::Barrier_AtomicIncrement;
using base::subtle::NoBarrier_CompareAndSwap;
+using base::subtle::NoBarrier_Load;
Timestamp LogicalClock::Now() {
return Timestamp(Barrier_AtomicIncrement(&now_, 1));
@@ -97,7 +98,7 @@ void LogicalClock::RegisterMetrics(const scoped_refptr<MetricEntity>& metric_ent
->AutoDetachToLastValue(&metric_detacher_);
}
-string LogicalClock::Stringify(Timestamp timestamp) {
+std::string LogicalClock::Stringify(Timestamp timestamp) {
return strings::Substitute("L: $0", timestamp.ToUint64());
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/codegen/row_projector.h
----------------------------------------------------------------------
diff --git a/src/kudu/codegen/row_projector.h b/src/kudu/codegen/row_projector.h
index e3e935d..5a03c48 100644
--- a/src/kudu/codegen/row_projector.h
+++ b/src/kudu/codegen/row_projector.h
@@ -127,10 +127,10 @@ class RowProjector {
"Base schema row: ", base_schema()->DebugRow(src_row));
}
- const vector<ProjectionIdxMapping>& base_cols_mapping() const {
+ const std::vector<ProjectionIdxMapping>& base_cols_mapping() const {
return projector_.base_cols_mapping();
}
- const vector<size_t>& projection_defaults() const {
+ const std::vector<size_t>& projection_defaults() const {
return projector_.projection_defaults();
}
bool is_identity() const { return projector_.is_identity(); }
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/column_predicate-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/column_predicate-test.cc b/src/kudu/common/column_predicate-test.cc
index d5d471c..a5660e9 100644
--- a/src/kudu/common/column_predicate-test.cc
+++ b/src/kudu/common/column_predicate-test.cc
@@ -27,6 +27,8 @@
#include "kudu/common/types.h"
#include "kudu/util/test_util.h"
+using std::vector;
+
namespace kudu {
class TestColumnPredicate : public KuduTest {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/column_predicate.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/column_predicate.cc b/src/kudu/common/column_predicate.cc
index 2131b4e..fca091a 100644
--- a/src/kudu/common/column_predicate.cc
+++ b/src/kudu/common/column_predicate.cc
@@ -27,6 +27,7 @@
#include "kudu/util/memory/arena.h"
using std::move;
+using std::string;
using std::vector;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/encoded_key-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/encoded_key-test.cc b/src/kudu/common/encoded_key-test.cc
index cc3122e..e67366e 100644
--- a/src/kudu/common/encoded_key-test.cc
+++ b/src/kudu/common/encoded_key-test.cc
@@ -27,6 +27,8 @@
#include "kudu/util/test_util.h"
#include "kudu/util/test_macros.h"
+using std::string;
+
namespace kudu {
#define EXPECT_ROWKEY_EQ(schema, expected, enc_key) \
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/encoded_key.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/encoded_key.cc b/src/kudu/common/encoded_key.cc
index e016bdb..e11f2dc 100644
--- a/src/kudu/common/encoded_key.cc
+++ b/src/kudu/common/encoded_key.cc
@@ -26,6 +26,7 @@
namespace kudu {
using std::string;
+using std::vector;
EncodedKey::EncodedKey(faststring* data,
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/encoded_key.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/encoded_key.h b/src/kudu/common/encoded_key.h
index 2a60654..24e7591 100644
--- a/src/kudu/common/encoded_key.h
+++ b/src/kudu/common/encoded_key.h
@@ -36,7 +36,7 @@ class EncodedKey {
// in which case raw_keys represents the supplied prefix of a
// composite key.
EncodedKey(faststring *data,
- vector<const void *> *raw_keys,
+ std::vector<const void *> *raw_keys,
size_t num_key_cols);
static gscoped_ptr<EncodedKey> FromContiguousRow(const ConstContiguousRow& row);
@@ -57,7 +57,7 @@ class EncodedKey {
const Slice &encoded_key() const { return encoded_key_; }
- const vector<const void *> &raw_keys() const { return raw_keys_; }
+ const std::vector<const void *> &raw_keys() const { return raw_keys_; }
size_t num_key_columns() const { return num_key_cols_; }
@@ -85,7 +85,7 @@ class EncodedKey {
const int num_key_cols_;
Slice encoded_key_;
gscoped_ptr<uint8_t[]> data_;
- vector<const void *> raw_keys_;
+ std::vector<const void *> raw_keys_;
};
// A builder for encoded key: creates an encoded key from
@@ -110,7 +110,7 @@ class EncodedKeyBuilder {
faststring encoded_key_;
const size_t num_key_cols_;
size_t idx_;
- vector<const void *> raw_keys_;
+ std::vector<const void *> raw_keys_;
};
} // namespace kudu
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/generic_iterators-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/generic_iterators-test.cc b/src/kudu/common/generic_iterators-test.cc
index 7b16fb2..db04feb 100644
--- a/src/kudu/common/generic_iterators-test.cc
+++ b/src/kudu/common/generic_iterators-test.cc
@@ -40,6 +40,8 @@ DEFINE_int32(num_iters, 1, "Number of times to run merge");
namespace kudu {
using std::shared_ptr;
+using std::string;
+using std::vector;
static const Schema kIntSchema({ ColumnSchema("val", UINT32) }, 1);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/generic_iterators.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/generic_iterators.cc b/src/kudu/common/generic_iterators.cc
index 2634a77..3808241 100644
--- a/src/kudu/common/generic_iterators.cc
+++ b/src/kudu/common/generic_iterators.cc
@@ -40,8 +40,9 @@ using std::remove_if;
using std::shared_ptr;
using std::sort;
using std::string;
-using std::unique_ptr;
using std::tuple;
+using std::unique_ptr;
+using std::vector;
DEFINE_bool(materializing_iterator_do_pushdown, true,
"Should MaterializingIterator do predicate pushdown");
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/generic_iterators.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/generic_iterators.h b/src/kudu/common/generic_iterators.h
index cb5a14a..f9d795e 100644
--- a/src/kudu/common/generic_iterators.h
+++ b/src/kudu/common/generic_iterators.h
@@ -51,7 +51,7 @@ class MergeIterator : public RowwiseIterator {
virtual bool HasNext() const OVERRIDE;
- virtual string ToString() const OVERRIDE;
+ virtual std::string ToString() const OVERRIDE;
virtual const Schema& schema() const OVERRIDE;
@@ -79,7 +79,7 @@ class MergeIterator : public RowwiseIterator {
// Statistics (keyed by projection column index) accumulated so far by any
// fully-consumed sub-iterators.
- vector<IteratorStats> finished_iter_stats_by_col_;
+ std::vector<IteratorStats> finished_iter_stats_by_col_;
// The number of iterators, used by ToString().
const int num_orig_iters_;
@@ -110,7 +110,7 @@ class UnionIterator : public RowwiseIterator {
bool HasNext() const OVERRIDE;
- string ToString() const OVERRIDE;
+ std::string ToString() const OVERRIDE;
const Schema &schema() const OVERRIDE {
CHECK(initted_);
@@ -149,7 +149,7 @@ class UnionIterator : public RowwiseIterator {
// Statistics (keyed by projection column index) accumulated so far by any
// fully-consumed sub-iterators.
- vector<IteratorStats> finished_iter_stats_by_col_;
+ std::vector<IteratorStats> finished_iter_stats_by_col_;
// When the underlying iterators are initialized, each needs its own
// copy of the scan spec in order to do its own pushdown calculations, etc.
@@ -173,7 +173,7 @@ class MaterializingIterator : public RowwiseIterator {
bool HasNext() const OVERRIDE;
- string ToString() const OVERRIDE;
+ std::string ToString() const OVERRIDE;
const Schema &schema() const OVERRIDE {
return iter_->schema();
@@ -227,7 +227,7 @@ class PredicateEvaluatingIterator : public RowwiseIterator {
bool HasNext() const OVERRIDE;
- string ToString() const OVERRIDE;
+ std::string ToString() const OVERRIDE;
const Schema &schema() const OVERRIDE {
return base_iter_->schema();
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/iterator.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/iterator.h b/src/kudu/common/iterator.h
index 0fb3cc7..8c5105e 100644
--- a/src/kudu/common/iterator.h
+++ b/src/kudu/common/iterator.h
@@ -54,7 +54,7 @@ class IteratorBase {
virtual bool HasNext() const = 0;
// Return a string representation of this iterator, suitable for debug output.
- virtual string ToString() const = 0;
+ virtual std::string ToString() const = 0;
// Return the schema for the rows which this iterator produces.
virtual const Schema &schema() const = 0;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/key_encoder.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/key_encoder.cc b/src/kudu/common/key_encoder.cc
index 453e8c7..565584c 100644
--- a/src/kudu/common/key_encoder.cc
+++ b/src/kudu/common/key_encoder.cc
@@ -90,7 +90,7 @@ const bool IsTypeAllowableInKey(const TypeInfo* typeinfo) {
////------------------------------------------------------------
template
-const KeyEncoder<string>& GetKeyEncoder(const TypeInfo* typeinfo);
+const KeyEncoder<std::string>& GetKeyEncoder(const TypeInfo* typeinfo);
template
const KeyEncoder<faststring>& GetKeyEncoder(const TypeInfo* typeinfo);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/key_util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/key_util-test.cc b/src/kudu/common/key_util-test.cc
index b6c71f3..5a8766f 100644
--- a/src/kudu/common/key_util-test.cc
+++ b/src/kudu/common/key_util-test.cc
@@ -151,9 +151,9 @@ TEST_F(KeyUtilTest, TestTryDecrementCell) {
}
{
ColumnSchema col_int32("a", INT32);
- int32_t orig = numeric_limits<int32_t>::min();
+ int32_t orig = std::numeric_limits<int32_t>::min();
EXPECT_EQ(key_util::TryDecrementCell(col_int32, &orig), false);
- EXPECT_EQ(orig, numeric_limits<int32_t>::min());
+ EXPECT_EQ(orig, std::numeric_limits<int32_t>::min());
}
{
ColumnSchema col_bool("a", BOOL);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/partial_row-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/partial_row-test.cc b/src/kudu/common/partial_row-test.cc
index 561f50a..0ade8f8 100644
--- a/src/kudu/common/partial_row-test.cc
+++ b/src/kudu/common/partial_row-test.cc
@@ -24,6 +24,8 @@
#include "kudu/common/schema.h"
#include "kudu/util/test_util.h"
+using std::string;
+
namespace kudu {
class PartialRowTest : public KuduTest {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/partial_row.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/partial_row.cc b/src/kudu/common/partial_row.cc
index d3957c2..7b8a5c8 100644
--- a/src/kudu/common/partial_row.cc
+++ b/src/kudu/common/partial_row.cc
@@ -31,6 +31,7 @@
#include "kudu/util/memory/overwrite.h"
#include "kudu/util/status.h"
+using std::string;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/partition.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/partition.cc b/src/kudu/common/partition.cc
index 593d554..e6ef4e0 100644
--- a/src/kudu/common/partition.cc
+++ b/src/kudu/common/partition.cc
@@ -367,7 +367,7 @@ Status PartitionSchema::CreatePartitions(const vector<KuduPartialRow>& split_row
partitions->swap(new_partitions);
}
- unordered_set<int> range_column_idxs;
+ std::unordered_set<int> range_column_idxs;
for (const ColumnId& column_id : range_schema_.column_ids) {
int column_idx = schema.find_column_by_id(column_id);
if (column_idx == Schema::kColumnNotFound) {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/partition.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/partition.h b/src/kudu/common/partition.h
index efc90a2..6be01d4 100644
--- a/src/kudu/common/partition.h
+++ b/src/kudu/common/partition.h
@@ -289,7 +289,7 @@ class PartitionSchema {
// Private templated helper for EncodeKey.
template<typename Row>
- Status EncodeKeyImpl(const Row& row, string* buf) const;
+ Status EncodeKeyImpl(const Row& row, std::string* buf) const;
// Returns true if all of the columns in the range partition key are unset in
// the row.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/partition_pruner.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/partition_pruner.cc b/src/kudu/common/partition_pruner.cc
index ac157a9..e6184f2 100644
--- a/src/kudu/common/partition_pruner.cc
+++ b/src/kudu/common/partition_pruner.cc
@@ -137,7 +137,7 @@ void EncodeRangeKeysFromPredicates(const Schema& schema,
// Arenas must be at least the minimum chunk size, and we require at least
// enough space for the range key columns.
- Arena arena(max<size_t>(Arena::kMinimumChunkSize, schema.key_byte_size()), 4096);
+ Arena arena(std::max<size_t>(Arena::kMinimumChunkSize, schema.key_byte_size()), 4096);
uint8_t* buf = static_cast<uint8_t*>(CHECK_NOTNULL(arena.AllocateBytes(schema.key_byte_size())));
ContiguousRow row(&schema, buf);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/row.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/row.h b/src/kudu/common/row.h
index cb68bb9..d34b8dc 100644
--- a/src/kudu/common/row.h
+++ b/src/kudu/common/row.h
@@ -186,14 +186,17 @@ class RowProjector {
// Returns the mapping between base schema and projection schema columns
// first: is the projection column index, second: is the base_schema index
- const vector<ProjectionIdxMapping>& base_cols_mapping() const { return base_cols_mapping_; }
-
+ const std::vector<ProjectionIdxMapping>& base_cols_mapping() const {
+ return base_cols_mapping_;
+ }
// Returns the projection indexes of the columns to add with a default value.
//
// These are columns which are present in 'projection_' but not in 'base_schema',
// and for which 'projection' has a default.
- const vector<size_t>& projection_defaults() const { return projection_defaults_; }
+ const std::vector<size_t>& projection_defaults() const {
+ return projection_defaults_;
+ }
private:
friend class Schema;
@@ -246,8 +249,8 @@ class RowProjector {
private:
DISALLOW_COPY_AND_ASSIGN(RowProjector);
- vector<ProjectionIdxMapping> base_cols_mapping_;
- vector<size_t> projection_defaults_;
+ std::vector<ProjectionIdxMapping> base_cols_mapping_;
+ std::vector<size_t> projection_defaults_;
const Schema* base_schema_;
const Schema* projection_;
@@ -569,7 +572,7 @@ class RowBuilder {
AddSlice(slice);
}
- void AddString(const string &str) {
+ void AddString(const std::string &str) {
CheckNextType(STRING);
AddSlice(str);
}
@@ -579,7 +582,7 @@ class RowBuilder {
AddSlice(slice);
}
- void AddBinary(const string &str) {
+ void AddBinary(const std::string &str) {
CheckNextType(BINARY);
AddSlice(str);
}
@@ -690,7 +693,7 @@ class RowBuilder {
Advance();
}
- void AddSlice(const string &str) {
+ void AddSlice(const std::string &str) {
uint8_t *in_arena = arena_.AddSlice(str);
CHECK(in_arena) << "could not allocate space in arena";
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/row_changelist-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/row_changelist-test.cc b/src/kudu/common/row_changelist-test.cc
index 6b934a2..3a1902d 100644
--- a/src/kudu/common/row_changelist-test.cc
+++ b/src/kudu/common/row_changelist-test.cc
@@ -28,10 +28,11 @@
#include "kudu/util/test_macros.h"
#include "kudu/util/test_util.h"
-namespace kudu {
-
+using std::string;
using strings::Substitute;
+namespace kudu {
+
class TestRowChangeList : public KuduTest {
public:
TestRowChangeList() :
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/row_changelist.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/row_changelist.cc b/src/kudu/common/row_changelist.cc
index cd73d46..4d933cd 100644
--- a/src/kudu/common/row_changelist.cc
+++ b/src/kudu/common/row_changelist.cc
@@ -27,6 +27,7 @@
#include "kudu/util/coding-inl.h"
#include "kudu/util/faststring.h"
+using std::string;
using strings::Substitute;
using strings::SubstituteAndAppend;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/row_changelist.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/row_changelist.h b/src/kudu/common/row_changelist.h
index d6e2f3b..bc05b48 100644
--- a/src/kudu/common/row_changelist.h
+++ b/src/kudu/common/row_changelist.h
@@ -107,7 +107,7 @@ class RowChangeList {
const Slice &slice() const { return encoded_data_; }
// Return a string form of this changelist.
- string ToString(const Schema &schema) const;
+ std::string ToString(const Schema &schema) const;
bool is_reinsert() const {
DCHECK_GT(encoded_data_.size(), 0);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/row_operations-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/row_operations-test.cc b/src/kudu/common/row_operations-test.cc
index 4b957db..27f025a 100644
--- a/src/kudu/common/row_operations-test.cc
+++ b/src/kudu/common/row_operations-test.cc
@@ -26,6 +26,8 @@
#include "kudu/util/test_util.h"
using std::shared_ptr;
+using std::string;
+using std::vector;
using strings::Substitute;
using strings::SubstituteAndAppend;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/row_operations.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/row_operations.cc b/src/kudu/common/row_operations.cc
index 388225a..0fb1142 100644
--- a/src/kudu/common/row_operations.cc
+++ b/src/kudu/common/row_operations.cc
@@ -28,6 +28,7 @@
#include "kudu/util/slice.h"
using std::string;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/scan_spec-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/scan_spec-test.cc b/src/kudu/common/scan_spec-test.cc
index be218a6..3e1e55f 100644
--- a/src/kudu/common/scan_spec-test.cc
+++ b/src/kudu/common/scan_spec-test.cc
@@ -31,6 +31,8 @@
#include "kudu/util/test_macros.h"
#include "kudu/util/test_util.h"
+using std::vector;
+
namespace kudu {
class TestScanSpec : public KuduTest {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/scan_spec.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/scan_spec.cc b/src/kudu/common/scan_spec.cc
index 98a99e4..40804ef 100644
--- a/src/kudu/common/scan_spec.cc
+++ b/src/kudu/common/scan_spec.cc
@@ -31,6 +31,7 @@
using std::any_of;
using std::max;
using std::move;
+using std::pair;
using std::string;
using std::vector;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/scan_spec.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/scan_spec.h b/src/kudu/common/scan_spec.h
index 4951b0b..bc1efc2 100644
--- a/src/kudu/common/scan_spec.h
+++ b/src/kudu/common/scan_spec.h
@@ -103,10 +103,10 @@ class ScanSpec {
return exclusive_upper_bound_key_;
}
- const string& lower_bound_partition_key() const {
+ const std::string& lower_bound_partition_key() const {
return lower_bound_partition_key_;
}
- const string& exclusive_upper_bound_partition_key() const {
+ const std::string& exclusive_upper_bound_partition_key() const {
return exclusive_upper_bound_partition_key_;
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/schema-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/schema-test.cc b/src/kudu/common/schema-test.cc
index 85c96da..a3554cc 100644
--- a/src/kudu/common/schema-test.cc
+++ b/src/kudu/common/schema-test.cc
@@ -33,6 +33,7 @@
namespace kudu {
namespace tablet {
+using std::string;
using std::unordered_map;
using std::vector;
using strings::Substitute;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/schema.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/schema.cc b/src/kudu/common/schema.cc
index c17ac31..a708d24 100644
--- a/src/kudu/common/schema.cc
+++ b/src/kudu/common/schema.cc
@@ -28,9 +28,11 @@
#include "kudu/util/status.h"
#include "kudu/common/row.h"
-namespace kudu {
-
+using std::string;
using std::unordered_set;
+using std::vector;
+
+namespace kudu {
// In a new schema, we typically would start assigning column IDs at 0. However, this
// makes it likely that in many test cases, the column IDs and the column indexes are
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/schema.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/schema.h b/src/kudu/common/schema.h
index a06581f..2de0c42 100644
--- a/src/kudu/common/schema.h
+++ b/src/kudu/common/schema.h
@@ -51,10 +51,6 @@
namespace kudu {
-using std::vector;
-using std::unordered_map;
-using std::unordered_set;
-
// The ID of a column. Each column in a table has a unique ID.
struct ColumnId {
explicit ColumnId(int32_t t_) : t(t_) {}
@@ -95,7 +91,7 @@ struct ColumnStorageAttributes {
cfile_block_size(0) {
}
- string ToString() const;
+ std::string ToString() const;
EncodingType encoding;
CompressionType compression;
@@ -158,7 +154,7 @@ class ColumnSchema {
// ColumnSchema col_c("c", INT32, false, &default_i32);
// Slice default_str("Hello");
// ColumnSchema col_d("d", STRING, false, &default_str);
- ColumnSchema(string name, DataType type, bool is_nullable = false,
+ ColumnSchema(std::string name, DataType type, bool is_nullable = false,
const void* read_default = NULL,
const void* write_default = NULL,
ColumnStorageAttributes attributes = ColumnStorageAttributes())
@@ -182,17 +178,17 @@ class ColumnSchema {
return is_nullable_;
}
- const string &name() const {
+ const std::string &name() const {
return name_;
}
// Return a string identifying this column, including its
// name.
- string ToString() const;
+ std::string ToString() const;
// Same as above, but only including the type information.
// For example, "STRING NOT NULL".
- string TypeToString() const;
+ std::string TypeToString() const;
// Returns true if the column has a read default value
bool has_read_default() const {
@@ -297,8 +293,8 @@ class ColumnSchema {
// Stringify the given cell. This just stringifies the cell contents,
// and doesn't include the column name or type.
- string Stringify(const void *cell) const {
- string ret;
+ std::string Stringify(const void *cell) const {
+ std::string ret;
type_info_->AppendDebugStringForValue(cell, &ret);
return ret;
}
@@ -329,11 +325,11 @@ class ColumnSchema {
private:
friend class SchemaBuilder;
- void set_name(const string& name) {
+ void set_name(const std::string& name) {
name_ = name;
}
- string name_;
+ std::string name_;
const TypeInfo *type_info_;
bool is_nullable_;
// use shared_ptr since the ColumnSchema is always copied around.
@@ -383,7 +379,7 @@ class Schema {
// empty schema and then use Reset(...) so that errors can be
// caught. If an invalid schema is passed to this constructor, an
// assertion will be fired!
- Schema(const vector<ColumnSchema>& cols,
+ Schema(const std::vector<ColumnSchema>& cols,
int key_columns)
: name_to_index_bytes_(0),
// TODO: C++11 provides a single-arg constructor
@@ -400,8 +396,8 @@ class Schema {
// empty schema and then use Reset(...) so that errors can be
// caught. If an invalid schema is passed to this constructor, an
// assertion will be fired!
- Schema(const vector<ColumnSchema>& cols,
- const vector<ColumnId>& ids,
+ Schema(const std::vector<ColumnSchema>& cols,
+ const std::vector<ColumnId>& ids,
int key_columns)
: name_to_index_bytes_(0),
// TODO: C++11 provides a single-arg constructor
@@ -415,7 +411,7 @@ class Schema {
// Reset this Schema object to the given schema.
// If this fails, the Schema object is left in an inconsistent
// state and may not be used.
- Status Reset(const vector<ColumnSchema>& cols, int key_columns) {
+ Status Reset(const std::vector<ColumnSchema>& cols, int key_columns) {
std::vector<ColumnId> ids;
return Reset(cols, ids, key_columns);
}
@@ -423,8 +419,8 @@ class Schema {
// Reset this Schema object to the given schema.
// If this fails, the Schema object is left in an inconsistent
// state and may not be used.
- Status Reset(const vector<ColumnSchema>& cols,
- const vector<ColumnId>& ids,
+ Status Reset(const std::vector<ColumnSchema>& cols,
+ const std::vector<ColumnId>& ids,
int key_columns);
// Return the number of bytes needed to represent a single row of this schema, without
@@ -553,7 +549,7 @@ class Schema {
// in a way suitable for debugging. This isn't currently optimized
// so should be avoided in hot paths.
template<class RowType>
- string DebugRow(const RowType& row) const {
+ std::string DebugRow(const RowType& row) const {
DCHECK_SCHEMA_EQ(*this, *row.schema());
return DebugRowColumns(row, num_columns());
}
@@ -562,7 +558,7 @@ class Schema {
// key-compatible with this one. Per above, this is not for use in
// hot paths.
template<class RowType>
- string DebugRowKey(const RowType& row) const {
+ std::string DebugRowKey(const RowType& row) const {
DCHECK_KEY_PROJECTION_SCHEMA_EQ(*this, *row.schema());
return DebugRowColumns(row, num_key_columns());
}
@@ -587,7 +583,7 @@ class Schema {
START_KEY,
END_KEY
};
- string DebugEncodedRowKey(Slice encoded_key, StartOrEnd start_or_end) const;
+ std::string DebugEncodedRowKey(Slice encoded_key, StartOrEnd start_or_end) const;
// Compare two rows of this schema.
template<class RowTypeA, class RowTypeB>
@@ -610,9 +606,9 @@ class Schema {
// TODO this should probably be cached since the key projection
// is not supposed to change, for a single schema.
Schema CreateKeyProjection() const {
- vector<ColumnSchema> key_cols(cols_.begin(),
+ std::vector<ColumnSchema> key_cols(cols_.begin(),
cols_.begin() + num_key_columns_);
- vector<ColumnId> col_ids;
+ std::vector<ColumnId> col_ids;
if (!col_ids_.empty()) {
col_ids.assign(col_ids_.begin(), col_ids_.begin() + num_key_columns_);
}
@@ -668,7 +664,7 @@ class Schema {
// Stringify this Schema. This is not particularly efficient,
// so should only be used when necessary for output.
- string ToString() const;
+ std::string ToString() const;
// Return true if the schemas have exactly the same set of columns
// and respective types.
@@ -803,7 +799,7 @@ class Schema {
// row.
template<class RowType>
std::string DebugRowColumns(const RowType& row, int num_columns) const {
- string ret;
+ std::string ret;
ret.append("(");
for (size_t col_idx = 0; col_idx < num_columns; col_idx++) {
@@ -819,11 +815,11 @@ class Schema {
friend class SchemaBuilder;
- vector<ColumnSchema> cols_;
+ std::vector<ColumnSchema> cols_;
size_t num_key_columns_;
ColumnId max_col_id_;
- vector<ColumnId> col_ids_;
- vector<size_t> col_offsets_;
+ std::vector<ColumnId> col_ids_;
+ std::vector<size_t> col_offsets_;
// The keys of this map are StringPiece references to the actual name members of the
// ColumnSchema objects inside cols_. This avoids an extra copy of those strings,
@@ -834,7 +830,7 @@ class Schema {
// measure its memory footprint.
int64_t name_to_index_bytes_;
typedef STLCountingAllocator<std::pair<const StringPiece, size_t> > NameToIndexMapAllocator;
- typedef unordered_map<
+ typedef std::unordered_map<
StringPiece,
size_t,
std::hash<StringPiece>,
@@ -886,27 +882,27 @@ class SchemaBuilder {
Schema Build() const { return Schema(cols_, col_ids_, num_key_columns_); }
Schema BuildWithoutIds() const { return Schema(cols_, num_key_columns_); }
- Status AddKeyColumn(const string& name, DataType type);
+ Status AddKeyColumn(const std::string& name, DataType type);
Status AddColumn(const ColumnSchema& column, bool is_key);
- Status AddColumn(const string& name, DataType type) {
+ Status AddColumn(const std::string& name, DataType type) {
return AddColumn(name, type, false, NULL, NULL);
}
- Status AddNullableColumn(const string& name, DataType type) {
+ Status AddNullableColumn(const std::string& name, DataType type) {
return AddColumn(name, type, true, NULL, NULL);
}
- Status AddColumn(const string& name,
+ Status AddColumn(const std::string& name,
DataType type,
bool is_nullable,
const void *read_default,
const void *write_default);
- Status RemoveColumn(const string& name);
+ Status RemoveColumn(const std::string& name);
- Status RenameColumn(const string& old_name, const string& new_name);
+ Status RenameColumn(const std::string& old_name, const std::string& new_name);
Status ApplyColumnSchemaDelta(const ColumnSchemaDelta& col_delta);
@@ -914,9 +910,9 @@ class SchemaBuilder {
DISALLOW_COPY_AND_ASSIGN(SchemaBuilder);
ColumnId next_id_;
- vector<ColumnId> col_ids_;
- vector<ColumnSchema> cols_;
- unordered_set<string> col_names_;
+ std::vector<ColumnId> col_ids_;
+ std::vector<ColumnSchema> cols_;
+ std::unordered_set<std::string> col_names_;
size_t num_key_columns_;
};
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/timestamp.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/timestamp.cc b/src/kudu/common/timestamp.cc
index 106210d..a9b07ff 100644
--- a/src/kudu/common/timestamp.cc
+++ b/src/kudu/common/timestamp.cc
@@ -39,7 +39,7 @@ void Timestamp::EncodeTo(faststring* dst) const {
PutMemcmpableVarint64(dst, v);
}
-string Timestamp::ToString() const {
+std::string Timestamp::ToString() const {
return strings::Substitute("$0", v);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/types.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/types.cc b/src/kudu/common/types.cc
index f55c4e6..1248516 100644
--- a/src/kudu/common/types.cc
+++ b/src/kudu/common/types.cc
@@ -24,6 +24,7 @@
#include "kudu/util/logging.h"
using std::shared_ptr;
+using std::string;
using std::unordered_map;
namespace kudu {
[3/6] kudu git commit: remove 'using std::...' and other from header
files
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/util.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/util.h b/src/kudu/gutil/strings/util.h
index 59db97d..fcd6b6d 100644
--- a/src/kudu/gutil/strings/util.h
+++ b/src/kudu/gutil/strings/util.h
@@ -35,12 +35,8 @@
#endif
#include <functional>
-using std::binary_function;
-using std::less;
#include <string>
-using std::string;
#include <vector>
-using std::vector;
#include "kudu/gutil/integral_types.h"
#include "kudu/gutil/port.h"
@@ -184,7 +180,7 @@ inline bool HasSuffixString(const StringPiece& str,
// The backslash character (\) is an escape character for * and ?
// We limit the patterns to having a max of 16 * or ? characters.
// ? matches 0 or 1 character, while * matches 0 or more characters.
-bool MatchPattern(const StringPiece& string,
+bool MatchPattern(const StringPiece& str,
const StringPiece& pattern);
// Returns where suffix begins in str, or NULL if str doesn't end with suffix.
@@ -248,7 +244,7 @@ inline ptrdiff_t strcount(const char* buf, size_t len, char c) {
return strcount(buf, buf + len, c);
}
// Returns the number of times a character occurs in a string for a C++ string:
-inline ptrdiff_t strcount(const string& buf, char c) {
+inline ptrdiff_t strcount(const std::string& buf, char c) {
return strcount(buf.c_str(), buf.size(), c);
}
@@ -267,7 +263,7 @@ char* AdjustedLastPos(const char* str, char separator, int n);
// Compares two char* strings for equality. (Works with NULL, which compares
// equal only to another NULL). Useful in hash tables:
// hash_map<const char*, Value, hash<const char*>, streq> ht;
-struct streq : public binary_function<const char*, const char*, bool> {
+struct streq : public std::binary_function<const char*, const char*, bool> {
bool operator()(const char* s1, const char* s2) const {
return ((s1 == 0 && s2 == 0) ||
(s1 && s2 && *s1 == *s2 && strcmp(s1, s2) == 0));
@@ -277,7 +273,7 @@ struct streq : public binary_function<const char*, const char*, bool> {
// Compares two char* strings. (Works with NULL, which compares greater than any
// non-NULL). Useful in maps:
// map<const char*, Value, strlt> m;
-struct strlt : public binary_function<const char*, const char*, bool> {
+struct strlt : public std::binary_function<const char*, const char*, bool> {
bool operator()(const char* s1, const char* s2) const {
return (s1 != s2) && (s2 == 0 || (s1 != 0 && strcmp(s1, s2) < 0));
}
@@ -298,7 +294,7 @@ inline bool IsAscii(const StringPiece& str) {
//
// Examples:
// "a" -> "b", "aaa" -> "aab", "aa\xff" -> "ab", "\xff" -> "", "" -> ""
-string PrefixSuccessor(const StringPiece& prefix);
+std::string PrefixSuccessor(const StringPiece& prefix);
// Returns the immediate lexicographically-following string. This is useful to
// turn an inclusive range into something that can be used with Bigtable's
@@ -317,7 +313,7 @@ string PrefixSuccessor(const StringPiece& prefix);
//
// WARNING: Transforms "" -> "\0"; this doesn't account for Bigtable's special
// treatment of "" as infinity.
-string ImmediateSuccessor(const StringPiece& s);
+std::string ImmediateSuccessor(const StringPiece& s);
// Fills in *separator with a short string less than limit but greater than or
// equal to start. If limit is greater than start, *separator is the common
@@ -327,7 +323,7 @@ string ImmediateSuccessor(const StringPiece& s);
// FindShortestSeparator("abracadabra", "bacradabra", &sep) => sep == "b"
// If limit is less than or equal to start, fills in *separator with start.
void FindShortestSeparator(const StringPiece& start, const StringPiece& limit,
- string* separator);
+ std::string* separator);
// Copies at most n-1 bytes from src to dest, and returns dest. If n >=1, null
// terminates dest; otherwise, returns dest unchanged. Unlike strncpy(), only
@@ -360,11 +356,11 @@ size_t strlcpy(char* dst, const char* src, size_t dst_size);
// Replaces the first occurrence (if replace_all is false) or all occurrences
// (if replace_all is true) of oldsub in s with newsub. In the second version,
// *res must be distinct from all the other arguments.
-string StringReplace(const StringPiece& s, const StringPiece& oldsub,
+std::string StringReplace(const StringPiece& s, const StringPiece& oldsub,
const StringPiece& newsub, bool replace_all);
void StringReplace(const StringPiece& s, const StringPiece& oldsub,
const StringPiece& newsub, bool replace_all,
- string* res);
+ std::string* res);
// Replaces all occurrences of substring in s with replacement. Returns the
// number of instances replaced. s must be distinct from the other arguments.
@@ -372,12 +368,12 @@ void StringReplace(const StringPiece& s, const StringPiece& oldsub,
// Less flexible, but faster, than RE::GlobalReplace().
int GlobalReplaceSubstring(const StringPiece& substring,
const StringPiece& replacement,
- string* s);
+ std::string* s);
// Removes v[i] for every element i in indices. Does *not* preserve the order of
// v. indices must be sorted in strict increasing order (no duplicates). Runs in
// O(indices.size()).
-void RemoveStrings(vector<string>* v, const vector<int>& indices);
+void RemoveStrings(std::vector<std::string>* v, const std::vector<int>& indices);
// Case-insensitive strstr(); use system strcasestr() instead.
// WARNING: Removes const-ness of string argument!
@@ -424,7 +420,7 @@ const char* strstr_delimited(const char* haystack,
char* gstrsep(char** stringp, const char* delim);
// Appends StringPiece(data, len) to *s.
-void FastStringAppend(string* s, const char* data, int len);
+void FastStringAppend(std::string* s, const char* data, int len);
// Returns a duplicate of the_string, with memory allocated by new[].
char* strdup_with_new(const char* the_string);
@@ -478,12 +474,12 @@ bool FindTagValuePair(const char* in_str, char tag_value_separator,
// Inserts separator after every interval characters in *s (but never appends to
// the end of the original *s).
-void UniformInsertString(string* s, int interval, const char* separator);
+void UniformInsertString(std::string* s, int interval, const char* separator);
// Inserts separator into s at each specified index. indices must be sorted in
// ascending order.
void InsertString(
- string* s, const vector<uint32>& indices, char const* separator);
+ std::string* s, const std::vector<uint32>& indices, char const* separator);
// Finds the nth occurrence of c in n; returns the index in s of that
// occurrence, or string::npos if fewer than n occurrences.
@@ -509,6 +505,6 @@ int SafeSnprintf(char* str, size_t size, const char* format, ...)
// Reads a line (terminated by delim) from file into *str. Reads delim from
// file, but doesn't copy it into *str. Returns true if read a delim-terminated
// line, or false on end-of-file or error.
-bool GetlineFromStdioFile(FILE* file, string* str, char delim);
+bool GetlineFromStdioFile(FILE* file, std::string* str, char delim);
#endif // STRINGS_UTIL_H_
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strtoint.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strtoint.h b/src/kudu/gutil/strtoint.h
index b581385..96d4856 100644
--- a/src/kudu/gutil/strtoint.h
+++ b/src/kudu/gutil/strtoint.h
@@ -32,7 +32,6 @@
#include <stdlib.h> // For strtol* functions.
#include <string>
-using std::string;
#include "kudu/gutil/integral_types.h"
#include "kudu/gutil/macros.h"
#include "kudu/gutil/port.h"
@@ -82,11 +81,11 @@ inline int64 atoi64(const char *nptr) {
}
// Convenience versions of the above that take a string argument.
-inline int32 atoi32(const string &s) {
+inline int32 atoi32(const std::string &s) {
return atoi32(s.c_str());
}
-inline int64 atoi64(const string &s) {
+inline int64 atoi64(const std::string &s) {
return atoi64(s.c_str());
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/type_traits.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/type_traits.h b/src/kudu/gutil/type_traits.h
index a4e874f..2f72028 100644
--- a/src/kudu/gutil/type_traits.h
+++ b/src/kudu/gutil/type_traits.h
@@ -60,8 +60,6 @@
#define BASE_TYPE_TRAITS_H_
#include <utility>
-using std::make_pair;
-using std::pair; // For pair
#include "kudu/gutil/template_util.h" // For true_type and false_type
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/walltime.cc
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/walltime.cc b/src/kudu/gutil/walltime.cc
index 89a805e..0224a53 100644
--- a/src/kudu/gutil/walltime.cc
+++ b/src/kudu/gutil/walltime.cc
@@ -57,7 +57,7 @@ static inline time_t gmktime(struct tm *tm) {
return rt < 0 ? time_t(-1) : rt;
}
-static void StringAppendStrftime(string* dst,
+static void StringAppendStrftime(std::string* dst,
const char* format,
const struct tm* tm) {
char space[1024];
@@ -183,7 +183,7 @@ WallTime WallTime_Now() {
#endif // defined(__APPLE__)
}
-void StringAppendStrftime(string* dst,
+void StringAppendStrftime(std::string* dst,
const char* format,
time_t when,
bool local) {
@@ -201,8 +201,8 @@ void StringAppendStrftime(string* dst,
StringAppendStrftime(dst, format, &tm);
}
-string LocalTimeAsString() {
- string ret;
+std::string LocalTimeAsString() {
+ std::string ret;
StringAppendStrftime(&ret, "%Y-%m-%d %H:%M:%S %Z", time(nullptr), true);
return ret;
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/walltime.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/walltime.h b/src/kudu/gutil/walltime.h
index e6a1294..9f5a4d7 100644
--- a/src/kudu/gutil/walltime.h
+++ b/src/kudu/gutil/walltime.h
@@ -23,7 +23,6 @@
#include <glog/logging.h>
#include <string>
-using std::string;
#if defined(__APPLE__)
#include <mach/clock.h>
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/all_types-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/all_types-itest.cc b/src/kudu/integration-tests/all_types-itest.cc
index 6dd1830..2b973cf 100644
--- a/src/kudu/integration-tests/all_types-itest.cc
+++ b/src/kudu/integration-tests/all_types-itest.cc
@@ -28,6 +28,7 @@
DEFINE_int32(num_rows_per_tablet, 100, "The number of rows to be inserted into each tablet");
+using std::string;
using std::vector;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/alter_table-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/alter_table-test.cc b/src/kudu/integration-tests/alter_table-test.cc
index 5c63537..3b79744 100644
--- a/src/kudu/integration-tests/alter_table-test.cc
+++ b/src/kudu/integration-tests/alter_table-test.cc
@@ -80,6 +80,7 @@ using master::AlterTableResponsePB;
using std::atomic;
using std::map;
using std::pair;
+using std::string;
using std::unique_ptr;
using std::vector;
using tablet::TabletReplica;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/client-negotiation-failover-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/client-negotiation-failover-itest.cc b/src/kudu/integration-tests/client-negotiation-failover-itest.cc
index 8f5ff13..18c285a 100644
--- a/src/kudu/integration-tests/client-negotiation-failover-itest.cc
+++ b/src/kudu/integration-tests/client-negotiation-failover-itest.cc
@@ -47,8 +47,8 @@ using kudu::client::KuduTableCreator;
using kudu::client::sp::shared_ptr;
using std::string;
using std::thread;
-using std::vector;
using std::unique_ptr;
+using std::vector;
using strings::Substitute;
DECLARE_bool(rpc_reopen_outbound_connections);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/client-stress-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/client-stress-test.cc b/src/kudu/integration-tests/client-stress-test.cc
index 2d7c0b7..7cc9ba4 100644
--- a/src/kudu/integration-tests/client-stress-test.cc
+++ b/src/kudu/integration-tests/client-stress-test.cc
@@ -36,6 +36,8 @@ METRIC_DECLARE_counter(leader_memory_pressure_rejections);
METRIC_DECLARE_counter(follower_memory_pressure_rejections);
using strings::Substitute;
+using std::set;
+using std::string;
using std::vector;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/cluster_itest_util.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/cluster_itest_util.h b/src/kudu/integration-tests/cluster_itest_util.h
index 017da70..4cda935 100644
--- a/src/kudu/integration-tests/cluster_itest_util.h
+++ b/src/kudu/integration-tests/cluster_itest_util.h
@@ -218,9 +218,9 @@ Status FindTabletLeader(const TabletServerMap& tablet_servers,
// Grabs list of followers using FindTabletLeader() above.
Status FindTabletFollowers(const TabletServerMap& tablet_servers,
- const string& tablet_id,
+ const std::string& tablet_id,
const MonoDelta& timeout,
- vector<TServerDetails*>* followers);
+ std::vector<TServerDetails*>* followers);
// Start an election on the specified tserver.
// 'timeout' only refers to the RPC asking the peer to start an election. The
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/cluster_verifier.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/cluster_verifier.cc b/src/kudu/integration-tests/cluster_verifier.cc
index f13a7f0..a5f0312 100644
--- a/src/kudu/integration-tests/cluster_verifier.cc
+++ b/src/kudu/integration-tests/cluster_verifier.cc
@@ -44,7 +44,7 @@ using tools::RemoteKsckMaster;
ClusterVerifier::ClusterVerifier(ExternalMiniCluster* cluster)
: cluster_(cluster),
- checksum_options_(ChecksumOptions()),
+ checksum_options_(tools::ChecksumOptions()),
operations_timeout_(MonoDelta::FromSeconds(60)) {
checksum_options_.use_snapshot = false;
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/cluster_verifier.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/cluster_verifier.h b/src/kudu/integration-tests/cluster_verifier.h
index 50aa8b0..11d2656 100644
--- a/src/kudu/integration-tests/cluster_verifier.h
+++ b/src/kudu/integration-tests/cluster_verifier.h
@@ -26,8 +26,6 @@
namespace kudu {
-using tools::ChecksumOptions;
-
class ExternalMiniCluster;
class MonoDelta;
@@ -90,7 +88,7 @@ class ClusterVerifier {
ExternalMiniCluster* cluster_;
- ChecksumOptions checksum_options_;
+ tools::ChecksumOptions checksum_options_;
MonoDelta operations_timeout_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/create-table-stress-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/create-table-stress-test.cc b/src/kudu/integration-tests/create-table-stress-test.cc
index e9483d3..fbdd96c 100644
--- a/src/kudu/integration-tests/create-table-stress-test.cc
+++ b/src/kudu/integration-tests/create-table-stress-test.cc
@@ -55,8 +55,10 @@ DECLARE_bool(log_preallocate_segments);
DEFINE_int32(num_test_tablets, 60, "Number of tablets for stress test");
using std::shared_ptr;
+using std::string;
using std::thread;
using std::unique_ptr;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/disk_reservation-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/disk_reservation-itest.cc b/src/kudu/integration-tests/disk_reservation-itest.cc
index b5b589f..23a8ea2 100644
--- a/src/kudu/integration-tests/disk_reservation-itest.cc
+++ b/src/kudu/integration-tests/disk_reservation-itest.cc
@@ -24,6 +24,7 @@
#include "kudu/util/metrics.h"
using std::string;
+using std::vector;
using strings::Substitute;
METRIC_DECLARE_entity(server);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/exactly_once_writes-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/exactly_once_writes-itest.cc b/src/kudu/integration-tests/exactly_once_writes-itest.cc
index 03466f7..bd7f08d 100644
--- a/src/kudu/integration-tests/exactly_once_writes-itest.cc
+++ b/src/kudu/integration-tests/exactly_once_writes-itest.cc
@@ -21,6 +21,9 @@
#include "kudu/util/logging.h"
#include "kudu/util/pb_util.h"
+using std::string;
+using std::vector;
+
namespace kudu {
namespace tserver {
@@ -69,7 +72,7 @@ void ExactlyOnceSemanticsITest::WriteRowsAndCollectResponses(int thread_idx,
Sockaddr address = cluster_.get()->tablet_server(
thread_idx % FLAGS_num_replicas)->bound_rpc_addr();
- RpcController controller;
+ rpc::RpcController controller;
const Schema schema = GetSimpleTestSchema();
@@ -151,7 +154,7 @@ void ExactlyOnceSemanticsITest::DoTestWritesWithExactlyOnceSemantics(
NO_FATALS(BuildAndStart(ts_flags, master_flags));
- vector<TServerDetails*> tservers;
+ vector<itest::TServerDetails*> tservers;
AppendValuesFromMap(tablet_servers_, &tservers);
vector<scoped_refptr<kudu::Thread>> threads;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/external_mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/external_mini_cluster.cc b/src/kudu/integration-tests/external_mini_cluster.cc
index fa7bed5..2acca30 100644
--- a/src/kudu/integration-tests/external_mini_cluster.cc
+++ b/src/kudu/integration-tests/external_mini_cluster.cc
@@ -67,6 +67,7 @@ using rapidjson::Value;
using std::string;
using std::unique_ptr;
using std::unordered_set;
+using std::vector;
using strings::Substitute;
typedef ListTabletsResponsePB::StatusAndSchemaPB StatusAndSchemaPB;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/flex_partitioning-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/flex_partitioning-itest.cc b/src/kudu/integration-tests/flex_partitioning-itest.cc
index deb5831..a2888f4 100644
--- a/src/kudu/integration-tests/flex_partitioning-itest.cc
+++ b/src/kudu/integration-tests/flex_partitioning-itest.cc
@@ -56,6 +56,8 @@ using kudu::master::GetTableLocationsRequestPB;
using kudu::master::GetTableLocationsResponsePB;
using kudu::master::MasterErrorPB;
using kudu::rpc::RpcController;
+using std::pair;
+using std::string;
using std::unique_ptr;
using std::unordered_map;
using std::vector;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/internal_mini_cluster.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/internal_mini_cluster.cc b/src/kudu/integration-tests/internal_mini_cluster.cc
index ec8ff70..6497668 100644
--- a/src/kudu/integration-tests/internal_mini_cluster.cc
+++ b/src/kudu/integration-tests/internal_mini_cluster.cc
@@ -34,6 +34,8 @@
#include "kudu/util/stopwatch.h"
#include "kudu/util/test_util.h"
+using std::string;
+using std::vector;
using strings::Substitute;
namespace kudu {
@@ -242,7 +244,7 @@ Status InternalMiniCluster::WaitForTabletServerCount(int count) const {
Status InternalMiniCluster::WaitForTabletServerCount(int count,
MatchMode mode,
vector<shared_ptr<TSDescriptor>>* descs) const {
- unordered_set<int> masters_to_search;
+ std::unordered_set<int> masters_to_search;
for (int i = 0; i < num_masters(); i++) {
if (!mini_master(i)->master()->IsShutdown()) {
masters_to_search.insert(i);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/linked_list-test-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/linked_list-test-util.h b/src/kudu/integration-tests/linked_list-test-util.h
index 97d149a..a73b65a 100644
--- a/src/kudu/integration-tests/linked_list-test-util.h
+++ b/src/kudu/integration-tests/linked_list-test-util.h
@@ -56,7 +56,7 @@ static const int64_t kSnapshotAtNow = -1;
static const int64_t kNoParticularCountExpected = -1;
// Vector of snapshot timestamp, count pairs.
-typedef vector<pair<uint64_t, int64_t> > SnapsAndCounts;
+typedef std::vector<std::pair<uint64_t, int64_t> > SnapsAndCounts;
// Provides methods for writing data and reading it back in such a way that
// facilitates checking for data integrity.
@@ -306,7 +306,7 @@ class PeriodicWebUIChecker {
const std::string& tablet_id, MonoDelta period)
: period_(period), is_running_(true) {
// List of master and ts web pages to fetch
- vector<std::string> master_pages, ts_pages;
+ std::vector<std::string> master_pages, ts_pages;
master_pages.emplace_back("/metrics");
master_pages.emplace_back("/masters");
@@ -382,7 +382,7 @@ class PeriodicWebUIChecker {
const MonoDelta period_;
AtomicBool is_running_;
scoped_refptr<Thread> checker_;
- vector<std::string> urls_;
+ std::vector<std::string> urls_;
};
// Helper class to hold results from a linked list scan and perform the
@@ -433,7 +433,7 @@ std::vector<const KuduPartialRow*> LinkedListTester::GenerateSplitRows(
}
std::vector<int64_t> LinkedListTester::GenerateSplitInts() {
- vector<int64_t> ret;
+ std::vector<int64_t> ret;
ret.reserve(num_tablets_ - 1);
int64_t increment = kint64max / num_tablets_;
for (int64_t i = 1; i < num_tablets_; i++) {
@@ -565,7 +565,7 @@ void LinkedListTester::DumpInsertHistogram(bool print_flags) {
// If it does, *errors will be incremented once per duplicate and the given message
// will be logged.
static void VerifyNoDuplicateEntries(const std::vector<int64_t>& ints, int* errors,
- const string& message) {
+ const std::string& message) {
for (int i = 1; i < ints.size(); i++) {
if (ints[i] == ints[i - 1]) {
LOG(ERROR) << message << ": " << ints[i];
@@ -581,7 +581,7 @@ Status LinkedListTester::VerifyLinkedListRemote(
client::sp::shared_ptr<client::KuduTable> table;
RETURN_NOT_OK(client_->OpenTable(table_name_, &table));
- string snapshot_str;
+ std::string snapshot_str;
if (snapshot_timestamp == kSnapshotAtNow) {
snapshot_str = "NOW";
} else {
@@ -696,8 +696,9 @@ Status LinkedListTester::WaitAndVerify(int seconds_to_run,
const boost::function<Status(const std::string&)>& cb,
WaitAndVerifyMode mode) {
- std::list<pair<int64_t, int64_t> > samples_as_list(sampled_timestamps_and_counts_.begin(),
- sampled_timestamps_and_counts_.end());
+ std::list<std::pair<int64_t, int64_t>> samples_as_list(
+ sampled_timestamps_and_counts_.begin(),
+ sampled_timestamps_and_counts_.end());
int64_t seen = 0;
bool called = false;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/linked_list-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/linked_list-test.cc b/src/kudu/integration-tests/linked_list-test.cc
index 16e8d60..f9fbe9b 100644
--- a/src/kudu/integration-tests/linked_list-test.cc
+++ b/src/kudu/integration-tests/linked_list-test.cc
@@ -54,6 +54,8 @@ using kudu::client::KuduClientBuilder;
using kudu::client::KuduSchema;
using kudu::client::sp::shared_ptr;
using kudu::itest::TServerDetails;
+using std::string;
+using std::vector;
DEFINE_int32(seconds_to_run, 5, "Number of seconds for which to run the test");
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/master_migration-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/master_migration-itest.cc b/src/kudu/integration-tests/master_migration-itest.cc
index 338c4f7..095086a 100644
--- a/src/kudu/integration-tests/master_migration-itest.cc
+++ b/src/kudu/integration-tests/master_migration-itest.cc
@@ -42,6 +42,7 @@ using kudu::client::KuduTable;
using kudu::client::KuduTableCreator;
using kudu::client::sp::shared_ptr;
using kudu::master::SysCatalogTable;
+using std::pair;
using std::string;
using std::vector;
using std::unique_ptr;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/master_replication-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/master_replication-itest.cc b/src/kudu/integration-tests/master_replication-itest.cc
index 0f3e22e..affd267 100644
--- a/src/kudu/integration-tests/master_replication-itest.cc
+++ b/src/kudu/integration-tests/master_replication-itest.cc
@@ -33,6 +33,7 @@
#include "kudu/util/pb_util.h"
#include "kudu/util/test_util.h"
+using std::string;
using std::vector;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/raft_consensus-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/raft_consensus-itest.cc b/src/kudu/integration-tests/raft_consensus-itest.cc
index 65684df..918ac0a 100644
--- a/src/kudu/integration-tests/raft_consensus-itest.cc
+++ b/src/kudu/integration-tests/raft_consensus-itest.cc
@@ -78,6 +78,7 @@ using consensus::ConsensusResponsePB;
using consensus::ConsensusServiceProxy;
using consensus::MajoritySize;
using consensus::MakeOpId;
+using consensus::OpId;
using consensus::RaftPeerPB;
using consensus::ReplicateMsg;
using itest::AddServer;
@@ -85,6 +86,8 @@ using itest::GetReplicaStatusAndCheckIfLeader;
using itest::LeaderStepDown;
using itest::RemoveServer;
using itest::StartElection;
+using itest::TabletServerMap;
+using itest::TServerDetails;
using itest::WaitUntilLeader;
using itest::WriteSimpleTestRow;
using master::TabletLocationsPB;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/security-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/security-itest.cc b/src/kudu/integration-tests/security-itest.cc
index bb0fd1f..13f3ac1 100644
--- a/src/kudu/integration-tests/security-itest.cc
+++ b/src/kudu/integration-tests/security-itest.cc
@@ -43,6 +43,7 @@ using kudu::client::KuduSession;
using kudu::client::KuduTable;
using kudu::client::KuduTableCreator;
using kudu::rpc::Messenger;
+using std::string;
using std::unique_ptr;
using std::vector;
using strings::Substitute;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/tablet_copy-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/tablet_copy-itest.cc b/src/kudu/integration-tests/tablet_copy-itest.cc
index 83c61d0..3a53687 100644
--- a/src/kudu/integration-tests/tablet_copy-itest.cc
+++ b/src/kudu/integration-tests/tablet_copy-itest.cc
@@ -470,7 +470,7 @@ TEST_F(TabletCopyITest, TestConcurrentTabletCopys) {
vector<const KuduPartialRow*> splits;
for (int i = 0; i < kNumTablets - 1; i++) {
KuduPartialRow* row = client_schema.NewRow();
- ASSERT_OK(row->SetInt32(0, numeric_limits<int32_t>::max() / kNumTablets * (i + 1)));
+ ASSERT_OK(row->SetInt32(0, std::numeric_limits<int32_t>::max() / kNumTablets * (i + 1)));
splits.push_back(row);
}
gscoped_ptr<KuduTableCreator> table_creator(client_->NewTableCreator());
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/test_workload.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/test_workload.cc b/src/kudu/integration-tests/test_workload.cc
index 37959a3..0669daa 100644
--- a/src/kudu/integration-tests/test_workload.cc
+++ b/src/kudu/integration-tests/test_workload.cc
@@ -81,7 +81,7 @@ void TestWorkload::set_schema(const client::KuduSchema& schema) {
// Do some sanity checks on the schema. They reflect how the rest of
// TestWorkload is going to use the schema.
CHECK_GT(schema.num_columns(), 0) << "Schema should have at least one column";
- vector<int> key_indexes;
+ std::vector<int> key_indexes;
schema.GetPrimaryKeyColumnIndexes(&key_indexes);
CHECK_EQ(1, key_indexes.size()) << "Schema should have just one key column";
CHECK_EQ(0, key_indexes[0]) << "Schema's key column should be index 0";
@@ -150,7 +150,7 @@ void TestWorkload::WriteThread() {
tools::GenerateDataForRow(schema_, key, &rng_, row);
if (payload_bytes_) {
// Note: overriding payload_bytes_ requires the "simple" schema.
- string test_payload(payload_bytes_.get(), '0');
+ std::string test_payload(payload_bytes_.get(), '0');
CHECK_OK(row->SetStringCopy(2, test_payload));
}
CHECK_OK(session->Apply(insert.release()));
@@ -246,7 +246,7 @@ void TestWorkload::Setup() {
if (!table_exists) {
// Create split rows.
- vector<const KuduPartialRow*> splits;
+ std::vector<const KuduPartialRow*> splits;
for (int i = 1; i < num_tablets_; i++) {
KuduPartialRow* r = schema_.NewRow();
CHECK_OK(r->SetInt32("key", MathLimits<int32_t>::kMax / num_tablets_ * i));
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/ts_itest-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/ts_itest-base.h b/src/kudu/integration-tests/ts_itest-base.h
index 52978c5..2a4e9f0 100644
--- a/src/kudu/integration-tests/ts_itest-base.h
+++ b/src/kudu/integration-tests/ts_itest-base.h
@@ -51,18 +51,6 @@ DEFINE_int32(num_replicas, 3, "Number of replicas per tablet server");
namespace kudu {
namespace tserver {
-using client::KuduSchemaFromSchema;
-using consensus::OpId;
-using consensus::RaftPeerPB;
-using itest::GetReplicaStatusAndCheckIfLeader;
-using itest::TabletReplicaMap;
-using itest::TabletServerMap;
-using itest::TServerDetails;
-using master::GetTableLocationsRequestPB;
-using master::GetTableLocationsResponsePB;
-using master::TabletLocationsPB;
-using rpc::RpcController;
-
static const int kMaxRetries = 20;
// A base for tablet server integration tests.
@@ -138,13 +126,13 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
// Waits that all replicas for a all tablets of 'table_id' table are online
// and creates the tablet_replicas_ map.
- void WaitForReplicasAndUpdateLocations(const string& table_id = kTableId) {
+ void WaitForReplicasAndUpdateLocations(const std::string& table_id = kTableId) {
bool replicas_missing = true;
for (int num_retries = 0; replicas_missing && num_retries < kMaxRetries; num_retries++) {
- std::unordered_multimap<std::string, TServerDetails*> tablet_replicas;
- GetTableLocationsRequestPB req;
- GetTableLocationsResponsePB resp;
- RpcController controller;
+ std::unordered_multimap<std::string, itest::TServerDetails*> tablet_replicas;
+ master::GetTableLocationsRequestPB req;
+ master::GetTableLocationsResponsePB resp;
+ rpc::RpcController controller;
req.mutable_table()->set_table_name(table_id);
controller.set_timeout(MonoDelta::FromSeconds(1));
CHECK_OK(cluster_->master_proxy()->GetTableLocations(req, &resp, &controller));
@@ -171,8 +159,10 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
for (const master::TabletLocationsPB& location : resp.tablet_locations()) {
for (const master::TabletLocationsPB_ReplicaPB& replica : location.replicas()) {
- TServerDetails* server = FindOrDie(tablet_servers_, replica.ts_info().permanent_uuid());
- tablet_replicas.insert(pair<std::string, TServerDetails*>(location.tablet_id(), server));
+ itest::TServerDetails* server =
+ FindOrDie(tablet_servers_, replica.ts_info().permanent_uuid());
+ tablet_replicas.insert(std::pair<std::string, itest::TServerDetails*>(
+ location.tablet_id(), server));
}
if (tablet_replicas.count(location.tablet_id()) < FLAGS_num_replicas) {
@@ -215,35 +205,35 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
// Returns the last committed leader of the consensus configuration. Tries to get it from master
// but then actually tries to the get the committed consensus configuration to make sure.
- TServerDetails* GetLeaderReplicaOrNull(const std::string& tablet_id) {
+ itest::TServerDetails* GetLeaderReplicaOrNull(const std::string& tablet_id) {
std::string leader_uuid;
Status master_found_leader_result = GetTabletLeaderUUIDFromMaster(tablet_id, &leader_uuid);
// See if the master is up to date. I.e. if it does report a leader and if the
// replica it reports as leader is still alive and (at least thinks) its still
// the leader.
- TServerDetails* leader;
+ itest::TServerDetails* leader;
if (master_found_leader_result.ok()) {
leader = GetReplicaWithUuidOrNull(tablet_id, leader_uuid);
- if (leader && GetReplicaStatusAndCheckIfLeader(leader, tablet_id,
- MonoDelta::FromMilliseconds(100)).ok()) {
+ if (leader && itest::GetReplicaStatusAndCheckIfLeader(
+ leader, tablet_id, MonoDelta::FromMilliseconds(100)).ok()) {
return leader;
}
}
// The replica we got from the master (if any) is either dead or not the leader.
// Find the actual leader.
- pair<TabletReplicaMap::iterator, TabletReplicaMap::iterator> range =
+ std::pair<itest::TabletReplicaMap::iterator, itest::TabletReplicaMap::iterator> range =
tablet_replicas_.equal_range(tablet_id);
- std::vector<TServerDetails*> replicas_copy;
+ std::vector<itest::TServerDetails*> replicas_copy;
for (;range.first != range.second; ++range.first) {
replicas_copy.push_back((*range.first).second);
}
std::random_shuffle(replicas_copy.begin(), replicas_copy.end());
- for (TServerDetails* replica : replicas_copy) {
- if (GetReplicaStatusAndCheckIfLeader(replica, tablet_id,
- MonoDelta::FromMilliseconds(100)).ok()) {
+ for (itest::TServerDetails* replica : replicas_copy) {
+ if (itest::GetReplicaStatusAndCheckIfLeader(
+ replica, tablet_id, MonoDelta::FromMilliseconds(100)).ok()) {
return replica;
}
}
@@ -253,22 +243,22 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
// For the last committed consensus configuration, return the last committed
// leader of the consensus configuration and its followers.
Status GetTabletLeaderAndFollowers(const std::string& tablet_id,
- TServerDetails** leader,
- vector<TServerDetails*>* followers) {
- pair<TabletReplicaMap::iterator, TabletReplicaMap::iterator> range =
+ itest::TServerDetails** leader,
+ std::vector<itest::TServerDetails*>* followers) {
+ std::pair<itest::TabletReplicaMap::iterator, itest::TabletReplicaMap::iterator> range =
tablet_replicas_.equal_range(tablet_id);
- std::vector<TServerDetails*> replicas;
+ std::vector<itest::TServerDetails*> replicas;
for (; range.first != range.second; ++range.first) {
replicas.push_back((*range.first).second);
}
- TServerDetails* leader_replica = nullptr;
+ itest::TServerDetails* leader_replica = nullptr;
auto it = replicas.begin();
for (; it != replicas.end(); ++it) {
- TServerDetails* replica = *it;
+ itest::TServerDetails* replica = *it;
bool found_leader_replica = false;
for (auto i = 0; i < kMaxRetries; ++i) {
- if (GetReplicaStatusAndCheckIfLeader(
+ if (itest::GetReplicaStatusAndCheckIfLeader(
replica, tablet_id, MonoDelta::FromMilliseconds(100)).ok()) {
leader_replica = replica;
found_leader_replica = true;
@@ -295,7 +285,7 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
}
Status GetLeaderReplicaWithRetries(const std::string& tablet_id,
- TServerDetails** leader,
+ itest::TServerDetails** leader,
int max_attempts = 100) {
int attempts = 0;
while (attempts < max_attempts) {
@@ -310,17 +300,17 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
}
Status GetTabletLeaderUUIDFromMaster(const std::string& tablet_id, std::string* leader_uuid) {
- GetTableLocationsRequestPB req;
- GetTableLocationsResponsePB resp;
- RpcController controller;
+ master::GetTableLocationsRequestPB req;
+ master::GetTableLocationsResponsePB resp;
+ rpc::RpcController controller;
controller.set_timeout(MonoDelta::FromMilliseconds(100));
req.mutable_table()->set_table_name(kTableId);
RETURN_NOT_OK(cluster_->master_proxy()->GetTableLocations(req, &resp, &controller));
- for (const TabletLocationsPB& loc : resp.tablet_locations()) {
+ for (const master::TabletLocationsPB& loc : resp.tablet_locations()) {
if (loc.tablet_id() == tablet_id) {
- for (const TabletLocationsPB::ReplicaPB& replica : loc.replicas()) {
- if (replica.role() == RaftPeerPB::LEADER) {
+ for (const master::TabletLocationsPB::ReplicaPB& replica : loc.replicas()) {
+ if (replica.role() == consensus::RaftPeerPB::LEADER) {
*leader_uuid = replica.ts_info().permanent_uuid();
return Status::OK();
}
@@ -330,9 +320,9 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
return Status::NotFound("Unable to find leader for tablet", tablet_id);
}
- TServerDetails* GetReplicaWithUuidOrNull(const std::string& tablet_id,
+ itest::TServerDetails* GetReplicaWithUuidOrNull(const std::string& tablet_id,
const std::string& uuid) {
- pair<TabletReplicaMap::iterator, TabletReplicaMap::iterator> range =
+ std::pair<itest::TabletReplicaMap::iterator, itest::TabletReplicaMap::iterator> range =
tablet_replicas_.equal_range(tablet_id);
for (;range.first != range.second; ++range.first) {
if ((*range.first).second->instance_id.permanent_uuid() == uuid) {
@@ -344,7 +334,7 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
// Gets the the locations of the consensus configuration and waits until all replicas
// are available for all tablets.
- void WaitForTSAndReplicas(const string& table_id = kTableId) {
+ void WaitForTSAndReplicas(const std::string& table_id = kTableId) {
int num_retries = 0;
// make sure the replicas are up and find the leader
while (true) {
@@ -366,7 +356,7 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
// Removes a set of servers from the replicas_ list.
// Handy for controlling who to validate against after killing servers.
- void PruneFromReplicas(const unordered_set<std::string>& uuids) {
+ void PruneFromReplicas(const std::unordered_set<std::string>& uuids) {
auto iter = tablet_replicas_.begin();
while (iter != tablet_replicas_.end()) {
if (uuids.count((*iter).second->instance_id.permanent_uuid()) != 0) {
@@ -382,25 +372,25 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
}
void GetOnlyLiveFollowerReplicas(const std::string& tablet_id,
- std::vector<TServerDetails*>* followers) {
+ std::vector<itest::TServerDetails*>* followers) {
followers->clear();
- TServerDetails* leader;
+ itest::TServerDetails* leader;
CHECK_OK(GetLeaderReplicaWithRetries(tablet_id, &leader));
- std::vector<TServerDetails*> replicas;
- pair<TabletReplicaMap::iterator, TabletReplicaMap::iterator> range =
+ std::vector<itest::TServerDetails*> replicas;
+ std::pair<itest::TabletReplicaMap::iterator, itest::TabletReplicaMap::iterator> range =
tablet_replicas_.equal_range(tablet_id);
for (;range.first != range.second; ++range.first) {
replicas.push_back((*range.first).second);
}
- for (TServerDetails* replica : replicas) {
+ for (itest::TServerDetails* replica : replicas) {
if (leader != NULL &&
replica->instance_id.permanent_uuid() == leader->instance_id.permanent_uuid()) {
continue;
}
- Status s = GetReplicaStatusAndCheckIfLeader(replica, tablet_id,
- MonoDelta::FromMilliseconds(100));
+ Status s = itest::GetReplicaStatusAndCheckIfLeader(
+ replica, tablet_id, MonoDelta::FromMilliseconds(100));
if (s.IsIllegalState()) {
followers->push_back(replica);
}
@@ -409,8 +399,8 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
// Return the index within 'replicas' for the replica which is farthest ahead.
int64_t GetFurthestAheadReplicaIdx(const std::string& tablet_id,
- const std::vector<TServerDetails*>& replicas) {
- std::vector<OpId> op_ids;
+ const std::vector<itest::TServerDetails*>& replicas) {
+ std::vector<consensus::OpId> op_ids;
CHECK_OK(GetLastOpIdForEachReplica(tablet_id, replicas, consensus::RECEIVED_OPID,
MonoDelta::FromSeconds(10), &op_ids));
@@ -460,8 +450,8 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
int live_count = 0;
std::string error = strings::Substitute("Fewer than $0 TabletServers were alive. Dead TSs: ",
num_tablet_servers);
- RpcController controller;
- for (const TabletServerMap::value_type& entry : tablet_servers_) {
+ rpc::RpcController controller;
+ for (const itest::TabletServerMap::value_type& entry : tablet_servers_) {
controller.Reset();
controller.set_timeout(MonoDelta::FromSeconds(10));
PingRequestPB req;
@@ -491,10 +481,10 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
}
// Create a table with a single tablet, with 'num_replicas'.
- void CreateTable(const string& table_id = kTableId) {
+ void CreateTable(const std::string& table_id = kTableId) {
// The tests here make extensive use of server schemas, but we need
// a client schema to create the table.
- client::KuduSchema client_schema(KuduSchemaFromSchema(schema_));
+ client::KuduSchema client_schema(client::KuduSchemaFromSchema(schema_));
gscoped_ptr<client::KuduTableCreator> table_creator(client_->NewTableCreator());
ASSERT_OK(table_creator->table_name(table_id)
.schema(&client_schema)
@@ -554,9 +544,9 @@ class TabletServerIntegrationTestBase : public TabletServerTestBase {
gscoped_ptr<itest::ExternalMiniClusterFsInspector> inspect_;
// Maps server uuid to TServerDetails
- TabletServerMap tablet_servers_;
+ itest::TabletServerMap tablet_servers_;
// Maps tablet to all replicas.
- TabletReplicaMap tablet_replicas_;
+ itest::TabletReplicaMap tablet_replicas_;
client::sp::shared_ptr<client::KuduClient> client_;
client::sp::shared_ptr<client::KuduTable> table_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/ts_recovery-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/ts_recovery-itest.cc b/src/kudu/integration-tests/ts_recovery-itest.cc
index e674884..3a44820 100644
--- a/src/kudu/integration-tests/ts_recovery-itest.cc
+++ b/src/kudu/integration-tests/ts_recovery-itest.cc
@@ -42,6 +42,7 @@
using std::string;
using std::unique_ptr;
+using std::vector;
namespace kudu {
@@ -390,7 +391,7 @@ TEST_P(TsRecoveryITestDeathTest, TestRecoverFromOpIdOverflow) {
vector<string> wal_children;
ASSERT_OK(fs_manager->env()->GetChildren(wal_dir, &wal_children));
// Skip '.', '..', and index files.
- unordered_set<string> wal_segments;
+ std::unordered_set<string> wal_segments;
for (const auto& filename : wal_children) {
if (HasPrefixString(filename, FsManager::kWalFileNamePrefix)) {
wal_segments.insert(filename);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/ts_tablet_manager-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/ts_tablet_manager-itest.cc b/src/kudu/integration-tests/ts_tablet_manager-itest.cc
index ab16b03..fcda144 100644
--- a/src/kudu/integration-tests/ts_tablet_manager-itest.cc
+++ b/src/kudu/integration-tests/ts_tablet_manager-itest.cc
@@ -66,6 +66,8 @@ using master::TabletReportPB;
using rpc::Messenger;
using rpc::MessengerBuilder;
using std::shared_ptr;
+using std::string;
+using std::vector;
using strings::Substitute;
using tablet::TabletReplica;
using tserver::MiniTabletServer;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/integration-tests/update_scan_delta_compact-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/update_scan_delta_compact-test.cc b/src/kudu/integration-tests/update_scan_delta_compact-test.cc
index 783ee56..ff25e84 100644
--- a/src/kudu/integration-tests/update_scan_delta_compact-test.cc
+++ b/src/kudu/integration-tests/update_scan_delta_compact-test.cc
@@ -42,6 +42,9 @@ DEFINE_int32(row_count, 2000, "How many rows will be used in this test for the b
DEFINE_int32(seconds_to_run, 4,
"How long this test runs for, after inserting the base data, in seconds");
+using std::string;
+using std::vector;
+
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/master/catalog_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/catalog_manager-test.cc b/src/kudu/master/catalog_manager-test.cc
index 0c7fb8a..062301e 100644
--- a/src/kudu/master/catalog_manager-test.cc
+++ b/src/kudu/master/catalog_manager-test.cc
@@ -21,11 +21,13 @@
#include "kudu/master/ts_descriptor.h"
#include "kudu/util/test_util.h"
+using std::string;
+using std::vector;
+using strings::Substitute;
+
namespace kudu {
namespace master {
-using strings::Substitute;
-
// Test of the tablet assignment algo for splits done at table creation time.
// This tests that when we define a split, the tablet lands on the expected
// side of the split, i.e. it's a closed interval on the start key and an open
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/master/catalog_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/catalog_manager.cc b/src/kudu/master/catalog_manager.cc
index 5b7c0d5..e8612b5 100644
--- a/src/kudu/master/catalog_manager.cc
+++ b/src/kudu/master/catalog_manager.cc
@@ -209,6 +209,7 @@ DEFINE_int32(catalog_manager_inject_latency_prior_tsk_write_ms, 0,
TAG_FLAG(catalog_manager_inject_latency_prior_tsk_write_ms, hidden);
TAG_FLAG(catalog_manager_inject_latency_prior_tsk_write_ms, unsafe);
+using std::map;
using std::pair;
using std::set;
using std::shared_ptr;
@@ -2621,7 +2622,7 @@ Status CatalogManager::HandleRaftConfigChanged(
*tablet_lock->mutable_data()->pb.mutable_consensus_state() = cstate;
if (FLAGS_master_tombstone_evicted_tablet_replicas) {
- unordered_set<string> current_member_uuids;
+ std::unordered_set<string> current_member_uuids;
for (const consensus::RaftPeerPB& peer : cstate.committed_config().peers()) {
InsertOrDie(¤t_member_uuids, peer.permanent_uuid());
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/master/catalog_manager.h
----------------------------------------------------------------------
diff --git a/src/kudu/master/catalog_manager.h b/src/kudu/master/catalog_manager.h
index 72401b0..e5986ba 100644
--- a/src/kudu/master/catalog_manager.h
+++ b/src/kudu/master/catalog_manager.h
@@ -210,8 +210,8 @@ class TableInfo : public RefCountedThreadSafe<TableInfo> {
void AddTablets(const std::vector<TabletInfo*>& tablets);
// Atomically add and remove multiple tablets from this table.
- void AddRemoveTablets(const vector<scoped_refptr<TabletInfo>>& tablets_to_add,
- const vector<scoped_refptr<TabletInfo>>& tablets_to_drop);
+ void AddRemoveTablets(const std::vector<scoped_refptr<TabletInfo>>& tablets_to_add,
+ const std::vector<scoped_refptr<TabletInfo>>& tablets_to_drop);
// Return true if tablet with 'partition_key_start' has been
// removed from 'tablet_map_' below.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/master/master-path-handlers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/master-path-handlers.cc b/src/kudu/master/master-path-handlers.cc
index 80668b1..26c7a5e 100644
--- a/src/kudu/master/master-path-handlers.cc
+++ b/src/kudu/master/master-path-handlers.cc
@@ -111,7 +111,7 @@ void MasterPathHandlers::HandleTabletServers(const Webserver::WebRequest& req,
*output << "<h3>" << "Registrations" << "</h3>\n";
auto generate_table = [](const vector<string>& rows,
const string& header,
- ostream* output) {
+ std::ostream* output) {
if (!rows.empty()) {
*output << "<h4>" << header << "</h4>\n";
*output << "<table class='table table-striped'>\n";
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/master/master-test-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/master/master-test-util.h b/src/kudu/master/master-test-util.h
index 7e7f021..efb9dbf 100644
--- a/src/kudu/master/master-test-util.h
+++ b/src/kudu/master/master-test-util.h
@@ -35,7 +35,7 @@ namespace kudu {
namespace master {
Status WaitForRunningTabletCount(MiniMaster* mini_master,
- const string& table_name,
+ const std::string& table_name,
int expected_count,
GetTableLocationsResponsePB* resp) {
int wait_time = 1000;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/master/master-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/master-test.cc b/src/kudu/master/master-test.cc
index a3585f1..e1fcff7 100644
--- a/src/kudu/master/master-test.cc
+++ b/src/kudu/master/master-test.cc
@@ -49,10 +49,15 @@
using kudu::rpc::Messenger;
using kudu::rpc::MessengerBuilder;
using kudu::rpc::RpcController;
+using std::map;
+using std::multiset;
using std::pair;
using std::shared_ptr;
using std::string;
using std::thread;
+using std::unordered_map;
+using std::unordered_set;
+using std::vector;
using strings::Substitute;
DECLARE_bool(catalog_manager_check_ts_count_for_create_table);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/master/master.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/master.cc b/src/kudu/master/master.cc
index 5fe077c..175f7be 100644
--- a/src/kudu/master/master.cc
+++ b/src/kudu/master/master.cc
@@ -68,6 +68,7 @@ TAG_FLAG(authn_token_validity_seconds, experimental);
using std::min;
using std::shared_ptr;
+using std::string;
using std::vector;
using kudu::consensus::RaftPeerPB;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/master/sys_catalog-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/sys_catalog-test.cc b/src/kudu/master/sys_catalog-test.cc
index b00339d..524f64a 100644
--- a/src/kudu/master/sys_catalog-test.cc
+++ b/src/kudu/master/sys_catalog-test.cc
@@ -42,6 +42,7 @@
using std::string;
using std::shared_ptr;
+using std::vector;
using kudu::rpc::Messenger;
using kudu::rpc::MessengerBuilder;
using kudu::security::Cert;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/master/sys_catalog.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/sys_catalog.cc b/src/kudu/master/sys_catalog.cc
index ad7e785..a9ef482 100644
--- a/src/kudu/master/sys_catalog.cc
+++ b/src/kudu/master/sys_catalog.cc
@@ -78,9 +78,10 @@ using kudu::tablet::TabletReplica;
using kudu::tserver::WriteRequestPB;
using kudu::tserver::WriteResponsePB;
using std::function;
+using std::set;
using std::shared_ptr;
-using std::unique_ptr;
using std::string;
+using std::unique_ptr;
using std::vector;
using strings::Substitute;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/master/sys_catalog.h
----------------------------------------------------------------------
diff --git a/src/kudu/master/sys_catalog.h b/src/kudu/master/sys_catalog.h
index 25e320d..2359737 100644
--- a/src/kudu/master/sys_catalog.h
+++ b/src/kudu/master/sys_catalog.h
@@ -234,7 +234,7 @@ class SysCatalogTable {
void ReqDeleteTablets(tserver::WriteRequestPB* req,
const std::vector<TabletInfo*>& tablets);
- static string TskSeqNumberToEntryId(int64_t seq_number);
+ static std::string TskSeqNumberToEntryId(int64_t seq_number);
// Special string injected into SyncWrite() random failures (if enabled).
//
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/master/ts_descriptor.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/ts_descriptor.cc b/src/kudu/master/ts_descriptor.cc
index 82c4961..5f78ba6 100644
--- a/src/kudu/master/ts_descriptor.cc
+++ b/src/kudu/master/ts_descriptor.cc
@@ -39,6 +39,8 @@ TAG_FLAG(tserver_unresponsive_timeout_ms, advanced);
using std::make_shared;
using std::shared_ptr;
+using std::string;
+using std::vector;
namespace kudu {
namespace master {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/exactly_once_rpc-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/exactly_once_rpc-test.cc b/src/kudu/rpc/exactly_once_rpc-test.cc
index 388919d..66eabf6 100644
--- a/src/kudu/rpc/exactly_once_rpc-test.cc
+++ b/src/kudu/rpc/exactly_once_rpc-test.cc
@@ -27,6 +27,7 @@ DECLARE_int64(result_tracker_gc_interval_ms);
using std::atomic_int;
using std::shared_ptr;
using std::unique_ptr;
+using std::vector;
namespace kudu {
namespace rpc {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/inbound_call.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/inbound_call.cc b/src/kudu/rpc/inbound_call.cc
index d1c27b7..9350d21 100644
--- a/src/kudu/rpc/inbound_call.cc
+++ b/src/kudu/rpc/inbound_call.cc
@@ -34,6 +34,7 @@
using google::protobuf::FieldDescriptor;
using google::protobuf::io::CodedOutputStream;
using google::protobuf::MessageLite;
+using std::string;
using std::unique_ptr;
using std::vector;
using strings::Substitute;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/mt-rpc-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/mt-rpc-test.cc b/src/kudu/rpc/mt-rpc-test.cc
index 73e3a13..0fa11e5 100644
--- a/src/kudu/rpc/mt-rpc-test.cc
+++ b/src/kudu/rpc/mt-rpc-test.cc
@@ -33,6 +33,7 @@ METRIC_DECLARE_counter(rpcs_queue_overflow);
using std::string;
using std::shared_ptr;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/negotiation-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/negotiation-test.cc b/src/kudu/rpc/negotiation-test.cc
index 68185bb..901475b 100644
--- a/src/kudu/rpc/negotiation-test.cc
+++ b/src/kudu/rpc/negotiation-test.cc
@@ -75,6 +75,7 @@ DECLARE_bool(rpc_trace_negotiation);
using std::string;
using std::thread;
using std::unique_ptr;
+using std::vector;
using kudu::security::Cert;
using kudu::security::PkiConfig;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/negotiation.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/negotiation.cc b/src/kudu/rpc/negotiation.cc
index 66a0112..591258f 100644
--- a/src/kudu/rpc/negotiation.cc
+++ b/src/kudu/rpc/negotiation.cc
@@ -66,6 +66,7 @@ DEFINE_bool(rpc_encrypt_loopback_connections, false,
"an attacker.");
TAG_FLAG(rpc_encrypt_loopback_connections, advanced);
+using std::string;
using std::unique_ptr;
using strings::Substitute;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/outbound_call.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/outbound_call.cc b/src/kudu/rpc/outbound_call.cc
index bcc39c3..00c3808 100644
--- a/src/kudu/rpc/outbound_call.cc
+++ b/src/kudu/rpc/outbound_call.cc
@@ -52,7 +52,9 @@ DEFINE_int32(rpc_inject_cancellation_state, -1,
"will be injected. Should use values in OutboundCall::State only");
TAG_FLAG(rpc_inject_cancellation_state, unsafe);
+using std::string;
using std::unique_ptr;
+using std::vector;
namespace kudu {
namespace rpc {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/remote_method.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/remote_method.cc b/src/kudu/rpc/remote_method.cc
index 32ec40d..35020bc 100644
--- a/src/kudu/rpc/remote_method.cc
+++ b/src/kudu/rpc/remote_method.cc
@@ -41,7 +41,7 @@ void RemoteMethod::ToPB(RemoteMethodPB* pb) const {
pb->set_method_name(method_name_);
}
-string RemoteMethod::ToString() const {
+std::string RemoteMethod::ToString() const {
return Substitute("$0.$1", service_name_, method_name_);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/request_tracker.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/request_tracker.cc b/src/kudu/rpc/request_tracker.cc
index 0a3dc27..07806f8 100644
--- a/src/kudu/rpc/request_tracker.cc
+++ b/src/kudu/rpc/request_tracker.cc
@@ -18,6 +18,7 @@
#include "kudu/rpc/request_tracker.h"
#include <mutex>
+#include <string>
#include <utility>
#include "kudu/gutil/map-util.h"
@@ -27,7 +28,7 @@ namespace rpc {
const RequestTracker::SequenceNumber RequestTracker::kNoSeqNo = -1;
-RequestTracker::RequestTracker(string client_id)
+RequestTracker::RequestTracker(std::string client_id)
: client_id_(std::move(client_id)),
next_(0) {}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/result_tracker.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/result_tracker.cc b/src/kudu/rpc/result_tracker.cc
index 11ff8d2..9378451 100644
--- a/src/kudu/rpc/result_tracker.cc
+++ b/src/kudu/rpc/result_tracker.cc
@@ -55,11 +55,14 @@ namespace rpc {
using google::protobuf::Message;
using kudu::MemTracker;
using rpc::InboundCall;
+using std::make_pair;
using std::move;
using std::lock_guard;
+using std::pair;
using std::shared_ptr;
using std::string;
using std::unique_ptr;
+using std::vector;
using strings::Substitute;
using strings::SubstituteAndAppend;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/result_tracker.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/result_tracker.h b/src/kudu/rpc/result_tracker.h
index f629d7a..4e808d1 100644
--- a/src/kudu/rpc/result_tracker.h
+++ b/src/kudu/rpc/result_tracker.h
@@ -240,7 +240,7 @@ class ResultTracker : public RefCountedThreadSafe<ResultTracker> {
// Typically this is invoked from an internal thread started by 'StartGCThread()'.
void GCResults();
- string ToString();
+ std::string ToString();
private:
// Information about client originated ongoing RPCs.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/retriable_rpc.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/retriable_rpc.h b/src/kudu/rpc/retriable_rpc.h
index 897d7a7..1facf0e 100644
--- a/src/kudu/rpc/retriable_rpc.h
+++ b/src/kudu/rpc/retriable_rpc.h
@@ -281,7 +281,7 @@ void RetriableRpc<Server, RequestPB, ResponsePB>::SendRpcCb(const Status& status
// failure.
Status final_status = result.status;
if (!final_status.ok()) {
- string error_string;
+ std::string error_string;
if (current_) {
error_string = strings::Substitute("Failed to write to server: $0", current_->ToString());
} else {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/rpc-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpc-test-base.h b/src/kudu/rpc/rpc-test-base.h
index c8c84ca..968e0a0 100644
--- a/src/kudu/rpc/rpc-test-base.h
+++ b/src/kudu/rpc/rpc-test-base.h
@@ -427,7 +427,7 @@ class RpcTestBase : public KuduTest {
}
protected:
- std::shared_ptr<Messenger> CreateMessenger(const string &name,
+ std::shared_ptr<Messenger> CreateMessenger(const std::string &name,
int n_reactors = 1,
bool enable_ssl = false) {
MessengerBuilder bld(name);
@@ -498,11 +498,11 @@ class RpcTestBase : public KuduTest {
RpcController controller;
int idx1;
- string s1(size1, 'a');
+ std::string s1(size1, 'a');
CHECK_OK(controller.AddOutboundSidecar(RpcSidecar::FromSlice(Slice(s1)), &idx1));
int idx2;
- string s2(size2, 'b');
+ std::string s2(size2, 'b');
CHECK_OK(controller.AddOutboundSidecar(RpcSidecar::FromSlice(Slice(s2)), &idx2));
request.set_sidecar1_idx(idx1);
@@ -613,7 +613,7 @@ class RpcTestBase : public KuduTest {
}
protected:
- string service_name_;
+ std::string service_name_;
std::shared_ptr<Messenger> server_messenger_;
scoped_refptr<ServicePool> service_pool_;
std::shared_ptr<kudu::MemTracker> mem_tracker_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/rpc.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpc.cc b/src/kudu/rpc/rpc.cc
index 685da13..d4c8b60 100644
--- a/src/kudu/rpc/rpc.cc
+++ b/src/kudu/rpc/rpc.cc
@@ -25,6 +25,7 @@
#include "kudu/rpc/rpc_header.pb.h"
using std::shared_ptr;
+using std::string;
using strings::Substitute;
using strings::SubstituteAndAppend;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/rpc_context.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpc_context.cc b/src/kudu/rpc/rpc_context.cc
index 06fd8c5..2ee88f5 100644
--- a/src/kudu/rpc/rpc_context.cc
+++ b/src/kudu/rpc/rpc_context.cc
@@ -33,6 +33,7 @@
#include "kudu/util/trace.h"
using google::protobuf::Message;
+using std::string;
using std::unique_ptr;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/rpc_stub-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpc_stub-test.cc b/src/kudu/rpc/rpc_stub-test.cc
index 9ee59b0..ecbb261 100644
--- a/src/kudu/rpc/rpc_stub-test.cc
+++ b/src/kudu/rpc/rpc_stub-test.cc
@@ -42,8 +42,10 @@ DEFINE_bool(is_panic_test_child, false, "Used by TestRpcPanic");
DECLARE_bool(socket_inject_short_recvs);
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
using std::vector;
+using base::subtle::NoBarrier_Load;
namespace kudu {
namespace rpc {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/rpcz_store.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpcz_store.cc b/src/kudu/rpc/rpcz_store.cc
index 66c23d0..9f56d3d 100644
--- a/src/kudu/rpc/rpcz_store.cc
+++ b/src/kudu/rpc/rpcz_store.cc
@@ -41,6 +41,7 @@ TAG_FLAG(rpc_dump_all_traces, advanced);
TAG_FLAG(rpc_dump_all_traces, runtime);
using std::pair;
+using std::string;
using std::vector;
using std::unique_ptr;
@@ -74,7 +75,7 @@ class MethodSampler {
// This function recurses through the parent-child relationship graph,
// keeping the current tree path in 'child_path' (empty at the root).
static void GetTraceMetrics(const Trace& t,
- const std::string& child_path,
+ const string& child_path,
RpczSamplePB* sample_pb);
// An individual recorded sample.
@@ -233,7 +234,7 @@ void RpczStore::LogTrace(InboundCall* call) {
// The traces may also be too large to fit in a log message.
LOG(WARNING) << call->ToString() << " took " << duration_ms << "ms (client timeout "
<< call->header_.timeout_millis() << ").";
- std::string s = call->trace()->DumpToString();
+ string s = call->trace()->DumpToString();
if (!s.empty()) {
LOG(WARNING) << "Trace:\n" << s;
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/sasl_common.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/sasl_common.cc b/src/kudu/rpc/sasl_common.cc
index 9f14413..ffeb1b2 100644
--- a/src/kudu/rpc/sasl_common.cc
+++ b/src/kudu/rpc/sasl_common.cc
@@ -42,6 +42,7 @@
#include "kudu/security/init.h"
using std::set;
+using std::string;
DECLARE_string(keytab_file);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/sasl_common.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/sasl_common.h b/src/kudu/rpc/sasl_common.h
index 6022f9e..437c9cd 100644
--- a/src/kudu/rpc/sasl_common.h
+++ b/src/kudu/rpc/sasl_common.h
@@ -33,8 +33,6 @@ class Sockaddr;
namespace rpc {
-using std::string;
-
// Constants
extern const char* const kSaslMechPlain;
extern const char* const kSaslMechGSSAPI;
@@ -83,7 +81,7 @@ Status DisableSaslInitialization() WARN_UNUSED_RESULT;
Status WrapSaslCall(sasl_conn_t* conn, const std::function<int()>& call) WARN_UNUSED_RESULT;
// Return <ip>;<port> string formatted for SASL library use.
-string SaslIpPortString(const Sockaddr& addr);
+std::string SaslIpPortString(const Sockaddr& addr);
// Return available plugin mechanisms for the given connection.
std::set<SaslMechanism::Type> SaslListAvailableMechs();
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/server_negotiation.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/server_negotiation.cc b/src/kudu/rpc/server_negotiation.cc
index 4f0ed5f..741310e 100644
--- a/src/kudu/rpc/server_negotiation.cc
+++ b/src/kudu/rpc/server_negotiation.cc
@@ -55,6 +55,7 @@
using std::set;
using std::string;
using std::unique_ptr;
+using std::vector;
// Fault injection flags.
DEFINE_double(rpc_inject_invalid_authn_token_ratio, 0,
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/rpc/service_pool.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/service_pool.cc b/src/kudu/rpc/service_pool.cc
index 1a23ca9..82a3ad4 100644
--- a/src/kudu/rpc/service_pool.cc
+++ b/src/kudu/rpc/service_pool.cc
@@ -37,6 +37,8 @@
#include "kudu/util/trace.h"
using std::shared_ptr;
+using std::string;
+using std::vector;
using strings::Substitute;
METRIC_DEFINE_histogram(server, rpc_incoming_queue_time,
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/security/cert-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/cert-test.cc b/src/kudu/security/cert-test.cc
index acd0f74..ff5d51a 100644
--- a/src/kudu/security/cert-test.cc
+++ b/src/kudu/security/cert-test.cc
@@ -33,6 +33,7 @@
#include "kudu/util/test_util.h"
using std::pair;
+using std::string;
using std::thread;
using std::vector;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/security/cert.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/cert.cc b/src/kudu/security/cert.cc
index dabf2d3..e1a2666 100644
--- a/src/kudu/security/cert.cc
+++ b/src/kudu/security/cert.cc
@@ -34,6 +34,7 @@
#include "kudu/util/status.h"
using std::string;
+using std::vector;
namespace kudu {
namespace security {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/security/openssl_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/openssl_util.cc b/src/kudu/security/openssl_util.cc
index dce93fc..b0b690c 100644
--- a/src/kudu/security/openssl_util.cc
+++ b/src/kudu/security/openssl_util.cc
@@ -40,6 +40,7 @@
using std::ostringstream;
using std::string;
+using std::vector;
namespace kudu {
namespace security {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/security/openssl_util.h
----------------------------------------------------------------------
diff --git a/src/kudu/security/openssl_util.h b/src/kudu/security/openssl_util.h
index f5cd817..aa493ff 100644
--- a/src/kudu/security/openssl_util.h
+++ b/src/kudu/security/openssl_util.h
@@ -69,7 +69,7 @@ typedef struct x509_st X509;
namespace kudu {
namespace security {
-using PasswordCallback = std::function<string(void)>;
+using PasswordCallback = std::function<std::string(void)>;
// Disable initialization of OpenSSL. Must be called before
// any call to InitializeOpenSSL().
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/security/openssl_util_bio.h
----------------------------------------------------------------------
diff --git a/src/kudu/security/openssl_util_bio.h b/src/kudu/security/openssl_util_bio.h
index c4053a1..c935b0b 100644
--- a/src/kudu/security/openssl_util_bio.h
+++ b/src/kudu/security/openssl_util_bio.h
@@ -57,7 +57,7 @@ Status ToBIO(BIO* bio, DataFormat format, TYPE* obj) {
// a password protected private key.
inline int TLSPasswordCB(char* buf, int size, int /* rwflag */, void* userdata) {
const auto* cb = reinterpret_cast<const PasswordCallback*>(userdata);
- string pw = (*cb)();
+ std::string pw = (*cb)();
if (pw.size() >= size) {
LOG(ERROR) << "Provided key password is longer than maximum length "
<< size;
@@ -87,7 +87,7 @@ Status FromBIO(BIO* bio, DataFormat format, c_unique_ptr<TYPE>* ret,
}
template<typename Type, typename Traits = SslTypeTraits<Type>>
-Status FromString(const string& data, DataFormat format,
+Status FromString(const std::string& data, DataFormat format,
c_unique_ptr<Type>* ret) {
const void* mdata = reinterpret_cast<const void*>(data.data());
auto bio = ssl_make_unique(BIO_new_mem_buf(
@@ -115,7 +115,7 @@ Status ToString(std::string* data, DataFormat format, Type* obj) {
}
template<typename Type, typename Traits = SslTypeTraits<Type>>
-Status FromFile(const string& fpath, DataFormat format,
+Status FromFile(const std::string& fpath, DataFormat format,
c_unique_ptr<Type>* ret, const PasswordCallback& cb = PasswordCallback()) {
auto bio = ssl_make_unique(BIO_new(BIO_s_file()));
OPENSSL_RET_NOT_OK(BIO_read_filename(bio.get(), fpath.c_str()),
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/security/simple_acl.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/simple_acl.cc b/src/kudu/security/simple_acl.cc
index 75b06a2..f7d0b14 100644
--- a/src/kudu/security/simple_acl.cc
+++ b/src/kudu/security/simple_acl.cc
@@ -26,6 +26,7 @@
#include "kudu/gutil/strings/stringpiece.h"
#include "kudu/util/status.h"
+using std::set;
using std::string;
using std::vector;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/security/test/mini_kdc.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/test/mini_kdc.cc b/src/kudu/security/test/mini_kdc.cc
index bae2278..1b082c3 100644
--- a/src/kudu/security/test/mini_kdc.cc
+++ b/src/kudu/security/test/mini_kdc.cc
@@ -39,6 +39,7 @@
using std::map;
using std::string;
using std::unique_ptr;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/security/tls_context.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/tls_context.cc b/src/kudu/security/tls_context.cc
index 353d1ed..5c7a7fc 100644
--- a/src/kudu/security/tls_context.cc
+++ b/src/kudu/security/tls_context.cc
@@ -44,6 +44,7 @@
using strings::Substitute;
using std::string;
using std::unique_lock;
+using std::vector;
DEFINE_int32(ipki_server_key_size, 2048,
"the number of bits for server cert's private key. The server cert "
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/security/token-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/token-test.cc b/src/kudu/security/token-test.cc
index 81bc8b9..564587e 100644
--- a/src/kudu/security/token-test.cc
+++ b/src/kudu/security/token-test.cc
@@ -31,8 +31,10 @@
DECLARE_int32(tsk_num_rsa_bits);
+using std::string;
using std::make_shared;
using std::unique_ptr;
+using std::vector;
namespace kudu {
namespace security {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/server/default-path-handlers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/default-path-handlers.cc b/src/kudu/server/default-path-handlers.cc
index 645b362..5090d84 100644
--- a/src/kudu/server/default-path-handlers.cc
+++ b/src/kudu/server/default-path-handlers.cc
@@ -48,6 +48,7 @@
using std::ifstream;
using std::string;
+using std::vector;
using strings::Substitute;
DEFINE_int64(web_log_bytes, 1024 * 1024,
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/server/pprof-path-handlers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/pprof-path-handlers.cc b/src/kudu/server/pprof-path-handlers.cc
index f7ae362..7b479af 100644
--- a/src/kudu/server/pprof-path-handlers.cc
+++ b/src/kudu/server/pprof-path-handlers.cc
@@ -49,6 +49,7 @@ using std::endl;
using std::ifstream;
using std::ostringstream;
using std::string;
+using std::vector;
// GLog already implements symbolization. Just import their hidden symbol.
namespace google {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/server/rpc_server-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/rpc_server-test.cc b/src/kudu/server/rpc_server-test.cc
index bf97c72..2d26791 100644
--- a/src/kudu/server/rpc_server-test.cc
+++ b/src/kudu/server/rpc_server-test.cc
@@ -29,6 +29,7 @@
using std::shared_ptr;
using std::string;
using std::unique_ptr;
+using std::vector;
DECLARE_bool(rpc_server_allow_ephemeral_ports);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/server/rpcz-path-handler.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/rpcz-path-handler.cc b/src/kudu/server/rpcz-path-handler.cc
index f0eddba..373d3e8 100644
--- a/src/kudu/server/rpcz-path-handler.cc
+++ b/src/kudu/server/rpcz-path-handler.cc
@@ -37,6 +37,7 @@ using kudu::rpc::DumpRpczStoreResponsePB;
using kudu::rpc::Messenger;
using std::ostringstream;
using std::shared_ptr;
+using std::string;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/server/tracing-path-handlers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/tracing-path-handlers.cc b/src/kudu/server/tracing-path-handlers.cc
index 0cbeb2c..d8ada6d 100644
--- a/src/kudu/server/tracing-path-handlers.cc
+++ b/src/kudu/server/tracing-path-handlers.cc
@@ -36,6 +36,7 @@
using std::map;
using std::ostringstream;
+using std::pair;
using std::string;
using std::unique_ptr;
using std::vector;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/server/webserver-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/webserver-test.cc b/src/kudu/server/webserver-test.cc
index 68fac44..5ea1da9 100644
--- a/src/kudu/server/webserver-test.cc
+++ b/src/kudu/server/webserver-test.cc
@@ -35,6 +35,7 @@
#include "kudu/util/test_util.h"
using std::string;
+using std::vector;
using std::unique_ptr;
DECLARE_int32(webserver_max_post_length_bytes);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/server/webui_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/webui_util.cc b/src/kudu/server/webui_util.cc
index 6be5486..8d5b44a 100644
--- a/src/kudu/server/webui_util.cc
+++ b/src/kudu/server/webui_util.cc
@@ -27,6 +27,7 @@
#include "kudu/server/monitored_task.h"
#include "kudu/util/url-coding.h"
+using std::string;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/all_types-scan-correctness-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/all_types-scan-correctness-test.cc b/src/kudu/tablet/all_types-scan-correctness-test.cc
index 73ebd45..49c17e7 100644
--- a/src/kudu/tablet/all_types-scan-correctness-test.cc
+++ b/src/kudu/tablet/all_types-scan-correctness-test.cc
@@ -22,6 +22,8 @@
#include "kudu/common/schema.h"
#include "kudu/tablet/tablet-test-base.h"
+using strings::Substitute;
+
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/cbtree-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/cbtree-test.cc b/src/kudu/tablet/cbtree-test.cc
index b60161a..db5243f 100644
--- a/src/kudu/tablet/cbtree-test.cc
+++ b/src/kudu/tablet/cbtree-test.cc
@@ -31,14 +31,15 @@
#include "kudu/util/test_macros.h"
#include "kudu/util/test_util.h"
-namespace kudu {
-namespace tablet {
-namespace btree {
-
+using std::string;
using std::thread;
using std::unordered_set;
using std::vector;
+namespace kudu {
+namespace tablet {
+namespace btree {
+
class TestCBTree : public KuduTest {
protected:
template<class T>
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/cfile_set-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/cfile_set-test.cc b/src/kudu/tablet/cfile_set-test.cc
index 686d70a..4cb3923 100644
--- a/src/kudu/tablet/cfile_set-test.cc
+++ b/src/kudu/tablet/cfile_set-test.cc
@@ -29,6 +29,8 @@
DECLARE_int32(cfile_default_block_size);
using std::shared_ptr;
+using std::string;
+using std::vector;
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/cfile_set.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/cfile_set.cc b/src/kudu/tablet/cfile_set.cc
index 5ba509c..d3715fc 100644
--- a/src/kudu/tablet/cfile_set.cc
+++ b/src/kudu/tablet/cfile_set.cc
@@ -40,11 +40,17 @@ TAG_FLAG(consult_bloom_filters, hidden);
namespace kudu {
namespace tablet {
+using cfile::BloomFileReader;
+using cfile::CFileIterator;
+using cfile::CFileReader;
+using cfile::ColumnIterator;
using cfile::ReaderOptions;
using cfile::DefaultColumnValueIterator;
using fs::ReadableBlock;
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
+using std::vector;
using strings::Substitute;
////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/cfile_set.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/cfile_set.h b/src/kudu/tablet/cfile_set.h
index 34b8c3c..394054e 100644
--- a/src/kudu/tablet/cfile_set.h
+++ b/src/kudu/tablet/cfile_set.h
@@ -41,11 +41,6 @@ namespace kudu {
namespace tablet {
-using kudu::cfile::BloomFileReader;
-using kudu::cfile::CFileIterator;
-using kudu::cfile::CFileReader;
-using kudu::cfile::ColumnIterator;
-
// Set of CFiles which make up the base data for a single rowset
//
// All of these files have the same number of rows, and thus the positional
@@ -81,8 +76,8 @@ class CFileSet : public std::enable_shared_from_this<CFileSet> {
boost::optional<rowid_t>* idx,
ProbeStats* stats) const;
- string ToString() const {
- return string("CFile base data in ") + rowset_metadata_->ToString();
+ std::string ToString() const {
+ return std::string("CFile base data in ") + rowset_metadata_->ToString();
}
// Check if the given row is present. If it is, sets *rowid to the
@@ -111,13 +106,14 @@ class CFileSet : public std::enable_shared_from_this<CFileSet> {
Status OpenAdHocIndexReader();
Status LoadMinMaxKeys();
- Status NewColumnIterator(ColumnId col_id, CFileReader::CacheControl cache_blocks,
- CFileIterator **iter) const;
- Status NewKeyIterator(CFileIterator** key_iter) const;
+ Status NewColumnIterator(ColumnId col_id,
+ cfile::CFileReader::CacheControl cache_blocks,
+ cfile::CFileIterator **iter) const;
+ Status NewKeyIterator(cfile::CFileIterator** key_iter) const;
// Return the CFileReader responsible for reading the key index.
// (the ad-hoc reader for composite keys, otherwise the key column reader)
- CFileReader* key_index_reader() const;
+ cfile::CFileReader* key_index_reader() const;
const Schema &tablet_schema() const { return rowset_metadata_->tablet_schema(); }
@@ -130,14 +126,14 @@ class CFileSet : public std::enable_shared_from_this<CFileSet> {
// Map of column ID to reader. These are lazily initialized as needed.
// We use flat_map here since it's the most memory-compact while
// still having good performance for small maps.
- typedef boost::container::flat_map<int, std::unique_ptr<CFileReader>> ReaderMap;
+ typedef boost::container::flat_map<int, std::unique_ptr<cfile::CFileReader>> ReaderMap;
ReaderMap readers_by_col_id_;
// A file reader for an ad-hoc index, i.e. an index that sits in its own file
// and is not embedded with the column's data blocks. This is used when the
// index pertains to more than one column, as in the case of composite keys.
- std::unique_ptr<CFileReader> ad_hoc_idx_reader_;
- gscoped_ptr<BloomFileReader> bloom_reader_;
+ std::unique_ptr<cfile::CFileReader> ad_hoc_idx_reader_;
+ gscoped_ptr<cfile::BloomFileReader> bloom_reader_;
};
@@ -165,8 +161,8 @@ class CFileSet::Iterator : public ColumnwiseIterator {
return cur_idx_ < upper_bound_idx_;
}
- virtual string ToString() const OVERRIDE {
- return string("rowset iterator for ") + base_data_->ToString();
+ virtual std::string ToString() const OVERRIDE {
+ return std::string("rowset iterator for ") + base_data_->ToString();
}
const Schema &schema() const OVERRIDE {
@@ -180,7 +176,7 @@ class CFileSet::Iterator : public ColumnwiseIterator {
}
// Collect the IO statistics for each of the underlying columns.
- virtual void GetIteratorStats(vector<IteratorStats> *stats) const OVERRIDE;
+ virtual void GetIteratorStats(std::vector<IteratorStats> *stats) const OVERRIDE;
virtual ~Iterator();
private:
@@ -215,8 +211,8 @@ class CFileSet::Iterator : public ColumnwiseIterator {
const Schema* projection_;
// Iterator for the key column in the underlying data.
- gscoped_ptr<CFileIterator> key_iter_;
- std::vector<std::unique_ptr<ColumnIterator>> col_iters_;
+ gscoped_ptr<cfile::CFileIterator> key_iter_;
+ std::vector<std::unique_ptr<cfile::ColumnIterator>> col_iters_;
bool initted_;
@@ -236,7 +232,7 @@ class CFileSet::Iterator : public ColumnwiseIterator {
// The underlying columns are prepared lazily, so that if a column is never
// materialized, it doesn't need to be read off disk.
- vector<bool> cols_prepared_;
+ std::vector<bool> cols_prepared_;
};
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/compaction-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/compaction-test.cc b/src/kudu/tablet/compaction-test.cc
index e2d389c..fd9ae83 100644
--- a/src/kudu/tablet/compaction-test.cc
+++ b/src/kudu/tablet/compaction-test.cc
@@ -51,6 +51,8 @@ DEFINE_int32(merge_benchmark_num_rows_per_rowset, 500000,
DECLARE_string(block_manager);
using std::shared_ptr;
+using std::string;
+using std::vector;
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/compaction.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/compaction.cc b/src/kudu/tablet/compaction.cc
index a39e17c..8619c8d 100644
--- a/src/kudu/tablet/compaction.cc
+++ b/src/kudu/tablet/compaction.cc
@@ -40,9 +40,12 @@
#include "kudu/util/debug/trace_event.h"
using kudu::clock::HybridClock;
+using std::deque;
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
using std::unordered_set;
+using std::vector;
using strings::Substitute;
namespace kudu {
[4/6] kudu git commit: remove 'using std::...' and other from header
files
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/join.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/join.h b/src/kudu/gutil/strings/join.h
index 4369c4c..1afc1f0 100644
--- a/src/kudu/gutil/strings/join.h
+++ b/src/kudu/gutil/strings/join.h
@@ -16,21 +16,10 @@ using __gnu_cxx::hash_map; // Not used in this file.
using __gnu_cxx::hash;
using __gnu_cxx::hash_set; // Not used in this file.
#include <iterator>
-using std::back_insert_iterator;
-using std::iterator_traits;
#include <map>
-using std::map;
-using std::multimap;
-#include <set>
-using std::multiset;
-using std::set;
#include <string>
-using std::string;
#include <utility>
-using std::make_pair;
-using std::pair;
#include <vector>
-using std::vector;
#include "kudu/gutil/integral_types.h"
#include "kudu/gutil/macros.h"
@@ -53,7 +42,7 @@ using std::vector;
// If result_length_p is not NULL, it will contain the length of the
// result string (not including the trailing '\0').
// ----------------------------------------------------------------------
-char* JoinUsing(const vector<const char*>& components,
+char* JoinUsing(const std::vector<const char*>& components,
const char* delim,
int* result_length_p);
@@ -67,7 +56,7 @@ char* JoinUsing(const vector<const char*>& components,
// If result_length_p is not NULL, it will contain the length of the
// result string (not including the trailing '\0').
// ----------------------------------------------------------------------
-char* JoinUsingToBuffer(const vector<const char*>& components,
+char* JoinUsingToBuffer(const std::vector<const char*>& components,
const char* delim,
int result_buffer_size,
char* result_buffer,
@@ -100,18 +89,18 @@ char* JoinUsingToBuffer(const vector<const char*>& components,
template <class CONTAINER>
void JoinStrings(const CONTAINER& components,
const StringPiece& delim,
- string* result);
+ std::string* result);
template <class CONTAINER>
-string JoinStrings(const CONTAINER& components,
+std::string JoinStrings(const CONTAINER& components,
const StringPiece& delim);
template <class ITERATOR>
void JoinStringsIterator(const ITERATOR& start,
const ITERATOR& end,
const StringPiece& delim,
- string* result);
+ std::string* result);
template <class ITERATOR>
-string JoinStringsIterator(const ITERATOR& start,
+std::string JoinStringsIterator(const ITERATOR& start,
const ITERATOR& end,
const StringPiece& delim);
@@ -120,7 +109,7 @@ template<typename ITERATOR>
void JoinKeysIterator(const ITERATOR& start,
const ITERATOR& end,
const StringPiece& delim,
- string *result) {
+ std::string *result) {
result->clear();
for (ITERATOR iter = start; iter != end; ++iter) {
if (iter == start) {
@@ -132,10 +121,10 @@ void JoinKeysIterator(const ITERATOR& start,
}
template <typename ITERATOR>
-string JoinKeysIterator(const ITERATOR& start,
+std::string JoinKeysIterator(const ITERATOR& start,
const ITERATOR& end,
const StringPiece& delim) {
- string result;
+ std::string result;
JoinKeysIterator(start, end, delim, &result);
return result;
}
@@ -146,7 +135,7 @@ void JoinKeysAndValuesIterator(const ITERATOR& start,
const ITERATOR& end,
const StringPiece& intra_delim,
const StringPiece& inter_delim,
- string *result) {
+ std::string *result) {
result->clear();
for (ITERATOR iter = start; iter != end; ++iter) {
if (iter == start) {
@@ -158,27 +147,27 @@ void JoinKeysAndValuesIterator(const ITERATOR& start,
}
template <typename ITERATOR>
-string JoinKeysAndValuesIterator(const ITERATOR& start,
+std::string JoinKeysAndValuesIterator(const ITERATOR& start,
const ITERATOR& end,
const StringPiece& intra_delim,
const StringPiece& inter_delim) {
- string result;
+ std::string result;
JoinKeysAndValuesIterator(start, end, intra_delim, inter_delim, &result);
return result;
}
-void JoinStringsInArray(string const* const* components,
+void JoinStringsInArray(std::string const* const* components,
int num_components,
const char* delim,
- string* result);
-void JoinStringsInArray(string const* components,
+ std::string* result);
+void JoinStringsInArray(std::string const* components,
int num_components,
const char* delim,
- string* result);
-string JoinStringsInArray(string const* const* components,
+ std::string* result);
+std::string JoinStringsInArray(std::string const* const* components,
int num_components,
const char* delim);
-string JoinStringsInArray(string const* components,
+std::string JoinStringsInArray(std::string const* components,
int num_components,
const char* delim);
@@ -188,14 +177,14 @@ string JoinStringsInArray(string const* components,
template <class CONTAINER>
inline void JoinStrings(const CONTAINER& components,
const StringPiece& delim,
- string* result) {
+ std::string* result) {
JoinStringsIterator(components.begin(), components.end(), delim, result);
}
template <class CONTAINER>
-inline string JoinStrings(const CONTAINER& components,
+inline std::string JoinStrings(const CONTAINER& components,
const StringPiece& delim) {
- string result;
+ std::string result;
JoinStrings(components, delim, &result);
return result;
}
@@ -203,10 +192,10 @@ inline string JoinStrings(const CONTAINER& components,
// Join the strings produced by calling 'functor' on each element of
// 'components'.
template<class CONTAINER, typename FUNC>
-string JoinMapped(const CONTAINER& components,
+std::string JoinMapped(const CONTAINER& components,
const FUNC& functor,
const StringPiece& delim) {
- string result;
+ std::string result;
for (typename CONTAINER::const_iterator iter = components.begin();
iter != components.end();
iter++) {
@@ -222,7 +211,7 @@ template <class ITERATOR>
void JoinStringsIterator(const ITERATOR& start,
const ITERATOR& end,
const StringPiece& delim,
- string* result) {
+ std::string* result) {
result->clear();
// Precompute resulting length so we can reserve() memory in one shot.
@@ -244,26 +233,26 @@ void JoinStringsIterator(const ITERATOR& start,
}
template <class ITERATOR>
-inline string JoinStringsIterator(const ITERATOR& start,
- const ITERATOR& end,
- const StringPiece& delim) {
- string result;
+inline std::string JoinStringsIterator(const ITERATOR& start,
+ const ITERATOR& end,
+ const StringPiece& delim) {
+ std::string result;
JoinStringsIterator(start, end, delim, &result);
return result;
}
-inline string JoinStringsInArray(string const* const* components,
- int num_components,
- const char* delim) {
- string result;
+inline std::string JoinStringsInArray(std::string const* const* components,
+ int num_components,
+ const char* delim) {
+ std::string result;
JoinStringsInArray(components, num_components, delim, &result);
return result;
}
-inline string JoinStringsInArray(string const* components,
- int num_components,
- const char* delim) {
- string result;
+inline std::string JoinStringsInArray(std::string const* components,
+ int num_components,
+ const char* delim) {
+ std::string result;
JoinStringsInArray(components, num_components, delim, &result);
return result;
}
@@ -279,21 +268,22 @@ inline string JoinStringsInArray(string const* components,
// as the last argument).
// ----------------------------------------------------------------------
-void JoinMapKeysAndValues(const map<string, string>& components,
+void JoinMapKeysAndValues(const std::map<std::string, std::string>& components,
const StringPiece& intra_delim,
const StringPiece& inter_delim,
- string* result);
-void JoinVectorKeysAndValues(const vector< pair<string, string> >& components,
- const StringPiece& intra_delim,
- const StringPiece& inter_delim,
- string* result);
+ std::string* result);
+void JoinVectorKeysAndValues(
+ const std::vector< std::pair<std::string, std::string> >& components,
+ const StringPiece& intra_delim,
+ const StringPiece& inter_delim,
+ std::string* result);
// DEPRECATED(jyrki): use JoinKeysAndValuesIterator directly.
template<typename T>
void JoinHashMapKeysAndValues(const T& container,
const StringPiece& intra_delim,
const StringPiece& inter_delim,
- string* result) {
+ std::string* result) {
JoinKeysAndValuesIterator(container.begin(), container.end(),
intra_delim, inter_delim,
result);
@@ -319,11 +309,11 @@ void JoinHashMapKeysAndValues(const T& container,
// A convenience wrapper around JoinCSVLineWithDelimiter which uses
// ',' as the delimiter.
// ----------------------------------------------------------------------
-void JoinCSVLine(const vector<string>& original_cols, string* output);
-string JoinCSVLine(const vector<string>& original_cols);
-void JoinCSVLineWithDelimiter(const vector<string>& original_cols,
+void JoinCSVLine(const std::vector<std::string>& original_cols, std::string* output);
+std::string JoinCSVLine(const std::vector<std::string>& original_cols);
+void JoinCSVLineWithDelimiter(const std::vector<std::string>& original_cols,
char delimiter,
- string* output);
+ std::string* output);
// ----------------------------------------------------------------------
// JoinElements()
@@ -340,7 +330,7 @@ template <class ITERATOR>
void JoinElementsIterator(ITERATOR first,
ITERATOR last,
StringPiece delim,
- string* result) {
+ std::string* result) {
result->clear();
for (ITERATOR it = first; it != last; ++it) {
if (it != first) {
@@ -351,10 +341,10 @@ void JoinElementsIterator(ITERATOR first,
}
template <class ITERATOR>
-string JoinElementsIterator(ITERATOR first,
+std::string JoinElementsIterator(ITERATOR first,
ITERATOR last,
StringPiece delim) {
- string result;
+ std::string result;
JoinElementsIterator(first, last, delim, &result);
return result;
}
@@ -362,13 +352,13 @@ string JoinElementsIterator(ITERATOR first,
template <class CONTAINER>
inline void JoinElements(const CONTAINER& components,
StringPiece delim,
- string* result) {
+ std::string* result) {
JoinElementsIterator(components.begin(), components.end(), delim, result);
}
template <class CONTAINER>
-inline string JoinElements(const CONTAINER& components, StringPiece delim) {
- string result;
+inline std::string JoinElements(const CONTAINER& components, StringPiece delim) {
+ std::string result;
JoinElements(components, delim, &result);
return result;
}
@@ -376,12 +366,12 @@ inline string JoinElements(const CONTAINER& components, StringPiece delim) {
template <class CONTAINER>
void JoinInts(const CONTAINER& components,
const char* delim,
- string* result) {
+ std::string* result) {
JoinElements(components, delim, result);
}
template <class CONTAINER>
-inline string JoinInts(const CONTAINER& components,
+inline std::string JoinInts(const CONTAINER& components,
const char* delim) {
return JoinElements(components, delim);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/numbers.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/numbers.h b/src/kudu/gutil/strings/numbers.h
index e9f5c1a..b0ec224 100644
--- a/src/kudu/gutil/strings/numbers.h
+++ b/src/kudu/gutil/strings/numbers.h
@@ -11,14 +11,8 @@
#include <string.h>
#include <time.h>
#include <functional>
-using std::binary_function;
-using std::less;
#include <limits>
-using std::numeric_limits;
#include <string>
-using std::string;
-#include <vector>
-using std::vector;
#include "kudu/gutil/int128.h"
#include "kudu/gutil/integral_types.h"
@@ -32,10 +26,10 @@ using std::vector;
* @{ */
// Convert a fingerprint to 16 hex digits.
-string FpToString(Fprint fp);
+std::string FpToString(Fprint fp);
// Formats a uint128 as a 32-digit hex string.
-string Uint128ToHexString(uint128 ui128);
+std::string Uint128ToHexString(uint128 ui128);
// Convert strings to numeric values, with strict error checking.
// Leading and trailing spaces are allowed.
@@ -52,12 +46,12 @@ bool safe_strtou64(const char* str, uint64* value);
bool safe_strtof(const char* str, float* value);
bool safe_strtod(const char* str, double* value);
-bool safe_strto32(const string& str, int32* value);
-bool safe_strto64(const string& str, int64* value);
-bool safe_strtou32(const string& str, uint32* value);
-bool safe_strtou64(const string& str, uint64* value);
-bool safe_strtof(const string& str, float* value);
-bool safe_strtod(const string& str, double* value);
+bool safe_strto32(const std::string& str, int32* value);
+bool safe_strto64(const std::string& str, int64* value);
+bool safe_strtou32(const std::string& str, uint32* value);
+bool safe_strtou64(const std::string& str, uint64* value);
+bool safe_strtof(const std::string& str, float* value);
+bool safe_strtod(const std::string& str, double* value);
// Parses buffer_size many characters from startptr into value.
bool safe_strto32(const char* startptr, int buffer_size, int32* value);
@@ -71,10 +65,10 @@ bool safe_strto64_base(const char* str, int64* value, int base);
bool safe_strtou32_base(const char* str, uint32* value, int base);
bool safe_strtou64_base(const char* str, uint64* value, int base);
-bool safe_strto32_base(const string& str, int32* value, int base);
-bool safe_strto64_base(const string& str, int64* value, int base);
-bool safe_strtou32_base(const string& str, uint32* value, int base);
-bool safe_strtou64_base(const string& str, uint64* value, int base);
+bool safe_strto32_base(const std::string& str, int32* value, int base);
+bool safe_strto64_base(const std::string& str, int64* value, int base);
+bool safe_strtou32_base(const std::string& str, uint32* value, int base);
+bool safe_strtou64_base(const std::string& str, uint64* value, int base);
bool safe_strto32_base(const char* startptr, int buffer_size,
int32* value, int base);
@@ -92,7 +86,7 @@ size_t u64tostr_base36(uint64 number, size_t buf_size, char* buffer);
// Similar to atoi(s), except s could be like "16k", "32M", "2G", "4t".
uint64 atoi_kmgt(const char* s);
-inline uint64 atoi_kmgt(const string& s) { return atoi_kmgt(s.c_str()); }
+inline uint64 atoi_kmgt(const std::string& s) { return atoi_kmgt(s.c_str()); }
// ----------------------------------------------------------------------
// FastIntToBuffer()
@@ -195,7 +189,7 @@ int HexDigitsPrefix(const char* buf, int num_digits);
// ConsumeStrayLeadingZeroes
// Eliminates all leading zeroes (unless the string itself is composed
// of nothing but zeroes, in which case one is kept: 0...0 becomes 0).
-void ConsumeStrayLeadingZeroes(string* str);
+void ConsumeStrayLeadingZeroes(std::string* str);
// ----------------------------------------------------------------------
// ParseLeadingInt32Value
@@ -206,7 +200,7 @@ void ConsumeStrayLeadingZeroes(string* str);
// treated as octal. If you know it's decimal, use ParseLeadingDec32Value.
// --------------------------------------------------------------------
int32 ParseLeadingInt32Value(const char* str, int32 deflt);
-inline int32 ParseLeadingInt32Value(const string& str, int32 deflt) {
+inline int32 ParseLeadingInt32Value(const std::string& str, int32 deflt) {
return ParseLeadingInt32Value(str.c_str(), deflt);
}
@@ -218,7 +212,7 @@ inline int32 ParseLeadingInt32Value(const string& str, int32 deflt) {
// treated as octal. If you know it's decimal, use ParseLeadingUDec32Value.
// --------------------------------------------------------------------
uint32 ParseLeadingUInt32Value(const char* str, uint32 deflt);
-inline uint32 ParseLeadingUInt32Value(const string& str, uint32 deflt) {
+inline uint32 ParseLeadingUInt32Value(const std::string& str, uint32 deflt) {
return ParseLeadingUInt32Value(str.c_str(), deflt);
}
@@ -232,7 +226,7 @@ inline uint32 ParseLeadingUInt32Value(const string& str, uint32 deflt) {
// See also: ParseLeadingDec64Value
// --------------------------------------------------------------------
int32 ParseLeadingDec32Value(const char* str, int32 deflt);
-inline int32 ParseLeadingDec32Value(const string& str, int32 deflt) {
+inline int32 ParseLeadingDec32Value(const std::string& str, int32 deflt) {
return ParseLeadingDec32Value(str.c_str(), deflt);
}
@@ -245,7 +239,7 @@ inline int32 ParseLeadingDec32Value(const string& str, int32 deflt) {
// See also: ParseLeadingUDec64Value
// --------------------------------------------------------------------
uint32 ParseLeadingUDec32Value(const char* str, uint32 deflt);
-inline uint32 ParseLeadingUDec32Value(const string& str, uint32 deflt) {
+inline uint32 ParseLeadingUDec32Value(const std::string& str, uint32 deflt) {
return ParseLeadingUDec32Value(str.c_str(), deflt);
}
@@ -260,23 +254,23 @@ inline uint32 ParseLeadingUDec32Value(const string& str, uint32 deflt) {
// valid integer is found; else returns deflt
// --------------------------------------------------------------------
uint64 ParseLeadingUInt64Value(const char* str, uint64 deflt);
-inline uint64 ParseLeadingUInt64Value(const string& str, uint64 deflt) {
+inline uint64 ParseLeadingUInt64Value(const std::string& str, uint64 deflt) {
return ParseLeadingUInt64Value(str.c_str(), deflt);
}
int64 ParseLeadingInt64Value(const char* str, int64 deflt);
-inline int64 ParseLeadingInt64Value(const string& str, int64 deflt) {
+inline int64 ParseLeadingInt64Value(const std::string& str, int64 deflt) {
return ParseLeadingInt64Value(str.c_str(), deflt);
}
uint64 ParseLeadingHex64Value(const char* str, uint64 deflt);
-inline uint64 ParseLeadingHex64Value(const string& str, uint64 deflt) {
+inline uint64 ParseLeadingHex64Value(const std::string& str, uint64 deflt) {
return ParseLeadingHex64Value(str.c_str(), deflt);
}
int64 ParseLeadingDec64Value(const char* str, int64 deflt);
-inline int64 ParseLeadingDec64Value(const string& str, int64 deflt) {
+inline int64 ParseLeadingDec64Value(const std::string& str, int64 deflt) {
return ParseLeadingDec64Value(str.c_str(), deflt);
}
uint64 ParseLeadingUDec64Value(const char* str, uint64 deflt);
-inline uint64 ParseLeadingUDec64Value(const string& str, uint64 deflt) {
+inline uint64 ParseLeadingUDec64Value(const std::string& str, uint64 deflt) {
return ParseLeadingUDec64Value(str.c_str(), deflt);
}
@@ -287,7 +281,7 @@ inline uint64 ParseLeadingUDec64Value(const string& str, uint64 deflt) {
// check if str is entirely consumed.
// --------------------------------------------------------------------
double ParseLeadingDoubleValue(const char* str, double deflt);
-inline double ParseLeadingDoubleValue(const string& str, double deflt) {
+inline double ParseLeadingDoubleValue(const std::string& str, double deflt) {
return ParseLeadingDoubleValue(str.c_str(), deflt);
}
@@ -299,7 +293,7 @@ inline double ParseLeadingDoubleValue(const string& str, double deflt) {
// 0/1, false/true, no/yes, n/y
// --------------------------------------------------------------------
bool ParseLeadingBoolValue(const char* str, bool deflt);
-inline bool ParseLeadingBoolValue(const string& str, bool deflt) {
+inline bool ParseLeadingBoolValue(const std::string& str, bool deflt) {
return ParseLeadingBoolValue(str.c_str(), deflt);
}
@@ -337,29 +331,29 @@ bool StrictAutoDigitLessThan(const char* a, int alen,
const char* b, int blen);
struct autodigit_less
- : public binary_function<const string&, const string&, bool> {
- bool operator()(const string& a, const string& b) const {
+ : public std::binary_function<const std::string&, const std::string&, bool> {
+ bool operator()(const std::string& a, const std::string& b) const {
return AutoDigitLessThan(a.data(), a.size(), b.data(), b.size());
}
};
struct autodigit_greater
- : public binary_function<const string&, const string&, bool> {
- bool operator()(const string& a, const string& b) const {
+ : public std::binary_function<const std::string&, const std::string&, bool> {
+ bool operator()(const std::string& a, const std::string& b) const {
return AutoDigitLessThan(b.data(), b.size(), a.data(), a.size());
}
};
struct strict_autodigit_less
- : public binary_function<const string&, const string&, bool> {
- bool operator()(const string& a, const string& b) const {
+ : public std::binary_function<const std::string&, const std::string&, bool> {
+ bool operator()(const std::string& a, const std::string& b) const {
return StrictAutoDigitLessThan(a.data(), a.size(), b.data(), b.size());
}
};
struct strict_autodigit_greater
- : public binary_function<const string&, const string&, bool> {
- bool operator()(const string& a, const string& b) const {
+ : public std::binary_function<const std::string&, const std::string&, bool> {
+ bool operator()(const std::string& a, const std::string& b) const {
return StrictAutoDigitLessThan(b.data(), b.size(), a.data(), a.size());
}
};
@@ -371,26 +365,26 @@ struct strict_autodigit_greater
//
// Return value: string
// ----------------------------------------------------------------------
-inline string SimpleItoa(int32 i) {
+inline std::string SimpleItoa(int32 i) {
char buf[16]; // Longest is -2147483648
- return string(buf, FastInt32ToBufferLeft(i, buf));
+ return std::string(buf, FastInt32ToBufferLeft(i, buf));
}
// We need this overload because otherwise SimpleItoa(5U) wouldn't compile.
-inline string SimpleItoa(uint32 i) {
+inline std::string SimpleItoa(uint32 i) {
char buf[16]; // Longest is 4294967295
- return string(buf, FastUInt32ToBufferLeft(i, buf));
+ return std::string(buf, FastUInt32ToBufferLeft(i, buf));
}
-inline string SimpleItoa(int64 i) {
+inline std::string SimpleItoa(int64 i) {
char buf[32]; // Longest is -9223372036854775808
- return string(buf, FastInt64ToBufferLeft(i, buf));
+ return std::string(buf, FastInt64ToBufferLeft(i, buf));
}
// We need this overload because otherwise SimpleItoa(5ULL) wouldn't compile.
-inline string SimpleItoa(uint64 i) {
+inline std::string SimpleItoa(uint64 i) {
char buf[32]; // Longest is 18446744073709551615
- return string(buf, FastUInt64ToBufferLeft(i, buf));
+ return std::string(buf, FastUInt64ToBufferLeft(i, buf));
}
// SimpleAtoi converts a string to an integer.
@@ -421,7 +415,7 @@ bool MUST_USE_RESULT SimpleAtoi(const char* s, int_type* out) {
}
template <typename int_type>
-bool MUST_USE_RESULT SimpleAtoi(const string& s, int_type* out) {
+bool MUST_USE_RESULT SimpleAtoi(const std::string& s, int_type* out) {
return SimpleAtoi(s.c_str(), out);
}
@@ -444,8 +438,8 @@ bool MUST_USE_RESULT SimpleAtoi(const string& s, int_type* out) {
//
// Return value: string
// ----------------------------------------------------------------------
-string SimpleDtoa(double value);
-string SimpleFtoa(float value);
+std::string SimpleDtoa(double value);
+std::string SimpleFtoa(float value);
char* DoubleToBuffer(double i, char* buffer);
char* FloatToBuffer(float i, char* buffer);
@@ -464,10 +458,10 @@ static const int kFloatToBufferSize = 24;
//
// Return value: string
// ----------------------------------------------------------------------
-string SimpleItoaWithCommas(int32 i);
-string SimpleItoaWithCommas(uint32 i);
-string SimpleItoaWithCommas(int64 i);
-string SimpleItoaWithCommas(uint64 i);
+std::string SimpleItoaWithCommas(int32 i);
+std::string SimpleItoaWithCommas(uint32 i);
+std::string SimpleItoaWithCommas(int64 i);
+std::string SimpleItoaWithCommas(uint64 i);
// ----------------------------------------------------------------------
// ItoaKMGT()
@@ -478,7 +472,7 @@ string SimpleItoaWithCommas(uint64 i);
//
// Return value: string
// ----------------------------------------------------------------------
-string ItoaKMGT(int64 i);
+std::string ItoaKMGT(int64 i);
// ----------------------------------------------------------------------
// ParseDoubleRange()
@@ -541,34 +535,34 @@ bool ParseDoubleRange(const char* text, int len, const char** end,
// Do not use in new code.
// DEPRECATED(wadetregaskis). Just call StringPrintf or SimpleFtoa.
-string FloatToString(float f, const char* format);
+std::string FloatToString(float f, const char* format);
// DEPRECATED(wadetregaskis). Just call StringPrintf or SimpleItoa.
-string IntToString(int i, const char* format);
+std::string IntToString(int i, const char* format);
// DEPRECATED(wadetregaskis). Just call StringPrintf or SimpleItoa.
-string Int64ToString(int64 i64, const char* format);
+std::string Int64ToString(int64 i64, const char* format);
// DEPRECATED(wadetregaskis). Just call StringPrintf or SimpleItoa.
-string UInt64ToString(uint64 ui64, const char* format);
+std::string UInt64ToString(uint64 ui64, const char* format);
// DEPRECATED(wadetregaskis). Just call StringPrintf.
-inline string FloatToString(float f) {
+inline std::string FloatToString(float f) {
return StringPrintf("%7f", f);
}
// DEPRECATED(wadetregaskis). Just call StringPrintf.
-inline string IntToString(int i) {
+inline std::string IntToString(int i) {
return StringPrintf("%7d", i);
}
// DEPRECATED(wadetregaskis). Just call StringPrintf.
-inline string Int64ToString(int64 i64) {
+inline std::string Int64ToString(int64 i64) {
return StringPrintf("%7" PRId64, i64);
}
// DEPRECATED(wadetregaskis). Just call StringPrintf.
-inline string UInt64ToString(uint64 ui64) {
+inline std::string UInt64ToString(uint64 ui64) {
return StringPrintf("%7" PRIu64, ui64);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/serialize.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/serialize.h b/src/kudu/gutil/strings/serialize.h
index 7966cd2..d8c5d0b 100644
--- a/src/kudu/gutil/strings/serialize.h
+++ b/src/kudu/gutil/strings/serialize.h
@@ -12,12 +12,8 @@
using __gnu_cxx::hash;
using __gnu_cxx::hash_map;
#include <string>
-using std::string;
#include <utility>
-using std::make_pair;
-using std::pair;
#include <vector>
-using std::vector;
#include <glog/logging.h>
@@ -32,20 +28,20 @@ using std::vector;
// Converts a 4-byte uint32 to a string such that the string keys sort in
// the same order as the original uint32 value.
// TODO(user): Rework all reinterpret_casts<> in this file.
-inline void KeyFromUint32(uint32 u32, string* key) {
+inline void KeyFromUint32(uint32 u32, std::string* key) {
uint32 norder = ghtonl(u32);
key->assign(reinterpret_cast<const char*>(&norder), sizeof(norder));
}
// Converts "fp" to an 8-byte string key
-inline void KeyFromUint64(uint64 fp, string* key) {
+inline void KeyFromUint64(uint64 fp, std::string* key) {
uint64 norder = htonll(fp);
key->assign(reinterpret_cast<const char*>(&norder), sizeof(norder));
}
// Converts a 16-byte uint128 to a string such that the string keys sort in
// the same order as the original uint128 value.
-inline void KeyFromUint128(uint128 fp, string* key) {
+inline void KeyFromUint128(uint128 fp, std::string* key) {
uint64 norder[] = { htonll(Uint128High64(fp)),
htonll(Uint128Low64(fp))
};
@@ -53,13 +49,13 @@ inline void KeyFromUint128(uint128 fp, string* key) {
}
// This version of KeyFromUint32 is less efficient but very convenient
-string Uint32ToKey(uint32 u32);
+std::string Uint32ToKey(uint32 u32);
// This version of KeyFromUint64 is less efficient but very convenient
-string Uint64ToKey(uint64 fp);
+std::string Uint64ToKey(uint64 fp);
// This version of KeyFromUint128 is less efficient but very convenient
-string Uint128ToKey(uint128 u128);
+std::string Uint128ToKey(uint128 u128);
// Converts a 4-byte string key (typically generated by KeyFromUint32 or
// Uint32ToKey) into a uint32 value.
@@ -98,11 +94,11 @@ inline uint128 KeyToUint128(const StringPiece& key) {
// inputs. To obtain keys such that lexicographic ordering corresponds
// to the natural total order on the integers, use OrderedStringFromInt32()
// or ReverseOrderedStringFromInt32() instead.
-void KeyFromInt32(int32 i32, string* key);
+void KeyFromInt32(int32 i32, std::string* key);
// Convenient form of KeyFromInt32.
-inline string Int32ToKey(int32 i32) {
- string s;
+inline std::string Int32ToKey(int32 i32) {
+ std::string s;
KeyFromInt32(i32, &s);
return s;
}
@@ -113,21 +109,21 @@ int32 KeyToInt32(const StringPiece& key);
// Converts a double value to an 8-byte string key, so that
// the string keys sort in the same order as the original double values.
-void KeyFromDouble(double x, string* key);
+void KeyFromDouble(double x, std::string* key);
// Converts key generated by KeyFromDouble() back to double.
double KeyToDouble(const StringPiece& key);
// This version of KeyFromDouble is less efficient but very convenient
-string DoubleToKey(double x);
+std::string DoubleToKey(double x);
// Converts int32 to a 4-byte string key such that lexicographic
// ordering of strings is equivalent to sorting in increasing order by
// integer values. This can be useful when constructing secondary
-void OrderedStringFromInt32(int32 i32, string* key);
+void OrderedStringFromInt32(int32 i32, std::string* key);
// This version of OrderedStringFromInt32 is less efficient but very convenient
-string Int32ToOrderedString(int32 i32);
+std::string Int32ToOrderedString(int32 i32);
// The inverse of the above function.
int32 OrderedStringToInt32(const StringPiece& key);
@@ -135,10 +131,10 @@ int32 OrderedStringToInt32(const StringPiece& key);
// Converts int64 to an 8-byte string key such that lexicographic
// ordering of strings is equivalent to sorting in increasing order by
// integer values.
-void OrderedStringFromInt64(int64 i64, string* key);
+void OrderedStringFromInt64(int64 i64, std::string* key);
// This version of OrderedStringFromInt64 is less efficient but very convenient
-string Int64ToOrderedString(int64 i64);
+std::string Int64ToOrderedString(int64 i64);
// The inverse of the above function.
int64 OrderedStringToInt64(const StringPiece& key);
@@ -146,10 +142,10 @@ int64 OrderedStringToInt64(const StringPiece& key);
// Converts int32 to a 4-byte string key such that lexicographic
// ordering of strings is equivalent to sorting in decreasing order
// by integer values. This can be useful when constructing secondary
-void ReverseOrderedStringFromInt32(int32 i32, string* key);
+void ReverseOrderedStringFromInt32(int32 i32, std::string* key);
// This version of ReverseOrderedStringFromInt32 is less efficient but very
-string Int32ToReverseOrderedString(int32 i32);
+std::string Int32ToReverseOrderedString(int32 i32);
// The inverse of the above function.
int32 ReverseOrderedStringToInt32(const StringPiece& key);
@@ -157,10 +153,10 @@ int32 ReverseOrderedStringToInt32(const StringPiece& key);
// Converts int64 to an 8-byte string key such that lexicographic
// ordering of strings is equivalent to sorting in decreasing order
// by integer values. This can be useful when constructing secondary
-void ReverseOrderedStringFromInt64(int64 i64, string* key);
+void ReverseOrderedStringFromInt64(int64 i64, std::string* key);
// This version of ReverseOrderedStringFromInt64 is less efficient but very
-string Int64ToReverseOrderedString(int64 i64);
+std::string Int64ToReverseOrderedString(int64 i64);
// The inverse of the above function.
int64 ReverseOrderedStringToInt64(const StringPiece& key);
@@ -176,9 +172,9 @@ int64 ReverseOrderedStringToInt64(const StringPiece& key);
// string s = EncodePOD(i);
// in place of:
// string s = EncodeUint32(static_cast<uint32>(i));
-template <typename T> inline string EncodePOD(const T& value) {
+template <typename T> inline std::string EncodePOD(const T& value) {
ENFORCE_POD(T);
- string s;
+ std::string s;
STLStringResizeUninitialized(&s, sizeof(T));
memcpy(string_as_array(&s), &value, sizeof(T));
return s;
@@ -214,11 +210,11 @@ template <typename T> inline bool DecodePOD(const StringPiece& str, T* result) {
// Stores the value bytes of a vector of plain old data type in a C++ string.
// Verifies the given data type is a POD and copies the bytes of each value
// in the vector into a newly created string.
-template <typename T> inline string EncodeVectorPOD(const vector<T>& vec) {
+template <typename T> inline std::string EncodeVectorPOD(const std::vector<T>& vec) {
ENFORCE_POD(T);
- string s;
+ std::string s;
STLStringResizeUninitialized(&s, vec.size() * sizeof(T));
- typename vector<T>::const_iterator iter;
+ typename std::vector<T>::const_iterator iter;
char* ptr;
for (iter = vec.begin(), ptr = string_as_array(&s);
iter != vec.end();
@@ -234,8 +230,8 @@ template <typename T> inline string EncodeVectorPOD(const vector<T>& vec) {
// Returns true if the operation succeeded.
// Note that other than the data length, no check is (or can be)
// done on the type of data stored in the string.
-template <typename T> inline bool DecodeVectorPOD(const string& str,
- vector<T>* result) {
+template <typename T> inline bool DecodeVectorPOD(const std::string& str,
+ std::vector<T>* result) {
ENFORCE_POD(T);
CHECK(result != NULL);
if (str.size() % sizeof(T) != 0)
@@ -270,19 +266,19 @@ template <typename T> inline bool DecodeVectorPOD(const string& str,
// they make the payload type explicit.
// Note that these encodings are NOT endian-neutral.
// ----------------------------------------------------------------------
-inline string EncodeDouble(double d) {
+inline std::string EncodeDouble(double d) {
return EncodePOD(d);
}
-inline string EncodeFloat(float f) {
+inline std::string EncodeFloat(float f) {
return EncodePOD(f);
}
-inline string EncodeUint32(uint32 i) {
+inline std::string EncodeUint32(uint32 i) {
return EncodePOD(i);
}
-inline string EncodeUint64(uint64 i) {
+inline std::string EncodeUint64(uint64 i) {
return EncodePOD(i);
}
@@ -311,8 +307,8 @@ inline bool DecodeUint64(const StringPiece& s, uint64* i) {
// <key, value> pairs. Returns true if there if no error in parsing, false
// otherwise.
// -------------------------------------------------------------------------
-bool DictionaryParse(const string& encoded_str,
- vector<pair<string, string> >* items);
+bool DictionaryParse(const std::string& encoded_str,
+ std::vector<std::pair<std::string, std::string> >* items);
// --------------------------------------------------------------------------
// DictionaryInt32Encode
@@ -328,16 +324,16 @@ bool DictionaryParse(const string& encoded_str,
// Note: these routines are not meant for use with very large dictionaries.
// They are written for convenience and not efficiency.
// --------------------------------------------------------------------------
-string DictionaryInt32Encode(const hash_map<string, int32>* dictionary);
-string DictionaryInt64Encode(const hash_map<string, int64>* dictionary);
-string DictionaryDoubleEncode(const hash_map<string, double>* dictionary);
-
-bool DictionaryInt32Decode(hash_map<string, int32>* dictionary,
- const string& encoded_str);
-bool DictionaryInt64Decode(hash_map<string, int64>* dictionary,
- const string& encoded_str);
-bool DictionaryDoubleDecode(hash_map<string, double>* dictionary,
- const string& encoded_str);
+std::string DictionaryInt32Encode(const hash_map<std::string, int32>* dictionary);
+std::string DictionaryInt64Encode(const hash_map<std::string, int64>* dictionary);
+std::string DictionaryDoubleEncode(const hash_map<std::string, double>* dictionary);
+
+bool DictionaryInt32Decode(hash_map<std::string, int32>* dictionary,
+ const std::string& encoded_str);
+bool DictionaryInt64Decode(hash_map<std::string, int64>* dictionary,
+ const std::string& encoded_str);
+bool DictionaryDoubleDecode(hash_map<std::string, double>* dictionary,
+ const std::string& encoded_str);
#endif // STRINGS_SERIALIZE_H_
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/split.cc
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/split.cc b/src/kudu/gutil/strings/split.cc
index a42faa7..f8de413 100644
--- a/src/kudu/gutil/strings/split.cc
+++ b/src/kudu/gutil/strings/split.cc
@@ -8,10 +8,7 @@
#include <stdlib.h>
#include <string.h>
#include <iterator>
-using std::back_insert_iterator;
-using std::iterator_traits;
#include <limits>
-using std::numeric_limits;
#include "kudu/gutil/integral_types.h"
#include <glog/logging.h>
@@ -22,6 +19,15 @@ using std::numeric_limits;
#include "kudu/gutil/strings/util.h"
#include "kudu/gutil/hash/hash.h"
+using std::back_insert_iterator;
+using std::iterator_traits;
+using std::map;
+using std::numeric_limits;
+using std::pair;
+using std::set;
+using std::string;
+using std::vector;
+
// Implementations for some of the Split2 API. Much of the Split2 API is
// templated so it exists in header files, either strings/split.h or
// strings/split_iternal.h.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/split.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/split.h b/src/kudu/gutil/strings/split.h
index c487689..cdf59aa 100644
--- a/src/kudu/gutil/strings/split.h
+++ b/src/kudu/gutil/strings/split.h
@@ -22,12 +22,6 @@
#include <stddef.h>
#include <algorithm>
-using std::copy;
-using std::max;
-using std::min;
-using std::reverse;
-using std::sort;
-using std::swap;
#include <ext/hash_map>
using __gnu_cxx::hash;
using __gnu_cxx::hash_map;
@@ -35,21 +29,11 @@ using __gnu_cxx::hash_map;
using __gnu_cxx::hash;
using __gnu_cxx::hash_set;
#include <iterator>
-using std::back_insert_iterator;
-using std::iterator_traits;
#include <map>
-using std::map;
-using std::multimap;
#include <set>
-using std::multiset;
-using std::set;
#include <string>
-using std::string;
#include <utility>
-using std::make_pair;
-using std::pair;
#include <vector>
-using std::vector;
#include <glog/logging.h>
@@ -356,7 +340,7 @@ class Literal {
StringPiece Find(StringPiece text) const;
private:
- const string delimiter_;
+ const std::string delimiter_;
};
// Represents a delimiter that will match any of the given byte-sized
@@ -383,7 +367,7 @@ class AnyOf {
StringPiece Find(StringPiece text) const;
private:
- const string delimiters_;
+ const std::string delimiters_;
};
// Wraps another delimiter and sets a max number of matches for that delimiter.
@@ -427,7 +411,7 @@ inline LimitImpl<Literal> Limit(const char* s, int limit) {
return LimitImpl<Literal>(Literal(s), limit);
}
-inline LimitImpl<Literal> Limit(const string& s, int limit) {
+inline LimitImpl<Literal> Limit(const std::string& s, int limit) {
return LimitImpl<Literal>(Literal(s), limit);
}
@@ -500,7 +484,7 @@ inline internal::Splitter<delimiter::Literal> Split(
}
inline internal::Splitter<delimiter::Literal> Split(
- StringPiece text, const string& delimiter) {
+ StringPiece text, const std::string& delimiter) {
return internal::Splitter<delimiter::Literal>(
text, delimiter::Literal(delimiter));
}
@@ -521,7 +505,7 @@ inline internal::Splitter<delimiter::Literal, Predicate> Split(
template <typename Predicate>
inline internal::Splitter<delimiter::Literal, Predicate> Split(
- StringPiece text, const string& delimiter, Predicate p) {
+ StringPiece text, const std::string& delimiter, Predicate p) {
return internal::Splitter<delimiter::Literal, Predicate>(
text, delimiter::Literal(delimiter), p);
}
@@ -573,7 +557,7 @@ void ClipString(char* str, int max_len);
// Version of ClipString() that uses string instead of char*.
// NOTE: See comment above.
// ----------------------------------------------------------------------
-void ClipString(string* full_str, int max_len);
+void ClipString(std::string* full_str, int max_len);
// ----------------------------------------------------------------------
// SplitStringToLines() Split a string into lines of maximum length
@@ -587,7 +571,7 @@ void ClipString(string* full_str, int max_len);
void SplitStringToLines(const char* full,
int max_len,
int num_lines,
- vector<string>* result);
+ std::vector<std::string>* result);
// ----------------------------------------------------------------------
// SplitOneStringToken()
@@ -607,7 +591,7 @@ void SplitStringToLines(const char* full,
// // r = "abc"
// // s points to ";de"
// ----------------------------------------------------------------------
-string SplitOneStringToken(const char** source, const char* delim);
+std::string SplitOneStringToken(const char** source, const char* delim);
// ----------------------------------------------------------------------
// SplitUsing()
@@ -618,7 +602,7 @@ string SplitOneStringToken(const char** source, const char* delim);
// Use SplitToVector with last argument 'false' if you want the
// empty fields.
// ----------------------------------------------------------------------
-vector<char*>* SplitUsing(char* full, const char* delimiters);
+std::vector<char*>* SplitUsing(char* full, const char* delimiters);
// ----------------------------------------------------------------------
// SplitToVector()
@@ -628,10 +612,10 @@ vector<char*>* SplitUsing(char* full, const char* delimiters);
// true, empty strings are omitted from the resulting vector.
// ----------------------------------------------------------------------
void SplitToVector(char* full, const char* delimiters,
- vector<char*>* vec,
+ std::vector<char*>* vec,
bool omit_empty_strings);
void SplitToVector(char* full, const char* delimiters,
- vector<const char*>* vec,
+ std::vector<const char*>* vec,
bool omit_empty_strings);
// ----------------------------------------------------------------------
@@ -645,7 +629,7 @@ void SplitToVector(char* full, const char* delimiters,
// ----------------------------------------------------------------------
void SplitStringPieceToVector(const StringPiece& full,
const char* delim,
- vector<StringPiece>* vec,
+ std::vector<StringPiece>* vec,
bool omit_empty_strings);
// ----------------------------------------------------------------------
@@ -676,21 +660,21 @@ void SplitStringPieceToVector(const StringPiece& full,
// For even better performance, store the result in a vector<StringPiece>
// to avoid string copies.
// ----------------------------------------------------------------------
-void SplitStringUsing(const string& full, const char* delimiters,
- vector<string>* result);
-void SplitStringToHashsetUsing(const string& full, const char* delimiters,
- hash_set<string>* result);
-void SplitStringToSetUsing(const string& full, const char* delimiters,
- set<string>* result);
+void SplitStringUsing(const std::string& full, const char* delimiters,
+ std::vector<std::string>* result);
+void SplitStringToHashsetUsing(const std::string& full, const char* delimiters,
+ hash_set<std::string>* result);
+void SplitStringToSetUsing(const std::string& full, const char* delimiters,
+ std::set<std::string>* result);
// The even-positioned (0-based) components become the keys for the
// odd-positioned components that follow them. When there is an odd
// number of components, the value for the last key will be unchanged
// if the key was already present in the hash table, or will be the
// empty string if the key is a newly inserted key.
-void SplitStringToMapUsing(const string& full, const char* delim,
- map<string, string>* result);
-void SplitStringToHashmapUsing(const string& full, const char* delim,
- hash_map<string, string>* result);
+void SplitStringToMapUsing(const std::string& full, const char* delim,
+ std::map<std::string, std::string>* result);
+void SplitStringToHashmapUsing(const std::string& full, const char* delim,
+ hash_map<std::string, std::string>* result);
// ----------------------------------------------------------------------
// SplitStringAllowEmpty()
@@ -712,8 +696,8 @@ void SplitStringToHashmapUsing(const string& full, const char* delim,
// For even better performance, store the result in a vector<StringPiece> to
// avoid string copies.
// ----------------------------------------------------------------------
-void SplitStringAllowEmpty(const string& full, const char* delim,
- vector<string>* result);
+void SplitStringAllowEmpty(const std::string& full, const char* delim,
+ std::vector<std::string>* result);
// ----------------------------------------------------------------------
// SplitStringWithEscaping()
@@ -733,18 +717,18 @@ void SplitStringAllowEmpty(const string& full, const char* delim,
//
// All versions other than "AllowEmpty" discard any empty substrings.
// ----------------------------------------------------------------------
-void SplitStringWithEscaping(const string& full,
+void SplitStringWithEscaping(const std::string& full,
const strings::CharSet& delimiters,
- vector<string>* result);
-void SplitStringWithEscapingAllowEmpty(const string& full,
+ std::vector<std::string>* result);
+void SplitStringWithEscapingAllowEmpty(const std::string& full,
const strings::CharSet& delimiters,
- vector<string>* result);
-void SplitStringWithEscapingToSet(const string& full,
+ std::vector<std::string>* result);
+void SplitStringWithEscapingToSet(const std::string& full,
const strings::CharSet& delimiters,
- set<string>* result);
-void SplitStringWithEscapingToHashset(const string& full,
+ std::set<std::string>* result);
+void SplitStringWithEscapingToHashset(const std::string& full,
const strings::CharSet& delimiters,
- hash_set<string>* result);
+ hash_set<std::string>* result);
// ----------------------------------------------------------------------
// SplitStringIntoNPiecesAllowEmpty()
@@ -759,10 +743,10 @@ void SplitStringWithEscapingToHashset(const string& full,
//
// If "full" is the empty string, yields an empty string as the only value.
// ----------------------------------------------------------------------
-void SplitStringIntoNPiecesAllowEmpty(const string& full,
+void SplitStringIntoNPiecesAllowEmpty(const std::string& full,
const char* delimiters,
int pieces,
- vector<string>* result);
+ std::vector<std::string>* result);
// ----------------------------------------------------------------------
// SplitStringAndParse()
@@ -806,18 +790,18 @@ void SplitStringIntoNPiecesAllowEmpty(const string& full,
// ----------------------------------------------------------------------
template <class T>
bool SplitStringAndParse(StringPiece source, StringPiece delim,
- bool (*parse)(const string& str, T* value),
- vector<T>* result);
+ bool (*parse)(const std::string& str, T* value),
+ std::vector<T>* result);
template <class Container>
bool SplitStringAndParseToContainer(
StringPiece source, StringPiece delim,
- bool (*parse)(const string& str, typename Container::value_type* value),
+ bool (*parse)(const std::string& str, typename Container::value_type* value),
Container* result);
template <class List>
bool SplitStringAndParseToList(
StringPiece source, StringPiece delim,
- bool (*parse)(const string& str, typename List::value_type* value),
+ bool (*parse)(const std::string& str, typename List::value_type* value),
List* result);
// ----------------------------------------------------------------------
// SplitRange()
@@ -866,12 +850,12 @@ bool SplitRange(const char* rangestr, int* from, int* to);
// See //util/csv/parser.h for more complete documentation.
//
// ----------------------------------------------------------------------
-void SplitCSVLine(char* line, vector<char*>* cols);
+void SplitCSVLine(char* line, std::vector<char*>* cols);
void SplitCSVLineWithDelimiter(char* line, char delimiter,
- vector<char*>* cols);
+ std::vector<char*>* cols);
// SplitCSVLine string wrapper that internally makes a copy of string line.
-void SplitCSVLineWithDelimiterForStrings(const string& line, char delimiter,
- vector<string>* cols);
+void SplitCSVLineWithDelimiterForStrings(const std::string& line, char delimiter,
+ std::vector<std::string>* cols);
// ----------------------------------------------------------------------
// SplitStructuredLine()
@@ -898,14 +882,14 @@ void SplitCSVLineWithDelimiterForStrings(const string& line, char delimiter,
char* SplitStructuredLine(char* line,
char delimiter,
const char* symbol_pairs,
- vector<char*>* cols);
+ std::vector<char*>* cols);
// Similar to the function with the same name above, but splits a StringPiece
// into StringPiece parts. Returns true if successful.
bool SplitStructuredLine(StringPiece line,
char delimiter,
const char* symbol_pairs,
- vector<StringPiece>* cols);
+ std::vector<StringPiece>* cols);
// ----------------------------------------------------------------------
// SplitStructuredLineWithEscapes()
@@ -929,14 +913,14 @@ bool SplitStructuredLine(StringPiece line,
char* SplitStructuredLineWithEscapes(char* line,
char delimiter,
const char* symbol_pairs,
- vector<char*>* cols);
+ std::vector<char*>* cols);
// Similar to the function with the same name above, but splits a StringPiece
// into StringPiece parts. Returns true if successful.
bool SplitStructuredLineWithEscapes(StringPiece line,
char delimiter,
const char* symbol_pairs,
- vector<StringPiece>* cols);
+ std::vector<StringPiece>* cols);
// ----------------------------------------------------------------------
// DEPRECATED(jgm): See the "NEW API" comment about this function below for
@@ -987,10 +971,10 @@ bool SplitStructuredLineWithEscapes(StringPiece line,
// vector<string> values = Split(key_values.second, AnyOf(vv_delim));
//
// ----------------------------------------------------------------------
-bool SplitStringIntoKeyValues(const string& line,
- const string& key_value_delimiters,
- const string& value_value_delimiters,
- string* key, vector<string>* values);
+bool SplitStringIntoKeyValues(const std::string& line,
+ const std::string& key_value_delimiters,
+ const std::string& value_value_delimiters,
+ std::string* key, std::vector<std::string>* values);
// ----------------------------------------------------------------------
// SplitStringIntoKeyValuePairs()
@@ -1033,10 +1017,11 @@ bool SplitStringIntoKeyValues(const string& line,
// }
//
// ----------------------------------------------------------------------
-bool SplitStringIntoKeyValuePairs(const string& line,
- const string& key_value_delimiters,
- const string& key_value_pair_delimiters,
- vector<pair<string, string> >* kv_pairs);
+bool SplitStringIntoKeyValuePairs(
+ const std::string& line,
+ const std::string& key_value_delimiters,
+ const std::string& key_value_pair_delimiters,
+ std::vector<std::pair<std::string, std::string> >* kv_pairs);
// ----------------------------------------------------------------------
@@ -1048,8 +1033,8 @@ bool SplitStringIntoKeyValuePairs(const string& line,
// whitespace (does not consume trailing whitespace), and returns
// a pointer beyond the last character parsed.
// --------------------------------------------------------------------
-const char* SplitLeadingDec32Values(const char* next, vector<int32>* result);
-const char* SplitLeadingDec64Values(const char* next, vector<int64>* result);
+const char* SplitLeadingDec32Values(const char* next, std::vector<int32>* result);
+const char* SplitLeadingDec64Values(const char* next, std::vector<int64>* result);
// ----------------------------------------------------------------------
// SplitOneIntToken()
@@ -1135,8 +1120,8 @@ bool SplitOneHexUint64Token(const char** source, const char* delim,
// SplitStringAndParse() -- see description above
template <class T>
bool SplitStringAndParse(StringPiece source, StringPiece delim,
- bool (*parse)(const string& str, T* value),
- vector<T>* result) {
+ bool (*parse)(const std::string& str, T* value),
+ std::vector<T>* result) {
return SplitStringAndParseToList(source, delim, parse, result);
}
@@ -1146,16 +1131,15 @@ namespace internal {
template <class Container, class InsertPolicy>
bool SplitStringAndParseToInserter(
StringPiece source, StringPiece delim,
- bool (*parse)(const string& str, typename Container::value_type* value),
+ bool (*parse)(const std::string& str, typename Container::value_type* value),
Container* result, InsertPolicy insert_policy) {
CHECK(NULL != parse);
CHECK(NULL != result);
CHECK(NULL != delim.data());
CHECK_GT(delim.size(), 0);
bool retval = true;
- vector<StringPiece> pieces = strings::Split(source,
- strings::delimiter::AnyOf(delim),
- strings::SkipEmpty());
+ std::vector<StringPiece> pieces = strings::Split(
+ source, strings::delimiter::AnyOf(delim), strings::SkipEmpty());
for (const auto& piece : pieces) {
typename Container::value_type t;
if (parse(piece.as_string(), &t)) {
@@ -1187,7 +1171,7 @@ struct BackInsertPolicy {
template <class Container>
bool SplitStringAndParseToContainer(
StringPiece source, StringPiece delim,
- bool (*parse)(const string& str, typename Container::value_type* value),
+ bool (*parse)(const std::string& str, typename Container::value_type* value),
Container* result) {
return strings::internal::SplitStringAndParseToInserter(
source, delim, parse, result, strings::internal::BasicInsertPolicy());
@@ -1197,7 +1181,7 @@ bool SplitStringAndParseToContainer(
template <class List>
bool SplitStringAndParseToList(
StringPiece source, StringPiece delim,
- bool (*parse)(const string& str, typename List::value_type* value),
+ bool (*parse)(const std::string& str, typename List::value_type* value),
List* result) {
return strings::internal::SplitStringAndParseToInserter(
source, delim, parse, result, strings::internal::BackInsertPolicy());
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/split_internal.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/split_internal.h b/src/kudu/gutil/strings/split_internal.h
index 01b3fac..eef72df 100644
--- a/src/kudu/gutil/strings/split_internal.h
+++ b/src/kudu/gutil/strings/split_internal.h
@@ -18,13 +18,8 @@
#define STRINGS_SPLIT_INTERNAL_H_
#include <iterator>
-using std::back_insert_iterator;
-using std::iterator_traits;
#include <map>
-using std::map;
-using std::multimap;
#include <vector>
-using std::vector;
#include "kudu/gutil/port.h" // for LANG_CXX11
#include "kudu/gutil/strings/stringpiece.h"
@@ -165,16 +160,16 @@ struct StringPieceTo {
// Specialization for converting to string.
template <>
-struct StringPieceTo<string> {
- string operator()(StringPiece from) const {
+struct StringPieceTo<std::string> {
+ std::string operator()(StringPiece from) const {
return from.ToString();
}
};
// Specialization for converting to *const* string.
template <>
-struct StringPieceTo<const string> {
- string operator()(StringPiece from) const {
+struct StringPieceTo<const std::string> {
+ std::string operator()(StringPiece from) const {
return from.ToString();
}
};
@@ -320,7 +315,7 @@ class Splitter {
// use of this intermediate vector "v" can be removed.
template <typename Container>
Container ToContainer() {
- vector<StringPiece> v;
+ std::vector<StringPiece> v;
for (Iterator it = begin(); it != end_; ++it) {
v.push_back(*it);
}
@@ -397,7 +392,7 @@ class Splitter {
// Reserves the given amount of capacity in a vector<string>
template <typename A>
- void ReserveCapacity(vector<string, A>* v, size_t size) {
+ void ReserveCapacity(std::vector<std::string, A>* v, size_t size) {
v->reserve(size);
}
void ReserveCapacity(...) {}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/strcat.cc
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/strcat.cc b/src/kudu/gutil/strings/strcat.cc
index 93f8114..9abb662 100644
--- a/src/kudu/gutil/strings/strcat.cc
+++ b/src/kudu/gutil/strings/strcat.cc
@@ -14,6 +14,8 @@
#include "kudu/gutil/strings/escaping.h"
#include "kudu/gutil/stl_util.h"
+using std::string;
+
AlphaNum gEmptyAlphaNum("");
// ----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/strcat.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/strcat.h b/src/kudu/gutil/strings/strcat.h
index 40b888b..7216c66 100644
--- a/src/kudu/gutil/strings/strcat.h
+++ b/src/kudu/gutil/strings/strcat.h
@@ -8,7 +8,6 @@
#define STRINGS_STRCAT_H_
#include <string>
-using std::string;
#include "kudu/gutil/integral_types.h"
#include "kudu/gutil/strings/numbers.h"
@@ -64,7 +63,7 @@ struct AlphaNum {
AlphaNum(const char *c_str) : piece(c_str) {} // NOLINT(runtime/explicit)
AlphaNum(StringPiece pc)
: piece(std::move(pc)) {} // NOLINT(runtime/explicit)
- AlphaNum(const string &s) : piece(s) {} // NOLINT(runtime/explicit)
+ AlphaNum(const std::string &s) : piece(s) {} // NOLINT(runtime/explicit)
StringPiece::size_type size() const { return piece.size(); }
const char *data() const { return piece.data(); }
@@ -99,19 +98,19 @@ extern AlphaNum gEmptyAlphaNum;
// be a reference into str.
// ----------------------------------------------------------------------
-string StrCat(const AlphaNum &a);
-string StrCat(const AlphaNum &a, const AlphaNum &b);
-string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c);
-string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+std::string StrCat(const AlphaNum &a);
+std::string StrCat(const AlphaNum &a, const AlphaNum &b);
+std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c);
+std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d);
-string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e);
-string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f);
-string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g);
-string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h);
@@ -119,13 +118,13 @@ namespace strings {
namespace internal {
// Do not call directly - this is not part of the public API.
-string StrCatNineOrMore(const AlphaNum *a1, ...);
+ std::string StrCatNineOrMore(const AlphaNum *a1, ...);
} // namespace internal
} // namespace strings
// Support 9 or more arguments
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i) {
const AlphaNum* null_alphanum = NULL;
@@ -133,7 +132,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j) {
@@ -142,7 +141,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
&j, null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k) {
@@ -151,7 +150,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
&j, &k, null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l) {
@@ -160,7 +159,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
&j, &k, &l, null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -170,7 +169,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
&j, &k, &l, &m, null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -180,7 +179,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
&j, &k, &l, &m, &n, null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -191,7 +190,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -203,7 +202,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -215,7 +214,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -227,7 +226,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -240,7 +239,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
&s, null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -253,7 +252,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
&s, &t, null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -266,7 +265,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
&s, &t, &u, null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -280,7 +279,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
&s, &t, &u, &v, null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -294,7 +293,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
&s, &t, &u, &v, &w, null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -309,7 +308,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -325,7 +324,7 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
null_alphanum);
}
-inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
+inline std::string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
const AlphaNum &d, const AlphaNum &e, const AlphaNum &f,
const AlphaNum &g, const AlphaNum &h, const AlphaNum &i,
const AlphaNum &j, const AlphaNum &k, const AlphaNum &l,
@@ -362,15 +361,15 @@ inline string StrCat(const AlphaNum &a, const AlphaNum &b, const AlphaNum &c,
// worked around as consecutive calls to StrAppend are quite efficient.
// ----------------------------------------------------------------------
-void StrAppend(string *dest, const AlphaNum &a);
-void StrAppend(string *dest, const AlphaNum &a, const AlphaNum &b);
-void StrAppend(string *dest, const AlphaNum &a, const AlphaNum &b,
+void StrAppend(std::string *dest, const AlphaNum &a);
+void StrAppend(std::string *dest, const AlphaNum &a, const AlphaNum &b);
+void StrAppend(std::string *dest, const AlphaNum &a, const AlphaNum &b,
const AlphaNum &c);
-void StrAppend(string *dest, const AlphaNum &a, const AlphaNum &b,
+void StrAppend(std::string *dest, const AlphaNum &a, const AlphaNum &b,
const AlphaNum &c, const AlphaNum &d);
// Support up to 9 params by using a default empty AlphaNum.
-void StrAppend(string *dest, const AlphaNum &a, const AlphaNum &b,
+void StrAppend(std::string *dest, const AlphaNum &a, const AlphaNum &b,
const AlphaNum &c, const AlphaNum &d, const AlphaNum &e,
const AlphaNum &f = gEmptyAlphaNum,
const AlphaNum &g = gEmptyAlphaNum,
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/stringpiece.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/stringpiece.h b/src/kudu/gutil/strings/stringpiece.h
index 0f28f2b..5812dd6 100644
--- a/src/kudu/gutil/strings/stringpiece.h
+++ b/src/kudu/gutil/strings/stringpiece.h
@@ -371,7 +371,7 @@ template<> struct GoodFastHash<StringPiece> {
#endif
// allow StringPiece to be logged
-extern ostream& operator<<(ostream& o, StringPiece piece);
+extern std::ostream& operator<<(std::ostream& o, StringPiece piece);
#endif // STRINGS_STRINGPIECE_H__
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/strip.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/strip.h b/src/kudu/gutil/strings/strip.h
index 8104b76..f834397 100644
--- a/src/kudu/gutil/strings/strip.h
+++ b/src/kudu/gutil/strings/strip.h
@@ -9,7 +9,6 @@
#include <stddef.h>
#include <string>
-using std::string;
#include "kudu/gutil/strings/ascii_ctype.h"
#include "kudu/gutil/strings/stringpiece.h"
@@ -17,25 +16,25 @@ using std::string;
// Given a string and a putative prefix, returns the string minus the
// prefix string if the prefix matches, otherwise the original
// string.
-string StripPrefixString(StringPiece str, const StringPiece& prefix);
+std::string StripPrefixString(StringPiece str, const StringPiece& prefix);
// Like StripPrefixString, but return true if the prefix was
// successfully matched. Write the output to *result.
// It is safe for result to point back to the input string.
bool TryStripPrefixString(StringPiece str, const StringPiece& prefix,
- string* result);
+ std::string* result);
// Given a string and a putative suffix, returns the string minus the
// suffix string if the suffix matches, otherwise the original
// string.
-string StripSuffixString(StringPiece str, const StringPiece& suffix);
+std::string StripSuffixString(StringPiece str, const StringPiece& suffix);
// Like StripSuffixString, but return true if the suffix was
// successfully matched. Write the output to *result.
// It is safe for result to point back to the input string.
bool TryStripSuffixString(StringPiece str, const StringPiece& suffix,
- string* result);
+ std::string* result);
// ----------------------------------------------------------------------
// StripString
@@ -53,7 +52,7 @@ inline void StripString(char* str, char remove, char replacewith) {
void StripString(char* str, StringPiece remove, char replacewith);
void StripString(char* str, int len, StringPiece remove, char replacewith);
-void StripString(string* s, StringPiece remove, char replacewith);
+void StripString(std::string* s, StringPiece remove, char replacewith);
// ----------------------------------------------------------------------
// StripDupCharacters
@@ -62,7 +61,7 @@ void StripString(string* s, StringPiece remove, char replacewith);
// StripDupCharacters("a//b/c//d", '/', 0) => "a/b/c/d"
// Return the number of characters removed
// ----------------------------------------------------------------------
-int StripDupCharacters(string* s, char dup_char, int start_pos);
+int StripDupCharacters(std::string* s, char dup_char, int start_pos);
// ----------------------------------------------------------------------
// StripWhiteSpace
@@ -88,7 +87,7 @@ void StripWhiteSpace(const char** str, int* len);
// StripTrailingWhitespace()
// Removes whitespace at the end of the string *s.
//------------------------------------------------------------------------
-void StripTrailingWhitespace(string* s);
+void StripTrailingWhitespace(std::string* s);
//------------------------------------------------------------------------
// StripTrailingNewline(string*)
@@ -97,7 +96,7 @@ void StripTrailingWhitespace(string* s);
// input mode, which appends '\n' to each map input. Returns true
// if a newline was stripped.
//------------------------------------------------------------------------
-bool StripTrailingNewline(string* s);
+bool StripTrailingNewline(std::string* s);
inline void StripWhiteSpace(char** str, int* len) {
// The "real" type for StripWhiteSpace is ForAll char types C, take
@@ -114,7 +113,7 @@ inline void StripWhiteSpace(StringPiece* str) {
str->set(data, len);
}
-void StripWhiteSpace(string* str);
+void StripWhiteSpace(std::string* str);
namespace strings {
@@ -151,10 +150,10 @@ inline char* StripLeadingWhiteSpace(char* line) {
StripLeadingWhiteSpace(const_cast<const char*>(line)));
}
-void StripLeadingWhiteSpace(string* str);
+void StripLeadingWhiteSpace(std::string* str);
// Remove leading, trailing, and duplicate internal whitespace.
-void RemoveExtraWhitespace(string* s);
+void RemoveExtraWhitespace(std::string* s);
// ----------------------------------------------------------------------
@@ -184,8 +183,8 @@ inline char* SkipLeadingWhiteSpace(char* str) {
// left and right bracket characters, such as '(' and ')'.
// ----------------------------------------------------------------------
-void StripCurlyBraces(string* s);
-void StripBrackets(char left, char right, string* s);
+void StripCurlyBraces(std::string* s);
+void StripBrackets(char left, char right, std::string* s);
// ----------------------------------------------------------------------
@@ -205,29 +204,29 @@ void StripBrackets(char left, char right, string* s);
// See "perldoc -q html"
// ----------------------------------------------------------------------
-void StripMarkupTags(string* s);
-string OutputWithMarkupTagsStripped(const string& s);
+void StripMarkupTags(std::string* s);
+std::string OutputWithMarkupTagsStripped(const std::string& s);
// ----------------------------------------------------------------------
// TrimStringLeft
// Removes any occurrences of the characters in 'remove' from the start
// of the string. Returns the number of chars trimmed.
// ----------------------------------------------------------------------
-int TrimStringLeft(string* s, const StringPiece& remove);
+int TrimStringLeft(std::string* s, const StringPiece& remove);
// ----------------------------------------------------------------------
// TrimStringRight
// Removes any occurrences of the characters in 'remove' from the end
// of the string. Returns the number of chars trimmed.
// ----------------------------------------------------------------------
-int TrimStringRight(string* s, const StringPiece& remove);
+int TrimStringRight(std::string* s, const StringPiece& remove);
// ----------------------------------------------------------------------
// TrimString
// Removes any occurrences of the characters in 'remove' from either
// end of the string.
// ----------------------------------------------------------------------
-inline int TrimString(string* s, const StringPiece& remove) {
+inline int TrimString(std::string* s, const StringPiece& remove) {
return TrimStringRight(s, remove) + TrimStringLeft(s, remove);
}
@@ -243,13 +242,13 @@ inline int TrimString(string* s, const StringPiece& remove) {
// " a:(b):c " -> "a b c"
// "first,last::(area)phone, ::zip" -> "first last area phone zip"
// ----------------------------------------------------------------------
-void TrimRunsInString(string* s, StringPiece remove);
+void TrimRunsInString(std::string* s, StringPiece remove);
// ----------------------------------------------------------------------
// RemoveNullsInString
// Removes any internal \0 characters from the string.
// ----------------------------------------------------------------------
-void RemoveNullsInString(string* s);
+void RemoveNullsInString(std::string* s);
// ----------------------------------------------------------------------
// strrm()
@@ -267,6 +266,6 @@ int memrm(char* str, int strlen, char c);
// Returns the new length.
// ----------------------------------------------------------------------
int strrmm(char* str, const char* chars);
-int strrmm(string* str, const string& chars);
+int strrmm(std::string* str, const std::string& chars);
#endif // STRINGS_STRIP_H_
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/substitute.cc
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/substitute.cc b/src/kudu/gutil/strings/substitute.cc
index 5e5c12a..c0d5e81 100644
--- a/src/kudu/gutil/strings/substitute.cc
+++ b/src/kudu/gutil/strings/substitute.cc
@@ -9,6 +9,8 @@
#include "kudu/gutil/strings/escaping.h"
#include "kudu/gutil/stl_util.h"
+using std::string;
+
namespace strings {
using internal::SubstituteArg;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/substitute.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/substitute.h b/src/kudu/gutil/strings/substitute.h
index 2de5960..3040156 100644
--- a/src/kudu/gutil/strings/substitute.h
+++ b/src/kudu/gutil/strings/substitute.h
@@ -2,7 +2,6 @@
#include <string.h>
#include <string>
-using std::string;
#include "kudu/gutil/basictypes.h"
#include "kudu/gutil/strings/numbers.h"
@@ -75,7 +74,7 @@ class SubstituteArg {
// object.
inline SubstituteArg(const char* value) // NOLINT(runtime/explicit)
: text_(value), size_(value == NULL ? 0 : strlen(text_)) {}
- inline SubstituteArg(const string& value) // NOLINT(runtime/explicit)
+ inline SubstituteArg(const std::string& value) // NOLINT(runtime/explicit)
: text_(value.data()), size_(value.size()) {}
inline SubstituteArg(const StringPiece& value) // NOLINT(runtime/explicit)
: text_(value.data()), size_(value.size()) {}
@@ -157,7 +156,7 @@ char* SubstituteToBuffer(StringPiece format,
} // namespace internal
void SubstituteAndAppend(
- string* output, StringPiece format,
+ std::string* output, StringPiece format,
const internal::SubstituteArg& arg0 = internal::SubstituteArg::kNoArg,
const internal::SubstituteArg& arg1 = internal::SubstituteArg::kNoArg,
const internal::SubstituteArg& arg2 = internal::SubstituteArg::kNoArg,
@@ -169,7 +168,7 @@ void SubstituteAndAppend(
const internal::SubstituteArg& arg8 = internal::SubstituteArg::kNoArg,
const internal::SubstituteArg& arg9 = internal::SubstituteArg::kNoArg);
-inline string Substitute(
+inline std::string Substitute(
StringPiece format,
const internal::SubstituteArg& arg0 = internal::SubstituteArg::kNoArg,
const internal::SubstituteArg& arg1 = internal::SubstituteArg::kNoArg,
@@ -181,7 +180,7 @@ inline string Substitute(
const internal::SubstituteArg& arg7 = internal::SubstituteArg::kNoArg,
const internal::SubstituteArg& arg8 = internal::SubstituteArg::kNoArg,
const internal::SubstituteArg& arg9 = internal::SubstituteArg::kNoArg) {
- string result;
+ std::string result;
SubstituteAndAppend(&result, format, arg0, arg1, arg2, arg3, arg4,
arg5, arg6, arg7, arg8, arg9);
return result;
[5/6] kudu git commit: remove 'using std::...' and other from header
files
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/types.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/types.h b/src/kudu/common/types.h
index 6e418dc..d1c9c79 100644
--- a/src/kudu/common/types.h
+++ b/src/kudu/common/types.h
@@ -37,7 +37,6 @@ namespace kudu {
// type we support.
const int kLargestTypeSize = sizeof(Slice);
-using std::string;
class TypeInfo;
// This is the important bit of this header:
@@ -52,9 +51,9 @@ class TypeInfo {
DataType type() const { return type_; }
// Returns the type used to actually store the data.
DataType physical_type() const { return physical_type_; }
- const string& name() const { return name_; }
+ const std::string& name() const { return name_; }
const size_t size() const { return size_; }
- void AppendDebugStringForValue(const void *ptr, string *str) const;
+ void AppendDebugStringForValue(const void *ptr, std::string *str) const;
int Compare(const void *lhs, const void *rhs) const;
// Returns true if increment(a) is equal to b.
bool AreConsecutive(const void* a, const void* b) const;
@@ -75,13 +74,13 @@ class TypeInfo {
const DataType type_;
const DataType physical_type_;
- const string name_;
+ const std::string name_;
const size_t size_;
const void* const min_value_;
// The maximum value of the type, or null if the type has no max value.
const void* const max_value_;
- typedef void (*AppendDebugFunc)(const void *, string *);
+ typedef void (*AppendDebugFunc)(const void *, std::string *);
const AppendDebugFunc append_func_;
typedef int (*CompareFunc)(const void *, const void *);
@@ -131,7 +130,7 @@ struct DataTypeTraits<UINT8> {
static const char *name() {
return "uint8";
}
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
str->append(SimpleItoa(*reinterpret_cast<const uint8_t *>(val)));
}
static int Compare(const void *lhs, const void *rhs) {
@@ -155,7 +154,7 @@ struct DataTypeTraits<INT8> {
static const char *name() {
return "int8";
}
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
str->append(SimpleItoa(*reinterpret_cast<const int8_t *>(val)));
}
static int Compare(const void *lhs, const void *rhs) {
@@ -179,7 +178,7 @@ struct DataTypeTraits<UINT16> {
static const char *name() {
return "uint16";
}
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
str->append(SimpleItoa(*reinterpret_cast<const uint16_t *>(val)));
}
static int Compare(const void *lhs, const void *rhs) {
@@ -203,7 +202,7 @@ struct DataTypeTraits<INT16> {
static const char *name() {
return "int16";
}
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
str->append(SimpleItoa(*reinterpret_cast<const int16_t *>(val)));
}
static int Compare(const void *lhs, const void *rhs) {
@@ -227,7 +226,7 @@ struct DataTypeTraits<UINT32> {
static const char *name() {
return "uint32";
}
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
str->append(SimpleItoa(*reinterpret_cast<const uint32_t *>(val)));
}
static int Compare(const void *lhs, const void *rhs) {
@@ -251,7 +250,7 @@ struct DataTypeTraits<INT32> {
static const char *name() {
return "int32";
}
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
str->append(SimpleItoa(*reinterpret_cast<const int32_t *>(val)));
}
static int Compare(const void *lhs, const void *rhs) {
@@ -275,7 +274,7 @@ struct DataTypeTraits<UINT64> {
static const char *name() {
return "uint64";
}
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
str->append(SimpleItoa(*reinterpret_cast<const uint64_t *>(val)));
}
static int Compare(const void *lhs, const void *rhs) {
@@ -299,7 +298,7 @@ struct DataTypeTraits<INT64> {
static const char *name() {
return "int64";
}
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
str->append(SimpleItoa(*reinterpret_cast<const int64_t *>(val)));
}
static int Compare(const void *lhs, const void *rhs) {
@@ -323,7 +322,7 @@ struct DataTypeTraits<FLOAT> {
static const char *name() {
return "float";
}
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
str->append(SimpleFtoa(*reinterpret_cast<const float *>(val)));
}
static int Compare(const void *lhs, const void *rhs) {
@@ -347,7 +346,7 @@ struct DataTypeTraits<DOUBLE> {
static const char *name() {
return "double";
}
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
str->append(SimpleDtoa(*reinterpret_cast<const double *>(val)));
}
static int Compare(const void *lhs, const void *rhs) {
@@ -371,7 +370,7 @@ struct DataTypeTraits<BINARY> {
static const char *name() {
return "binary";
}
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
const Slice *s = reinterpret_cast<const Slice *>(val);
str->push_back('"');
str->append(strings::CHexEscape(s->ToString()));
@@ -411,7 +410,7 @@ struct DataTypeTraits<BOOL> {
static const char* name() {
return "bool";
}
- static void AppendDebugStringForValue(const void* val, string* str) {
+ static void AppendDebugStringForValue(const void* val, std::string* str) {
str->append(*reinterpret_cast<const bool *>(val) ? "true" : "false");
}
static int Compare(const void *lhs, const void *rhs) {
@@ -437,7 +436,7 @@ struct DerivedTypeTraits {
typedef typename DataTypeTraits<PhysicalType>::cpp_type cpp_type;
static const DataType physical_type = PhysicalType;
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
DataTypeTraits<PhysicalType>::AppendDebugStringForValue(val, str);
}
@@ -463,7 +462,7 @@ struct DataTypeTraits<STRING> : public DerivedTypeTraits<BINARY>{
static const char* name() {
return "string";
}
- static void AppendDebugStringForValue(const void *val, string *str) {
+ static void AppendDebugStringForValue(const void *val, std::string *str) {
const Slice *s = reinterpret_cast<const Slice *>(val);
str->push_back('"');
str->append(strings::Utf8SafeCEscape(s->ToString()));
@@ -482,7 +481,7 @@ struct DataTypeTraits<UNIXTIME_MICROS> : public DerivedTypeTraits<INT64>{
return "unixtime_micros";
}
- static void AppendDebugStringForValue(const void* val, string* str) {
+ static void AppendDebugStringForValue(const void* val, std::string* str) {
int64_t timestamp_micros = *reinterpret_cast<const int64_t *>(val);
time_t secs_since_epoch = timestamp_micros / US_TO_S;
// If the time is negative we need to take into account that any microseconds
@@ -598,7 +597,7 @@ class Variant {
// Set the variant to a STRING type.
// The specified data block will be copied, and released by the variant
// on the next set/clear call.
- void Reset(const string& data) {
+ void Reset(const std::string& data) {
Slice slice(data);
Reset(STRING, &slice);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/wire_protocol-test-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/wire_protocol-test-util.h b/src/kudu/common/wire_protocol-test-util.h
index 8e47c96..a5a0412 100644
--- a/src/kudu/common/wire_protocol-test-util.h
+++ b/src/kudu/common/wire_protocol-test-util.h
@@ -56,7 +56,7 @@ inline void AddTestRowToPB(RowOperationsPB::Type op_type,
const Schema& schema,
int32_t key,
int32_t int_val,
- const string& string_val,
+ const std::string& string_val,
RowOperationsPB* ops) {
AddTestRowWithNullableStringToPB(op_type, schema, key, int_val, string_val.c_str(), ops);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/wire_protocol-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/wire_protocol-test.cc b/src/kudu/common/wire_protocol-test.cc
index 83a966e..c5cc271 100644
--- a/src/kudu/common/wire_protocol-test.cc
+++ b/src/kudu/common/wire_protocol-test.cc
@@ -31,6 +31,7 @@
#include "kudu/util/test_macros.h"
#include "kudu/util/test_util.h"
+using std::string;
using std::vector;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/wire_protocol.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/wire_protocol.cc b/src/kudu/common/wire_protocol.cc
index 33850a9..b1e06f2 100644
--- a/src/kudu/common/wire_protocol.cc
+++ b/src/kudu/common/wire_protocol.cc
@@ -37,6 +37,7 @@
#include "kudu/util/slice.h"
using google::protobuf::RepeatedPtrField;
+using std::string;
using std::vector;
namespace kudu {
@@ -452,7 +453,7 @@ void ColumnPredicateToPB(const ColumnPredicate& predicate,
Status ColumnPredicateFromPB(const Schema& schema,
Arena* arena,
const ColumnPredicatePB& pb,
- optional<ColumnPredicate>* predicate) {
+ boost::optional<ColumnPredicate>* predicate) {
if (!pb.has_column()) {
return Status::InvalidArgument("Column predicate must include a column", SecureDebugString(pb));
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/wire_protocol.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/wire_protocol.h b/src/kudu/common/wire_protocol.h
index bd77171..a113053 100644
--- a/src/kudu/common/wire_protocol.h
+++ b/src/kudu/common/wire_protocol.h
@@ -25,8 +25,6 @@
#include "kudu/common/wire_protocol.pb.h"
#include "kudu/util/status.h"
-using boost::optional;
-
namespace kudu {
class Arena;
@@ -119,7 +117,7 @@ void ColumnPredicateToPB(const ColumnPredicate& predicate, ColumnPredicatePB* pb
Status ColumnPredicateFromPB(const Schema& schema,
Arena* arena,
const ColumnPredicatePB& pb,
- optional<ColumnPredicate>* predicate);
+ boost::optional<ColumnPredicate>* predicate);
// Encode the given row block into the provided protobuf and data buffers.
//
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/consensus-test-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/consensus-test-util.h b/src/kudu/consensus/consensus-test-util.h
index de1b587..1075db4 100644
--- a/src/kudu/consensus/consensus-test-util.h
+++ b/src/kudu/consensus/consensus-test-util.h
@@ -49,16 +49,14 @@
#define ASSERT_OPID_EQ(left, right) \
OpId TOKENPASTE2(_left, __LINE__) = (left); \
OpId TOKENPASTE2(_right, __LINE__) = (right); \
- if (!consensus::OpIdEquals(TOKENPASTE2(_left, __LINE__), TOKENPASTE2(_right,__LINE__))) \
+ if (!consensus::OpIdEquals(TOKENPASTE2(_left, __LINE__), TOKENPASTE2(_right,__LINE__))) { \
FAIL() << "Expected: " << SecureShortDebugString(TOKENPASTE2(_right,__LINE__)) << "\n" \
- << "Value: " << SecureShortDebugString(TOKENPASTE2(_left,__LINE__)) << "\n"
+ << "Value: " << SecureShortDebugString(TOKENPASTE2(_left,__LINE__)) << "\n"; \
+ }
namespace kudu {
namespace consensus {
-using log::Log;
-using strings::Substitute;
-
inline gscoped_ptr<ReplicateMsg> CreateDummyReplicate(int64_t term,
int64_t index,
const Timestamp& timestamp,
@@ -78,7 +76,8 @@ inline gscoped_ptr<ReplicateMsg> CreateDummyReplicate(int64_t term,
inline RaftPeerPB FakeRaftPeerPB(const std::string& uuid) {
RaftPeerPB peer_pb;
peer_pb.set_permanent_uuid(uuid);
- peer_pb.mutable_last_known_addr()->set_host(Substitute("$0-fake-hostname", CURRENT_TEST_NAME()));
+ peer_pb.mutable_last_known_addr()->set_host(strings::Substitute(
+ "$0-fake-hostname", CURRENT_TEST_NAME()));
peer_pb.mutable_last_known_addr()->set_port(0);
return peer_pb;
}
@@ -109,9 +108,9 @@ inline RaftConfigPB BuildRaftConfigPBForTests(int num) {
for (int i = 0; i < num; i++) {
RaftPeerPB* peer_pb = raft_config.add_peers();
peer_pb->set_member_type(RaftPeerPB::VOTER);
- peer_pb->set_permanent_uuid(Substitute("peer-$0", i));
+ peer_pb->set_permanent_uuid(strings::Substitute("peer-$0", i));
HostPortPB* hp = peer_pb->mutable_last_known_addr();
- hp->set_host(Substitute("peer-$0.fake-domain-for-tests", i));
+ hp->set_host(strings::Substitute("peer-$0.fake-domain-for-tests", i));
hp->set_port(0);
}
return raft_config;
@@ -578,7 +577,7 @@ class LocalTestPeerProxyFactory : public PeerProxyFactory {
return Status::OK();
}
- const vector<LocalTestPeerProxy*>& GetProxies() {
+ const std::vector<LocalTestPeerProxy*>& GetProxies() {
return proxies_;
}
@@ -591,7 +590,7 @@ class LocalTestPeerProxyFactory : public PeerProxyFactory {
std::shared_ptr<rpc::Messenger> messenger_;
TestPeerMapManager* const peers_;
// NOTE: There is no need to delete this on the dctor because proxies are externally managed
- vector<LocalTestPeerProxy*> proxies_;
+ std::vector<LocalTestPeerProxy*> proxies_;
};
// A simple implementation of the transaction driver.
@@ -600,7 +599,7 @@ class LocalTestPeerProxyFactory : public PeerProxyFactory {
// work.
class TestDriver {
public:
- TestDriver(ThreadPool* pool, Log* log, const scoped_refptr<ConsensusRound>& round)
+ TestDriver(ThreadPool* pool, log::Log* log, const scoped_refptr<ConsensusRound>& round)
: round_(round),
pool_(pool),
log_(log) {
@@ -645,14 +644,15 @@ class TestDriver {
}
ThreadPool* pool_;
- Log* log_;
+ log::Log* log_;
};
// A transaction factory for tests, usually this is implemented by TabletReplica.
class TestTransactionFactory : public ReplicaTransactionFactory {
public:
- explicit TestTransactionFactory(Log* log) : consensus_(nullptr),
- log_(log) {
+ explicit TestTransactionFactory(log::Log* log)
+ : consensus_(nullptr),
+ log_(log) {
CHECK_OK(ThreadPoolBuilder("test-txn-factory").set_max_threads(1).Build(&pool_));
}
@@ -690,7 +690,7 @@ class TestTransactionFactory : public ReplicaTransactionFactory {
private:
gscoped_ptr<ThreadPool> pool_;
RaftConsensus* consensus_;
- Log* log_;
+ log::Log* log_;
};
} // namespace consensus
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/consensus_peers-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/consensus_peers-test.cc b/src/kudu/consensus/consensus_peers-test.cc
index e1b0ac3..97dc179 100644
--- a/src/kudu/consensus/consensus_peers-test.cc
+++ b/src/kudu/consensus/consensus_peers-test.cc
@@ -45,6 +45,7 @@ using log::LogOptions;
using rpc::Messenger;
using rpc::MessengerBuilder;
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
const char* kTabletId = "test-peers-tablet";
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/consensus_peers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/consensus_peers.cc b/src/kudu/consensus/consensus_peers.cc
index bbf48ce..1fce7c5 100644
--- a/src/kudu/consensus/consensus_peers.cc
+++ b/src/kudu/consensus/consensus_peers.cc
@@ -78,10 +78,12 @@ DECLARE_int32(raft_heartbeat_interval_ms);
namespace kudu {
namespace consensus {
-using std::shared_ptr;
-using std::weak_ptr;
using rpc::Messenger;
using rpc::RpcController;
+using std::shared_ptr;
+using std::string;
+using std::vector;
+using std::weak_ptr;
using strings::Substitute;
using tserver::TabletServerErrorPB;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/consensus_queue-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/consensus_queue-test.cc b/src/kudu/consensus/consensus_queue-test.cc
index 0ce4419..69fdad8 100644
--- a/src/kudu/consensus/consensus_queue-test.cc
+++ b/src/kudu/consensus/consensus_queue-test.cc
@@ -42,6 +42,8 @@ DECLARE_int32(consensus_max_batch_size_bytes);
METRIC_DECLARE_entity(tablet);
+using std::vector;
+
namespace kudu {
namespace consensus {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/consensus_queue.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/consensus_queue.cc b/src/kudu/consensus/consensus_queue.cc
index cf3d250..d7aa2f7 100644
--- a/src/kudu/consensus/consensus_queue.cc
+++ b/src/kudu/consensus/consensus_queue.cc
@@ -73,7 +73,9 @@ namespace kudu {
namespace consensus {
using log::Log;
+using std::string;
using std::unique_ptr;
+using std::vector;
using strings::Substitute;
METRIC_DEFINE_gauge_int64(tablet, majority_done_ops, "Leader Operations Acked by Majority",
@@ -228,7 +230,7 @@ void PeerMessageQueue::UntrackPeer(const string& uuid) {
void PeerMessageQueue::CheckPeersInActiveConfigIfLeaderUnlocked() const {
DCHECK(queue_lock_.is_locked());
if (queue_state_.mode != LEADER) return;
- unordered_set<string> config_peer_uuids;
+ std::unordered_set<string> config_peer_uuids;
for (const RaftPeerPB& peer_pb : queue_state_.active_config->peers()) {
InsertOrDie(&config_peer_uuids, peer_pb.permanent_uuid());
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/log-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/log-test-base.h b/src/kudu/consensus/log-test-base.h
index a4ee663..6647617 100644
--- a/src/kudu/consensus/log-test-base.h
+++ b/src/kudu/consensus/log-test-base.h
@@ -53,20 +53,6 @@ METRIC_DECLARE_entity(tablet);
namespace kudu {
namespace log {
-using clock::Clock;
-
-using consensus::OpId;
-using consensus::CommitMsg;
-using consensus::ReplicateMsg;
-using consensus::WRITE_OP;
-using consensus::NO_OP;
-
-using tserver::WriteRequestPB;
-
-using tablet::TxResultPB;
-using tablet::OperationResultPB;
-using tablet::MemStoreTargetPB;
-
constexpr char kTestTable[] = "test-log-table";
constexpr char kTestTableId[] = "test-log-table-id";
constexpr char kTestTablet[] = "test-log-tablet";
@@ -76,19 +62,20 @@ constexpr bool APPEND_ASYNC = false;
// Append a single batch of 'count' NoOps to the log.
// If 'size' is not NULL, increments it by the expected increase in log size.
// Increments 'op_id''s index once for each operation logged.
-inline Status AppendNoOpsToLogSync(const scoped_refptr<Clock>& clock,
+inline Status AppendNoOpsToLogSync(const scoped_refptr<clock::Clock>& clock,
Log* log,
- OpId* op_id,
+ consensus::OpId* op_id,
int count,
int* size = NULL) {
- vector<consensus::ReplicateRefPtr> replicates;
+ std::vector<consensus::ReplicateRefPtr> replicates;
for (int i = 0; i < count; i++) {
- consensus::ReplicateRefPtr replicate = make_scoped_refptr_replicate(new ReplicateMsg());
- ReplicateMsg* repl = replicate->get();
+ consensus::ReplicateRefPtr replicate =
+ make_scoped_refptr_replicate(new consensus::ReplicateMsg());
+ consensus::ReplicateMsg* repl = replicate->get();
repl->mutable_id()->CopyFrom(*op_id);
- repl->set_op_type(NO_OP);
+ repl->set_op_type(consensus::NO_OP);
repl->set_timestamp(clock->Now().ToUint64());
// Increment op_id.
@@ -113,9 +100,9 @@ inline Status AppendNoOpsToLogSync(const scoped_refptr<Clock>& clock,
return s.Wait();
}
-inline Status AppendNoOpToLogSync(const scoped_refptr<Clock>& clock,
+inline Status AppendNoOpToLogSync(const scoped_refptr<clock::Clock>& clock,
Log* log,
- OpId* op_id,
+ consensus::OpId* op_id,
int* size = NULL) {
return AppendNoOpsToLogSync(clock, log, op_id, 1, size);
}
@@ -128,7 +115,7 @@ enum CorruptionType {
FLIP_BYTE
};
-inline Status CorruptLogFile(Env* env, const string& log_path,
+inline Status CorruptLogFile(Env* env, const std::string& log_path,
CorruptionType type, int corruption_offset) {
faststring buf;
RETURN_NOT_OK_PREPEND(ReadFileToString(env, log_path, &buf),
@@ -153,7 +140,7 @@ inline Status CorruptLogFile(Env* env, const string& log_path,
class LogTestBase : public KuduTest {
public:
- typedef pair<int, int> DeltaId;
+ typedef std::pair<int, int> DeltaId;
LogTestBase()
: schema_(GetSimpleTestSchema()),
@@ -192,13 +179,13 @@ class LogTestBase : public KuduTest {
void CheckRightNumberOfSegmentFiles(int expected) {
// Test that we actually have the expected number of files in the fs.
// We should have n segments plus '.' and '..'
- vector<string> files;
+ std::vector<std::string> files;
ASSERT_OK(env_->GetChildren(
JoinPathSegments(fs_manager_->GetWalsRootDir(),
kTestTablet),
&files));
int count = 0;
- for (const string& s : files) {
+ for (const std::string& s : files) {
if (HasPrefixString(s, FsManager::kWalFileNamePrefix)) {
count++;
}
@@ -206,7 +193,7 @@ class LogTestBase : public KuduTest {
ASSERT_EQ(expected, count);
}
- void EntriesToIdList(vector<uint32_t>* ids) {
+ void EntriesToIdList(std::vector<uint32_t>* ids) {
for (const LogEntryPB* entry : entries_) {
VLOG(2) << "Entry contents: " << SecureDebugString(*entry);
if (entry->type() == REPLICATE) {
@@ -220,12 +207,13 @@ class LogTestBase : public KuduTest {
}
// Appends a batch with size 2 (1 insert, 1 mutate) to the log.
- void AppendReplicateBatch(const OpId& opid, bool sync = APPEND_SYNC) {
- consensus::ReplicateRefPtr replicate = make_scoped_refptr_replicate(new ReplicateMsg());
- replicate->get()->set_op_type(WRITE_OP);
+ void AppendReplicateBatch(const consensus::OpId& opid, bool sync = APPEND_SYNC) {
+ consensus::ReplicateRefPtr replicate =
+ make_scoped_refptr_replicate(new consensus::ReplicateMsg());
+ replicate->get()->set_op_type(consensus::WRITE_OP);
replicate->get()->mutable_id()->CopyFrom(opid);
replicate->get()->set_timestamp(clock_->Now().ToUint64());
- WriteRequestPB* batch_request = replicate->get()->mutable_write_request();
+ tserver::WriteRequestPB* batch_request = replicate->get()->mutable_write_request();
ASSERT_OK(SchemaToPB(schema_, batch_request->mutable_schema()));
AddTestRowToPB(RowOperationsPB::INSERT, schema_,
opid.index(),
@@ -262,7 +250,7 @@ class LogTestBase : public KuduTest {
// Append a commit log entry containing one entry for the insert and one
// for the mutate.
- void AppendCommit(const OpId& original_opid,
+ void AppendCommit(const consensus::OpId& original_opid,
bool sync = APPEND_SYNC) {
// The mrs id for the insert.
const int kTargetMrsId = 1;
@@ -274,21 +262,21 @@ class LogTestBase : public KuduTest {
AppendCommit(original_opid, kTargetMrsId, kTargetRsId, kTargetDeltaId, sync);
}
- void AppendCommit(const OpId& original_opid,
+ void AppendCommit(const consensus::OpId& original_opid,
int mrs_id, int rs_id, int dms_id,
bool sync = APPEND_SYNC) {
- gscoped_ptr<CommitMsg> commit(new CommitMsg);
- commit->set_op_type(WRITE_OP);
+ gscoped_ptr<consensus::CommitMsg> commit(new consensus::CommitMsg);
+ commit->set_op_type(consensus::WRITE_OP);
commit->mutable_commited_op_id()->CopyFrom(original_opid);
- TxResultPB* result = commit->mutable_result();
+ tablet::TxResultPB* result = commit->mutable_result();
- OperationResultPB* insert = result->add_ops();
+ tablet::OperationResultPB* insert = result->add_ops();
insert->add_mutated_stores()->set_mrs_id(mrs_id);
- OperationResultPB* mutate = result->add_ops();
- MemStoreTargetPB* target = mutate->add_mutated_stores();
+ tablet::OperationResultPB* mutate = result->add_ops();
+ tablet::MemStoreTargetPB* target = mutate->add_mutated_stores();
target->set_dms_id(dms_id);
target->set_rs_id(rs_id);
AppendCommit(std::move(commit), sync);
@@ -297,23 +285,23 @@ class LogTestBase : public KuduTest {
// Append a COMMIT message for 'original_opid', but with results
// indicating that the associated writes failed due to
// "NotFound" errors.
- void AppendCommitWithNotFoundOpResults(const OpId& original_opid) {
- gscoped_ptr<CommitMsg> commit(new CommitMsg);
- commit->set_op_type(WRITE_OP);
+ void AppendCommitWithNotFoundOpResults(const consensus::OpId& original_opid) {
+ gscoped_ptr<consensus::CommitMsg> commit(new consensus::CommitMsg);
+ commit->set_op_type(consensus::WRITE_OP);
commit->mutable_commited_op_id()->CopyFrom(original_opid);
- TxResultPB* result = commit->mutable_result();
+ tablet::TxResultPB* result = commit->mutable_result();
- OperationResultPB* insert = result->add_ops();
+ tablet::OperationResultPB* insert = result->add_ops();
StatusToPB(Status::NotFound("fake failed write"), insert->mutable_failed_status());
- OperationResultPB* mutate = result->add_ops();
+ tablet::OperationResultPB* mutate = result->add_ops();
StatusToPB(Status::NotFound("fake failed write"), mutate->mutable_failed_status());
AppendCommit(std::move(commit));
}
- void AppendCommit(gscoped_ptr<CommitMsg> commit, bool sync = APPEND_SYNC) {
+ void AppendCommit(gscoped_ptr<consensus::CommitMsg> commit, bool sync = APPEND_SYNC) {
if (sync) {
Synchronizer s;
ASSERT_OK(log_->AsyncAppendCommit(std::move(commit), s.AsStatusCallback()));
@@ -327,7 +315,7 @@ class LogTestBase : public KuduTest {
// Appends 'count' ReplicateMsgs and the corresponding CommitMsgs to the log
void AppendReplicateBatchAndCommitEntryPairsToLog(int count, bool sync = true) {
for (int i = 0; i < count; i++) {
- OpId opid = consensus::MakeOpId(1, current_index_);
+ consensus::OpId opid = consensus::MakeOpId(1, current_index_);
AppendReplicateBatch(opid);
AppendCommit(opid, sync);
current_index_ += 1;
@@ -337,7 +325,7 @@ class LogTestBase : public KuduTest {
// Append a single NO_OP entry. Increments op_id by one.
// If non-NULL, and if the write is successful, 'size' is incremented
// by the size of the written operation.
- Status AppendNoOp(OpId* op_id, int* size = NULL) {
+ Status AppendNoOp(consensus::OpId* op_id, int* size = NULL) {
return AppendNoOpToLogSync(clock_, log_.get(), op_id, size);
}
@@ -345,7 +333,7 @@ class LogTestBase : public KuduTest {
// Increments op_id's index by the number of records written.
// If non-NULL, 'size' keeps track of the size of the operations
// successfully written.
- Status AppendNoOps(OpId* op_id, int num, int* size = NULL) {
+ Status AppendNoOps(consensus::OpId* op_id, int num, int* size = NULL) {
for (int i = 0; i < num; i++) {
RETURN_NOT_OK(AppendNoOp(op_id, size));
}
@@ -357,8 +345,8 @@ class LogTestBase : public KuduTest {
return log_->RollOver();
}
- string DumpSegmentsToString(const SegmentSequence& segments) {
- string dump;
+ std::string DumpSegmentsToString(const SegmentSequence& segments) {
+ std::string dump;
for (const scoped_refptr<ReadableLogSegment>& segment : segments) {
dump.append("------------\n");
strings::SubstituteAndAppend(&dump, "Segment: $0, Path: $1\n",
@@ -388,9 +376,9 @@ class LogTestBase : public KuduTest {
int64_t current_index_;
LogOptions options_;
// Reusable entries vector that deletes the entries on destruction.
- vector<LogEntryPB* > entries_;
+ std::vector<LogEntryPB* > entries_;
scoped_refptr<LogAnchorRegistry> log_anchor_registry_;
- scoped_refptr<Clock> clock_;
+ scoped_refptr<clock::Clock> clock_;
};
} // namespace log
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/log-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/log-test.cc b/src/kudu/consensus/log-test.cc
index 7101af9..dd5c69b 100644
--- a/src/kudu/consensus/log-test.cc
+++ b/src/kudu/consensus/log-test.cc
@@ -51,7 +51,12 @@ using std::shared_ptr;
using std::string;
using std::unique_ptr;
using std::vector;
+using consensus::CommitMsg;
using consensus::MakeOpId;
+using consensus::NO_OP;
+using consensus::OpId;
+using consensus::ReplicateMsg;
+using consensus::WRITE_OP;
using strings::Substitute;
struct TestLogSequenceElem {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/log.h
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/log.h b/src/kudu/consensus/log.h
index 4027c8a..c4d16a3 100644
--- a/src/kudu/consensus/log.h
+++ b/src/kudu/consensus/log.h
@@ -93,7 +93,7 @@ class Log : public RefCountedThreadSafe<Log> {
// Append the given set of replicate messages, asynchronously.
// This requires that the replicates have already been assigned OpIds.
- Status AsyncAppendReplicates(const vector<consensus::ReplicateRefPtr>& replicates,
+ Status AsyncAppendReplicates(const std::vector<consensus::ReplicateRefPtr>& replicates,
const StatusCallback& callback);
// Append the given commit message, asynchronously.
@@ -489,7 +489,7 @@ class LogEntryBatch {
return entry_batch_pb_->entry(idx).replicate().id();
}
- void SetReplicates(const vector<consensus::ReplicateRefPtr>& replicates) {
+ void SetReplicates(const std::vector<consensus::ReplicateRefPtr>& replicates) {
replicates_ = replicates;
}
@@ -509,7 +509,7 @@ class LogEntryBatch {
// Used only when type is REPLICATE, this makes sure there's at
// least a reference to each replicate message until we're finished
// appending.
- vector<consensus::ReplicateRefPtr> replicates_;
+ std::vector<consensus::ReplicateRefPtr> replicates_;
// Callback to be invoked upon the entries being written and
// synced to disk.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/log_anchor_registry-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/log_anchor_registry-test.cc b/src/kudu/consensus/log_anchor_registry-test.cc
index 817fe0b..f6d255c 100644
--- a/src/kudu/consensus/log_anchor_registry-test.cc
+++ b/src/kudu/consensus/log_anchor_registry-test.cc
@@ -23,6 +23,7 @@
#include "kudu/gutil/strings/substitute.h"
#include "kudu/util/test_util.h"
+using std::string;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/log_cache-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/log_cache-test.cc b/src/kudu/consensus/log_cache-test.cc
index 12910fe..3ac9dcd 100644
--- a/src/kudu/consensus/log_cache-test.cc
+++ b/src/kudu/consensus/log_cache-test.cc
@@ -32,6 +32,8 @@
#include "kudu/util/test_util.h"
using std::shared_ptr;
+using std::vector;
+using strings::Substitute;
DECLARE_int32(log_cache_size_limit_mb);
DECLARE_int32(global_log_cache_size_limit_mb);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/log_cache.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/log_cache.cc b/src/kudu/consensus/log_cache.cc
index a7088c9..285d7e7 100644
--- a/src/kudu/consensus/log_cache.cc
+++ b/src/kudu/consensus/log_cache.cc
@@ -53,6 +53,8 @@ DEFINE_int32(global_log_cache_size_limit_mb, 1024,
"caching log entries across all tablets is kept under this threshold.");
TAG_FLAG(global_log_cache_size_limit_mb, advanced);
+using std::string;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/log_index.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/log_index.cc b/src/kudu/consensus/log_index.cc
index 9cd0ce3..e3d743f 100644
--- a/src/kudu/consensus/log_index.cc
+++ b/src/kudu/consensus/log_index.cc
@@ -45,6 +45,7 @@
#include "kudu/util/locks.h"
using std::string;
+using std::vector;
using strings::Substitute;
#define RETRY_ON_EINTR(ret, expr) do { \
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/log_reader.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/log_reader.cc b/src/kudu/consensus/log_reader.cc
index e8262d4..3c676ef 100644
--- a/src/kudu/consensus/log_reader.cc
+++ b/src/kudu/consensus/log_reader.cc
@@ -61,6 +61,8 @@ struct LogSegmentSeqnoComparator {
using consensus::OpId;
using consensus::ReplicateMsg;
using std::shared_ptr;
+using std::string;
+using std::vector;
using strings::Substitute;
const int64_t LogReader::kNoSizeLimit = -1;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/log_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/log_util.cc b/src/kudu/consensus/log_util.cc
index bf20545..497e22e 100644
--- a/src/kudu/consensus/log_util.cc
+++ b/src/kudu/consensus/log_util.cc
@@ -69,8 +69,9 @@ namespace kudu {
namespace log {
using consensus::OpId;
-using std::vector;
+using std::string;
using std::shared_ptr;
+using std::vector;
using std::unique_ptr;
using strings::Substitute;
using strings::SubstituteAndAppend;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/mt-log-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/mt-log-test.cc b/src/kudu/consensus/mt-log-test.cc
index d925fb4..133a895 100644
--- a/src/kudu/consensus/mt-log-test.cc
+++ b/src/kudu/consensus/mt-log-test.cc
@@ -46,7 +46,10 @@ namespace log {
using std::shared_ptr;
using std::vector;
+using consensus::OpId;
using consensus::ReplicateRefPtr;
+using consensus::ReplicateMsg;
+using consensus::WRITE_OP;
using consensus::make_scoped_refptr_replicate;
namespace {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/quorum_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/quorum_util.cc b/src/kudu/consensus/quorum_util.cc
index d4b39f4..d462082 100644
--- a/src/kudu/consensus/quorum_util.cc
+++ b/src/kudu/consensus/quorum_util.cc
@@ -28,15 +28,16 @@
#include "kudu/util/pb_util.h"
#include "kudu/util/status.h"
-namespace kudu {
-namespace consensus {
-
using google::protobuf::RepeatedPtrField;
using std::map;
using std::pair;
using std::string;
+using std::vector;
using strings::Substitute;
+namespace kudu {
+namespace consensus {
+
bool IsRaftConfigMember(const std::string& uuid, const RaftConfigPB& config) {
for (const RaftPeerPB& peer : config.peers()) {
if (peer.permanent_uuid() == uuid) {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/raft_consensus.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/raft_consensus.cc b/src/kudu/consensus/raft_consensus.cc
index cefe569..66339bf 100644
--- a/src/kudu/consensus/raft_consensus.cc
+++ b/src/kudu/consensus/raft_consensus.cc
@@ -125,6 +125,8 @@ METRIC_DEFINE_gauge_int64(tablet, raft_term,
"Current Term of the Raft Consensus algorithm. This number increments "
"each time a leader election is started.");
+using std::string;
+
namespace {
// Return the mean interval at which to check for failures of the
@@ -1665,7 +1667,7 @@ Status RaftConsensus::UnsafeChangeConfig(const UnsafeChangeConfigRequestPB& req,
// addresses of each server (since we can get the address information from
// the committed config). Additionally, only a subset of the committed config
// is required for typical cluster repair scenarios.
- unordered_set<string> retained_peer_uuids;
+ std::unordered_set<string> retained_peer_uuids;
const RaftConfigPB& config = req.new_config();
for (const RaftPeerPB& new_peer : config.peers()) {
const string& peer_uuid = new_peer.permanent_uuid();
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/raft_consensus_quorum-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/raft_consensus_quorum-test.cc b/src/kudu/consensus/raft_consensus_quorum-test.cc
index 6bddb5e..0350b94 100644
--- a/src/kudu/consensus/raft_consensus_quorum-test.cc
+++ b/src/kudu/consensus/raft_consensus_quorum-test.cc
@@ -55,7 +55,9 @@ METRIC_DECLARE_entity(tablet);
ASSERT_NO_FATAL_FAILURE(ReplicateSequenceOfMessages(a, b, c, d, e, f, g))
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
+using std::vector;
namespace kudu {
@@ -479,9 +481,7 @@ class RaftConsensusQuorumTest : public KuduTest {
}
void VerifyNoCommitsBeforeReplicates(const vector<LogEntryPB*>& entries) {
- unordered_set<OpId,
- OpIdHashFunctor,
- OpIdEqualsFunctor> replication_ops;
+ std::unordered_set<OpId, OpIdHashFunctor, OpIdEqualsFunctor> replication_ops;
for (const LogEntryPB* entry : entries) {
if (entry->has_replicate()) {
@@ -567,7 +567,7 @@ class RaftConsensusQuorumTest : public KuduTest {
MetricRegistry metric_registry_;
scoped_refptr<MetricEntity> metric_entity_;
const Schema schema_;
- unordered_map<ConsensusRound*, Synchronizer*> syncs_;
+ std::unordered_map<ConsensusRound*, Synchronizer*> syncs_;
};
// Tests Replicate/Commit a single message through the leader.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/time_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/time_manager-test.cc b/src/kudu/consensus/time_manager-test.cc
index 2aeb212..5bed655 100644
--- a/src/kudu/consensus/time_manager-test.cc
+++ b/src/kudu/consensus/time_manager-test.cc
@@ -65,8 +65,8 @@ class TimeManagerTest : public KuduTest {
scoped_refptr<clock::HybridClock> clock_;
scoped_refptr<TimeManager> time_manager_;
- vector<unique_ptr<CountDownLatch>> latches_;
- vector<std::thread> threads_;
+ std::vector<unique_ptr<CountDownLatch>> latches_;
+ std::vector<std::thread> threads_;
};
// Tests TimeManager's functionality in non-leader mode and the transition to leader mode.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/consensus/time_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/time_manager.cc b/src/kudu/consensus/time_manager.cc
index b1f1482..c9444cb 100644
--- a/src/kudu/consensus/time_manager.cc
+++ b/src/kudu/consensus/time_manager.cc
@@ -42,12 +42,13 @@ TAG_FLAG(safe_time_max_lag_ms, experimental);
DECLARE_int32(raft_heartbeat_interval_ms);
DECLARE_int32(scanner_max_wait_ms);
+using kudu::clock::Clock;
+using std::string;
+using strings::Substitute;
+
namespace kudu {
namespace consensus {
-using clock::Clock;
-using strings::Substitute;
-
typedef std::lock_guard<simple_spinlock> Lock;
ExternalConsistencyMode TimeManager::GetMessageConsistencyMode(const ReplicateMsg& message) {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/fs/block_manager.h
----------------------------------------------------------------------
diff --git a/src/kudu/fs/block_manager.h b/src/kudu/fs/block_manager.h
index c3bfc89..1e9ed47 100644
--- a/src/kudu/fs/block_manager.h
+++ b/src/kudu/fs/block_manager.h
@@ -160,7 +160,7 @@ class ReadableBlock : public Block {
// beginning from 'offset' in the block, returning an error if fewer bytes exist.
// Sets each "result" to the data that was read.
// If an error was encountered, returns a non-OK status.
- virtual Status ReadV(uint64_t offset, vector<Slice>* results) const = 0;
+ virtual Status ReadV(uint64_t offset, std::vector<Slice>* results) const = 0;
// Returns the memory usage of this object including the object itself.
virtual size_t memory_footprint() const = 0;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/fs/data_dirs.cc
----------------------------------------------------------------------
diff --git a/src/kudu/fs/data_dirs.cc b/src/kudu/fs/data_dirs.cc
index 5596b22..2fbec20 100644
--- a/src/kudu/fs/data_dirs.cc
+++ b/src/kudu/fs/data_dirs.cc
@@ -102,6 +102,7 @@ using internal::DataDirGroup;
using std::default_random_engine;
using std::deque;
using std::iota;
+using std::set;
using std::shuffle;
using std::string;
using std::unique_ptr;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/fs/data_dirs.h
----------------------------------------------------------------------
diff --git a/src/kudu/fs/data_dirs.h b/src/kudu/fs/data_dirs.h
index 817f1a0..5cb17cc 100644
--- a/src/kudu/fs/data_dirs.h
+++ b/src/kudu/fs/data_dirs.h
@@ -286,7 +286,7 @@ class DataDirManager {
// Adds 'uuid_idx' to the set of failed data directories. This directory will
// no longer be used. Logs an error message prefixed with 'error_message'
// describing what directories are affected.
- void MarkDataDirFailed(uint16_t uuid_idx, const string& error_message = "");
+ void MarkDataDirFailed(uint16_t uuid_idx, const std::string& error_message = "");
// Returns whether or not the 'uuid_idx' refers to a failed directory.
bool IsDataDirFailed(uint16_t uuid_idx) const;
@@ -315,12 +315,12 @@ class DataDirManager {
// added. Although this function does not itself change DataDirManager state,
// its expected usage warrants that it is called within the scope of a
// lock_guard of dir_group_lock_.
- Status GetDirsForGroupUnlocked(int target_size, vector<uint16_t>* group_indices);
+ Status GetDirsForGroupUnlocked(int target_size, std::vector<uint16_t>* group_indices);
// Goes through the data dirs in 'uuid_indices' and populates
// 'healthy_indices' with those that haven't failed.
- void RemoveUnhealthyDataDirsUnlocked(const vector<uint16_t>& uuid_indices,
- vector<uint16_t>* healthy_indices) const;
+ void RemoveUnhealthyDataDirsUnlocked(const std::vector<uint16_t>& uuid_indices,
+ std::vector<uint16_t>* healthy_indices) const;
Env* env_;
const std::string block_manager_type_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/fs/fs-test-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/fs/fs-test-util.h b/src/kudu/fs/fs-test-util.h
index 7f741af..1391698 100644
--- a/src/kudu/fs/fs-test-util.h
+++ b/src/kudu/fs/fs-test-util.h
@@ -64,7 +64,7 @@ class CountingReadableBlock : public ReadableBlock {
}
virtual Status Read(uint64_t offset, Slice* result) const OVERRIDE {
- vector<Slice> results = { *result };
+ std::vector<Slice> results = { *result };
return ReadV(offset, &results);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/fs/fs_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/fs/fs_manager.cc b/src/kudu/fs/fs_manager.cc
index 0c43706..ac3e15a 100644
--- a/src/kudu/fs/fs_manager.cc
+++ b/src/kudu/fs/fs_manager.cc
@@ -90,6 +90,8 @@ using kudu::fs::LogBlockManager;
using kudu::fs::ReadableBlock;
using kudu::fs::WritableBlock;
using std::map;
+using std::ostream;
+using std::set;
using std::stack;
using std::string;
using std::unique_ptr;
@@ -305,7 +307,7 @@ Status FsManager::CreateInitialFileSystemLayout(boost::optional<string> uuid) {
// subdirectories.
//
// In the event of failure, delete everything we created.
- deque<ScopedFileDeleter*> delete_on_failure;
+ std::deque<ScopedFileDeleter*> delete_on_failure;
ElementDeleter d(&delete_on_failure);
InstanceMetadataPB metadata;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/int128.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/int128.h b/src/kudu/gutil/int128.h
index 2a19cca..4512672 100644
--- a/src/kudu/gutil/int128.h
+++ b/src/kudu/gutil/int128.h
@@ -6,7 +6,6 @@
#define BASE_INT128_H_
#include <iosfwd>
-using std::ostream;
#include "kudu/gutil/integral_types.h"
struct uint128_pod;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/map-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/map-util.h b/src/kudu/gutil/map-util.h
index 6fffedf..9883c1d 100644
--- a/src/kudu/gutil/map-util.h
+++ b/src/kudu/gutil/map-util.h
@@ -63,13 +63,8 @@
#define UTIL_GTL_MAP_UTIL_H_
#include <stddef.h>
-#include <string>
-using std::string;
#include <utility>
-using std::make_pair;
-using std::pair;
#include <vector>
-using std::vector;
#include <glog/logging.h>
@@ -305,7 +300,7 @@ bool ContainsKeyValuePair(const Collection& collection,
const Key& key,
const Value& value) {
typedef typename Collection::const_iterator const_iterator;
- pair<const_iterator, const_iterator> range = collection.equal_range(key);
+ std::pair<const_iterator, const_iterator> range = collection.equal_range(key);
for (const_iterator it = range.first; it != range.second; ++it) {
if (it->second == value) {
return true;
@@ -324,7 +319,7 @@ bool ContainsKeyValuePair(const Collection& collection,
template <class Collection>
bool InsertOrUpdate(Collection* const collection,
const typename Collection::value_type& vt) {
- pair<typename Collection::iterator, bool> ret = collection->insert(vt);
+ std::pair<typename Collection::iterator, bool> ret = collection->insert(vt);
if (!ret.second) {
// update
ret.first->second = vt.second;
@@ -361,7 +356,7 @@ bool InsertAndDeleteExisting(
Collection* const collection,
const typename Collection::key_type& key,
const typename Collection::mapped_type& value) {
- pair<typename Collection::iterator, bool> ret =
+ std::pair<typename Collection::iterator, bool> ret =
collection->insert(typename Collection::value_type(key, value));
if (!ret.second) {
delete ret.first->second;
@@ -435,7 +430,7 @@ typename Collection::mapped_type& InsertKeyOrDie(
Collection* const collection,
const typename Collection::key_type& key) {
typedef typename Collection::value_type value_type;
- pair<typename Collection::iterator, bool> res =
+ std::pair<typename Collection::iterator, bool> res =
collection->insert(value_type(key, typename Collection::mapped_type()));
CHECK(res.second) << "duplicate key: " << key;
return res.first->second;
@@ -511,7 +506,7 @@ template <class Collection>
typename Collection::mapped_type&
LookupOrInsertNew(Collection* const collection,
const typename Collection::key_type& key) {
- pair<typename Collection::iterator, bool> ret =
+ std::pair<typename Collection::iterator, bool> ret =
collection->insert(
typename Collection::value_type(key,
static_cast<typename Collection::mapped_type>(NULL)));
@@ -530,7 +525,7 @@ typename Collection::mapped_type&
LookupOrInsertNew(Collection* const collection,
const typename Collection::key_type& key,
const Arg& arg) {
- pair<typename Collection::iterator, bool> ret =
+ std::pair<typename Collection::iterator, bool> ret =
collection->insert(
typename Collection::value_type(
key,
@@ -563,7 +558,7 @@ LookupOrInsertNewSharedPtr(
const typename Collection::key_type& key) {
typedef typename Collection::mapped_type SharedPtr;
typedef typename Collection::mapped_type::element_type Element;
- pair<typename Collection::iterator, bool> ret =
+ std::pair<typename Collection::iterator, bool> ret =
collection->insert(typename Collection::value_type(key, SharedPtr()));
if (ret.second) {
ret.first->second.reset(new Element());
@@ -584,7 +579,7 @@ LookupOrInsertNewSharedPtr(
const Arg& arg) {
typedef typename Collection::mapped_type SharedPtr;
typedef typename Collection::mapped_type::element_type Element;
- pair<typename Collection::iterator, bool> ret =
+ std::pair<typename Collection::iterator, bool> ret =
collection->insert(typename Collection::value_type(key, SharedPtr()));
if (ret.second) {
ret.first->second.reset(new Element(arg));
@@ -608,7 +603,7 @@ bool UpdateReturnCopy(Collection* const collection,
const typename Collection::key_type& key,
const typename Collection::mapped_type& value,
typename Collection::mapped_type* previous) {
- pair<typename Collection::iterator, bool> ret =
+ std::pair<typename Collection::iterator, bool> ret =
collection->insert(typename Collection::value_type(key, value));
if (!ret.second) {
// update
@@ -626,7 +621,7 @@ template <class Collection>
bool UpdateReturnCopy(Collection* const collection,
const typename Collection::value_type& vt,
typename Collection::mapped_type* previous) {
- pair<typename Collection::iterator, bool> ret =
+ std::pair<typename Collection::iterator, bool> ret =
collection->insert(vt);
if (!ret.second) {
// update
@@ -650,7 +645,7 @@ template <class Collection>
typename Collection::mapped_type* const
InsertOrReturnExisting(Collection* const collection,
const typename Collection::value_type& vt) {
- pair<typename Collection::iterator, bool> ret = collection->insert(vt);
+ std::pair<typename Collection::iterator, bool> ret = collection->insert(vt);
if (ret.second) {
return NULL; // Inserted, no existing previous value.
} else {
@@ -750,7 +745,7 @@ void AppendKeysFromMap(const MapContainer& map_container,
// without the complexity of a SFINAE-based solution.)
template <class MapContainer, class KeyType>
void AppendKeysFromMap(const MapContainer& map_container,
- vector<KeyType>* key_container) {
+ std::vector<KeyType>* key_container) {
CHECK(key_container != NULL);
// We now have the opportunity to call reserve(). Calling reserve() every
// time is a bad idea for some use cases: libstdc++'s implementation of
@@ -794,7 +789,7 @@ void AppendValuesFromMap(const MapContainer& map_container,
// without the complexity of a SFINAE-based solution.)
template <class MapContainer, class ValueType>
void AppendValuesFromMap(const MapContainer& map_container,
- vector<ValueType>* value_container) {
+ std::vector<ValueType>* value_container) {
CHECK(value_container != NULL);
// See AppendKeysFromMap for why this is done.
if (value_container->empty()) {
@@ -826,18 +821,19 @@ void AppendValuesFromMap(const MapContainer& map_container,
// if (result.second) ....
//
template <class MapContainer, typename Function>
-pair<typename MapContainer::mapped_type* const, bool>
+std::pair<typename MapContainer::mapped_type* const, bool>
ComputeIfAbsentReturnAbsense(MapContainer* container,
const typename MapContainer::key_type& key,
Function compute_func) {
typename MapContainer::iterator iter = container->find(key);
bool new_value = iter == container->end();
if (new_value) {
- pair<typename MapContainer::iterator, bool> result = container->emplace(key, compute_func());
+ std::pair<typename MapContainer::iterator, bool> result =
+ container->emplace(key, compute_func());
DCHECK(result.second) << "duplicate key: " << key;
iter = result.first;
}
- return make_pair(&iter->second, new_value);
+ return std::make_pair(&iter->second, new_value);
};
// Like the above but doesn't return a pair, just returns a pointer to the value.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/stl_util.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/stl_util.h b/src/kudu/gutil/stl_util.h
index 60cb587..9e7cfb3 100644
--- a/src/kudu/gutil/stl_util.h
+++ b/src/kudu/gutil/stl_util.h
@@ -31,26 +31,13 @@
#include <stddef.h>
#include <string.h> // for memcpy
#include <algorithm>
-using std::copy;
-using std::max;
-using std::min;
-using std::reverse;
-using std::sort;
-using std::swap;
#include <cassert>
#include <deque>
-using std::deque;
#include <functional>
-using std::binary_function;
-using std::less;
#include <iterator>
-using std::back_insert_iterator;
-using std::iterator_traits;
#include <memory>
#include <string>
-using std::string;
#include <vector>
-using std::vector;
#include "kudu/gutil/integral_types.h"
#include "kudu/gutil/macros.h"
@@ -59,7 +46,7 @@ using std::vector;
// Sort and remove duplicates of an STL vector or deque.
template<class T>
void STLSortAndRemoveDuplicates(T *v) {
- sort(v->begin(), v->end());
+ std::sort(v->begin(), v->end());
v->erase(unique(v->begin(), v->end()), v->end());
}
@@ -77,8 +64,8 @@ template<class T> void STLClearObject(T* obj) {
// Specialization for deque. Same as STLClearObject but doesn't call reserve
// since deque doesn't have reserve.
template <class T, class A>
-void STLClearObject(deque<T, A>* obj) {
- deque<T, A> tmp;
+void STLClearObject(std::deque<T, A>* obj) {
+ std::deque<T, A> tmp;
tmp.swap(*obj);
}
@@ -94,7 +81,7 @@ template <class T> inline void STLClearIfBig(T* obj, size_t limit = 1<<20) {
// Specialization for deque, which doesn't implement capacity().
template <class T, class A>
-inline void STLClearIfBig(deque<T, A>* obj, size_t limit = 1<<20) {
+inline void STLClearIfBig(std::deque<T, A>* obj, size_t limit = 1<<20) {
if (obj->size() >= limit) {
STLClearObject(obj);
} else {
@@ -214,7 +201,7 @@ void STLDeleteContainerPairSecondPointers(ForwardIterator begin,
}
template<typename T>
-inline void STLAssignToVector(vector<T>* vec,
+inline void STLAssignToVector(std::vector<T>* vec,
const T* ptr,
size_t n) {
vec->resize(n);
@@ -225,7 +212,7 @@ inline void STLAssignToVector(vector<T>* vec,
// Not faster; but we need the specialization so the function works at all
// on the vector<bool> specialization.
template<>
-inline void STLAssignToVector(vector<bool>* vec,
+inline void STLAssignToVector(std::vector<bool>* vec,
const bool* ptr,
size_t n) {
vec->clear();
@@ -242,7 +229,7 @@ inline void STLAssignToVector(vector<bool>* vec,
// STLAssignToVectorChar(&vec, ptr, size);
// STLAssignToString(&str, ptr, size);
-inline void STLAssignToVectorChar(vector<char>* vec,
+inline void STLAssignToVectorChar(std::vector<char>* vec,
const char* ptr,
size_t n) {
STLAssignToVector(vec, ptr, n);
@@ -266,7 +253,7 @@ struct InternalStringRepGCC4 {
// "*str" as a result of resizing may be left uninitialized, rather
// than being filled with '0' bytes. Typically used when code is then
// going to overwrite the backing store of the string with known data.
-inline void STLStringResizeUninitialized(string* s, size_t new_size) {
+inline void STLStringResizeUninitialized(std::string* s, size_t new_size) {
if (sizeof(*s) == sizeof(InternalStringRepGCC4)) {
if (new_size > s->capacity()) {
s->reserve(new_size);
@@ -291,17 +278,17 @@ inline void STLStringResizeUninitialized(string* s, size_t new_size) {
// Returns true if the string implementation supports a resize where
// the new characters added to the string are left untouched.
-inline bool STLStringSupportsNontrashingResize(const string& s) {
+inline bool STLStringSupportsNontrashingResize(const std::string& s) {
return (sizeof(s) == sizeof(InternalStringRepGCC4));
}
-inline void STLAssignToString(string* str, const char* ptr, size_t n) {
+inline void STLAssignToString(std::string* str, const char* ptr, size_t n) {
STLStringResizeUninitialized(str, n);
if (n == 0) return;
memcpy(&*str->begin(), ptr, n);
}
-inline void STLAppendToString(string* str, const char* ptr, size_t n) {
+inline void STLAppendToString(std::string* str, const char* ptr, size_t n) {
if (n == 0) return;
size_t old_size = str->size();
STLStringResizeUninitialized(str, old_size + n);
@@ -318,7 +305,7 @@ inline void STLAppendToString(string* str, const char* ptr, size_t n) {
// change this as well.
template<typename T, typename Allocator>
-inline T* vector_as_array(vector<T, Allocator>* v) {
+inline T* vector_as_array(std::vector<T, Allocator>* v) {
# ifdef NDEBUG
return &*v->begin();
# else
@@ -327,7 +314,7 @@ inline T* vector_as_array(vector<T, Allocator>* v) {
}
template<typename T, typename Allocator>
-inline const T* vector_as_array(const vector<T, Allocator>* v) {
+inline const T* vector_as_array(const std::vector<T, Allocator>* v) {
# ifdef NDEBUG
return &*v->begin();
# else
@@ -347,7 +334,7 @@ inline const T* vector_as_array(const vector<T, Allocator>* v) {
// contiguous is officially part of the C++11 standard [string.require]/5.
// According to Matt Austern, this should already work on all current C++98
// implementations.
-inline char* string_as_array(string* str) {
+inline char* string_as_array(std::string* str) {
// DO NOT USE const_cast<char*>(str->data())! See the unittest for why.
return str->empty() ? NULL : &*str->begin();
}
@@ -804,9 +791,9 @@ BinaryOperateOnSecond<Pair, BinaryOp> BinaryOperate2nd(const BinaryOp& f) {
// F has to be a model of AdaptableBinaryFunction.
// G1 and G2 have to be models of AdabtableUnaryFunction.
template<typename F, typename G1, typename G2>
-class BinaryComposeBinary : public binary_function<typename G1::argument_type,
- typename G2::argument_type,
- typename F::result_type> {
+class BinaryComposeBinary : public std::binary_function<typename G1::argument_type,
+ typename G2::argument_type,
+ typename F::result_type> {
public:
BinaryComposeBinary(F f, G1 g1, G2 g2) : f_(f), g1_(g1), g2_(g2) { }
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/stringprintf.cc
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/stringprintf.cc b/src/kudu/gutil/stringprintf.cc
index 112605c..45a0cde 100644
--- a/src/kudu/gutil/stringprintf.cc
+++ b/src/kudu/gutil/stringprintf.cc
@@ -6,11 +6,13 @@
#include <stdarg.h> // For va_list and related operations
#include <stdio.h> // MSVC requires this for _vsnprintf
#include <vector>
-using std::vector;
#include <glog/logging.h>
#include "kudu/gutil/logging-inl.h"
#include "kudu/gutil/macros.h"
+using std::string;
+using std::vector;
+
#ifdef _MSC_VER
enum { IS__MSC_VER = 1 };
#else
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/stringprintf.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/stringprintf.h b/src/kudu/gutil/stringprintf.h
index 2083574..0343834 100644
--- a/src/kudu/gutil/stringprintf.h
+++ b/src/kudu/gutil/stringprintf.h
@@ -12,30 +12,28 @@
#include <stdarg.h>
#include <string>
-using std::string;
#include <vector>
-using std::vector;
#include "kudu/gutil/port.h"
// Return a C++ string
-extern string StringPrintf(const char* format, ...)
+extern std::string StringPrintf(const char* format, ...)
// Tell the compiler to do printf format string checking.
PRINTF_ATTRIBUTE(1,2);
// Store result into a supplied string and return it
-extern const string& SStringPrintf(string* dst, const char* format, ...)
+extern const std::string& SStringPrintf(std::string* dst, const char* format, ...)
// Tell the compiler to do printf format string checking.
PRINTF_ATTRIBUTE(2,3);
// Append result to a supplied string
-extern void StringAppendF(string* dst, const char* format, ...)
+extern void StringAppendF(std::string* dst, const char* format, ...)
// Tell the compiler to do printf format string checking.
PRINTF_ATTRIBUTE(2,3);
// Lower-level routine that takes a va_list and appends to a specified
// string. All other routines are just convenience wrappers around it.
-extern void StringAppendV(string* dst, const char* format, va_list ap);
+extern void StringAppendV(std::string* dst, const char* format, va_list ap);
// The max arguments supported by StringPrintfVector
extern const int kStringPrintfVectorMaxArgs;
@@ -43,6 +41,6 @@ extern const int kStringPrintfVectorMaxArgs;
// You can use this version when all your arguments are strings, but
// you don't know how many arguments you'll have at compile time.
// StringPrintfVector will LOG(FATAL) if v.size() > kStringPrintfVectorMaxArgs
-extern string StringPrintfVector(const char* format, const vector<string>& v);
+extern std::string StringPrintfVector(const char* format, const std::vector<std::string>& v);
#endif /* _BASE_STRINGPRINTF_H */
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/escaping.cc
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/escaping.cc b/src/kudu/gutil/strings/escaping.cc
index 7b03335..4128b92 100644
--- a/src/kudu/gutil/strings/escaping.cc
+++ b/src/kudu/gutil/strings/escaping.cc
@@ -8,9 +8,7 @@
#include <string.h>
#include <limits>
-using std::numeric_limits;
#include <vector>
-using std::vector;
#include "kudu/gutil/integral_types.h"
#include "kudu/gutil/port.h"
@@ -20,6 +18,10 @@ using std::vector;
#include "kudu/gutil/charmap.h"
#include "kudu/gutil/stl_util.h"
+using std::numeric_limits;
+using std::string;
+using std::vector;
+
namespace strings {
// These are used for the leave_nulls_escaped argument to CUnescapeInternal().
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/escaping.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/escaping.h b/src/kudu/gutil/strings/escaping.h
index 19e0860..b94001b 100644
--- a/src/kudu/gutil/strings/escaping.h
+++ b/src/kudu/gutil/strings/escaping.h
@@ -23,9 +23,7 @@
#include <stddef.h>
#include <string>
-using std::string;
#include <vector>
-using std::vector;
#include <glog/logging.h>
@@ -85,7 +83,7 @@ int EscapeStrForCSV(const char* src, char* dest, int dest_len);
// ----------------------------------------------------------------------
int UnescapeCEscapeSequences(const char* source, char* dest);
int UnescapeCEscapeSequences(const char* source, char* dest,
- vector<string>* errors);
+ std::vector<std::string>* errors);
// ----------------------------------------------------------------------
// UnescapeCEscapeString()
@@ -103,10 +101,10 @@ int UnescapeCEscapeSequences(const char* source, char* dest,
//
// *** DEPRECATED: Use CUnescape() in new code ***
// ----------------------------------------------------------------------
-int UnescapeCEscapeString(const string& src, string* dest);
-int UnescapeCEscapeString(const string& src, string* dest,
- vector<string>* errors);
-string UnescapeCEscapeString(const string& src);
+int UnescapeCEscapeString(const std::string& src, std::string* dest);
+int UnescapeCEscapeString(const std::string& src, std::string* dest,
+ std::vector<std::string>* errors);
+std::string UnescapeCEscapeString(const std::string& src);
// ----------------------------------------------------------------------
// CUnescape()
@@ -139,12 +137,12 @@ string UnescapeCEscapeString(const string& src);
// 'error'. To disable error reporting, set 'error' to NULL.
// ----------------------------------------------------------------------
bool CUnescape(const StringPiece& source, char* dest, int* dest_len,
- string* error);
+ std::string* error);
-bool CUnescape(const StringPiece& source, string* dest, string* error);
+bool CUnescape(const StringPiece& source, std::string* dest, std::string* error);
// A version with no error reporting.
-inline bool CUnescape(const StringPiece& source, string* dest) {
+inline bool CUnescape(const StringPiece& source, std::string* dest) {
return CUnescape(source, dest, NULL);
}
@@ -163,15 +161,15 @@ inline bool CUnescape(const StringPiece& source, string* dest) {
bool CUnescapeForNullTerminatedString(const StringPiece& source,
char* dest,
int* dest_len,
- string* error);
+ std::string* error);
bool CUnescapeForNullTerminatedString(const StringPiece& source,
- string* dest,
- string* error);
+ std::string* dest,
+ std::string* error);
// A version with no error reporting.
inline bool CUnescapeForNullTerminatedString(const StringPiece& source,
- string* dest) {
+ std::string* dest) {
return CUnescapeForNullTerminatedString(source, dest, NULL);
}
@@ -207,10 +205,10 @@ int Utf8SafeCHexEscapeString(const char* src, int src_len, char* dest,
// allocation. However, it is much more convenient to use in
// non-speed-critical code like logging messages etc.
// ----------------------------------------------------------------------
-string CEscape(const StringPiece& src);
-string CHexEscape(const StringPiece& src);
-string Utf8SafeCEscape(const StringPiece& src);
-string Utf8SafeCHexEscape(const StringPiece& src);
+std::string CEscape(const StringPiece& src);
+std::string CHexEscape(const StringPiece& src);
+std::string Utf8SafeCEscape(const StringPiece& src);
+std::string Utf8SafeCHexEscape(const StringPiece& src);
// ----------------------------------------------------------------------
// BackslashEscape()
@@ -233,21 +231,21 @@ string Utf8SafeCHexEscape(const StringPiece& src);
// ----------------------------------------------------------------------
void BackslashEscape(const StringPiece& src,
const strings::CharSet& to_escape,
- string* dest);
+ std::string* dest);
void BackslashUnescape(const StringPiece& src,
const strings::CharSet& to_unescape,
- string* dest);
+ std::string* dest);
-inline string BackslashEscape(const StringPiece& src,
+inline std::string BackslashEscape(const StringPiece& src,
const strings::CharSet& to_escape) {
- string s;
+ std::string s;
BackslashEscape(src, to_escape, &s);
return s;
}
-inline string BackslashUnescape(const StringPiece& src,
+inline std::string BackslashUnescape(const StringPiece& src,
const strings::CharSet& to_unescape) {
- string s;
+ std::string s;
BackslashUnescape(src, to_unescape, &s);
return s;
}
@@ -311,14 +309,14 @@ int QEncodingUnescape(const char* src, int slen, char* dest, int szdest);
// these versions src and dest must be different strings.
// ----------------------------------------------------------------------
int Base64Unescape(const char* src, int slen, char* dest, int szdest);
-bool Base64Unescape(const char* src, int slen, string* dest);
-inline bool Base64Unescape(const string& src, string* dest) {
+bool Base64Unescape(const char* src, int slen, std::string* dest);
+inline bool Base64Unescape(const std::string& src, std::string* dest) {
return Base64Unescape(src.data(), src.size(), dest);
}
int WebSafeBase64Unescape(const char* src, int slen, char* dest, int szdest);
-bool WebSafeBase64Unescape(const char* src, int slen, string* dest);
-inline bool WebSafeBase64Unescape(const string& src, string* dest) {
+bool WebSafeBase64Unescape(const char* src, int slen, std::string* dest);
+inline bool WebSafeBase64Unescape(const std::string& src, std::string* dest) {
return WebSafeBase64Unescape(src.data(), src.size(), dest);
}
@@ -346,16 +344,16 @@ int Base64Escape(const unsigned char* src, int slen, char* dest, int szdest);
int WebSafeBase64Escape(const unsigned char* src, int slen, char* dest,
int szdest, bool do_padding);
// Encode src into dest with padding.
-void Base64Escape(const string& src, string* dest);
+void Base64Escape(const std::string& src, std::string* dest);
// Encode src into dest web-safely without padding.
-void WebSafeBase64Escape(const string& src, string* dest);
+void WebSafeBase64Escape(const std::string& src, std::string* dest);
// Encode src into dest web-safely with padding.
-void WebSafeBase64EscapeWithPadding(const string& src, string* dest);
+void WebSafeBase64EscapeWithPadding(const std::string& src, std::string* dest);
void Base64Escape(const unsigned char* src, int szsrc,
- string* dest, bool do_padding);
+ std::string* dest, bool do_padding);
void WebSafeBase64Escape(const unsigned char* src, int szsrc,
- string* dest, bool do_padding);
+ std::string* dest, bool do_padding);
// ----------------------------------------------------------------------
// Base32Unescape()
@@ -364,8 +362,8 @@ void WebSafeBase64Escape(const unsigned char* src, int szsrc,
// RETURNS the length of dest, or -1 if src contains invalid chars.
// ----------------------------------------------------------------------
int Base32Unescape(const char* src, int slen, char* dest, int szdest);
-bool Base32Unescape(const char* src, int slen, string* dest);
-inline bool Base32Unescape(const string& src, string* dest) {
+bool Base32Unescape(const char* src, int slen, std::string* dest);
+inline bool Base32Unescape(const std::string& src, std::string* dest) {
return Base32Unescape(src.data(), src.size(), dest);
}
@@ -381,7 +379,7 @@ inline bool Base32Unescape(const string& src, string* dest) {
// ----------------------------------------------------------------------
int Base32Escape(const unsigned char* src, size_t szsrc,
char* dest, size_t szdest);
-bool Base32Escape(const string& src, string* dest);
+bool Base32Escape(const std::string& src, std::string* dest);
// ----------------------------------------------------------------------
// Base32HexEscape()
@@ -396,7 +394,7 @@ bool Base32Escape(const string& src, string* dest);
// ----------------------------------------------------------------------
int Base32HexEscape(const unsigned char* src, size_t szsrc,
char* dest, size_t szdest);
-bool Base32HexEscape(const string& src, string* dest);
+bool Base32HexEscape(const std::string& src, std::string* dest);
// Return the length to use for the output buffer given to the base32 escape
// routines. This function may return incorrect results if given input_len
@@ -464,15 +462,15 @@ void FiveBytesToEightBase32Digits(const unsigned char* in_bytes, char* out);
//
// The versions that receive a string for the output will append to it.
// ----------------------------------------------------------------------
-void EscapeFileName(const StringPiece& src, string* dst);
-void UnescapeFileName(const StringPiece& src, string* dst);
-inline string EscapeFileName(const StringPiece& src) {
- string r;
+void EscapeFileName(const StringPiece& src, std::string* dst);
+void UnescapeFileName(const StringPiece& src, std::string* dst);
+inline std::string EscapeFileName(const StringPiece& src) {
+ std::string r;
EscapeFileName(src, &r);
return r;
}
-inline string UnescapeFileName(const StringPiece& src) {
- string r;
+inline std::string UnescapeFileName(const StringPiece& src) {
+ std::string r;
UnescapeFileName(src, &r);
return r;
}
@@ -510,8 +508,8 @@ inline int hex_digit_to_int(char c) {
// ----------------------------------------------------------------------
void a2b_hex(const char* from, unsigned char* to, int num);
void a2b_hex(const char* from, char* to, int num);
-void a2b_hex(const char* from, string* to, int num);
-string a2b_hex(const string& a);
+void a2b_hex(const char* from, std::string* to, int num);
+std::string a2b_hex(const std::string& a);
// ----------------------------------------------------------------------
// a2b_bin()
@@ -523,7 +521,7 @@ string a2b_hex(const string& a);
// multiple of 8.
// Return value: ceil(a.size()/8) bytes of binary data
// ----------------------------------------------------------------------
-string a2b_bin(const string& a, bool byte_order_msb);
+std::string a2b_bin(const std::string& a, bool byte_order_msb);
// ----------------------------------------------------------------------
// b2a_hex()
@@ -532,7 +530,7 @@ string a2b_bin(const string& a, bool byte_order_msb);
// Return value: 2*'num' characters of ascii text (via the 'to' argument)
// ----------------------------------------------------------------------
void b2a_hex(const unsigned char* from, char* to, int num);
-void b2a_hex(const unsigned char* from, string* to, int num);
+void b2a_hex(const unsigned char* from, std::string* to, int num);
// ----------------------------------------------------------------------
// b2a_hex()
@@ -540,8 +538,8 @@ void b2a_hex(const unsigned char* from, string* to, int num);
// 'num' bytes of binary to a 2*'num'-character hexadecimal representation
// Return value: 2*'num' characters of ascii string
// ----------------------------------------------------------------------
-string b2a_hex(const char* from, int num);
-string b2a_hex(const StringPiece& b);
+std::string b2a_hex(const char* from, int num);
+std::string b2a_hex(const StringPiece& b);
// ----------------------------------------------------------------------
// b2a_bin()
@@ -551,7 +549,7 @@ string b2a_hex(const StringPiece& b);
// first in the string if byte_order_msb is set.
// Return value: 8*b.size() characters of ascii text
// ----------------------------------------------------------------------
-string b2a_bin(const string& b, bool byte_order_msb);
+std::string b2a_bin(const std::string& b, bool byte_order_msb);
// ----------------------------------------------------------------------
// ShellEscape
@@ -563,13 +561,13 @@ string b2a_bin(const string& b, bool byte_order_msb);
// safe for Bourne shell syntax (i.e. sh, bash), but mileage may vary
// with other shells.
// ----------------------------------------------------------------------
-string ShellEscape(StringPiece src);
+std::string ShellEscape(StringPiece src);
// Runs ShellEscape() on the arguments, concatenates them with a space, and
// returns the resulting string.
template <class InputIterator>
-string ShellEscapeCommandLine(InputIterator begin, const InputIterator& end) {
- string result;
+std::string ShellEscapeCommandLine(InputIterator begin, const InputIterator& end) {
+ std::string result;
for (; begin != end; ++begin) {
if (!result.empty()) result.append(" ");
result.append(ShellEscape(*begin));
@@ -579,12 +577,12 @@ string ShellEscapeCommandLine(InputIterator begin, const InputIterator& end) {
// Reads at most bytes_to_read from binary_string and writes it to
// ascii_string in lower case hex.
-void ByteStringToAscii(const string& binary_string, int bytes_to_read,
- string* ascii_string);
+void ByteStringToAscii(const std::string& binary_string, int bytes_to_read,
+ std::string* ascii_string);
-inline string ByteStringToAscii(const string& binary_string,
+inline std::string ByteStringToAscii(const std::string& binary_string,
int bytes_to_read) {
- string result;
+ std::string result;
ByteStringToAscii(binary_string, bytes_to_read, &result);
return result;
}
@@ -594,7 +592,7 @@ inline string ByteStringToAscii(const string& binary_string,
// Empty input successfully converts to empty output.
// Returns false and may modify output if it is
// unable to parse the hex string.
-bool ByteStringFromAscii(const string& ascii_string, string* binary_string);
+bool ByteStringFromAscii(const std::string& ascii_string, std::string* binary_string);
// Clean up a multi-line string to conform to Unix line endings.
// Reads from src and appends to dst, so usually dst should be empty.
@@ -621,11 +619,11 @@ bool ByteStringFromAscii(const string& ascii_string, string* binary_string);
// This does not do the right thing for CRCRLF files created by
// broken programs that do another Unix->DOS conversion on files
// that are already in CRLF format.
-void CleanStringLineEndings(const string& src, string* dst,
+void CleanStringLineEndings(const std::string& src, std::string* dst,
bool auto_end_last_line);
// Same as above, but transforms the argument in place.
-void CleanStringLineEndings(string* str, bool auto_end_last_line);
+void CleanStringLineEndings(std::string* str, bool auto_end_last_line);
} // namespace strings
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/human_readable.cc
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/human_readable.cc b/src/kudu/gutil/strings/human_readable.cc
index fb3419a..2af0a35 100644
--- a/src/kudu/gutil/strings/human_readable.cc
+++ b/src/kudu/gutil/strings/human_readable.cc
@@ -11,6 +11,8 @@
#include "kudu/gutil/stringprintf.h"
#include "kudu/gutil/strings/strip.h"
+using std::string;
+
namespace {
template <typename T>
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/human_readable.h
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/human_readable.h b/src/kudu/gutil/strings/human_readable.h
index e05b169..53207f6 100644
--- a/src/kudu/gutil/strings/human_readable.h
+++ b/src/kudu/gutil/strings/human_readable.h
@@ -7,10 +7,7 @@
#define STRINGS_HUMAN_READABLE_H__
#include <functional>
-using std::binary_function;
-using std::less;
#include <string>
-using std::string;
#include "kudu/gutil/basictypes.h"
#include "kudu/gutil/integral_types.h"
@@ -41,16 +38,16 @@ class HumanReadableNumBytes {
// e.g. 1000000 -> "976.6K".
// Note that calling these two functions in succession isn't a
// noop, since ToString() may round.
- static bool ToInt64(const string &str, int64 *num_bytes);
- static string ToString(int64 num_bytes);
+ static bool ToInt64(const std::string &str, int64 *num_bytes);
+ static std::string ToString(int64 num_bytes);
// Like ToString but without rounding. For example 1025 would return
// "1025B" rather than "1.0K". Uses the largest common denominator.
- static string ToStringWithoutRounding(int64 num_bytes);
+ static std::string ToStringWithoutRounding(int64 num_bytes);
- static bool ToDouble(const string &str, double *num_bytes);
+ static bool ToDouble(const std::string &str, double *num_bytes);
// Function overloading this with a function that takes an int64 is just
// asking for trouble.
- static string DoubleToString(double num_bytes);
+ static std::string DoubleToString(double num_bytes);
// TODO(user): Maybe change this class to use SIPrefix?
@@ -71,7 +68,7 @@ class HumanReadableNumBytes {
// 3.02P
// 0.007E
// ----------------------------------------------------------------------
- static bool LessThan(const string &a, const string &b);
+ static bool LessThan(const std::string &a, const std::string &b);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(HumanReadableNumBytes);
@@ -80,16 +77,16 @@ class HumanReadableNumBytes {
// See documentation at HumanReadableNumBytes::LessThan().
struct humanreadablebytes_less
- : public binary_function<const string&, const string&, bool> {
- bool operator()(const string& a, const string &b) const {
+ : public std::binary_function<const std::string&, const std::string&, bool> {
+ bool operator()(const std::string& a, const std::string &b) const {
return HumanReadableNumBytes::LessThan(a, b);
}
};
// See documentation at HumanReadableNumBytes::LessThan().
struct humanreadablebytes_greater
- : public binary_function<const string&, const string&, bool> {
- bool operator()(const string& a, const string &b) const {
+ : public std::binary_function<const std::string&, const std::string&, bool> {
+ bool operator()(const std::string& a, const std::string &b) const {
return HumanReadableNumBytes::LessThan(b, a);
}
};
@@ -99,11 +96,11 @@ class HumanReadableInt {
// Similar to HumanReadableNumBytes::ToInt64(), but uses decimal
// rather than binary expansions - so M = 1 million, B = 1 billion,
// etc. Numbers beyond 1T are expressed as "3E14" etc.
- static string ToString(int64 value);
+ static std::string ToString(int64 value);
// Reverses ToString(). Note that calling these two functions in
// succession isn't a noop, since ToString() may round.
- static bool ToInt64(const string &str, int64 *value);
+ static bool ToInt64(const std::string &str, int64 *value);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(HumanReadableInt);
@@ -112,16 +109,16 @@ class HumanReadableInt {
class HumanReadableNum {
public:
// Same as HumanReadableInt::ToString().
- static string ToString(int64 value);
+ static std::string ToString(int64 value);
// Similar to HumanReadableInt::ToString(), but prints 2 decimal
// places for numbers with absolute value < 10.0 and 1 decimal place
// for numbers >= 10.0 and < 100.0.
- static string DoubleToString(double value);
+ static std::string DoubleToString(double value);
// Reverses DoubleToString(). Note that calling these two functions in
// succession isn't a noop, since there may be rounding errors.
- static bool ToDouble(const string &str, double *value);
+ static bool ToDouble(const std::string &str, double *value);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(HumanReadableNum);
@@ -136,7 +133,7 @@ class HumanReadableElapsedTime {
// 933120.0 -> "10.8 days"
// 39420000.0 -> "1.25 years"
// -10 -> "-10 s"
- static string ToShortString(double seconds);
+ static std::string ToShortString(double seconds);
// Reverses ToShortString(). Note that calling these two functions in
// succession isn't a noop, since ToShortString() may round.
@@ -153,7 +150,7 @@ class HumanReadableElapsedTime {
// "-10 sec" -> -10
// "18.3" -> 18.3
// "1M" -> 2592000 (1 month = 30 days)
- static bool ToDouble(const string& str, double* value);
+ static bool ToDouble(const std::string& str, double* value);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(HumanReadableElapsedTime);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/gutil/strings/join.cc
----------------------------------------------------------------------
diff --git a/src/kudu/gutil/strings/join.cc b/src/kudu/gutil/strings/join.cc
index 4c289f2..645e612 100644
--- a/src/kudu/gutil/strings/join.cc
+++ b/src/kudu/gutil/strings/join.cc
@@ -8,6 +8,11 @@
#include "kudu/gutil/strings/ascii_ctype.h"
#include "kudu/gutil/strings/escaping.h"
+using std::map;
+using std::pair;
+using std::string;
+using std::vector;
+
// ----------------------------------------------------------------------
// JoinUsing()
// This merges a vector of string components with delim inserted
[2/6] kudu git commit: remove 'using std::...' and other from header
files
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/compaction.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/compaction.h b/src/kudu/tablet/compaction.h
index bead82e..24ea328 100644
--- a/src/kudu/tablet/compaction.h
+++ b/src/kudu/tablet/compaction.h
@@ -100,11 +100,11 @@ class CompactionInput {
// Create an input which merges several other compaction inputs. The inputs are merged
// in key-order according to the given schema. All inputs must have matching schemas.
- static CompactionInput *Merge(const vector<std::shared_ptr<CompactionInput> > &inputs,
+ static CompactionInput *Merge(const std::vector<std::shared_ptr<CompactionInput> > &inputs,
const Schema *schema);
virtual Status Init() = 0;
- virtual Status PrepareBlock(vector<CompactionInputRow> *block) = 0;
+ virtual Status PrepareBlock(std::vector<CompactionInputRow> *block) = 0;
// Returns the arena for this compaction input corresponding to the last
// prepared block. This must be called *after* PrepareBlock() as if this
@@ -150,7 +150,7 @@ class RowSetsInCompaction {
private:
RowSetVector rowsets_;
- vector<std::unique_lock<std::mutex>> locks_;
+ std::vector<std::unique_lock<std::mutex>> locks_;
};
// One row yielded by CompactionInput::PrepareBlock.
@@ -223,7 +223,7 @@ Status FlushCompactionInput(CompactionInput *input,
//
// After return of this function, this CompactionInput object is "used up" and will
// yield no further rows.
-Status ReupdateMissedDeltas(const string &tablet_name,
+Status ReupdateMissedDeltas(const std::string &tablet_name,
CompactionInput *input,
const HistoryGcOpts& history_gc_opts,
const MvccSnapshot &snap_to_exclude,
@@ -232,11 +232,13 @@ Status ReupdateMissedDeltas(const string &tablet_name,
// Dump the given compaction input to 'lines' or LOG(INFO) if it is NULL.
// This consumes all of the input in the compaction input.
-Status DebugDumpCompactionInput(CompactionInput *input, vector<string> *lines);
+Status DebugDumpCompactionInput(CompactionInput *input, std::vector<std::string> *lines);
// Helper methods to print a row with full history.
-string RowToString(const RowBlockRow& row, const Mutation* redo_head, const Mutation* undo_head);
-string CompactionInputRowToString(const CompactionInputRow& input_row);
+std::string RowToString(const RowBlockRow& row,
+ const Mutation* redo_head,
+ const Mutation* undo_head);
+std::string CompactionInputRowToString(const CompactionInputRow& input_row);
} // namespace tablet
} // namespace kudu
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/compaction_policy.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/compaction_policy.cc b/src/kudu/tablet/compaction_policy.cc
index 3836d29..93fb7b2 100644
--- a/src/kudu/tablet/compaction_policy.cc
+++ b/src/kudu/tablet/compaction_policy.cc
@@ -180,7 +180,7 @@ class BoundCalculator {
// Compute the lower and upper bounds to the 0-1 knapsack problem with the elements
// added so far.
- pair<double, double> ComputeLowerAndUpperBound() const {
+ std::pair<double, double> ComputeLowerAndUpperBound() const {
int excess_weight = total_weight_ - max_weight_;
if (excess_weight <= 0) {
// If we've added less than the budget, our "bounds" are just including
@@ -350,7 +350,7 @@ void BudgetedCompactionPolicy::RunExact(
// See docs/design-docs/compaction-policy.md for an overview of the compaction
// policy implemented in this function.
Status BudgetedCompactionPolicy::PickRowSets(const RowSetTree &tree,
- unordered_set<RowSet*>* picked,
+ std::unordered_set<RowSet*>* picked,
double* quality,
std::vector<std::string>* log) {
vector<RowSetInfo> asc_min_key, asc_max_key;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/composite-pushdown-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/composite-pushdown-test.cc b/src/kudu/tablet/composite-pushdown-test.cc
index 63b3e68..19fd3da 100644
--- a/src/kudu/tablet/composite-pushdown-test.cc
+++ b/src/kudu/tablet/composite-pushdown-test.cc
@@ -24,6 +24,9 @@
#include "kudu/util/test_macros.h"
#include "kudu/util/test_util.h"
+using std::string;
+using std::vector;
+
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/concurrent_btree.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/concurrent_btree.h b/src/kudu/tablet/concurrent_btree.h
index 1a2af12..0e4dfa6 100644
--- a/src/kudu/tablet/concurrent_btree.h
+++ b/src/kudu/tablet/concurrent_btree.h
@@ -206,7 +206,7 @@ struct VersionField {
return v & BTREE_INSERTING_MASK;
}
- static string Stringify(AtomicVersion v) {
+ static std::string Stringify(AtomicVersion v) {
return StringPrintf("[flags=%c%c%c vins=%" PRIu64 " vsplit=%" PRIu64 "]",
(v & BTREE_LOCK_MASK) ? 'L':' ',
(v & BTREE_SPLITTING_MASK) ? 'S':' ',
@@ -625,8 +625,8 @@ class PACKED InternalNode : public NodeBase<Traits> {
#endif
}
- string ToString() const {
- string ret("[");
+ std::string ToString() const {
+ std::string ret("[");
for (int i = 0; i < num_children_; i++) {
if (i > 0) {
ret.append(", ");
@@ -778,8 +778,8 @@ class LeafNode : public NodeBase<Traits> {
num_entries_ = new_num_entries;
}
- string ToString() const {
- string ret;
+ std::string ToString() const {
+ std::string ret;
for (int i = 0; i < num_entries_; i++) {
if (i > 0) {
ret.append(", ");
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/delta_compaction.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_compaction.cc b/src/kudu/tablet/delta_compaction.cc
index af50e98..ee110af 100644
--- a/src/kudu/tablet/delta_compaction.cc
+++ b/src/kudu/tablet/delta_compaction.cc
@@ -42,6 +42,7 @@ namespace kudu {
using fs::CreateBlockOptions;
using fs::WritableBlock;
+using std::string;
using std::unique_ptr;
using std::vector;
using strings::Substitute;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/delta_iterator_merger.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_iterator_merger.h b/src/kudu/tablet/delta_iterator_merger.h
index f1e5cef..139cdd4 100644
--- a/src/kudu/tablet/delta_iterator_merger.h
+++ b/src/kudu/tablet/delta_iterator_merger.h
@@ -52,16 +52,16 @@ class DeltaIteratorMerger : public DeltaIterator {
virtual Status PrepareBatch(size_t nrows, PrepareFlag flag) OVERRIDE;
virtual Status ApplyUpdates(size_t col_to_apply, ColumnBlock *dst) OVERRIDE;
virtual Status ApplyDeletes(SelectionVector *sel_vec) OVERRIDE;
- virtual Status CollectMutations(vector<Mutation *> *dst, Arena *arena) OVERRIDE;
+ virtual Status CollectMutations(std::vector<Mutation *> *dst, Arena *arena) OVERRIDE;
virtual Status FilterColumnIdsAndCollectDeltas(const std::vector<ColumnId>& col_ids,
- vector<DeltaKeyAndUpdate>* out,
+ std::vector<DeltaKeyAndUpdate>* out,
Arena* arena) OVERRIDE;
virtual bool HasNext() OVERRIDE;
bool MayHaveDeltas() override;
virtual std::string ToString() const OVERRIDE;
private:
- explicit DeltaIteratorMerger(vector<std::unique_ptr<DeltaIterator> > iters);
+ explicit DeltaIteratorMerger(std::vector<std::unique_ptr<DeltaIterator> > iters);
std::vector<std::unique_ptr<DeltaIterator> > iters_;
};
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/delta_key.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_key.h b/src/kudu/tablet/delta_key.h
index 7ad6b0a..68ca198 100644
--- a/src/kudu/tablet/delta_key.h
+++ b/src/kudu/tablet/delta_key.h
@@ -89,7 +89,7 @@ class DeltaKey {
return Status::OK();
}
- string ToString() const {
+ std::string ToString() const {
return strings::Substitute("(row $0@tx$1)", row_idx_, timestamp_.ToString());
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/delta_stats.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_stats.cc b/src/kudu/tablet/delta_stats.cc
index 928d6eb..a3ffbee 100644
--- a/src/kudu/tablet/delta_stats.cc
+++ b/src/kudu/tablet/delta_stats.cc
@@ -28,6 +28,7 @@ using strings::Substitute;
namespace kudu {
+using std::string;
using std::vector;
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/delta_store.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_store.cc b/src/kudu/tablet/delta_store.cc
index 137bcda..6eaa307 100644
--- a/src/kudu/tablet/delta_store.cc
+++ b/src/kudu/tablet/delta_store.cc
@@ -28,6 +28,7 @@ namespace tablet {
using std::shared_ptr;
using std::string;
+using std::vector;
using strings::Substitute;
string DeltaKeyAndUpdate::Stringify(DeltaType type, const Schema& schema, bool pad_key) const {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/delta_store.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_store.h b/src/kudu/tablet/delta_store.h
index b1fce99..564d33f 100644
--- a/src/kudu/tablet/delta_store.h
+++ b/src/kudu/tablet/delta_store.h
@@ -163,7 +163,7 @@ class DeltaIterator {
//
// The Mutation objects will be allocated out of the provided Arena, which must be non-NULL.
// Must have called PrepareBatch() with flag = PREPARE_FOR_COLLECT.
- virtual Status CollectMutations(vector<Mutation *> *dst, Arena *arena) = 0;
+ virtual Status CollectMutations(std::vector<Mutation *> *dst, Arena *arena) = 0;
// Iterate through all deltas, adding deltas for columns not
// specified in 'col_ids' to 'out'.
@@ -172,7 +172,7 @@ class DeltaIterator {
// must be non-NULL.
// Must have called PrepareBatch() with flag = PREPARE_FOR_COLLECT.
virtual Status FilterColumnIdsAndCollectDeltas(const std::vector<ColumnId>& col_ids,
- vector<DeltaKeyAndUpdate>* out,
+ std::vector<DeltaKeyAndUpdate>* out,
Arena* arena) = 0;
// Returns true if there are any more rows left in this iterator.
@@ -202,7 +202,7 @@ Status DebugDumpDeltaIterator(DeltaType type,
DeltaIterator* iter,
const Schema& schema,
size_t nrows,
- vector<std::string>* out);
+ std::vector<std::string>* out);
// Writes the contents of 'iter' to 'out', block by block. Used by
// minor delta compaction.
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/delta_tracker.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_tracker.cc b/src/kudu/tablet/delta_tracker.cc
index 5e0bdf1..cbaaff2 100644
--- a/src/kudu/tablet/delta_tracker.cc
+++ b/src/kudu/tablet/delta_tracker.cc
@@ -43,9 +43,11 @@ using fs::CreateBlockOptions;
using fs::ReadableBlock;
using fs::WritableBlock;
using log::LogAnchorRegistry;
+using std::set;
using std::shared_ptr;
using std::string;
using std::unique_ptr;
+using std::vector;
using strings::Substitute;
Status DeltaTracker::Open(const shared_ptr<RowSetMetadata>& rowset_metadata,
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/delta_tracker.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/delta_tracker.h b/src/kudu/tablet/delta_tracker.h
index 77b86e1..3c66230 100644
--- a/src/kudu/tablet/delta_tracker.h
+++ b/src/kudu/tablet/delta_tracker.h
@@ -151,7 +151,7 @@ class DeltaTracker {
// stores visible before attempting to flush the metadata to disk.
Status CommitDeltaStoreMetadataUpdate(const RowSetMetadataUpdate& update,
const SharedDeltaStoreVector& to_remove,
- const vector<BlockId>& new_delta_blocks,
+ const std::vector<BlockId>& new_delta_blocks,
DeltaType type,
MetadataFlushType flush_type);
@@ -254,7 +254,7 @@ class DeltaTracker {
MetadataFlushType flush_type);
// This collects undo and/or redo stores into '*stores'.
- void CollectStores(vector<std::shared_ptr<DeltaStore>>* stores,
+ void CollectStores(std::vector<std::shared_ptr<DeltaStore>>* stores,
WhichStores which) const;
// Performs the actual compaction. Results of compaction are written to "block",
@@ -280,8 +280,8 @@ class DeltaTracker {
// race on 'redo_delta_stores_'.
Status MakeDeltaIteratorMergerUnlocked(size_t start_idx, size_t end_idx,
const Schema* schema,
- vector<std::shared_ptr<DeltaStore > > *target_stores,
- vector<BlockId> *target_blocks,
+ std::vector<std::shared_ptr<DeltaStore > > *target_stores,
+ std::vector<BlockId> *target_blocks,
std::unique_ptr<DeltaIterator> *out);
std::string LogPrefix() const;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/deltafile-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/deltafile-test.cc b/src/kudu/tablet/deltafile-test.cc
index e353802..6bedbb1 100644
--- a/src/kudu/tablet/deltafile-test.cc
+++ b/src/kudu/tablet/deltafile-test.cc
@@ -37,7 +37,9 @@ DEFINE_int32(n_verify, 1, "number of times to verify the updates"
using std::is_sorted;
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
+using std::vector;
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/deltafile.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/deltafile.cc b/src/kudu/tablet/deltafile.cc
index 0572ccf..f96903e 100644
--- a/src/kudu/tablet/deltafile.cc
+++ b/src/kudu/tablet/deltafile.cc
@@ -49,7 +49,9 @@ DEFINE_string(deltafile_default_compression_codec, "lz4",
TAG_FLAG(deltafile_default_compression_codec, experimental);
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
+using std::vector;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/deltafile.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/deltafile.h b/src/kudu/tablet/deltafile.h
index f0db2d5..ada35a5 100644
--- a/src/kudu/tablet/deltafile.h
+++ b/src/kudu/tablet/deltafile.h
@@ -201,11 +201,11 @@ class DeltaFileIterator : public DeltaIterator {
Status PrepareBatch(size_t nrows, PrepareFlag flag) OVERRIDE;
Status ApplyUpdates(size_t col_to_apply, ColumnBlock *dst) OVERRIDE;
Status ApplyDeletes(SelectionVector *sel_vec) OVERRIDE;
- Status CollectMutations(vector<Mutation *> *dst, Arena *arena) OVERRIDE;
+ Status CollectMutations(std::vector<Mutation *> *dst, Arena *arena) OVERRIDE;
Status FilterColumnIdsAndCollectDeltas(const std::vector<ColumnId>& col_ids,
- vector<DeltaKeyAndUpdate>* out,
+ std::vector<DeltaKeyAndUpdate>* out,
Arena* arena) OVERRIDE;
- string ToString() const OVERRIDE;
+ std::string ToString() const OVERRIDE;
virtual bool HasNext() OVERRIDE;
bool MayHaveDeltas() override;
@@ -254,7 +254,7 @@ class DeltaFileIterator : public DeltaIterator {
rowid_t prepared_block_start_idx_;
// Return a string description of this prepared block, for logging.
- string ToString() const;
+ std::string ToString() const;
};
@@ -282,7 +282,8 @@ class DeltaFileIterator : public DeltaIterator {
Status VisitMutations(Visitor *visitor);
// Log a FATAL error message about a bad delta.
- void FatalUnexpectedDelta(const DeltaKey &key, const Slice &deltas, const string &msg);
+ void FatalUnexpectedDelta(const DeltaKey &key, const Slice &deltas,
+ const std::string &msg);
std::shared_ptr<DeltaFileReader> dfr_;
@@ -314,7 +315,7 @@ class DeltaFileIterator : public DeltaIterator {
// The type of this delta iterator, i.e. UNDO or REDO.
const DeltaType delta_type_;
- CFileReader::CacheControl cache_blocks_;
+ cfile::CFileReader::CacheControl cache_blocks_;
};
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/deltamemstore-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/deltamemstore-test.cc b/src/kudu/tablet/deltamemstore-test.cc
index 1471359..a523c31 100644
--- a/src/kudu/tablet/deltamemstore-test.cc
+++ b/src/kudu/tablet/deltamemstore-test.cc
@@ -37,8 +37,10 @@
DEFINE_int32(benchmark_num_passes, 100, "Number of passes to apply deltas in the benchmark");
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
using std::unordered_set;
+using std::vector;
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/deltamemstore.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/deltamemstore.cc b/src/kudu/tablet/deltamemstore.cc
index dc52c28..3cd9939 100644
--- a/src/kudu/tablet/deltamemstore.cc
+++ b/src/kudu/tablet/deltamemstore.cc
@@ -32,7 +32,9 @@ namespace kudu {
namespace tablet {
using log::LogAnchorRegistry;
+using std::string;
using std::shared_ptr;
+using std::vector;
using strings::Substitute;
////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/deltamemstore.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/deltamemstore.h b/src/kudu/tablet/deltamemstore.h
index f9526e1..240f3c6 100644
--- a/src/kudu/tablet/deltamemstore.h
+++ b/src/kudu/tablet/deltamemstore.h
@@ -194,13 +194,13 @@ class DMSIterator : public DeltaIterator {
Status ApplyDeletes(SelectionVector *sel_vec) OVERRIDE;
- Status CollectMutations(vector<Mutation *> *dst, Arena *arena) OVERRIDE;
+ Status CollectMutations(std::vector<Mutation *> *dst, Arena *arena) OVERRIDE;
- Status FilterColumnIdsAndCollectDeltas(const vector<ColumnId>& col_ids,
- vector<DeltaKeyAndUpdate>* out,
+ Status FilterColumnIdsAndCollectDeltas(const std::vector<ColumnId>& col_ids,
+ std::vector<DeltaKeyAndUpdate>* out,
Arena* arena) OVERRIDE;
- string ToString() const OVERRIDE;
+ std::string ToString() const OVERRIDE;
virtual bool HasNext() OVERRIDE;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/diskrowset-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/diskrowset-test-base.h b/src/kudu/tablet/diskrowset-test-base.h
index 927cd7c..e654509 100644
--- a/src/kudu/tablet/diskrowset-test-base.h
+++ b/src/kudu/tablet/diskrowset-test-base.h
@@ -53,8 +53,6 @@ DEFINE_int32(n_read_passes, 10,
namespace kudu {
namespace tablet {
-using std::unordered_set;
-
class TestRowSet : public KuduRowSetTest {
public:
TestRowSet()
@@ -74,10 +72,10 @@ class TestRowSet : public KuduRowSetTest {
}
static Schema CreateProjection(const Schema& schema,
- const vector<string>& cols) {
- vector<ColumnSchema> col_schemas;
- vector<ColumnId> col_ids;
- for (const string& col : cols) {
+ const std::vector<std::string>& cols) {
+ std::vector<ColumnSchema> col_schemas;
+ std::vector<ColumnId> col_ids;
+ for (const std::string& col : cols) {
int idx = schema.find_column(col);
CHECK_GE(idx, 0);
col_schemas.push_back(schema.column(idx));
@@ -132,7 +130,7 @@ class TestRowSet : public KuduRowSetTest {
// Picks some number of rows from the given rowset and updates
// them. Stores the indexes of the updated rows in *updated.
void UpdateExistingRows(DiskRowSet *rs, float update_ratio,
- unordered_set<uint32_t> *updated) {
+ std::unordered_set<uint32_t> *updated) {
int to_update = static_cast<int>(n_rows_ * update_ratio);
faststring update_buf;
RowChangeListEncoder update(&update_buf);
@@ -205,14 +203,14 @@ class TestRowSet : public KuduRowSetTest {
// Updated rows (those whose index is present in 'updated') should have
// a 'val' column equal to idx*5.
// Other rows should have val column equal to idx.
- void VerifyUpdates(const DiskRowSet &rs, const unordered_set<uint32_t> &updated) {
+ void VerifyUpdates(const DiskRowSet &rs, const std::unordered_set<uint32_t> &updated) {
LOG_TIMING(INFO, "Reading updated rows with row iter") {
VerifyUpdatesWithRowIter(rs, updated);
}
}
void VerifyUpdatesWithRowIter(const DiskRowSet &rs,
- const unordered_set<uint32_t> &updated) {
+ const std::unordered_set<uint32_t> &updated) {
Schema proj_val = CreateProjection(schema_, { "val" });
MvccSnapshot snap = MvccSnapshot::CreateSnapshotIncludingAllTransactions();
gscoped_ptr<RowwiseIterator> row_iter;
@@ -233,7 +231,7 @@ class TestRowSet : public KuduRowSetTest {
}
void VerifyUpdatedBlock(const uint32_t *from_file, int start_row, size_t n_rows,
- const unordered_set<uint32_t> &updated) {
+ const std::unordered_set<uint32_t> &updated) {
for (int j = 0; j < n_rows; j++) {
uint32_t idx_in_file = start_row + j;
int expected;
@@ -253,7 +251,7 @@ class TestRowSet : public KuduRowSetTest {
// Perform a random read of the given row key,
// asserting that the result matches 'expected_val'.
void VerifyRandomRead(const DiskRowSet& rs, const Slice& row_key,
- const string& expected_val) {
+ const std::string& expected_val) {
Arena arena(256, 1024);
AutoReleasePool pool;
ScanSpec spec;
@@ -265,9 +263,9 @@ class TestRowSet : public KuduRowSetTest {
gscoped_ptr<RowwiseIterator> row_iter;
CHECK_OK(rs.NewRowIterator(&schema_, snap, UNORDERED, &row_iter));
CHECK_OK(row_iter->Init(&spec));
- vector<string> rows;
+ std::vector<std::string> rows;
IterateToStringList(row_iter.get(), &rows);
- string result = JoinStrings(rows, "\n");
+ std::string result = JoinStrings(rows, "\n");
ASSERT_EQ(expected_val, result);
}
@@ -300,7 +298,7 @@ class TestRowSet : public KuduRowSetTest {
}
void BenchmarkIterationPerformance(const DiskRowSet &rs,
- const string &log_message) {
+ const std::string &log_message) {
Schema proj_val = CreateProjection(schema_, { "val" });
LOG_TIMING(INFO, log_message + " (val column only)") {
for (int i = 0; i < FLAGS_n_read_passes; i++) {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/diskrowset-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/diskrowset-test.cc b/src/kudu/tablet/diskrowset-test.cc
index 71c92b2..4520af0 100644
--- a/src/kudu/tablet/diskrowset-test.cc
+++ b/src/kudu/tablet/diskrowset-test.cc
@@ -41,8 +41,10 @@ DECLARE_int32(tablet_delta_store_minor_compact_max);
using std::is_sorted;
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
using std::unordered_set;
+using std::vector;
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/diskrowset.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/diskrowset.cc b/src/kudu/tablet/diskrowset.cc
index db6daf6..d63aab2 100644
--- a/src/kudu/tablet/diskrowset.cc
+++ b/src/kudu/tablet/diskrowset.cc
@@ -72,6 +72,7 @@ using log::LogAnchorRegistry;
using std::shared_ptr;
using std::string;
using std::unique_ptr;
+using std::vector;
const char *DiskRowSet::kMinKeyMetaEntryName = "min_key";
const char *DiskRowSet::kMaxKeyMetaEntryName = "max_key";
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/key_value_test_schema.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/key_value_test_schema.h b/src/kudu/tablet/key_value_test_schema.h
index 479be39..da36990 100644
--- a/src/kudu/tablet/key_value_test_schema.h
+++ b/src/kudu/tablet/key_value_test_schema.h
@@ -42,8 +42,8 @@ struct ExpectedKeyValueRow {
return key == other.key && val == other.val;
}
- string ToString() const {
- string ret = strings::Substitute("{$0,", key);
+ std::string ToString() const {
+ std::string ret = strings::Substitute("{$0,", key);
if (val == boost::none) {
ret.append("NULL}");
} else {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/local_tablet_writer.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/local_tablet_writer.h b/src/kudu/tablet/local_tablet_writer.h
index b92a409..073e46a 100644
--- a/src/kudu/tablet/local_tablet_writer.h
+++ b/src/kudu/tablet/local_tablet_writer.h
@@ -79,7 +79,7 @@ class LocalTabletWriter {
// Returns a bad Status if the applied operation had a per-row error.
Status Write(RowOperationsPB::Type type,
const KuduPartialRow& row) {
- vector<Op> ops;
+ std::vector<Op> ops;
ops.emplace_back(type, &row);
return WriteBatch(ops);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/lock_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/lock_manager-test.cc b/src/kudu/tablet/lock_manager-test.cc
index d505989..e61e127 100644
--- a/src/kudu/tablet/lock_manager-test.cc
+++ b/src/kudu/tablet/lock_manager-test.cc
@@ -29,8 +29,9 @@
#include "kudu/util/test_util.h"
#include "kudu/util/thread.h"
-using std::vector;
using std::shared_ptr;
+using std::string;
+using std::vector;
DEFINE_int32(num_test_threads, 10, "number of stress test client threads");
DEFINE_int32(num_iterations, 1000, "number of iterations per client thread");
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/lock_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/lock_manager.cc b/src/kudu/tablet/lock_manager.cc
index 3c37429..2bd2b88 100644
--- a/src/kudu/tablet/lock_manager.cc
+++ b/src/kudu/tablet/lock_manager.cc
@@ -31,6 +31,8 @@
#include "kudu/util/semaphore.h"
#include "kudu/util/trace.h"
+using base::subtle::NoBarrier_Load;
+
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/major_delta_compaction-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/major_delta_compaction-test.cc b/src/kudu/tablet/major_delta_compaction-test.cc
index c170537..a3e4299 100644
--- a/src/kudu/tablet/major_delta_compaction-test.cc
+++ b/src/kudu/tablet/major_delta_compaction-test.cc
@@ -34,7 +34,9 @@
#include "kudu/util/test_util.h"
using std::shared_ptr;
+using std::string;
using std::unordered_set;
+using std::vector;
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/memrowset-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/memrowset-test.cc b/src/kudu/tablet/memrowset-test.cc
index 8ebb5fa..8df2889 100644
--- a/src/kudu/tablet/memrowset-test.cc
+++ b/src/kudu/tablet/memrowset-test.cc
@@ -40,6 +40,8 @@ namespace tablet {
using consensus::OpId;
using log::LogAnchorRegistry;
using std::shared_ptr;
+using std::string;
+using std::vector;
class TestMemRowSet : public KuduTest {
public:
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/memrowset.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/memrowset.cc b/src/kudu/tablet/memrowset.cc
index 82b328e..f113eff 100644
--- a/src/kudu/tablet/memrowset.cc
+++ b/src/kudu/tablet/memrowset.cc
@@ -43,6 +43,8 @@ TAG_FLAG(mrs_use_codegen, hidden);
using std::pair;
using std::shared_ptr;
+using std::string;
+using std::vector;
namespace kudu { namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/memrowset.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/memrowset.h b/src/kudu/tablet/memrowset.h
index ae953c3..fd827a3 100644
--- a/src/kudu/tablet/memrowset.h
+++ b/src/kudu/tablet/memrowset.h
@@ -312,10 +312,10 @@ class MemRowSet : public RowSet,
// If 'lines' is NULL, dumps to LOG(INFO).
//
// This dumps every row, so should only be used in tests, etc.
- virtual Status DebugDump(vector<string> *lines = NULL) OVERRIDE;
+ virtual Status DebugDump(std::vector<std::string> *lines = NULL) OVERRIDE;
- string ToString() const OVERRIDE {
- return string("memrowset");
+ std::string ToString() const OVERRIDE {
+ return "memrowset";
}
// Mark the memrowset as frozen. See CBTree::Freeze()
@@ -471,7 +471,7 @@ class MemRowSet::Iterator : public RowwiseIterator {
return iter_->Next();
}
- string ToString() const OVERRIDE {
+ std::string ToString() const OVERRIDE {
return "memrowset iterator";
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/mock-rowsets.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/mock-rowsets.h b/src/kudu/tablet/mock-rowsets.h
index 37c2c8b..07736e0 100644
--- a/src/kudu/tablet/mock-rowsets.h
+++ b/src/kudu/tablet/mock-rowsets.h
@@ -67,7 +67,7 @@ class MockRowSet : public RowSet {
LOG(FATAL) << "Unimplemented";
return "";
}
- virtual Status DebugDump(vector<std::string> *lines = NULL) OVERRIDE {
+ virtual Status DebugDump(std::vector<std::string> *lines = NULL) OVERRIDE {
LOG(FATAL) << "Unimplemented";
return Status::OK();
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/mt-rowset_delta_compaction-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/mt-rowset_delta_compaction-test.cc b/src/kudu/tablet/mt-rowset_delta_compaction-test.cc
index e159ac0..21d2d80 100644
--- a/src/kudu/tablet/mt-rowset_delta_compaction-test.cc
+++ b/src/kudu/tablet/mt-rowset_delta_compaction-test.cc
@@ -37,6 +37,7 @@ DEFINE_int32(num_seconds_per_thread, kDefaultNumSecondsPerThread,
"Minimum number of seconds each thread should work");
using std::shared_ptr;
+using std::vector;
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/multi_column_writer.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/multi_column_writer.cc b/src/kudu/tablet/multi_column_writer.cc
index abcd259..8b01048 100644
--- a/src/kudu/tablet/multi_column_writer.cc
+++ b/src/kudu/tablet/multi_column_writer.cc
@@ -36,7 +36,7 @@ using std::unique_ptr;
MultiColumnWriter::MultiColumnWriter(FsManager* fs,
const Schema* schema,
- string tablet_id)
+ std::string tablet_id)
: fs_(fs),
schema_(schema),
finished_(false),
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/mutation.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/mutation.cc b/src/kudu/tablet/mutation.cc
index 79be724..6e24fec 100644
--- a/src/kudu/tablet/mutation.cc
+++ b/src/kudu/tablet/mutation.cc
@@ -23,8 +23,8 @@
namespace kudu {
namespace tablet {
-string Mutation::StringifyMutationList(const Schema &schema, const Mutation *head) {
- string ret;
+std::string Mutation::StringifyMutationList(const Schema &schema, const Mutation *head) {
+ std::string ret;
ret.append("[");
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/mutation.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/mutation.h b/src/kudu/tablet/mutation.h
index bb3e464..0b90d76 100644
--- a/src/kudu/tablet/mutation.h
+++ b/src/kudu/tablet/mutation.h
@@ -69,7 +69,7 @@ class Mutation {
// Return a stringified version of the given list of mutations.
// This should only be used for debugging/logging.
- static string StringifyMutationList(const Schema &schema, const Mutation *head);
+ static std::string StringifyMutationList(const Schema &schema, const Mutation *head);
// Append this mutation to the list at the given pointer.
// This operation uses "Release" memory semantics
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/mvcc.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/mvcc.cc b/src/kudu/tablet/mvcc.cc
index e683a4e..d8f25f0 100644
--- a/src/kudu/tablet/mvcc.cc
+++ b/src/kudu/tablet/mvcc.cc
@@ -32,7 +32,8 @@
#include "kudu/util/debug/trace_event.h"
#include "kudu/util/stopwatch.h"
-namespace kudu { namespace tablet {
+namespace kudu {
+namespace tablet {
using strings::Substitute;
@@ -413,7 +414,7 @@ bool MvccSnapshot::MayHaveUncommittedTransactionsAtOrBefore(const Timestamp& tim
}
std::string MvccSnapshot::ToString() const {
- string ret("MvccSnapshot[committed={T|");
+ std::string ret("MvccSnapshot[committed={T|");
if (committed_timestamps_.size() == 0) {
StrAppend(&ret, "T < ", all_committed_before_.ToString(),"}]");
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/mvcc.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/mvcc.h b/src/kudu/tablet/mvcc.h
index df3a9e9..7b5cdf8 100644
--- a/src/kudu/tablet/mvcc.h
+++ b/src/kudu/tablet/mvcc.h
@@ -32,8 +32,6 @@ class CountDownLatch;
namespace tablet {
class MvccManager;
-using std::string;
-
// A snapshot of the current MVCC state, which can determine whether
// a transaction ID should be considered visible.
class MvccSnapshot {
@@ -90,7 +88,7 @@ class MvccSnapshot {
// Return a string representation of the set of committed transactions
// in this snapshot, suitable for debug printouts.
- string ToString() const;
+ std::string ToString() const;
// Return true if the snapshot is considered 'clean'. A clean snapshot is one
// which is determined only by a timestamp -- the snapshot considers all
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/row_op.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/row_op.cc b/src/kudu/tablet/row_op.cc
index c1e9533..da97e6b 100644
--- a/src/kudu/tablet/row_op.cc
+++ b/src/kudu/tablet/row_op.cc
@@ -48,7 +48,7 @@ void RowOp::SetMutateSucceeded(gscoped_ptr<OperationResultPB> result) {
this->result = std::move(result);
}
-string RowOp::ToString(const Schema& schema) const {
+std::string RowOp::ToString(const Schema& schema) const {
return decoded_op.ToString(schema);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/rowset.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/rowset.cc b/src/kudu/tablet/rowset.cc
index 0295f23..b81bb91 100644
--- a/src/kudu/tablet/rowset.cc
+++ b/src/kudu/tablet/rowset.cc
@@ -29,6 +29,8 @@
#include "kudu/tablet/rowset_metadata.h"
using std::shared_ptr;
+using std::string;
+using std::vector;
using strings::Substitute;
namespace kudu { namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/rowset.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/rowset.h b/src/kudu/tablet/rowset.h
index b5b7c4b..43bc74d 100644
--- a/src/kudu/tablet/rowset.h
+++ b/src/kudu/tablet/rowset.h
@@ -108,11 +108,11 @@ class RowSet {
std::string* max_encoded_key) const = 0;
// Return a displayable string for this rowset.
- virtual string ToString() const = 0;
+ virtual std::string ToString() const = 0;
// Dump the full contents of this rowset, for debugging.
// This is very verbose so only useful within unit tests.
- virtual Status DebugDump(vector<string> *lines = NULL) = 0;
+ virtual Status DebugDump(std::vector<std::string> *lines = NULL) = 0;
// Estimate the number of bytes on-disk
virtual uint64_t OnDiskSize() const = 0;
@@ -218,7 +218,7 @@ class RowSet {
};
// Used often enough, may as well typedef it.
-typedef vector<std::shared_ptr<RowSet> > RowSetVector;
+typedef std::vector<std::shared_ptr<RowSet> > RowSetVector;
// Structure which caches an encoded and hashed key, suitable
// for probing against rowsets.
class RowSetKeyProbe {
@@ -335,9 +335,9 @@ class DuplicatingRowSet : public RowSet {
// Return the size of this rowset relevant for merge compactions.
uint64_t OnDiskDataSizeNoUndos() const OVERRIDE;
- string ToString() const OVERRIDE;
+ std::string ToString() const OVERRIDE;
- virtual Status DebugDump(vector<string> *lines = NULL) OVERRIDE;
+ virtual Status DebugDump(std::vector<std::string> *lines = NULL) OVERRIDE;
std::shared_ptr<RowSetMetadata> metadata() OVERRIDE;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/rowset_info.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/rowset_info.cc b/src/kudu/tablet/rowset_info.cc
index 2b85288..f65ca0d 100644
--- a/src/kudu/tablet/rowset_info.cc
+++ b/src/kudu/tablet/rowset_info.cc
@@ -36,6 +36,7 @@
#include "kudu/util/slice.h"
using std::shared_ptr;
+using std::string;
using std::unordered_map;
using std::vector;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/rowset_metadata.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/rowset_metadata.cc b/src/kudu/tablet/rowset_metadata.cc
index dd853cb..99b7d68 100644
--- a/src/kudu/tablet/rowset_metadata.cc
+++ b/src/kudu/tablet/rowset_metadata.cc
@@ -134,7 +134,7 @@ void RowSetMetadata::ToProtobuf(RowSetDataPB *pb) {
}
}
-const string RowSetMetadata::ToString() const {
+const std::string RowSetMetadata::ToString() const {
return Substitute("RowSet($0)", id_);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/rowset_metadata.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/rowset_metadata.h b/src/kudu/tablet/rowset_metadata.h
index 5652380..edd91aa 100644
--- a/src/kudu/tablet/rowset_metadata.h
+++ b/src/kudu/tablet/rowset_metadata.h
@@ -132,12 +132,12 @@ class RowSetMetadata {
return blocks_by_col_id_;
}
- vector<BlockId> redo_delta_blocks() const {
+ std::vector<BlockId> redo_delta_blocks() const {
std::lock_guard<LockType> l(lock_);
return redo_delta_blocks_;
}
- vector<BlockId> undo_delta_blocks() const {
+ std::vector<BlockId> undo_delta_blocks() const {
std::lock_guard<LockType> l(lock_);
return undo_delta_blocks_;
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/rowset_tree-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/rowset_tree-test.cc b/src/kudu/tablet/rowset_tree-test.cc
index 9de20d7..9b9cb8b 100644
--- a/src/kudu/tablet/rowset_tree-test.cc
+++ b/src/kudu/tablet/rowset_tree-test.cc
@@ -31,6 +31,7 @@
using std::shared_ptr;
using std::string;
using std::unordered_set;
+using std::vector;
namespace kudu { namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/rowset_tree.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/rowset_tree.cc b/src/kudu/tablet/rowset_tree.cc
index 4c748e6..afffa40 100644
--- a/src/kudu/tablet/rowset_tree.cc
+++ b/src/kudu/tablet/rowset_tree.cc
@@ -33,6 +33,7 @@
using std::vector;
using std::shared_ptr;
+using std::string;
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/svg_dump.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/svg_dump.cc b/src/kudu/tablet/svg_dump.cc
index 1c5f49f..f0e8a74 100644
--- a/src/kudu/tablet/svg_dump.cc
+++ b/src/kudu/tablet/svg_dump.cc
@@ -50,6 +50,7 @@ DEFINE_string(compaction_policy_dump_svgs_pattern, "",
TAG_FLAG(compaction_policy_dump_svgs_pattern, hidden);
using std::ostream;
+using std::string;
using std::unordered_set;
using std::vector;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet-harness.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet-harness.h b/src/kudu/tablet/tablet-harness.h
index 648adc0..9d61ff2 100644
--- a/src/kudu/tablet/tablet-harness.h
+++ b/src/kudu/tablet/tablet-harness.h
@@ -33,9 +33,6 @@
#include "kudu/util/metrics.h"
#include "kudu/util/status.h"
-using std::string;
-using std::vector;
-
namespace kudu {
namespace tablet {
@@ -52,8 +49,9 @@ static std::pair<PartitionSchema, Partition> CreateDefaultPartition(const Schema
CHECK_OK(PartitionSchema::FromPB(PartitionSchemaPB(), schema, &partition_schema));
// Create the tablet partitions.
- vector<Partition> partitions;
- CHECK_OK(partition_schema.CreatePartitions(vector<KuduPartialRow>(), {}, schema, &partitions));
+ std::vector<Partition> partitions;
+ CHECK_OK(partition_schema.CreatePartitions(
+ std::vector<KuduPartialRow>(), {}, schema, &partitions));
CHECK_EQ(1, partitions.size());
return std::make_pair(partition_schema, partitions[0]);
}
@@ -65,7 +63,7 @@ class TabletHarness {
HYBRID_CLOCK,
LOGICAL_CLOCK
};
- explicit Options(string root_dir)
+ explicit Options(std::string root_dir)
: env(Env::Default()),
tablet_id("test_tablet_id"),
root_dir(std::move(root_dir)),
@@ -73,8 +71,8 @@ class TabletHarness {
clock_type(LOGICAL_CLOCK) {}
Env* env;
- string tablet_id;
- string root_dir;
+ std::string tablet_id;
+ std::string root_dir;
bool enable_metrics;
ClockType clock_type;
};
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet-pushdown-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet-pushdown-test.cc b/src/kudu/tablet/tablet-pushdown-test.cc
index 2106a5a..03758bc 100644
--- a/src/kudu/tablet/tablet-pushdown-test.cc
+++ b/src/kudu/tablet/tablet-pushdown-test.cc
@@ -29,6 +29,9 @@
#include "kudu/util/test_macros.h"
#include "kudu/util/test_util.h"
+using std::string;
+using std::vector;
+
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet-schema-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet-schema-test.cc b/src/kudu/tablet/tablet-schema-test.cc
index 8b2a659..a066bfc 100644
--- a/src/kudu/tablet/tablet-schema-test.cc
+++ b/src/kudu/tablet/tablet-schema-test.cc
@@ -29,6 +29,9 @@
#include "kudu/util/test_macros.h"
#include "kudu/util/test_util.h"
+using std::pair;
+using std::string;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet-test-base.h b/src/kudu/tablet/tablet-test-base.h
index ec80023..3f4df2d 100644
--- a/src/kudu/tablet/tablet-test-base.h
+++ b/src/kudu/tablet/tablet-test-base.h
@@ -44,9 +44,6 @@
#include "kudu/tablet/tablet-test-util.h"
#include "kudu/gutil/strings/numbers.h"
-using std::unordered_set;
-using strings::Substitute;
-
namespace kudu {
namespace tablet {
@@ -85,12 +82,13 @@ struct StringKeyTestSetup {
snprintf(buf, buf_size, "hello %" PRId64, key_idx);
}
- string FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
+ std::string FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
char buf[256];
FormatKey(buf, sizeof(buf), key_idx);
- return Substitute(R"((string key="$0", int32 key_idx=$1, int32 val=$2))",
- buf, key_idx, val);
+ return strings::Substitute(
+ R"((string key="$0", int32 key_idx=$1, int32 val=$2))",
+ buf, key_idx, val);
}
// Slices can be arbitrarily large
@@ -120,10 +118,10 @@ struct CompositeKeyTestSetup {
snprintf(buf, buf_size, "hello %" PRId64, key_idx);
}
- string FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
+ std::string FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
char buf[256];
FormatKey(buf, sizeof(buf), key_idx);
- return Substitute(
+ return strings::Substitute(
"(string key1=$0, int32 key2=$1, int32 val=$2, int32 val=$3)",
buf, key_idx, key_idx, val);
}
@@ -161,7 +159,7 @@ struct IntKeyTestSetup {
CHECK_OK(row->SetInt32(2, val));
}
- string FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
+ std::string FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
CHECK(false) << "Unsupported type";
return "";
}
@@ -215,29 +213,29 @@ void IntKeyTestSetup<INT64>::BuildRowKeyFromExistingRow(KuduPartialRow *row,
}
template<>
-string IntKeyTestSetup<INT8>::FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
- return Substitute(
+std::string IntKeyTestSetup<INT8>::FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
+ return strings::Substitute(
"(int8 key=$0, int32 key_idx=$1, int32 val=$2)",
(key_idx % 2 == 0) ? -key_idx : key_idx, key_idx, val);
}
template<>
-string IntKeyTestSetup<INT16>::FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
- return Substitute(
+std::string IntKeyTestSetup<INT16>::FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
+ return strings::Substitute(
"(int16 key=$0, int32 key_idx=$1, int32 val=$2)",
(key_idx % 2 == 0) ? -key_idx : key_idx, key_idx, val);
}
template<>
-string IntKeyTestSetup<INT32>::FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
- return Substitute(
+std::string IntKeyTestSetup<INT32>::FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
+ return strings::Substitute(
"(int32 key=$0, int32 key_idx=$1, int32 val=$2)",
(key_idx % 2 == 0) ? -key_idx : key_idx, key_idx, val);
}
template<>
-string IntKeyTestSetup<INT64>::FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
- return Substitute(
+std::string IntKeyTestSetup<INT64>::FormatDebugRow(int64_t key_idx, int32_t val, bool updated) {
+ return strings::Substitute(
"(int64 key=$0, int32 key_idx=$1, int32 val=$2)",
(key_idx % 2 == 0) ? -key_idx : key_idx, key_idx, val);
}
@@ -270,14 +268,14 @@ struct NullableValueTestSetup {
}
}
- string FormatDebugRow(int64_t key_idx, int64_t val, bool updated) {
+ std::string FormatDebugRow(int64_t key_idx, int64_t val, bool updated) {
if (!updated && ShouldInsertAsNull(key_idx)) {
- return Substitute(
+ return strings::Substitute(
"(int32 key=$0, int32 key_idx=$1, int32 val=NULL)",
(int32_t)key_idx, key_idx);
}
- return Substitute(
+ return strings::Substitute(
"(int32 key=$0, int32 key_idx=$1, int32 val=$2)",
(int32_t)key_idx, key_idx, val);
}
@@ -489,7 +487,7 @@ class TabletTestBase : public KuduTabletTest {
// Iterate through the full table, stringifying the resulting rows
// into the given vector. This is only useful in tests which insert
// a very small number of rows.
- Status IterateToStringList(vector<string> *out) {
+ Status IterateToStringList(std::vector<std::string> *out) {
gscoped_ptr<RowwiseIterator> iter;
RETURN_NOT_OK(this->tablet()->NewRowIterator(this->client_schema_, &iter));
RETURN_NOT_OK(iter->Init(NULL));
@@ -507,7 +505,7 @@ class TabletTestBase : public KuduTabletTest {
// make sure that we don't overflow the type on inserts
// or else we get errors because the key already exists
uint64_t ClampRowCount(uint64_t proposal) const {
- uint64_t num_rows = min(max_rows_, proposal);
+ uint64_t num_rows = std::min(max_rows_, proposal);
if (num_rows < proposal) {
LOG(WARNING) << "Clamping max rows to " << num_rows << " to prevent overflow";
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet-test-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet-test-util.h b/src/kudu/tablet/tablet-test-util.h
index 2a5ee2a..515ff0c 100644
--- a/src/kudu/tablet/tablet-test-util.h
+++ b/src/kudu/tablet/tablet-test-util.h
@@ -36,10 +36,6 @@
namespace kudu {
namespace tablet {
-using consensus::RaftConfigPB;
-using std::string;
-using std::vector;
-
class KuduTabletTest : public KuduTest {
public:
explicit KuduTabletTest(const Schema& schema,
@@ -56,8 +52,8 @@ class KuduTabletTest : public KuduTest {
SetUpTestTablet();
}
- void CreateTestTablet(const string& root_dir = "") {
- string dir = root_dir.empty() ? GetTestPath("fs_root") : root_dir;
+ void CreateTestTablet(const std::string& root_dir = "") {
+ std::string dir = root_dir.empty() ? GetTestPath("fs_root") : root_dir;
TabletHarness::Options opts(dir);
opts.enable_metrics = true;
opts.clock_type = clock_type_;
@@ -66,12 +62,12 @@ class KuduTabletTest : public KuduTest {
CHECK_OK(harness_->Create(first_time));
}
- void SetUpTestTablet(const string& root_dir = "") {
+ void SetUpTestTablet(const std::string& root_dir = "") {
CreateTestTablet(root_dir);
CHECK_OK(harness_->Open());
}
- void TabletReOpen(const string& root_dir = "") {
+ void TabletReOpen(const std::string& root_dir = "") {
SetUpTestTablet(root_dir);
}
@@ -157,7 +153,7 @@ static inline Status SilentIterateToStringList(RowwiseIterator* iter,
}
static inline Status IterateToStringList(RowwiseIterator* iter,
- vector<string>* out,
+ std::vector<std::string>* out,
int limit = INT_MAX) {
out->clear();
Schema schema = iter->schema();
@@ -178,16 +174,17 @@ static inline Status IterateToStringList(RowwiseIterator* iter,
// Performs snapshot reads, under each of the snapshots in 'snaps', and stores
// the results in 'collected_rows'.
-static inline void CollectRowsForSnapshots(Tablet* tablet,
- const Schema& schema,
- const vector<MvccSnapshot>& snaps,
- vector<vector<string>* >* collected_rows) {
+static inline void CollectRowsForSnapshots(
+ Tablet* tablet,
+ const Schema& schema,
+ const std::vector<MvccSnapshot>& snaps,
+ std::vector<std::vector<std::string>* >* collected_rows) {
for (const MvccSnapshot& snapshot : snaps) {
DVLOG(1) << "Snapshot: " << snapshot.ToString();
gscoped_ptr<RowwiseIterator> iter;
ASSERT_OK(tablet->NewRowIterator(schema, snapshot, UNORDERED, &iter));
ASSERT_OK(iter->Init(NULL));
- auto collector = new vector<string>();
+ auto collector = new std::vector<std::string>();
ASSERT_OK(IterateToStringList(iter.get(), collector));
for (const auto& mrs : *collector) {
DVLOG(1) << "Got from MRS: " << mrs;
@@ -198,10 +195,11 @@ static inline void CollectRowsForSnapshots(Tablet* tablet,
// Performs snapshot reads, under each of the snapshots in 'snaps', and verifies that
// the results match the ones in 'expected_rows'.
-static inline void VerifySnapshotsHaveSameResult(Tablet* tablet,
- const Schema& schema,
- const vector<MvccSnapshot>& snaps,
- const vector<vector<string>* >& expected_rows) {
+static inline void VerifySnapshotsHaveSameResult(
+ Tablet* tablet,
+ const Schema& schema,
+ const std::vector<MvccSnapshot>& snaps,
+ const std::vector<std::vector<std::string>* >& expected_rows) {
int idx = 0;
// Now iterate again and make sure we get the same thing.
for (const MvccSnapshot& snapshot : snaps) {
@@ -212,7 +210,7 @@ static inline void VerifySnapshotsHaveSameResult(Tablet* tablet,
UNORDERED,
&iter));
ASSERT_OK(iter->Init(NULL));
- vector<string> collector;
+ std::vector<std::string> collector;
ASSERT_OK(IterateToStringList(iter.get(), &collector));
ASSERT_EQ(collector.size(), expected_rows[idx]->size());
@@ -231,7 +229,7 @@ static inline void VerifySnapshotsHaveSameResult(Tablet* tablet,
static inline Status DumpRowSet(const RowSet &rs,
const Schema &projection,
const MvccSnapshot &snap,
- vector<string> *out,
+ std::vector<std::string> *out,
int limit = INT_MAX) {
gscoped_ptr<RowwiseIterator> iter;
RETURN_NOT_OK(rs.NewRowIterator(&projection, snap, UNORDERED, &iter));
@@ -242,10 +240,10 @@ static inline Status DumpRowSet(const RowSet &rs,
// Take an un-initialized iterator, Init() it, and iterate through all of its rows.
// The resulting string contains a line per entry.
-static inline string InitAndDumpIterator(gscoped_ptr<RowwiseIterator> iter) {
+static inline std::string InitAndDumpIterator(gscoped_ptr<RowwiseIterator> iter) {
CHECK_OK(iter->Init(NULL));
- vector<string> out;
+ std::vector<std::string> out;
CHECK_OK(IterateToStringList(iter.get(), &out));
return JoinStrings(out, "\n");
}
@@ -253,11 +251,11 @@ static inline string InitAndDumpIterator(gscoped_ptr<RowwiseIterator> iter) {
// Dump all of the rows of the tablet into the given vector.
static inline Status DumpTablet(const Tablet& tablet,
const Schema& projection,
- vector<string>* out) {
+ std::vector<std::string>* out) {
gscoped_ptr<RowwiseIterator> iter;
RETURN_NOT_OK(tablet.NewRowIterator(projection, &iter));
RETURN_NOT_OK(iter->Init(NULL));
- std::vector<string> rows;
+ std::vector<std::string> rows;
RETURN_NOT_OK(IterateToStringList(iter.get(), &rows));
std::sort(rows.begin(), rows.end());
out->swap(rows);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet-test.cc b/src/kudu/tablet/tablet-test.cc
index d20862e..1e257db 100644
--- a/src/kudu/tablet/tablet-test.cc
+++ b/src/kudu/tablet/tablet-test.cc
@@ -40,7 +40,9 @@ DEFINE_int32(testcompaction_num_rows, 1000,
"Number of rows per rowset in TestCompaction");
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
+using std::vector;
namespace kudu {
namespace tablet {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet.cc b/src/kudu/tablet/tablet.cc
index 4304262..6da7ea3 100644
--- a/src/kudu/tablet/tablet.cc
+++ b/src/kudu/tablet/tablet.cc
@@ -151,6 +151,8 @@ METRIC_DEFINE_gauge_size(tablet, on_disk_size, "Tablet Size On Disk",
using kudu::MaintenanceManager;
using kudu::clock::HybridClock;
using kudu::log::LogAnchorRegistry;
+using std::ostream;
+using std::pair;
using std::shared_ptr;
using std::string;
using std::unordered_set;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet.h
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet.h b/src/kudu/tablet/tablet.h
index a81fd03..3f3c006 100644
--- a/src/kudu/tablet/tablet.h
+++ b/src/kudu/tablet/tablet.h
@@ -312,7 +312,7 @@ class Tablet {
// Verbosely dump this entire tablet to the logs. This is only
// really useful when debugging unit tests failures where the tablet
// has a very small number of rows.
- Status DebugDump(vector<std::string> *lines = NULL);
+ Status DebugDump(std::vector<std::string> *lines = NULL);
const Schema* schema() const {
return &metadata_->schema();
@@ -360,7 +360,7 @@ class Tablet {
// Method used by tests to retrieve all rowsets of this table. This
// will be removed once code for selecting the appropriate RowSet is
// finished and delta files is finished is part of Tablet class.
- void GetRowSetsForTests(vector<std::shared_ptr<RowSet> >* out);
+ void GetRowSetsForTests(std::vector<std::shared_ptr<RowSet> >* out);
// Register the maintenance ops associated with this tablet
void RegisterMaintenanceOps(MaintenanceManager* maintenance_manager);
@@ -462,7 +462,7 @@ class Tablet {
const MvccSnapshot &snap,
const ScanSpec *spec,
OrderMode order,
- vector<std::shared_ptr<RowwiseIterator> > *iters) const;
+ std::vector<std::shared_ptr<RowwiseIterator> > *iters) const;
Status PickRowSetsToCompact(RowSetsInCompaction *picked,
CompactFlags flags) const;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet_bootstrap.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_bootstrap.cc b/src/kudu/tablet/tablet_bootstrap.cc
index 1aa78cf..8c91378 100644
--- a/src/kudu/tablet/tablet_bootstrap.cc
+++ b/src/kudu/tablet/tablet_bootstrap.cc
@@ -104,6 +104,7 @@ using std::shared_ptr;
using std::string;
using std::unique_ptr;
using std::unordered_map;
+using std::vector;
using strings::Substitute;
using tserver::AlterSchemaRequestPB;
using tserver::WriteRequestPB;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet_history_gc-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_history_gc-test.cc b/src/kudu/tablet/tablet_history_gc-test.cc
index 5aae7b5..c8a5f08 100644
--- a/src/kudu/tablet/tablet_history_gc-test.cc
+++ b/src/kudu/tablet/tablet_history_gc-test.cc
@@ -31,6 +31,9 @@ DECLARE_int32(tablet_history_max_age_sec);
DECLARE_string(time_source);
using kudu::clock::HybridClock;
+using std::string;
+using std::vector;
+using strings::Substitute;
// Specify row regex to match on. Empty string means don't match anything.
#define ASSERT_DEBUG_DUMP_ROWS_MATCH(pattern) do { \
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet_metadata.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_metadata.cc b/src/kudu/tablet/tablet_metadata.cc
index f7a951d..af7d82d 100644
--- a/src/kudu/tablet/tablet_metadata.cc
+++ b/src/kudu/tablet/tablet_metadata.cc
@@ -53,6 +53,8 @@ TAG_FLAG(enable_tablet_orphaned_block_deletion, runtime);
using std::memory_order_relaxed;
using std::shared_ptr;
+using std::string;
+using std::vector;
using base::subtle::Barrier_AtomicIncrement;
using strings::Substitute;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet_mm_ops-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_mm_ops-test.cc b/src/kudu/tablet/tablet_mm_ops-test.cc
index 442d9fd..815242e 100644
--- a/src/kudu/tablet/tablet_mm_ops-test.cc
+++ b/src/kudu/tablet/tablet_mm_ops-test.cc
@@ -68,7 +68,7 @@ class KuduTabletMmOpsTest : public TabletTestBase<IntKeyTestSetup<INT64>> {
}
void TestAffectedMetrics(MaintenanceOp* op,
- const unordered_set<
+ const std::unordered_set<
scoped_refptr<Histogram>,
ScopedRefPtrHashFunctor<Histogram>,
ScopedRefPtrEqualToFunctor<Histogram> >& metrics) {
@@ -84,7 +84,7 @@ class KuduTabletMmOpsTest : public TabletTestBase<IntKeyTestSetup<INT64>> {
MaintenanceOpStats stats_;
MonoTime next_time_;
- vector<scoped_refptr<Histogram> > all_possible_metrics_;
+ std::vector<scoped_refptr<Histogram> > all_possible_metrics_;
};
TEST_F(KuduTabletMmOpsTest, TestCompactRowSetsOpCacheStats) {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet_replica-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_replica-test.cc b/src/kudu/tablet/tablet_replica-test.cc
index c8f248b..ada9039 100644
--- a/src/kudu/tablet/tablet_replica-test.cc
+++ b/src/kudu/tablet/tablet_replica-test.cc
@@ -59,6 +59,7 @@ using consensus::ConsensusBootstrapInfo;
using consensus::ConsensusMetadata;
using consensus::ConsensusMetadataManager;
using consensus::OpId;
+using consensus::RaftConfigPB;
using consensus::RaftPeerPB;
using log::Log;
using log::LogOptions;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/tablet_replica.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/tablet_replica.cc b/src/kudu/tablet/tablet_replica.cc
index 4a67b10..0681ade 100644
--- a/src/kudu/tablet/tablet_replica.cc
+++ b/src/kudu/tablet/tablet_replica.cc
@@ -100,7 +100,9 @@ using rpc::Messenger;
using rpc::ResultTracker;
using std::map;
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
+using std::vector;
using strings::Substitute;
TabletReplica::TabletReplica(
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/transactions/alter_schema_transaction.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/transactions/alter_schema_transaction.cc b/src/kudu/tablet/transactions/alter_schema_transaction.cc
index 2081966..8ab38d0 100644
--- a/src/kudu/tablet/transactions/alter_schema_transaction.cc
+++ b/src/kudu/tablet/transactions/alter_schema_transaction.cc
@@ -37,6 +37,7 @@ using consensus::ReplicateMsg;
using consensus::CommitMsg;
using consensus::ALTER_SCHEMA_OP;
using consensus::DriverType;
+using std::string;
using std::unique_ptr;
using strings::Substitute;
using tserver::TabletServerErrorPB;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/transactions/transaction_driver.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/transactions/transaction_driver.cc b/src/kudu/tablet/transactions/transaction_driver.cc
index ebee430..b90f911 100644
--- a/src/kudu/tablet/transactions/transaction_driver.cc
+++ b/src/kudu/tablet/transactions/transaction_driver.cc
@@ -43,6 +43,7 @@ using log::Log;
using rpc::RequestIdPB;
using rpc::ResultTracker;
using std::shared_ptr;
+using std::string;
static const char* kTimestampFieldName = "timestamp";
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/transactions/transaction_tracker.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/transactions/transaction_tracker.cc b/src/kudu/tablet/transactions/transaction_tracker.cc
index 603092b..c15b39e 100644
--- a/src/kudu/tablet/transactions/transaction_tracker.cc
+++ b/src/kudu/tablet/transactions/transaction_tracker.cc
@@ -59,6 +59,7 @@ METRIC_DEFINE_counter(tablet, transaction_memory_pressure_rejections,
"transaction memory limit was reached.");
using std::shared_ptr;
+using std::string;
using std::vector;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tablet/transactions/write_transaction.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/transactions/write_transaction.cc b/src/kudu/tablet/transactions/write_transaction.cc
index 5707b75..f20717b 100644
--- a/src/kudu/tablet/transactions/write_transaction.cc
+++ b/src/kudu/tablet/transactions/write_transaction.cc
@@ -53,7 +53,9 @@ using consensus::WRITE_OP;
using tserver::TabletServerErrorPB;
using tserver::WriteRequestPB;
using tserver::WriteResponsePB;
+using std::string;
using std::unique_ptr;
+using std::vector;
using strings::Substitute;
WriteTransaction::WriteTransaction(unique_ptr<WriteTransactionState> state, DriverType type)
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tools/color.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/color.cc b/src/kudu/tools/color.cc
index e90761d..c99d7fe 100644
--- a/src/kudu/tools/color.cc
+++ b/src/kudu/tools/color.cc
@@ -30,7 +30,7 @@ DEFINE_string(color, "auto",
"valid values are 'always' or 'never'.");
TAG_FLAG(color, stable);
-static bool ValidateColorFlag(const char* flagname, const string& value) {
+static bool ValidateColorFlag(const char* flagname, const std::string& value) {
if (value == "always" ||
value == "auto" ||
value == "never") {
@@ -69,7 +69,7 @@ const char* StringForCode(AnsiCode color) {
}
} // anonymous namespace
-string Color(AnsiCode color, StringPiece s) {
+std::string Color(AnsiCode color, StringPiece s) {
return strings::Substitute("$0$1$2",
StringForCode(color),
s,
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tools/ksck-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck-test.cc b/src/kudu/tools/ksck-test.cc
index 517d71c..4b02639 100644
--- a/src/kudu/tools/ksck-test.cc
+++ b/src/kudu/tools/ksck-test.cc
@@ -37,6 +37,7 @@ using std::shared_ptr;
using std::static_pointer_cast;
using std::string;
using std::unordered_map;
+using std::vector;
using strings::Substitute;
class MockKsckTabletServer : public KsckTabletServer {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tools/ksck.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck.cc b/src/kudu/tools/ksck.cc
index 766f008..f3376cd 100644
--- a/src/kudu/tools/ksck.cc
+++ b/src/kudu/tools/ksck.cc
@@ -62,6 +62,7 @@ namespace tools {
using std::cout;
using std::endl;
using std::left;
+using std::map;
using std::ostream;
using std::right;
using std::setw;
@@ -69,6 +70,7 @@ using std::shared_ptr;
using std::string;
using std::stringstream;
using std::unordered_map;
+using std::vector;
using strings::Substitute;
namespace {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tools/ksck.h
----------------------------------------------------------------------
diff --git a/src/kudu/tools/ksck.h b/src/kudu/tools/ksck.h
index 805bbed..f367914 100644
--- a/src/kudu/tools/ksck.h
+++ b/src/kudu/tools/ksck.h
@@ -401,12 +401,12 @@ class Ksck {
// If tablets is not empty, checks only the specified tablet IDs.
// If both are specified, takes the intersection.
// If both are empty (unset), all tables and tablets are checked.
- void set_table_filters(vector<string> table_names) {
+ void set_table_filters(std::vector<std::string> table_names) {
table_filters_ = std::move(table_names);
}
// See above.
- void set_tablet_id_filters(vector<string> tablet_ids) {
+ void set_tablet_id_filters(std::vector<std::string> tablet_ids) {
tablet_id_filters_ = std::move(tablet_ids);
}
@@ -451,25 +451,25 @@ class Ksck {
int table_num_replicas);
// Print an informational message to this instance's output stream.
- ostream& Out() {
+ std::ostream& Out() {
return *out_;
}
// Print an error message to this instance's output stream.
- ostream& Error() {
+ std::ostream& Error() {
return (*out_) << Color(AnsiCode::RED, "ERROR: ");
}
// Print a warning message to this instance's output stream.
- ostream& Warn() {
+ std::ostream& Warn() {
return (*out_) << Color(AnsiCode::YELLOW, "WARNING: ");
}
const std::shared_ptr<KsckCluster> cluster_;
bool check_replica_count_ = true;
- vector<string> table_filters_;
- vector<string> tablet_id_filters_;
+ std::vector<std::string> table_filters_;
+ std::vector<std::string> tablet_id_filters_;
std::ostream* out_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tools/kudu-admin-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/kudu-admin-test.cc b/src/kudu/tools/kudu-admin-test.cc
index 7237548..cf67e5c 100644
--- a/src/kudu/tools/kudu-admin-test.cc
+++ b/src/kudu/tools/kudu-admin-test.cc
@@ -329,7 +329,7 @@ TEST_F(AdminCliTest, TestUnsafeChangeConfigOnSingleFollower) {
ASSERT_OK(WaitForOpFromCurrentTerm(followers[0], tablet_id, COMMITTED_OPID, kTimeout, &opid));
active_tablet_servers.clear();
- unordered_set<string> replica_uuids;
+ std::unordered_set<string> replica_uuids;
for (const auto& loc : tablet_locations.replicas()) {
const string& uuid = loc.ts_info().permanent_uuid();
InsertOrDie(&active_tablet_servers, uuid, tablet_servers_[uuid]);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tools/kudu-tool-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc
index ba1e085..7d9f3e8 100644
--- a/src/kudu/tools/kudu-tool-test.cc
+++ b/src/kudu/tools/kudu-tool-test.cc
@@ -102,8 +102,10 @@ using rpc::RpcController;
using std::back_inserter;
using std::copy;
using std::ostringstream;
+using std::pair;
using std::string;
using std::unique_ptr;
+using std::unordered_map;
using std::vector;
using strings::Substitute;
using tablet::LocalTabletWriter;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tools/kudu-ts-cli-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/kudu-ts-cli-test.cc b/src/kudu/tools/kudu-ts-cli-test.cc
index a70ea20..a4ecdc5 100644
--- a/src/kudu/tools/kudu-ts-cli-test.cc
+++ b/src/kudu/tools/kudu-ts-cli-test.cc
@@ -33,6 +33,8 @@ using kudu::itest::TabletServerMap;
using kudu::itest::TServerDetails;
using strings::Split;
using strings::Substitute;
+using std::string;
+using std::vector;
namespace kudu {
namespace tools {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tools/tool_action.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action.cc b/src/kudu/tools/tool_action.cc
index 9b7a580..fd824d7 100644
--- a/src/kudu/tools/tool_action.cc
+++ b/src/kudu/tools/tool_action.cc
@@ -30,6 +30,7 @@
#include "kudu/gutil/strings/substitute.h"
#include "kudu/util/url-coding.h"
+using std::pair;
using std::string;
using std::unique_ptr;
using std::unordered_map;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tools/tool_action_local_replica.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action_local_replica.cc b/src/kudu/tools/tool_action_local_replica.cc
index 82b6e5e..72d24d4 100644
--- a/src/kudu/tools/tool_action_local_replica.cc
+++ b/src/kudu/tools/tool_action_local_replica.cc
@@ -108,6 +108,8 @@ using rpc::MessengerBuilder;
using std::cout;
using std::endl;
using std::list;
+using std::map;
+using std::pair;
using std::shared_ptr;
using std::string;
using std::unique_ptr;
@@ -452,7 +454,7 @@ Status SummarizeDataSize(const RunnerContext& context) {
vector<string> tablets;
RETURN_NOT_OK(fs->ListTabletIds(&tablets));
- unordered_map<string, TabletSizeStats> size_stats_by_table_id;
+ std::unordered_map<string, TabletSizeStats> size_stats_by_table_id;
DataTable output_table({ "table id", "tablet id", "rowset id", "block type", "size" });
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tools/tool_action_master.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action_master.cc b/src/kudu/tools/tool_action_master.cc
index ef71a24..b6d9c22 100644
--- a/src/kudu/tools/tool_action_master.cc
+++ b/src/kudu/tools/tool_action_master.cc
@@ -46,6 +46,7 @@ using master::MasterServiceProxy;
using std::cout;
using std::string;
using std::unique_ptr;
+using std::vector;
namespace tools {
namespace {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tools/tool_action_pbc.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action_pbc.cc b/src/kudu/tools/tool_action_pbc.cc
index 5b6d8d8..ceda9b8 100644
--- a/src/kudu/tools/tool_action_pbc.cc
+++ b/src/kudu/tools/tool_action_pbc.cc
@@ -40,6 +40,7 @@
using std::cout;
using std::string;
using std::unique_ptr;
+using std::vector;
DEFINE_bool(oneline, false, "print each protobuf on a single line");
TAG_FLAG(oneline, stable);
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tools/tool_action_tserver.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action_tserver.cc b/src/kudu/tools/tool_action_tserver.cc
index 3703103..e396169 100644
--- a/src/kudu/tools/tool_action_tserver.cc
+++ b/src/kudu/tools/tool_action_tserver.cc
@@ -42,6 +42,7 @@ DECLARE_string(columns);
using std::cout;
using std::string;
using std::unique_ptr;
+using std::vector;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/heartbeater.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/heartbeater.cc b/src/kudu/tserver/heartbeater.cc
index f5695d7..84232e0 100644
--- a/src/kudu/tserver/heartbeater.cc
+++ b/src/kudu/tserver/heartbeater.cc
@@ -64,6 +64,8 @@ using kudu::master::MasterServiceProxy;
using kudu::master::TabletReportPB;
using kudu::rpc::RpcController;
using std::shared_ptr;
+using std::string;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/scanners.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/scanners.cc b/src/kudu/tserver/scanners.cc
index 6dd8295..af35bf0 100644
--- a/src/kudu/tserver/scanners.cc
+++ b/src/kudu/tserver/scanners.cc
@@ -45,6 +45,8 @@ METRIC_DEFINE_gauge_size(server, active_scanners,
kudu::MetricUnit::kScanners,
"Number of scanners that are currently active");
+using std::string;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/scanners.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/scanners.h b/src/kudu/tserver/scanners.h
index 5e425b2..184f5fc 100644
--- a/src/kudu/tserver/scanners.h
+++ b/src/kudu/tserver/scanners.h
@@ -118,7 +118,7 @@ class ScannerManager {
// Periodically call RemoveExpiredScanners().
void RunRemovalThread();
- ScannerMapStripe& GetStripeByScannerId(const string& scanner_id);
+ ScannerMapStripe& GetStripeByScannerId(const std::string& scanner_id);
// (Optional) scanner metrics for this instance.
gscoped_ptr<ScannerMetrics> metrics_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/tablet_copy-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy-test-base.h b/src/kudu/tserver/tablet_copy-test-base.h
index 83cd554..0c2ff2e 100644
--- a/src/kudu/tserver/tablet_copy-test-base.h
+++ b/src/kudu/tserver/tablet_copy-test-base.h
@@ -69,8 +69,8 @@ class TabletCopyTest : public TabletServerTestBase {
// Return a vector of the blocks contained in the specified superblock (not
// including orphaned blocks).
- static vector<BlockId> ListBlocks(const tablet::TabletSuperBlockPB& superblock) {
- vector<BlockId> block_ids;
+ static std::vector<BlockId> ListBlocks(const tablet::TabletSuperBlockPB& superblock) {
+ std::vector<BlockId> block_ids;
for (const auto& rowset : superblock.rowsets()) {
for (const auto& col : rowset.columns()) {
block_ids.emplace_back(col.block().id());
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/tablet_copy_client-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_client-test.cc b/src/kudu/tserver/tablet_copy_client-test.cc
index 8e70a79..fcde4ec 100644
--- a/src/kudu/tserver/tablet_copy_client-test.cc
+++ b/src/kudu/tserver/tablet_copy_client-test.cc
@@ -29,6 +29,8 @@
#include "kudu/util/env_util.h"
using std::shared_ptr;
+using std::string;
+using std::vector;
namespace kudu {
namespace tserver {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/tablet_copy_service-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_service-test.cc b/src/kudu/tserver/tablet_copy_service-test.cc
index ffa35bb..ef3cf64 100644
--- a/src/kudu/tserver/tablet_copy_service-test.cc
+++ b/src/kudu/tserver/tablet_copy_service-test.cc
@@ -43,6 +43,8 @@
DECLARE_uint64(tablet_copy_idle_timeout_ms);
DECLARE_uint64(tablet_copy_timeout_poll_period_ms);
+using std::string;
+
namespace kudu {
namespace tserver {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/tablet_copy_service.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_service.cc b/src/kudu/tserver/tablet_copy_service.cc
index ef11ecc..ed4feca 100644
--- a/src/kudu/tserver/tablet_copy_service.cc
+++ b/src/kudu/tserver/tablet_copy_service.cc
@@ -68,6 +68,8 @@ DEFINE_double(tablet_copy_early_session_timeout_prob, 0,
"resulting in tablet copy failure. (For testing only!)");
TAG_FLAG(tablet_copy_early_session_timeout_prob, unsafe);
+using std::string;
+using std::vector;
using strings::Substitute;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/tablet_copy_service.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_service.h b/src/kudu/tserver/tablet_copy_service.h
index c4f701e..2eeab40 100644
--- a/src/kudu/tserver/tablet_copy_service.h
+++ b/src/kudu/tserver/tablet_copy_service.h
@@ -107,7 +107,7 @@ class TabletCopyServiceImpl : public TabletCopyServiceIf {
void SetupErrorAndRespond(rpc::RpcContext* context,
TabletCopyErrorPB::Code code,
- const string& message,
+ const std::string& message,
const Status& s);
server::ServerBase* server_;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/tablet_copy_source_session-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_source_session-test.cc b/src/kudu/tserver/tablet_copy_source_session-test.cc
index e8ff1c6..1655a2b 100644
--- a/src/kudu/tserver/tablet_copy_source_session-test.cc
+++ b/src/kudu/tserver/tablet_copy_source_session-test.cc
@@ -47,6 +47,7 @@ METRIC_DECLARE_entity(tablet);
using std::shared_ptr;
using std::string;
using std::unique_ptr;
+using std::vector;
namespace kudu {
namespace tserver {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/tablet_copy_source_session.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_source_session.cc b/src/kudu/tserver/tablet_copy_source_session.cc
index f470647..ba18e54 100644
--- a/src/kudu/tserver/tablet_copy_source_session.cc
+++ b/src/kudu/tserver/tablet_copy_source_session.cc
@@ -47,7 +47,9 @@ using consensus::OpId;
using fs::ReadableBlock;
using log::ReadableLogSegment;
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
+using std::vector;
using strings::Substitute;
using tablet::TabletMetadata;
using tablet::TabletReplica;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/tablet_server-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_server-test-base.h b/src/kudu/tserver/tablet_server-test-base.h
index e174e4a..4d37a15 100644
--- a/src/kudu/tserver/tablet_server-test-base.h
+++ b/src/kudu/tserver/tablet_server-test-base.h
@@ -68,7 +68,7 @@ namespace tserver {
class TabletServerTestBase : public KuduTest {
public:
- typedef pair<int32_t, int32_t> KeyValue;
+ typedef std::pair<int32_t, int32_t> KeyValue;
TabletServerTestBase()
: schema_(GetSimpleTestSchema()),
@@ -141,7 +141,7 @@ class TabletServerTestBase : public KuduTest {
WriteResponsePB resp;
rpc::RpcController controller;
controller.set_timeout(MonoDelta::FromSeconds(FLAGS_rpc_timeout));
- string new_string_val(strings::Substitute("mutated$0", row_idx));
+ std::string new_string_val(strings::Substitute("mutated$0", row_idx));
AddTestRowToPB(RowOperationsPB::UPDATE, schema_, row_idx, new_val, new_string_val,
req.mutable_row_operations());
@@ -179,8 +179,8 @@ class TabletServerTestBase : public KuduTest {
uint64_t count,
uint64_t num_batches = -1,
TabletServerServiceProxy* proxy = NULL,
- string tablet_id = kTabletId,
- vector<uint64_t>* write_timestamps_collector = NULL,
+ std::string tablet_id = kTabletId,
+ std::vector<uint64_t>* write_timestamps_collector = NULL,
TimeSeries *ts = NULL,
bool string_field_defined = true) {
@@ -214,7 +214,7 @@ class TabletServerTestBase : public KuduTest {
uint64_t last_row_in_batch = first_row_in_batch + count / num_batches;
for (int j = first_row_in_batch; j < last_row_in_batch; j++) {
- string str_val = strings::Substitute("original$0", j);
+ std::string str_val = strings::Substitute("original$0", j);
const char* cstr_val = str_val.c_str();
if (!string_field_defined) {
cstr_val = NULL;
@@ -249,7 +249,7 @@ class TabletServerTestBase : public KuduTest {
void DeleteTestRowsRemote(int64_t first_row,
uint64_t count,
TabletServerServiceProxy* proxy = NULL,
- string tablet_id = kTabletId) {
+ std::string tablet_id = kTabletId) {
if (!proxy) {
proxy = proxy_.get();
}
@@ -278,9 +278,9 @@ class TabletServerTestBase : public KuduTest {
ASSERT_OK(row->SetStringCopy(2, StringPrintf("hello %d", index)));
}
- void DrainScannerToStrings(const string& scanner_id,
+ void DrainScannerToStrings(const std::string& scanner_id,
const Schema& projection,
- vector<string>* results,
+ std::vector<std::string>* results,
TabletServerServiceProxy* proxy = NULL,
uint32_t call_seq_id = 1) {
@@ -314,7 +314,7 @@ class TabletServerTestBase : public KuduTest {
void StringifyRowsFromResponse(const Schema& projection,
const rpc::RpcController& rpc,
ScanResponsePB& resp,
- vector<string>* results) {
+ std::vector<std::string>* results) {
RowwiseRowBlockPB* rrpb = resp.mutable_data();
Slice direct, indirect; // sidecar data buffers
ASSERT_OK(rpc.GetInboundSidecar(rrpb->rows_sidecar(), &direct));
@@ -322,7 +322,7 @@ class TabletServerTestBase : public KuduTest {
ASSERT_OK(rpc.GetInboundSidecar(rrpb->indirect_data_sidecar(),
&indirect));
}
- vector<const uint8_t*> rows;
+ std::vector<const uint8_t*> rows;
ASSERT_OK(ExtractRowsFromRowBlockPB(projection, *rrpb,
indirect, &direct, &rows));
VLOG(1) << "Round trip got " << rows.size() << " rows";
@@ -372,7 +372,7 @@ class TabletServerTestBase : public KuduTest {
}
// Verifies that a set of expected rows (key, value) is present in the tablet.
- void VerifyRows(const Schema& schema, const vector<KeyValue>& expected) {
+ void VerifyRows(const Schema& schema, const std::vector<KeyValue>& expected) {
gscoped_ptr<RowwiseIterator> iter;
ASSERT_OK(tablet_replica_->tablet()->NewRowIterator(schema, &iter));
ASSERT_OK(iter->Init(NULL));
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/tablet_server-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_server-test.cc b/src/kudu/tserver/tablet_server-test.cc
index 9fe3a3c..f4c3e6b 100644
--- a/src/kudu/tserver/tablet_server-test.cc
+++ b/src/kudu/tserver/tablet_server-test.cc
@@ -49,6 +49,7 @@ using kudu::tablet::TabletSuperBlockPB;
using std::shared_ptr;
using std::string;
using std::unique_ptr;
+using std::vector;
using strings::Substitute;
DEFINE_int32(single_threaded_insert_latency_bench_warmup_rows, 100,
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/tablet_server.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_server.cc b/src/kudu/tserver/tablet_server.cc
index 818b57f..f922b5e 100644
--- a/src/kudu/tserver/tablet_server.cc
+++ b/src/kudu/tserver/tablet_server.cc
@@ -36,6 +36,7 @@
#include "kudu/util/net/sockaddr.h"
#include "kudu/util/status.h"
+using std::string;
using kudu::rpc::ServiceIf;
namespace kudu {
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/tablet_service.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_service.cc b/src/kudu/tserver/tablet_service.cc
index 3c1c101..21a99cc 100644
--- a/src/kudu/tserver/tablet_service.cc
+++ b/src/kudu/tserver/tablet_service.cc
@@ -131,6 +131,7 @@ using kudu::tablet::TabletStatusPB;
using kudu::tablet::TransactionCompletionCallback;
using kudu::tablet::WriteTransactionState;
using std::shared_ptr;
+using std::string;
using std::unique_ptr;
using std::unordered_set;
using std::vector;
http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/tserver/ts_tablet_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/ts_tablet_manager-test.cc b/src/kudu/tserver/ts_tablet_manager-test.cc
index c65abdc..6d3f110 100644
--- a/src/kudu/tserver/ts_tablet_manager-test.cc
+++ b/src/kudu/tserver/ts_tablet_manager-test.cc
@@ -39,6 +39,9 @@
#define ASSERT_MONOTONIC_REPORT_SEQNO(report_seqno, tablet_report) \
ASSERT_NO_FATAL_FAILURE(AssertMonotonicReportSeqno(report_seqno, tablet_report))
+using std::string;
+using std::vector;
+
namespace kudu {
namespace tserver {