kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject [03/14] kudu git commit: [iwyu] first pass
Date Mon, 21 Aug 2017 21:03:50 GMT
http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 5b4934e4..84dc5f5 100644
--- a/src/kudu/tserver/ts_tablet_manager-test.cc
+++ b/src/kudu/tserver/ts_tablet_manager-test.cc
@@ -17,20 +17,36 @@
 
 #include "kudu/tserver/ts_tablet_manager.h"
 
-#include <gtest/gtest.h>
+#include <cstdint>
+#include <ostream>
 #include <string>
+#include <utility>
+#include <vector>
+
+#include <glog/logging.h>
+#include <gtest/gtest.h>
 
+#include "kudu/common/common.pb.h"
 #include "kudu/common/partition.h"
 #include "kudu/common/schema.h"
 #include "kudu/consensus/metadata.pb.h"
-#include "kudu/fs/fs_manager.h"
+#include "kudu/consensus/opid_util.h"
+#include "kudu/consensus/raft_consensus.h"
+#include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/port.h"
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/master/master.pb.h"
+#include "kudu/tablet/tablet.h"
+#include "kudu/tablet/tablet-harness.h"
 #include "kudu/tablet/tablet_replica.h"
-#include "kudu/tablet/tablet-test-util.h"
 #include "kudu/tserver/heartbeater.h"
 #include "kudu/tserver/mini_tablet_server.h"
 #include "kudu/tserver/tablet_server.h"
+#include "kudu/util/monotime.h"
+#include "kudu/util/net/net_util.h"
 #include "kudu/util/pb_util.h"
+#include "kudu/util/status.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 #define ASSERT_REPORT_HAS_UPDATED_TABLET(report, tablet_id) \
@@ -43,6 +59,9 @@ using std::string;
 using std::vector;
 
 namespace kudu {
+
+class FsManager;
+
 namespace tserver {
 
 using consensus::kInvalidOpIdIndex;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/tserver/ts_tablet_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/ts_tablet_manager.cc b/src/kudu/tserver/ts_tablet_manager.cc
index 0d5e8dc..7972380 100644
--- a/src/kudu/tserver/ts_tablet_manager.cc
+++ b/src/kudu/tserver/ts_tablet_manager.cc
@@ -18,45 +18,56 @@
 #include "kudu/tserver/ts_tablet_manager.h"
 
 #include <algorithm>
-#include <boost/bind.hpp>
-#include <boost/optional.hpp>
-#include <glog/logging.h>
+#include <cstdint>
 #include <memory>
 #include <mutex>
+#include <ostream>
 #include <string>
+#include <utility>
 #include <vector>
 
+#include <boost/bind.hpp> // IWYU pragma: keep
+#include <boost/optional/optional.hpp>
+#include <gflags/gflags.h>
+#include <glog/logging.h>
+
+#include "kudu/clock/clock.h"
 #include "kudu/common/wire_protocol.h"
+#include "kudu/common/wire_protocol.pb.h"
+#include "kudu/consensus/consensus.pb.h"
 #include "kudu/consensus/consensus_meta.h"
 #include "kudu/consensus/consensus_meta_manager.h"
 #include "kudu/consensus/log.h"
 #include "kudu/consensus/metadata.pb.h"
+#include "kudu/consensus/opid.pb.h"
 #include "kudu/consensus/opid_util.h"
 #include "kudu/consensus/quorum_util.h"
+#include "kudu/consensus/raft_consensus.h"
+#include "kudu/fs/data_dirs.h"
 #include "kudu/fs/fs_manager.h"
-#include "kudu/gutil/casts.h"
+#include "kudu/gutil/bind.h"
+#include "kudu/gutil/bind_helpers.h"
+#include "kudu/gutil/map-util.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/gutil/strings/util.h"
 #include "kudu/master/master.pb.h"
-#include "kudu/rpc/messenger.h"
 #include "kudu/rpc/result_tracker.h"
 #include "kudu/tablet/metadata.pb.h"
-#include "kudu/tablet/tablet.h"
-#include "kudu/tablet/tablet.pb.h"
 #include "kudu/tablet/tablet_bootstrap.h"
 #include "kudu/tablet/tablet_metadata.h"
 #include "kudu/tablet/tablet_replica.h"
 #include "kudu/tserver/heartbeater.h"
 #include "kudu/tserver/tablet_copy_client.h"
 #include "kudu/tserver/tablet_server.h"
-#include "kudu/tserver/tablet_service.h"
 #include "kudu/util/debug/trace_event.h"
-#include "kudu/util/env.h"
-#include "kudu/util/env_util.h"
 #include "kudu/util/fault_injection.h"
 #include "kudu/util/flag_tags.h"
-#include "kudu/util/pb_util.h"
+#include "kudu/util/logging.h"
+#include "kudu/util/monotime.h"
+#include "kudu/util/net/net_util.h"
+#include "kudu/util/net/sockaddr.h"
 #include "kudu/util/stopwatch.h"
+#include "kudu/util/threadpool.h"
 #include "kudu/util/trace.h"
 
 DEFINE_int32(num_tablets_to_copy_simultaneously, 10,
@@ -101,8 +112,16 @@ DEFINE_double(fault_crash_after_tc_files_fetched, 0.0,
               "(For testing only!)");
 TAG_FLAG(fault_crash_after_tc_files_fetched, unsafe);
 
+using std::shared_ptr;
+using std::string;
+using std::vector;
+using strings::Substitute;
+
 namespace kudu {
-namespace tserver {
+
+namespace tablet {
+class Tablet;
+}
 
 using consensus::ConsensusMetadata;
 using consensus::ConsensusMetadataManager;
@@ -114,10 +133,6 @@ using fs::DataDirManager;
 using log::Log;
 using master::ReportedTabletPB;
 using master::TabletReportPB;
-using std::shared_ptr;
-using std::string;
-using std::vector;
-using strings::Substitute;
 using tablet::Tablet;
 using tablet::TABLET_DATA_COPYING;
 using tablet::TABLET_DATA_DELETED;
@@ -128,6 +143,8 @@ using tablet::TabletMetadata;
 using tablet::TabletReplica;
 using tserver::TabletCopyClient;
 
+namespace tserver {
+
 TSTabletManager::TSTabletManager(TabletServer* server)
   : fs_manager_(server->fs_manager()),
     cmeta_manager_(new ConsensusMetadataManager(fs_manager_)),

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 d4c7c63..b0420da 100644
--- a/src/kudu/tserver/ts_tablet_manager.h
+++ b/src/kudu/tserver/ts_tablet_manager.h
@@ -17,35 +17,45 @@
 
 #pragma once
 
-#include <boost/optional/optional_fwd.hpp>
-#include <gtest/gtest_prod.h>
-#include <memory>
+#include <functional>
+#include <cstdint>
 #include <string>
 #include <unordered_map>
 #include <unordered_set>
 #include <vector>
 
+#include <gtest/gtest_prod.h>
+
+#include "kudu/consensus/metadata.pb.h"
+#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/ref_counted.h"
+#include "kudu/tablet/metadata.pb.h"
 #include "kudu/tserver/tablet_replica_lookup.h"
-#include "kudu/tserver/tserver_admin.pb.h"
 #include "kudu/tserver/tserver.pb.h"
+#include "kudu/tserver/tserver_admin.pb.h"
 #include "kudu/util/locks.h"
-#include "kudu/util/metrics.h"
 #include "kudu/util/status.h"
-#include "kudu/util/threadpool.h"
+
+namespace boost {
+template <class T>
+class optional;
+}
 
 namespace kudu {
 
-class PartitionSchema;
 class FsManager;
-class HostPort;
+class MetricRegistry;
+class NodeInstancePB;
 class Partition;
+class PartitionSchema;
 class Schema;
+class ThreadPool;
 
 namespace consensus {
 class ConsensusMetadataManager;
-class RaftConfigPB;
+class OpId;
+class StartTabletCopyRequestPB;
 } // namespace consensus
 
 namespace master {
@@ -53,14 +63,9 @@ class ReportedTabletPB;
 class TabletReportPB;
 } // namespace master
 
-namespace rpc {
-class ResultTracker;
-} // namespace rpc
-
 namespace tablet {
 class TabletMetadata;
 class TabletReplica;
-class TabletStatusPB;
 }
 
 namespace tserver {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 c53ab4c..8578939 100644
--- a/src/kudu/tserver/tserver-path-handlers.cc
+++ b/src/kudu/tserver/tserver-path-handlers.cc
@@ -18,32 +18,59 @@
 #include "kudu/tserver/tserver-path-handlers.h"
 
 #include <algorithm>
+#include <cstddef>
+#include <cstdint>
 #include <map>
 #include <memory>
 #include <sstream>
 #include <string>
+#include <type_traits>
+#include <utility>
 #include <vector>
 
+#include <boost/bind.hpp> // IWYU pragma: keep
+#include <glog/logging.h>
+
+#include "kudu/common/column_predicate.h"
+#include "kudu/common/common.pb.h"
+#include "kudu/common/encoded_key.h"
+#include "kudu/common/iterator.h"
+#include "kudu/common/iterator_stats.h"
+#include "kudu/common/partition.h"
 #include "kudu/common/scan_spec.h"
+#include "kudu/common/schema.h"
+#include "kudu/common/wire_protocol.pb.h"
+#include "kudu/consensus/consensus.pb.h"
 #include "kudu/consensus/log_anchor_registry.h"
+#include "kudu/consensus/metadata.pb.h"
+#include "kudu/consensus/opid.pb.h"
 #include "kudu/consensus/quorum_util.h"
+#include "kudu/consensus/raft_consensus.h"
 #include "kudu/gutil/map-util.h"
+#include "kudu/gutil/ref_counted.h"
+#include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/strings/human_readable.h"
 #include "kudu/gutil/strings/join.h"
 #include "kudu/gutil/strings/numbers.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/server/webui_util.h"
 #include "kudu/tablet/metadata.pb.h"
+#include "kudu/tablet/tablet.h"
 #include "kudu/tablet/tablet.pb.h"
-#include "kudu/tablet/tablet_bootstrap.h"
+#include "kudu/tablet/tablet_metadata.h"
 #include "kudu/tablet/tablet_replica.h"
+#include "kudu/tablet/transactions/transaction.h"
 #include "kudu/tserver/scanners.h"
 #include "kudu/tserver/tablet_server.h"
 #include "kudu/tserver/ts_tablet_manager.h"
 #include "kudu/util/easy_json.h"
 #include "kudu/util/maintenance_manager.h"
+#include "kudu/util/maintenance_manager.pb.h"
+#include "kudu/util/mem_tracker.h"
+#include "kudu/util/monotime.h"
 #include "kudu/util/pb_util.h"
 #include "kudu/util/url-coding.h"
+#include "kudu/util/web_callback_registry.h"
 
 using kudu::consensus::GetConsensusRole;
 using kudu::consensus::ConsensusStatePB;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/tserver/tserver-path-handlers.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tserver-path-handlers.h b/src/kudu/tserver/tserver-path-handlers.h
index b37ca1c..385b24d 100644
--- a/src/kudu/tserver/tserver-path-handlers.h
+++ b/src/kudu/tserver/tserver-path-handlers.h
@@ -23,6 +23,7 @@
 
 #include "kudu/gutil/macros.h"
 #include "kudu/server/webserver.h"
+#include "kudu/util/status.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/twitter-demo/ingest_firehose.cc
----------------------------------------------------------------------
diff --git a/src/kudu/twitter-demo/ingest_firehose.cc b/src/kudu/twitter-demo/ingest_firehose.cc
index 686f9d3..6ecab3f 100644
--- a/src/kudu/twitter-demo/ingest_firehose.cc
+++ b/src/kudu/twitter-demo/ingest_firehose.cc
@@ -15,25 +15,24 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <curl/curl.h>
-#include <fstream>
+#include <algorithm>
+#include <fstream>  // IWYU pragma: keep
+#include <iostream>
+#include <string>
+#include <type_traits>
+
 #include <gflags/gflags.h>
 #include <glog/logging.h>
-#include <iostream>
-#include <stdint.h>
 
 #include "kudu/client/client.h"
-#include "kudu/gutil/macros.h"
-#include "kudu/gutil/once.h"
-#include "kudu/rpc/messenger.h"
-#include "kudu/master/master.h"
-#include "kudu/tserver/tserver_service.proxy.h"
-#include "kudu/twitter-demo/oauth.h"
+#include "kudu/client/shared_ptr.h"
+#include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/move.h"
+#include "kudu/gutil/port.h"
 #include "kudu/twitter-demo/insert_consumer.h"
 #include "kudu/twitter-demo/twitter_streamer.h"
 #include "kudu/util/flags.h"
 #include "kudu/util/logging.h"
-#include "kudu/util/net/net_util.h"
 #include "kudu/util/slice.h"
 #include "kudu/util/status.h"
 
@@ -56,7 +55,6 @@ namespace kudu {
 namespace twitter_demo {
 
 using client::sp::shared_ptr;
-using tserver::TabletServerServiceProxy;
 
 // Consumer which simply logs messages to the console.
 class LoggingConsumer : public TwitterConsumer {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 1d5a0c6..d09800e 100644
--- a/src/kudu/twitter-demo/insert_consumer.cc
+++ b/src/kudu/twitter-demo/insert_consumer.cc
@@ -17,21 +17,18 @@
 
 #include "kudu/twitter-demo/insert_consumer.h"
 
-#include <ctime>
-#include <mutex>
+#include <algorithm>
+#include <ostream>
 #include <string>
 #include <vector>
 
 #include <glog/logging.h>
 
 #include "kudu/client/client.h"
-#include "kudu/common/wire_protocol.h"
-#include "kudu/common/row.h"
-#include "kudu/common/schema.h"
-#include "kudu/gutil/bind.h"
+#include "kudu/client/write_op.h"
+#include "kudu/common/partial_row.h"
+#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/stl_util.h"
-#include "kudu/tserver/tserver.pb.h"
-#include "kudu/tserver/tserver_service.proxy.h"
 #include "kudu/twitter-demo/parser.h"
 #include "kudu/twitter-demo/twitter-schema.h"
 #include "kudu/util/status.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/twitter-demo/insert_consumer.h
----------------------------------------------------------------------
diff --git a/src/kudu/twitter-demo/insert_consumer.h b/src/kudu/twitter-demo/insert_consumer.h
index 00cdce4..368215f 100644
--- a/src/kudu/twitter-demo/insert_consumer.h
+++ b/src/kudu/twitter-demo/insert_consumer.h
@@ -19,23 +19,18 @@
 
 #include "kudu/twitter-demo/twitter_streamer.h"
 
-#include <string>
-
-#include "kudu/client/callbacks.h"
 #include "kudu/client/schema.h"
 #include "kudu/client/shared_ptr.h"
-#include "kudu/rpc/rpc_controller.h"
-#include "kudu/tserver/tserver_service.proxy.h"
+#include "kudu/gutil/port.h"
 #include "kudu/twitter-demo/parser.h"
-#include "kudu/util/locks.h"
 #include "kudu/util/slice.h"
+#include "kudu/util/status.h"
 
 namespace kudu {
 namespace client {
 class KuduClient;
 class KuduTable;
 class KuduSession;
-class KuduStatusCallback;
 } // namespace client
 
 namespace twitter_demo {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/twitter-demo/oauth.cc
----------------------------------------------------------------------
diff --git a/src/kudu/twitter-demo/oauth.cc b/src/kudu/twitter-demo/oauth.cc
index c7292ce..088463c 100644
--- a/src/kudu/twitter-demo/oauth.cc
+++ b/src/kudu/twitter-demo/oauth.cc
@@ -18,7 +18,9 @@
 #include "kudu/twitter-demo/oauth.h"
 
 #include <algorithm>
+#include <ctime>
 #include <vector>
+
 #include <glog/logging.h>
 extern "C" {
 #include <oauth.h>

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 4c84054..8d34663 100644
--- a/src/kudu/twitter-demo/parser-test.cc
+++ b/src/kudu/twitter-demo/parser-test.cc
@@ -17,14 +17,18 @@
 
 #include "kudu/twitter-demo/parser.h"
 
+#include <string>
+#include <vector>
+
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 
 #include "kudu/gutil/strings/split.h"
 #include "kudu/util/env.h"
+#include "kudu/util/faststring.h"
 #include "kudu/util/path_util.h"
-#include "kudu/util/test_util.h"
 #include "kudu/util/status.h"
+#include "kudu/util/test_macros.h"
 
 using std::string;
 using std::vector;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/twitter-demo/parser.cc
----------------------------------------------------------------------
diff --git a/src/kudu/twitter-demo/parser.cc b/src/kudu/twitter-demo/parser.cc
index 73b8a13..7df1793 100644
--- a/src/kudu/twitter-demo/parser.cc
+++ b/src/kudu/twitter-demo/parser.cc
@@ -17,11 +17,11 @@
 
 #include "kudu/twitter-demo/parser.h"
 
-#include <time.h>
+#include <cstring>
+#include <ctime>
 
 #include <glog/logging.h>
 #include <rapidjson/document.h>
-#include <rapidjson/rapidjson.h>
 
 #include "kudu/gutil/stringprintf.h"
 #include "kudu/util/jsonreader.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/twitter-demo/parser.h
----------------------------------------------------------------------
diff --git a/src/kudu/twitter-demo/parser.h b/src/kudu/twitter-demo/parser.h
index c100450..9973428 100644
--- a/src/kudu/twitter-demo/parser.h
+++ b/src/kudu/twitter-demo/parser.h
@@ -17,10 +17,10 @@
 #ifndef KUDU_TWITTER_DEMO_PARSER_H
 #define KUDU_TWITTER_DEMO_PARSER_H
 
+#include <cstdint>
 #include <string>
 
 #include "kudu/gutil/macros.h"
-#include "kudu/util/slice.h"
 #include "kudu/util/status.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 2d94515..b55ad22 100644
--- a/src/kudu/twitter-demo/twitter_streamer.cc
+++ b/src/kudu/twitter-demo/twitter_streamer.cc
@@ -17,14 +17,17 @@
 
 #include "kudu/twitter-demo/twitter_streamer.h"
 
-#include <curl/curl.h>
-#include <gflags/gflags.h>
-#include <glog/logging.h>
+#include <cstdint>
+#include <cstring>
 #include <mutex>
-#include <string.h>
+#include <ostream>
 #include <string>
 #include <thread>
 
+#include <curl/curl.h>
+#include <gflags/gflags.h>
+#include <glog/logging.h>
+
 #include "kudu/twitter-demo/oauth.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/once.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 e134e39..37c1514 100644
--- a/src/kudu/twitter-demo/twitter_streamer.h
+++ b/src/kudu/twitter-demo/twitter_streamer.h
@@ -17,9 +17,11 @@
 #ifndef KUDU_TWITTER_DEMO_TWITTER_STREAMER_H
 #define KUDU_TWITTER_DEMO_TWITTER_STREAMER_H
 
+#include <cstddef>
 #include <mutex>
 #include <thread>
 
+#include "kudu/gutil/macros.h"
 #include "kudu/util/faststring.h"
 #include "kudu/util/slice.h"
 #include "kudu/util/status.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/kudu/util/CMakeLists.txt b/src/kudu/util/CMakeLists.txt
index f3e9ec8..836facf 100644
--- a/src/kudu/util/CMakeLists.txt
+++ b/src/kudu/util/CMakeLists.txt
@@ -462,5 +462,6 @@ endif()
 ADD_KUDU_TEST(compression/compression-test)
 if(NOT NO_TESTS)
   target_link_libraries(compression-test
+    cfile
     kudu_util_compression)
 endif()

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/async_logger.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/async_logger.cc b/src/kudu/util/async_logger.cc
index 8e6a4a9..1b1d9e4 100644
--- a/src/kudu/util/async_logger.cc
+++ b/src/kudu/util/async_logger.cc
@@ -17,11 +17,9 @@
 
 #include "kudu/util/async_logger.h"
 
-#include <algorithm>
 #include <string>
 #include <thread>
 
-#include "kudu/util/locks.h"
 #include "kudu/util/monotime.h"
 
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/async_logger.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/async_logger.h b/src/kudu/util/async_logger.h
index 2804a9b..7a7d37b 100644
--- a/src/kudu/util/async_logger.h
+++ b/src/kudu/util/async_logger.h
@@ -18,6 +18,9 @@
 
 #include "kudu/gutil/macros.h"
 
+#include <algorithm>
+#include <cstdint>
+#include <ctime>
 #include <memory>
 #include <string>
 #include <thread>
@@ -25,7 +28,9 @@
 
 #include <glog/logging.h>
 
-#include "kudu/util/locks.h"
+#include "kudu/gutil/integral_types.h"
+#include "kudu/util/condition_variable.h"
+#include "kudu/util/mutex.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/atomic-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/atomic-test.cc b/src/kudu/util/atomic-test.cc
index 9834d09..a65d55d 100644
--- a/src/kudu/util/atomic-test.cc
+++ b/src/kudu/util/atomic-test.cc
@@ -17,6 +17,7 @@
 
 #include "kudu/util/atomic.h"
 
+#include <cstdint>
 #include <limits>
 #include <vector>
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/atomic.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/atomic.cc b/src/kudu/util/atomic.cc
index 1fdae39..430631f 100644
--- a/src/kudu/util/atomic.cc
+++ b/src/kudu/util/atomic.cc
@@ -17,7 +17,8 @@
 
 #include "kudu/util/atomic.h"
 
-#include <stdint.h>
+#include <cstdint>
+#include <ostream>
 
 #include <glog/logging.h>
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/atomic.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/atomic.h b/src/kudu/util/atomic.h
index da9b677..3051a41 100644
--- a/src/kudu/util/atomic.h
+++ b/src/kudu/util/atomic.h
@@ -18,7 +18,9 @@
 #ifndef KUDU_UTIL_ATOMIC_H
 #define KUDU_UTIL_ATOMIC_H
 
-#include <algorithm>
+#include <algorithm>  // IWYU pragma: keep
+#include <cstdint>
+#include <cstdlib>
 #include <type_traits>
 
 #include "kudu/gutil/atomicops.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/bitmap-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/bitmap-test.cc b/src/kudu/util/bitmap-test.cc
index a91e414..73306d9 100644
--- a/src/kudu/util/bitmap-test.cc
+++ b/src/kudu/util/bitmap-test.cc
@@ -15,9 +15,12 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <gtest/gtest.h>
+#include <cstdint>
+#include <cstring>
 #include <vector>
 
+#include <gtest/gtest.h>
+
 #include "kudu/gutil/strings/join.h"
 #include "kudu/util/bitmap.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/bitmap.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/bitmap.cc b/src/kudu/util/bitmap.cc
index e38f2e2..eed7880 100644
--- a/src/kudu/util/bitmap.cc
+++ b/src/kudu/util/bitmap.cc
@@ -14,11 +14,15 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#include <glog/logging.h>
+
+#include "kudu/util/bitmap.h"
+
+#include <cstring>
 #include <string>
 
+#include <glog/logging.h>
+
 #include "kudu/gutil/stringprintf.h"
-#include "kudu/util/bitmap.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/bitmap.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/bitmap.h b/src/kudu/util/bitmap.h
index 1689b50..d9f5260 100644
--- a/src/kudu/util/bitmap.h
+++ b/src/kudu/util/bitmap.h
@@ -19,8 +19,15 @@
 #ifndef KUDU_UTIL_BITMAP_H
 #define KUDU_UTIL_BITMAP_H
 
+#include <cstddef>
+#include <cstdint>
+#include <ostream>
 #include <string>
+
+#include <glog/logging.h>
+
 #include "kudu/gutil/bits.h"
+#include "kudu/gutil/port.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/blocking_queue-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/blocking_queue-test.cc b/src/kudu/util/blocking_queue-test.cc
index 00f558a..a2271ff 100644
--- a/src/kudu/util/blocking_queue-test.cc
+++ b/src/kudu/util/blocking_queue-test.cc
@@ -15,16 +15,20 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <glog/logging.h>
-#include <gtest/gtest.h>
+#include <cstddef>
+#include <cstdint>
 #include <map>
-#include <memory>
 #include <string>
 #include <thread>
 #include <vector>
 
+#include <gtest/gtest.h>
+
+#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/util/countdown_latch.h"
 #include "kudu/util/blocking_queue.h"
+#include "kudu/util/monotime.h"
+#include "kudu/util/mutex.h"
 #include "kudu/util/status.h"
 #include "kudu/util/test_macros.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/bloom_filter-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/bloom_filter-test.cc b/src/kudu/util/bloom_filter-test.cc
index 3cee985..788ec36 100644
--- a/src/kudu/util/bloom_filter-test.cc
+++ b/src/kudu/util/bloom_filter-test.cc
@@ -15,10 +15,15 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+
 #include <glog/logging.h>
 #include <gtest/gtest.h>
-#include <stdlib.h>
+
 #include "kudu/util/bloom_filter.h"
+#include "kudu/util/slice.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/bloom_filter.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/bloom_filter.cc b/src/kudu/util/bloom_filter.cc
index 2b48b0d..b1a2055 100644
--- a/src/kudu/util/bloom_filter.cc
+++ b/src/kudu/util/bloom_filter.cc
@@ -15,10 +15,13 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <math.h>
-
 #include "kudu/util/bloom_filter.h"
-#include "kudu/util/bitmap.h"
+
+#include <cmath>
+#include <cstring>
+#include <ostream>
+
+#include <glog/logging.h>
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/bloom_filter.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/bloom_filter.h b/src/kudu/util/bloom_filter.h
index 419de3b..1ebd323 100644
--- a/src/kudu/util/bloom_filter.h
+++ b/src/kudu/util/bloom_filter.h
@@ -17,8 +17,12 @@
 #ifndef KUDU_UTIL_BLOOM_FILTER_H
 #define KUDU_UTIL_BLOOM_FILTER_H
 
+#include <cstddef>
+#include <cstdint>
+
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/hash/city.h"
+#include "kudu/gutil/integral_types.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/util/bitmap.h"
 #include "kudu/util/slice.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/cache-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/cache-test.cc b/src/kudu/util/cache-test.cc
index eed72ad..4a16be0 100644
--- a/src/kudu/util/cache-test.cc
+++ b/src/kudu/util/cache-test.cc
@@ -2,16 +2,29 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <cassert>
+#include <cstdint>
+#include <cstring>
+#include <memory>
+#include <string>
+#include <vector>
+
 #include <glog/logging.h>
 #include <gflags/gflags.h>
+#include <gflags/gflags_declare.h>
 #include <gtest/gtest.h>
-#include <memory>
 
-#include <vector>
+#include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/port.h"
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/util/cache.h"
 #include "kudu/util/coding.h"
+#include "kudu/util/env.h"
+#include "kudu/util/faststring.h"
 #include "kudu/util/mem_tracker.h"
 #include "kudu/util/metrics.h"
+#include "kudu/util/slice.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 #if defined(__linux__)

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/cache.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/cache.cc b/src/kudu/util/cache.cc
index d65d277..ff52a82 100644
--- a/src/kudu/util/cache.cc
+++ b/src/kudu/util/cache.cc
@@ -2,23 +2,27 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <cstdlib>
+#include <cstring>
 #include <memory>
 #include <mutex>
+#include <ostream>
 #include <string>
 #include <vector>
 
 #include <gflags/gflags.h>
 #include <glog/logging.h>
 
+#include "kudu/gutil/atomicops.h"
 #include "kudu/gutil/atomic_refcount.h"
+#include "kudu/gutil/dynamic_annotations.h"
 #include "kudu/gutil/bits.h"
 #include "kudu/gutil/hash/city.h"
+#include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/gutil/sysinfo.h"
 #include "kudu/util/alignment.h"
-#include "kudu/util/atomic.h"
 #include "kudu/util/cache.h"
 #include "kudu/util/cache_metrics.h"
 #include "kudu/util/flag_tags.h"
@@ -41,8 +45,6 @@ using std::vector;
 
 namespace kudu {
 
-class MetricEntity;
-
 Cache::~Cache() {
 }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/cache.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/cache.h b/src/kudu/util/cache.h
index af0a9ae..036b7d1 100644
--- a/src/kudu/util/cache.h
+++ b/src/kudu/util/cache.h
@@ -18,6 +18,7 @@
 #ifndef KUDU_UTIL_CACHE_H_
 #define KUDU_UTIL_CACHE_H_
 
+#include <cstddef>
 #include <cstdint>
 #include <memory>
 #include <string>
@@ -29,7 +30,6 @@
 namespace kudu {
 
 class Cache;
-struct CacheMetrics;
 class MetricEntity;
 
 enum CacheType {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/cache_metrics.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/cache_metrics.h b/src/kudu/util/cache_metrics.h
index 47f759f..04a546b 100644
--- a/src/kudu/util/cache_metrics.h
+++ b/src/kudu/util/cache_metrics.h
@@ -17,18 +17,13 @@
 #ifndef KUDU_UTIL_CACHE_METRICS_H
 #define KUDU_UTIL_CACHE_METRICS_H
 
-#include <stdint.h>
+#include <cstdint>
 
-#include "kudu/gutil/macros.h"
 #include "kudu/gutil/ref_counted.h"
+#include "kudu/util/metrics.h"
 
 namespace kudu {
 
-template<class T>
-class AtomicGauge;
-class Counter;
-class MetricEntity;
-
 struct CacheMetrics {
   explicit CacheMetrics(const scoped_refptr<MetricEntity>& metric_entity);
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/callback_bind-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/callback_bind-test.cc b/src/kudu/util/callback_bind-test.cc
index 6f75867..9bb5e5f 100644
--- a/src/kudu/util/callback_bind-test.cc
+++ b/src/kudu/util/callback_bind-test.cc
@@ -15,11 +15,21 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <algorithm>
+#include <ostream>
+#include <string>
+#include <type_traits>
+
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/gutil/bind.h"
+#include "kudu/gutil/bind_helpers.h"
 #include "kudu/gutil/callback.h"
+#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
-
-#include <gtest/gtest.h>
+#include "kudu/gutil/move.h"
+#include "kudu/gutil/ref_counted.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/coding-inl.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/coding-inl.h b/src/kudu/util/coding-inl.h
index 5fe0f9d..a47e9ce 100644
--- a/src/kudu/util/coding-inl.h
+++ b/src/kudu/util/coding-inl.h
@@ -24,8 +24,11 @@
 #ifndef KUDU_UTIL_CODING_INL_H
 #define KUDU_UTIL_CODING_INL_H
 
-#include <stdint.h>
-#include <string.h>
+#include <cstdint>
+#include <cstring>
+
+#include "kudu/gutil/port.h"  // IWYU pragma: keep
+// IWYU pragma: no_include <endian.h>
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/coding.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/coding.cc b/src/kudu/util/coding.cc
index bd3cfcd..952af28 100644
--- a/src/kudu/util/coding.cc
+++ b/src/kudu/util/coding.cc
@@ -4,6 +4,7 @@
 
 #include "kudu/util/coding.h"
 #include "kudu/util/coding-inl.h"
+#include "kudu/util/faststring.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/coding.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/coding.h b/src/kudu/util/coding.h
index 698d92a..0612533 100644
--- a/src/kudu/util/coding.h
+++ b/src/kudu/util/coding.h
@@ -10,14 +10,17 @@
 #ifndef STORAGE_LEVELDB_UTIL_CODING_H_
 #define STORAGE_LEVELDB_UTIL_CODING_H_
 
-#include <stdint.h>
-#include <string.h>
-#include <string>
+#include <cstdint>
+#include <cstring>
 
 #include "kudu/util/slice.h"
-#include "kudu/util/faststring.h"
+#include "kudu/gutil/port.h"  // IWYU pragma: keep
+// IWYU pragma: no_include <endian.h>
 
 namespace kudu {
+
+class faststring;
+
 extern void PutFixed32(faststring* dst, uint32_t value);
 extern void PutFixed64(faststring* dst, uint64_t value);
 extern void PutVarint32(faststring* dst, uint32_t value);

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/compression/compression-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/compression/compression-test.cc b/src/kudu/util/compression/compression-test.cc
index 36d003c..8d5374b 100644
--- a/src/kudu/util/compression/compression-test.cc
+++ b/src/kudu/util/compression/compression-test.cc
@@ -15,17 +15,23 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <stdlib.h>
-
+#include <cstdint>
+#include <cstdlib>
+#include <cstring>
 #include <vector>
 
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 
+#include "kudu/cfile/cfile-test-base.h"
+#include "kudu/common/common.pb.h"
+#include "kudu/fs/block_id.h"
+#include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/move.h"
 #include "kudu/util/compression/compression_codec.h"
+#include "kudu/util/slice.h"
 #include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
-#include "kudu/util/status.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 41dcae2..a2231b6 100644
--- a/src/kudu/util/compression/compression_codec.cc
+++ b/src/kudu/util/compression/compression_codec.cc
@@ -17,6 +17,8 @@
 
 #include "kudu/util/compression/compression_codec.h"
 
+#include <memory>
+#include <ostream>
 #include <string>
 #include <vector>
 
@@ -26,9 +28,10 @@
 #include <snappy.h>
 #include <zlib.h>
 
-
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/singleton.h"
 #include "kudu/gutil/stringprintf.h"
+#include "kudu/util/faststring.h"
 #include "kudu/util/logging.h"
 #include "kudu/util/string_case.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/compression/compression_codec.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/compression/compression_codec.h b/src/kudu/util/compression/compression_codec.h
index 538af15..4f81fd3 100644
--- a/src/kudu/util/compression/compression_codec.h
+++ b/src/kudu/util/compression/compression_codec.h
@@ -17,11 +17,14 @@
 #ifndef KUDU_CFILE_COMPRESSION_CODEC_H
 #define KUDU_CFILE_COMPRESSION_CODEC_H
 
+#include <cstddef>
+#include <cstdint>
 #include <string>
 #include <vector>
 
+#include <snappy-stubs-public.h>
+
 #include "kudu/util/compression/compression.pb.h"
-#include "kudu/gutil/macros.h"
 #include "kudu/util/slice.h"
 #include "kudu/util/status.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/condition_variable.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/condition_variable.cc b/src/kudu/util/condition_variable.cc
index 13d1d36..be4afa4 100644
--- a/src/kudu/util/condition_variable.cc
+++ b/src/kudu/util/condition_variable.cc
@@ -4,12 +4,17 @@
 
 #include "kudu/util/condition_variable.h"
 
-#include <glog/logging.h>
-
-#include <errno.h>
 #include <sys/time.h>
 
+#include <cerrno>
+#include <ctime>
+#include <ostream>
+
+#include <glog/logging.h>
+
+#include "kudu/gutil/integral_types.h"
 #include "kudu/util/monotime.h"
+#include "kudu/util/mutex.h"
 #include "kudu/util/thread_restrictions.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/condition_variable.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/condition_variable.h b/src/kudu/util/condition_variable.h
index ca6e265..1f251ca 100644
--- a/src/kudu/util/condition_variable.h
+++ b/src/kudu/util/condition_variable.h
@@ -67,13 +67,12 @@
 
 #include <pthread.h>
 
-#include "kudu/util/monotime.h"
-#include "kudu/util/mutex.h"
+#include "kudu/gutil/macros.h"
 
 namespace kudu {
 
-class ConditionVarImpl;
-class TimeDelta;
+class MonoDelta;
+class Mutex;
 
 class ConditionVariable {
  public:

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/countdown_latch-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/countdown_latch-test.cc b/src/kudu/util/countdown_latch-test.cc
index cf2517c..adb2623 100644
--- a/src/kudu/util/countdown_latch-test.cc
+++ b/src/kudu/util/countdown_latch-test.cc
@@ -15,11 +15,14 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <boost/bind.hpp>
+#include <boost/bind.hpp> // IWYU pragma: keep
 #include <gtest/gtest.h>
 
+#include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/util/countdown_latch.h"
-#include "kudu/util/test_util.h"
+#include "kudu/util/monotime.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/thread.h"
 #include "kudu/util/threadpool.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/crc-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/crc-test.cc b/src/kudu/util/crc-test.cc
index 3c46230..cf13268 100644
--- a/src/kudu/util/crc-test.cc
+++ b/src/kudu/util/crc-test.cc
@@ -15,7 +15,16 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <cstdint>
+#include <cstring>
+#include <ostream>
+#include <string>
+
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/strings/numbers.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/crc.h"
 #include "kudu/util/stopwatch.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/curl_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/curl_util.cc b/src/kudu/util/curl_util.cc
index 3e8e591..44ef089 100644
--- a/src/kudu/util/curl_util.cc
+++ b/src/kudu/util/curl_util.cc
@@ -17,12 +17,16 @@
 
 #include "kudu/util/curl_util.h"
 
+#include <cstddef>
+#include <cstdint>
+#include <ostream>
 
 #include <curl/curl.h>
 #include <glog/logging.h>
 
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/security/openssl_util.h"
+#include "kudu/util/faststring.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/debug-util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/debug-util-test.cc b/src/kudu/util/debug-util-test.cc
index 74b5b79..455f8cb 100644
--- a/src/kudu/util/debug-util-test.cc
+++ b/src/kudu/util/debug-util-test.cc
@@ -15,15 +15,22 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <glog/stl_logging.h>
-#include <signal.h>
+#include <unistd.h>
+
+#include <csignal>
 #include <string>
 #include <vector>
 
+#include <glog/logging.h>
+#include <gtest/gtest.h>
+
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/util/countdown_latch.h"
 #include "kudu/util/debug-util.h"
+#include "kudu/util/monotime.h"
 #include "kudu/util/scoped_cleanup.h"
+#include "kudu/util/status.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 #include "kudu/util/thread.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/debug-util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/debug-util.cc b/src/kudu/util/debug-util.cc
index 1f2b035..be39fe3 100644
--- a/src/kudu/util/debug-util.cc
+++ b/src/kudu/util/debug-util.cc
@@ -17,20 +17,29 @@
 
 #include "kudu/util/debug-util.h"
 
-#include <execinfo.h>
 #include <dirent.h>
-#include <glog/logging.h>
-#include <signal.h>
-#include <string>
+#include <sched.h>
+#ifdef __linux__
+#include <syscall.h>
+#else
 #include <sys/syscall.h>
+#endif
+#include <unistd.h>
+
+#include <cerrno>
+#include <csignal>
+#include <ostream>
+#include <string>
+
+#include <glog/logging.h>
 
+#include "kudu/gutil/atomicops.h"
 #include "kudu/gutil/hash/city.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/spinlock.h"
 #include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/strings/numbers.h"
 #include "kudu/util/debug/sanitizer_scopes.h"
-#include "kudu/util/env.h"
 #include "kudu/util/errno.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/thread.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/debug-util.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/debug-util.h b/src/kudu/util/debug-util.h
index fc12445..a84c04c 100644
--- a/src/kudu/util/debug-util.h
+++ b/src/kudu/util/debug-util.h
@@ -19,6 +19,8 @@
 
 #include <sys/types.h>
 
+#include <cstdint>
+#include <cstring>
 #include <string>
 #include <vector>
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/debug/trace_event.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/debug/trace_event.h b/src/kudu/util/debug/trace_event.h
index 75a83e6..2c51309 100644
--- a/src/kudu/util/debug/trace_event.h
+++ b/src/kudu/util/debug/trace_event.h
@@ -194,6 +194,7 @@
 #include "kudu/gutil/atomicops.h"
 #include "kudu/util/debug/trace_event_impl.h"
 #include "kudu/util/debug/trace_event_memory.h"
+#include "kudu/util/thread.h"
 #include "kudu/gutil/walltime.h"
 
 // By default, const char* argument values are assumed to have long-lived scope

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 1d72a24..e8f00ab 100644
--- a/src/kudu/util/debug/trace_event_impl.cc
+++ b/src/kudu/util/debug/trace_event_impl.cc
@@ -5,29 +5,45 @@
 
 #include "kudu/util/debug/trace_event_impl.h"
 
+#include <sched.h>
+#include <unistd.h>
+
 #include <algorithm>
-#include <gflags/gflags.h>
+#include <cinttypes>
+#include <cstdlib>
+#include <cstring>
 #include <list>
+#include <sstream>
+#include <type_traits>
+#include <utility>
 #include <vector>
 
+#include <gflags/gflags.h>
+
 #include "kudu/gutil/bind.h"
-#include "kudu/util/atomic.h"
-#include "kudu/util/debug/trace_event.h"
-#include "kudu/gutil/mathlimits.h"
+#include "kudu/gutil/dynamic_annotations.h"
 #include "kudu/gutil/map-util.h"
-#include "kudu/gutil/strings/join.h"
-#include "kudu/gutil/strings/split.h"
-#include "kudu/gutil/strings/util.h"
+#include "kudu/gutil/mathlimits.h"
+#include "kudu/gutil/move.h"
+#include "kudu/gutil/port.h"
+#include "kudu/gutil/ref_counted_memory.h"
 #include "kudu/gutil/singleton.h"
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/stringprintf.h"
-#include "kudu/gutil/strings/escaping.h"
+#include "kudu/gutil/strings/join.h"
+#include "kudu/gutil/strings/split.h"
+#include "kudu/gutil/strings/stringpiece.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/gutil/dynamic_annotations.h"
-
+#include "kudu/gutil/strings/util.h"
+#include "kudu/gutil/sysinfo.h"
 #include "kudu/gutil/walltime.h"
+
+#include "kudu/util/atomic.h"
+#include "kudu/util/debug/trace_event.h"
 #include "kudu/util/debug/trace_event_synthetic_delay.h"
 #include "kudu/util/flag_tags.h"
+#include "kudu/util/monotime.h"
+#include "kudu/util/status.h"
 #include "kudu/util/thread.h"
 
 DEFINE_string(trace_to_console, "",

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/debug/trace_event_impl.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/debug/trace_event_impl.h b/src/kudu/util/debug/trace_event_impl.h
index e5e85df..53b1690 100644
--- a/src/kudu/util/debug/trace_event_impl.h
+++ b/src/kudu/util/debug/trace_event_impl.h
@@ -5,25 +5,27 @@
 #ifndef KUDU_UTIL_DEBUG_TRACE_EVENT_IMPL_H_
 #define KUDU_UTIL_DEBUG_TRACE_EVENT_IMPL_H_
 
-#include <gtest/gtest_prod.h>
+#include <cstddef>
+#include <cstdint>
+#include <iosfwd>
 #include <stack>
-#include <sstream>
 #include <string>
 #include <unordered_map>
-#include <unordered_set>
 #include <vector>
 
+#include <glog/logging.h>
+#include <gtest/gtest_prod.h>
 
 #include "kudu/gutil/atomicops.h"
+#include "kudu/gutil/bind_helpers.h"
 #include "kudu/gutil/callback.h"
+#include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/integral_types.h"
+#include "kudu/gutil/macros.h"
+#include "kudu/gutil/spinlock.h"
 #include "kudu/gutil/walltime.h"
 #include "kudu/gutil/ref_counted.h"
-#include "kudu/gutil/ref_counted_memory.h"
-#include "kudu/util/atomic.h"
-#include "kudu/util/condition_variable.h"
-#include "kudu/util/locks.h"
-#include "kudu/util/thread.h"
-#include "kudu/util/threadlocal.h"
+#include "kudu/util/mutex.h"
 
 // Older style trace macros with explicit id and extra data
 // Only these macros result in publishing data to ETW as currently implemented.
@@ -57,6 +59,10 @@ struct hash<kudu::Thread*> {
 #endif
 
 namespace kudu {
+
+class RefCountedString;
+class Thread;
+
 namespace debug {
 
 // For any argument of type TRACE_VALUE_TYPE_CONVERTABLE the provided

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/debug/trace_event_synthetic_delay.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/debug/trace_event_synthetic_delay.cc b/src/kudu/util/debug/trace_event_synthetic_delay.cc
index 0fff9fb..947ab88 100644
--- a/src/kudu/util/debug/trace_event_synthetic_delay.cc
+++ b/src/kudu/util/debug/trace_event_synthetic_delay.cc
@@ -2,9 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "kudu/gutil/singleton.h"
 #include "kudu/util/debug/trace_event_synthetic_delay.h"
 
+#include <cstring>
+#include <ostream>
+
+#include <glog/logging.h>
+
+#include "kudu/gutil/dynamic_annotations.h"
+#include "kudu/gutil/port.h"
+#include "kudu/gutil/singleton.h"
+
 namespace {
 const int kMaxSyntheticDelays = 32;
 }  // namespace

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/debug/trace_event_synthetic_delay.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/debug/trace_event_synthetic_delay.h b/src/kudu/util/debug/trace_event_synthetic_delay.h
index f53d5f4..5866814 100644
--- a/src/kudu/util/debug/trace_event_synthetic_delay.h
+++ b/src/kudu/util/debug/trace_event_synthetic_delay.h
@@ -32,9 +32,13 @@
 #ifndef KUDU_UTIL_DEBUG_TRACE_EVENT_SYNTHETIC_DELAY_H_
 #define KUDU_UTIL_DEBUG_TRACE_EVENT_SYNTHETIC_DELAY_H_
 
+#include <string>
+
 #include "kudu/gutil/atomicops.h"
+#include "kudu/gutil/macros.h"
 #include "kudu/util/debug/trace_event.h"
 #include "kudu/util/monotime.h"
+#include "kudu/util/mutex.h"
 
 // Apply a named delay in the current scope.
 #define TRACE_EVENT_SYNTHETIC_DELAY(name)                                     \

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/easy_json-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/easy_json-test.cc b/src/kudu/util/easy_json-test.cc
index 6d07581..7074512 100644
--- a/src/kudu/util/easy_json-test.cc
+++ b/src/kudu/util/easy_json-test.cc
@@ -19,9 +19,9 @@
 
 #include <gtest/gtest.h>
 #include <rapidjson/document.h>
+#include <rapidjson/rapidjson.h>
 
 #include "kudu/gutil/integral_types.h"
-#include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/easy_json.h"
 #include "kudu/util/test_util.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/easy_json.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/easy_json.cc b/src/kudu/util/easy_json.cc
index 4b26dad..c6cb597 100644
--- a/src/kudu/util/easy_json.cc
+++ b/src/kudu/util/easy_json.cc
@@ -18,15 +18,14 @@
 #include "kudu/util/easy_json.h"
 
 #include <string>
-#include <utility>
+#include <ostream>
 
 #include <glog/logging.h>
 #include <rapidjson/document.h>
+#include <rapidjson/rapidjson.h>
 #include <rapidjson/stringbuffer.h>
 #include <rapidjson/writer.h>
 
-#include "kudu/gutil/strings/substitute.h"
-
 using rapidjson::SizeType;
 using rapidjson::Value;
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/env-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/env-test.cc b/src/kudu/util/env-test.cc
index 4e3ed9f..b38c004 100644
--- a/src/kudu/util/env-test.cc
+++ b/src/kudu/util/env-test.cc
@@ -15,42 +15,57 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <fcntl.h>
-#include <sys/types.h>
+#if !defined(__APPLE__)
+#include <linux/falloc.h>
+#endif  // !defined(__APPLE__)
+// Copied from falloc.h. Useful for older kernels that lack support for
+// hole punching; fallocate(2) will return EOPNOTSUPP.
+#ifndef FALLOC_FL_KEEP_SIZE
+#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */
+#endif
+#ifndef FALLOC_FL_PUNCH_HOLE
+#define FALLOC_FL_PUNCH_HOLE  0x02 /* de-allocates range */
+#endif
 
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <algorithm>
+#include <cerrno>
+#include <cstdio>
+#include <cstdint>
+#include <cstdlib>
 #include <memory>
+#include <ostream>
 #include <string>
+#include <utility>
+#include <vector>
 
+#include <gflags/gflags_declare.h>
 #include <glog/logging.h>
-#include <glog/stl_logging.h>
+#include <glog/stl_logging.h> // IWYU pragma: keep
 #include <gtest/gtest.h>
 
 #include "kudu/gutil/bind.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/human_readable.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/gutil/strings/util.h"
 #include "kudu/util/env.h"
 #include "kudu/util/env_util.h"
-#include "kudu/util/malloc.h"
+#include "kudu/util/make_shared.h"
+#include "kudu/util/monotime.h"
+#include "kudu/util/faststring.h"
 #include "kudu/util/path_util.h"
 #include "kudu/util/random.h"
 #include "kudu/util/random_util.h"
+#include "kudu/util/slice.h"
 #include "kudu/util/status.h"
 #include "kudu/util/stopwatch.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
-#if !defined(__APPLE__)
-#include <linux/falloc.h>
-#endif  // !defined(__APPLE__)
-// Copied from falloc.h. Useful for older kernels that lack support for
-// hole punching; fallocate(2) will return EOPNOTSUPP.
-#ifndef FALLOC_FL_KEEP_SIZE
-#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */
-#endif
-#ifndef FALLOC_FL_PUNCH_HOLE
-#define FALLOC_FL_PUNCH_HOLE  0x02 /* de-allocates range */
-#endif
-
 DECLARE_bool(never_fsync);
 DECLARE_bool(suicide_on_eio);
 DECLARE_double(env_inject_eio);

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/env.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/env.cc b/src/kudu/util/env.cc
index 1f6478c..90755e0 100644
--- a/src/kudu/util/env.cc
+++ b/src/kudu/util/env.cc
@@ -6,7 +6,10 @@
 
 #include <memory>
 
+#include <glog/logging.h>
+
 #include "kudu/util/faststring.h"
+#include "kudu/util/slice.h"
 
 using std::unique_ptr;
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/env.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/env.h b/src/kudu/util/env.h
index c2a1bdc..7624577 100644
--- a/src/kudu/util/env.h
+++ b/src/kudu/util/env.h
@@ -13,7 +13,7 @@
 #ifndef STORAGE_LEVELDB_INCLUDE_ENV_H_
 #define STORAGE_LEVELDB_INCLUDE_ENV_H_
 
-#include <cstdarg>
+#include <cstddef>
 #include <cstdint>
 #include <map>
 #include <memory>
@@ -21,6 +21,7 @@
 #include <vector>
 
 #include "kudu/gutil/callback_forward.h"
+#include "kudu/gutil/macros.h"
 #include "kudu/util/status.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/env_posix.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/env_posix.cc b/src/kudu/util/env_posix.cc
index f4a3388..58c3984 100644
--- a/src/kudu/util/env_posix.cc
+++ b/src/kudu/util/env_posix.cc
@@ -3,40 +3,49 @@
 // found in the LICENSE file. See the AUTHORS file for names of contributors.
 
 #include <dirent.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <fnmatch.h>
 #include <fts.h>
 #include <glob.h>
-#include <limits.h>
 #include <pthread.h>
-#include <sys/mman.h>
 #include <sys/resource.h>
 #include <sys/stat.h>
 #include <sys/statvfs.h>
 #include <sys/time.h>
-#include <sys/types.h>
 #include <sys/uio.h>
 #include <sys/utsname.h>
 #include <unistd.h>
+// IWYU pragma: no_include <asm/int-ll64.h>
+// IWYU pragma: no_include <asm/ioctl.h>
+// IWYU pragma: no_include <sys/statfs.h>
 
+#include <algorithm>
+#include <cstdint>
 #include <cstdio>
 #include <cstdlib>
 #include <cstring>
 #include <ctime>
+#include <map>
 #include <memory>
 #include <numeric>
+#include <cerrno>
+#include <ostream>
 #include <string>
 #include <type_traits>
 #include <vector>
 
+#include <gflags/gflags.h>
 #include <glog/logging.h>
 
 #include "kudu/gutil/atomicops.h"
+#include "kudu/gutil/basictypes.h"
+#include "kudu/gutil/bind_helpers.h"
 #include "kudu/gutil/bind.h"
-#include "kudu/gutil/callback.h"
+#include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/macros.h"
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/once.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/split.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/atomic.h"
@@ -52,9 +61,11 @@
 #include "kudu/util/path_util.h"
 #include "kudu/util/scoped_cleanup.h"
 #include "kudu/util/slice.h"
+#include "kudu/util/status.h"
 #include "kudu/util/stopwatch.h"
 #include "kudu/util/thread_restrictions.h"
 #include "kudu/util/trace.h"
+#include "kudu/gutil/stringprintf.h"
 
 #if defined(__APPLE__)
 #include <mach-o/dyld.h>
@@ -63,10 +74,11 @@
 #include <linux/falloc.h>
 #include <linux/fiemap.h>
 #include <linux/fs.h>
+#include <linux/kernel.h>
 #include <linux/magic.h>
 #include <sys/ioctl.h>
 #include <sys/sysinfo.h>
-#include <sys/vfs.h>
+#include <sys/vfs.h>  // IWYU pragma: keep
 #endif  // defined(__APPLE__)
 
 using base::subtle::Atomic64;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 61a4e3e..1298646 100644
--- a/src/kudu/util/env_util-test.cc
+++ b/src/kudu/util/env_util-test.cc
@@ -20,17 +20,24 @@
 #include <unistd.h>
 
 #include <algorithm>
+#include <cstdint>
+#include <cerrno>
 #include <memory>
+#include <string>
 #include <unordered_set>
+#include <vector>
 
-#include <gflags/gflags.h>
+#include <gflags/gflags_declare.h>
+#include <glog/logging.h>
 #include <glog/stl_logging.h>
+#include <gtest/gtest.h>
 
-#include "kudu/gutil/map-util.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/gutil/walltime.h"
+#include "kudu/util/env.h"
 #include "kudu/util/env_util.h"
 #include "kudu/util/path_util.h"
+#include "kudu/util/status.h"
 #include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/env_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/env_util.cc b/src/kudu/util/env_util.cc
index c6e0f50..04a9844 100644
--- a/src/kudu/util/env_util.cc
+++ b/src/kudu/util/env_util.cc
@@ -18,23 +18,24 @@
 #include "kudu/util/env_util.h"
 
 #include <algorithm>
+#include <cstdint>
+#include <cerrno>
+#include <ctime>
 #include <memory>
 #include <string>
-#include <utility>
 #include <vector>
+#include <utility>
 
 #include <gflags/gflags.h>
 #include <glog/logging.h>
 
 #include "kudu/gutil/bind.h"
-#include "kudu/gutil/map-util.h"
-#include "kudu/gutil/strings/numbers.h"
-#include "kudu/gutil/strings/split.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/gutil/strings/util.h"
-#include "kudu/util/debug-util.h"
 #include "kudu/util/env.h"
 #include "kudu/util/flag_tags.h"
+#include "kudu/util/slice.h"
 #include "kudu/util/path_util.h"
 #include "kudu/util/status.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/env_util.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/env_util.h b/src/kudu/util/env_util.h
index f93d81b..21bf0ff 100644
--- a/src/kudu/util/env_util.h
+++ b/src/kudu/util/env_util.h
@@ -17,13 +17,22 @@
 #ifndef KUDU_UTIL_ENV_UTIL_H
 #define KUDU_UTIL_ENV_UTIL_H
 
+#include <cstddef>
+#include <cstdint>
 #include <memory>
 #include <string>
 
 #include "kudu/gutil/macros.h"
-#include "kudu/util/env.h"
+#include "kudu/util/status.h"
 
 namespace kudu {
+
+class Env;
+class RandomAccessFile;
+class SequentialFile;
+class WritableFile;
+struct WritableFileOptions;
+
 namespace env_util {
 
 Status OpenFileForWrite(Env *env, const std::string &path,

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/errno-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/errno-test.cc b/src/kudu/util/errno-test.cc
index 911ca14..f628b55 100644
--- a/src/kudu/util/errno-test.cc
+++ b/src/kudu/util/errno-test.cc
@@ -15,6 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <cerrno>
 #include <string>
 
 #include <gtest/gtest.h>

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/errno.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/errno.cc b/src/kudu/util/errno.cc
index 65b2173..cc00d0f 100644
--- a/src/kudu/util/errno.cc
+++ b/src/kudu/util/errno.cc
@@ -17,11 +17,11 @@
 
 #include "kudu/util/errno.h"
 
-#include <errno.h>
-#include <string.h>
+#include <cstring>
+#include <glog/logging.h>
 
 #include "kudu/gutil/dynamic_annotations.h"
-#include "kudu/util/logging.h"
+// IWYU pragma: no_include <features.h>
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/errno.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/errno.h b/src/kudu/util/errno.h
index 7d5416e..89802de 100644
--- a/src/kudu/util/errno.h
+++ b/src/kudu/util/errno.h
@@ -17,6 +17,7 @@
 #ifndef KUDU_ERRNO_H
 #define KUDU_ERRNO_H
 
+#include <cstddef>
 #include <string>
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/failure_detector-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/failure_detector-test.cc b/src/kudu/util/failure_detector-test.cc
index 306d81a..f8f4478 100644
--- a/src/kudu/util/failure_detector-test.cc
+++ b/src/kudu/util/failure_detector-test.cc
@@ -15,17 +15,23 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <algorithm>
+#include <ostream>
+#include <string>
 
+#include <glog/logging.h>
 #include <gtest/gtest.h>
-#include <string>
 
 #include "kudu/gutil/bind.h"
+#include "kudu/gutil/bind_helpers.h"
 #include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/map-util.h"
+#include "kudu/gutil/ref_counted.h"
 #include "kudu/util/countdown_latch.h"
 #include "kudu/util/failure_detector.h"
-#include "kudu/util/locks.h"
 #include "kudu/util/monotime.h"
 #include "kudu/util/status.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/failure_detector.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/failure_detector.cc b/src/kudu/util/failure_detector.cc
index 8e2a6ae..7adb403 100644
--- a/src/kudu/util/failure_detector.cc
+++ b/src/kudu/util/failure_detector.cc
@@ -17,15 +17,18 @@
 
 #include "kudu/util/failure_detector.h"
 
-#include <glog/logging.h>
+#include <cstddef>
 #include <mutex>
+#include <ostream>
 #include <unordered_map>
 
+#include <glog/logging.h>
+
+#include "kudu/gutil/basictypes.h"
+#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/map-util.h"
 #include "kudu/gutil/stl_util.h"
 #include "kudu/gutil/strings/substitute.h"
-#include "kudu/util/locks.h"
-#include "kudu/util/random_util.h"
 #include "kudu/util/status.h"
 #include "kudu/util/thread.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/failure_detector.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/failure_detector.h b/src/kudu/util/failure_detector.h
index 0290011..1e986b4 100644
--- a/src/kudu/util/failure_detector.h
+++ b/src/kudu/util/failure_detector.h
@@ -18,22 +18,20 @@
 #ifndef KUDU_UTIL_FAILURE_DETECTOR_H_
 #define KUDU_UTIL_FAILURE_DETECTOR_H_
 
+#include <cstdint>
 #include <string>
 #include <unordered_map>
 
 #include "kudu/gutil/callback.h"
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/util/countdown_latch.h"
-#include "kudu/util/monotime.h"
 #include "kudu/util/locks.h"
+#include "kudu/util/monotime.h"
 #include "kudu/util/random.h"
-#include "kudu/util/status_callback.h"
 
 namespace kudu {
-class MonoDelta;
-class MonoTime;
 class Status;
 class Thread;
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/faststring-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/faststring-test.cc b/src/kudu/util/faststring-test.cc
index c57cb41..07c5697 100644
--- a/src/kudu/util/faststring-test.cc
+++ b/src/kudu/util/faststring-test.cc
@@ -16,6 +16,11 @@
 // under the License.
 
 #include <algorithm>
+#include <cstring>
+#include <memory>
+
+#include <gtest/gtest.h>
+
 #include "kudu/util/faststring.h"
 #include "kudu/util/random.h"
 #include "kudu/util/random_util.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/faststring.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/faststring.h b/src/kudu/util/faststring.h
index 3d25c84..992060b 100644
--- a/src/kudu/util/faststring.h
+++ b/src/kudu/util/faststring.h
@@ -17,10 +17,13 @@
 #ifndef KUDU_UTIL_FASTSTRING_H
 #define KUDU_UTIL_FASTSTRING_H
 
+#include <cstdint>
+#include <cstring>
 #include <string>
 
 #include "kudu/gutil/dynamic_annotations.h"
 #include "kudu/gutil/macros.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/fastmem.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/fault_injection.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/fault_injection.cc b/src/kudu/util/fault_injection.cc
index 20d24e7..32cb954 100644
--- a/src/kudu/util/fault_injection.cc
+++ b/src/kudu/util/fault_injection.cc
@@ -17,13 +17,16 @@
 
 #include "kudu/util/fault_injection.h"
 
-#include <stdlib.h>
-#include <sys/time.h>
+#include <unistd.h>
 
+#include <ostream>
+
+#include <glog/logging.h>
+
+#include "kudu/gutil/dynamic_annotations.h"
 #include "kudu/gutil/once.h"
 #include "kudu/util/debug/leakcheck_disabler.h"
 #include "kudu/util/monotime.h"
-#include "kudu/util/os-util.h"
 #include "kudu/util/random.h"
 #include "kudu/util/random_util.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/fault_injection.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/fault_injection.h b/src/kudu/util/fault_injection.h
index 43548e6..c46b118 100644
--- a/src/kudu/util/fault_injection.h
+++ b/src/kudu/util/fault_injection.h
@@ -18,6 +18,7 @@
 #define KUDU_UTIL_FAULT_INJECTION_H
 
 #include "kudu/gutil/macros.h"
+#include "kudu/gutil/port.h"
 #include "kudu/util/status.h"
 
 // Macros for injecting various kinds of faults with varying probability. If

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 0402bdc..2960feb 100644
--- a/src/kudu/util/file_cache-stress-test.cc
+++ b/src/kudu/util/file_cache-stress-test.cc
@@ -44,6 +44,7 @@
 #include "kudu/util/path_util.h"
 #include "kudu/util/random.h"
 #include "kudu/util/status.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 // Like CHECK_OK(), but dumps the contents of the cache before failing.

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/file_cache-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/file_cache-test.cc b/src/kudu/util/file_cache-test.cc
index 1752bd2..7d8bd3a 100644
--- a/src/kudu/util/file_cache-test.cc
+++ b/src/kudu/util/file_cache-test.cc
@@ -17,20 +17,27 @@
 
 #include "kudu/util/file_cache.h"
 
+#include <unistd.h>
+
+#include <cstdint>
 #include <memory>
 #include <string>
 #include <thread>
 #include <vector>
 
-#include <gflags/gflags.h>
+#include <gflags/gflags_declare.h>
+#include <glog/logging.h>
 #include <gtest/gtest.h>
 
 #include "kudu/gutil/strings/substitute.h"
+#include "kudu/util/cache.h"
 #include "kudu/util/env.h"
-#include "kudu/util/metrics.h"
+#include "kudu/util/metrics.h"  // IWYU pragma: keep
 #include "kudu/util/random.h"
 #include "kudu/util/scoped_cleanup.h"
+#include "kudu/util/slice.h"
 #include "kudu/util/status.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 DECLARE_bool(cache_force_single_shard);

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/file_cache.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/file_cache.cc b/src/kudu/util/file_cache.cc
index de0cae7..34e9eef 100644
--- a/src/kudu/util/file_cache.cc
+++ b/src/kudu/util/file_cache.cc
@@ -18,13 +18,17 @@
 #include "kudu/util/file_cache.h"
 
 #include <atomic>
+#include <cstdint>
+#include <cstring>
 #include <memory>
 #include <mutex>
+#include <ostream>
 #include <string>
 #include <utility>
 #include <vector>
 
 #include <gflags/gflags.h>
+#include <glog/logging.h>
 
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/map-util.h"
@@ -35,9 +39,10 @@
 #include "kudu/util/env.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/locks.h"
-#include "kudu/util/malloc.h"
-#include "kudu/util/metrics.h"
+#include "kudu/util/metrics.h"  // IWYU pragma: keep
+#include "kudu/util/monotime.h"
 #include "kudu/util/once.h"
+#include "kudu/util/slice.h"
 #include "kudu/util/status.h"
 #include "kudu/util/thread.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/file_cache.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/file_cache.h b/src/kudu/util/file_cache.h
index 44330d3..021c758 100644
--- a/src/kudu/util/file_cache.h
+++ b/src/kudu/util/file_cache.h
@@ -27,13 +27,13 @@
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/util/cache.h"
 #include "kudu/util/countdown_latch.h"
-#include "kudu/util/env.h"
 #include "kudu/util/locks.h"
-#include "kudu/util/slice.h"
 #include "kudu/util/status.h"
 
 namespace kudu {
 
+class Env;
+
 namespace internal {
 
 template <class FileType>

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/flag_tags-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/flag_tags-test.cc b/src/kudu/util/flag_tags-test.cc
index 13ee535..a06a05e 100644
--- a/src/kudu/util/flag_tags-test.cc
+++ b/src/kudu/util/flag_tags-test.cc
@@ -15,16 +15,22 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <string>
+#include <unordered_set>
+#include <vector>
+
 #include <gtest/gtest.h>
 #include <gflags/gflags.h>
-#include <unordered_set>
+#include <gflags/gflags_declare.h>
 
 #include "kudu/gutil/map-util.h"
+#include "kudu/gutil/macros.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/flags.h"
 #include "kudu/util/logging.h"
 #include "kudu/util/logging_test_util.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 DECLARE_bool(never_fsync);

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/flag_tags.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/flag_tags.cc b/src/kudu/util/flag_tags.cc
index 8b9ebe3..7e11ea2 100644
--- a/src/kudu/util/flag_tags.cc
+++ b/src/kudu/util/flag_tags.cc
@@ -17,15 +17,18 @@
 
 #include "kudu/util/flag_tags.h"
 
-#include "kudu/gutil/map-util.h"
-#include "kudu/gutil/singleton.h"
-
 #include <map>
+#include <ostream>
 #include <string>
 #include <unordered_set>
 #include <utility>
 #include <vector>
 
+#include <glog/logging.h>
+
+#include "kudu/gutil/map-util.h"
+#include "kudu/gutil/singleton.h"
+
 using std::multimap;
 using std::pair;
 using std::string;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/flag_tags.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/flag_tags.h b/src/kudu/util/flag_tags.h
index ddfdab1..ba5c870 100644
--- a/src/kudu/util/flag_tags.h
+++ b/src/kudu/util/flag_tags.h
@@ -112,7 +112,6 @@
 
 #include <string>
 #include <unordered_set>
-#include <vector>
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/flag_validators-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/flag_validators-test.cc b/src/kudu/util/flag_validators-test.cc
index 3e7fb5b..77efab3 100644
--- a/src/kudu/util/flag_validators-test.cc
+++ b/src/kudu/util/flag_validators-test.cc
@@ -15,15 +15,22 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <cstdlib>
+#include <functional>
+#include <map>
+#include <ostream>
 #include <string>
+#include <utility>
 
 #include <gflags/gflags.h>
+#include <glog/logging.h>
 #include <gtest/gtest.h>
 
+#include "kudu/gutil/macros.h"
 #include "kudu/util/debug/leakcheck_disabler.h"
 #include "kudu/util/flags.h"
 #include "kudu/util/flag_validators.h"
-#include "kudu/util/logging.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 DEFINE_string(grouped_0, "", "First flag to set.");

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/flags-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/flags-test.cc b/src/kudu/util/flags-test.cc
index dd5acd0..60ebebb 100644
--- a/src/kudu/util/flags-test.cc
+++ b/src/kudu/util/flags-test.cc
@@ -15,15 +15,23 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <string>
+#include <vector>
+
 #include <gflags/gflags.h>
+#include <gflags/gflags_declare.h>
+#include <glog/logging.h>
 #include <gtest/gtest.h>
-#include <string>
 
+#include "kudu/gutil/macros.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/env.h"
 #include "kudu/util/flags.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/logging.h"
+#include "kudu/util/slice.h"
+#include "kudu/util/status.h"
+#include "kudu/util/test_macros.h"
 #include "kudu/util/test_util.h"
 
 // Test gflags

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/flags.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/flags.cc b/src/kudu/util/flags.cc
index 19d5b4f..957ea7a 100644
--- a/src/kudu/util/flags.cc
+++ b/src/kudu/util/flags.cc
@@ -17,21 +17,32 @@
 
 #include "kudu/util/flags.h"
 
+#include <unistd.h>
+
+#include <cstdlib>
+#include <functional>
 #include <iostream>
-#include <map>
-#include <sstream>
 #include <string>
 #include <unordered_set>
+#include <utility>
 #include <vector>
 
 #include <sys/stat.h>
-#include <sys/types.h>
 
 #include <gflags/gflags.h>
+#include <gflags/gflags_declare.h>
+#include <glog/logging.h>
+#ifdef TCMALLOC_ENABLED
 #include <gperftools/heap-profiler.h>
+#endif
 
+#include "kudu/gutil/macros.h"
+#include "kudu/gutil/map-util.h"
+#include "kudu/gutil/stringprintf.h"
 #include "kudu/gutil/strings/join.h"
+#include "kudu/gutil/strings/numbers.h"
 #include "kudu/gutil/strings/split.h"
+#include "kudu/gutil/strings/stringpiece.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/flag_validators.h"
@@ -48,7 +59,7 @@ using google::CommandLineFlagInfo;
 using std::cout;
 using std::endl;
 using std::string;
-using std::stringstream;
+using std::ostringstream;
 using std::unordered_set;
 using std::vector;
 
@@ -352,7 +363,7 @@ void DumpFlagsXML() {
       EscapeForHtmlToString(google::ProgramUsage())) << endl;
 
   for (const CommandLineFlagInfo& flag : flags) {
-    cout << DescribeOneFlagInXML(flag) << std::endl;
+    cout << DescribeOneFlagInXML(flag) << endl;
   }
 
   cout << "</AllFlags>" << endl;
@@ -516,7 +527,7 @@ string CommandlineFlagsIntoString(EscapeMode mode) {
 }
 
 string GetNonDefaultFlags(const GFlagsMap& default_flags) {
-  stringstream args;
+  ostringstream args;
   vector<CommandLineFlagInfo> flags;
   GetAllFlags(&flags);
   for (const auto& flag : flags) {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/flags.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/flags.h b/src/kudu/util/flags.h
index ae20564..0c3028a 100644
--- a/src/kudu/util/flags.h
+++ b/src/kudu/util/flags.h
@@ -17,11 +17,13 @@
 #ifndef KUDU_UTIL_FLAGS_H
 #define KUDU_UTIL_FLAGS_H
 
-#include <gflags/gflags.h>
+#include <cstdint>
 #include <string>
 #include <unordered_map>
 
-#include "kudu/gutil/macros.h"
+namespace google {
+  struct CommandLineFlagInfo;
+}
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/group_varint-inl.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/group_varint-inl.h b/src/kudu/util/group_varint-inl.h
index 8f418b6..27e289f 100644
--- a/src/kudu/util/group_varint-inl.h
+++ b/src/kudu/util/group_varint-inl.h
@@ -17,11 +17,37 @@
 #ifndef KUDU_UTIL_GROUP_VARINT_INL_H
 #define KUDU_UTIL_GROUP_VARINT_INL_H
 
+#include <emmintrin.h>
+#ifdef __linux__
+#include <endian.h>
+#endif
+#include <smmintrin.h>
+#include <tmmintrin.h>
+#include <xmmintrin.h>
+
+#include <cstdint>
+#include <cstring>
+
 #include <boost/utility/binary.hpp>
+#include <boost/parameter/name.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
+#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/control/iif.hpp>
+#include <boost/preprocessor/control/while.hpp>
+#include <boost/preprocessor/list/fold_left.hpp>
+#include <boost/preprocessor/logical/bitand.hpp>
+#include <boost/preprocessor/logical/bool.hpp>
+#include <boost/preprocessor/logical/compl.hpp>
+#include <boost/preprocessor/seq/elem.hpp>
+#include <boost/preprocessor/seq/fold_left.hpp>
+#include <boost/preprocessor/seq/size.hpp>
+#include <boost/preprocessor/tuple/elem.hpp>
+#include <boost/preprocessor/variadic/elem.hpp>
 #include <glog/logging.h>
-#include <stdint.h>
-#include <smmintrin.h>
 
+#ifndef __linux__
+#include "kudu/gutil/port.h"
+#endif
 #include "kudu/util/faststring.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 e8f4bfa..983fb0f 100644
--- a/src/kudu/util/group_varint-test.cc
+++ b/src/kudu/util/group_varint-test.cc
@@ -15,12 +15,21 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <glog/logging.h>
-#include <gtest/gtest.h>
+#include <cstdint>
+#include <cstdlib>
+#include <cstring>
+#include <string>
+#ifdef NDEBUG
 #include <vector>
+#endif
 
+#include <gtest/gtest.h>
+
+#include "kudu/util/faststring.h"
 #include "kudu/util/group_varint-inl.h"
+#ifdef NDEBUG
 #include "kudu/util/stopwatch.h"
+#endif
 
 namespace kudu {
 namespace coding {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/group_varint.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/group_varint.cc b/src/kudu/util/group_varint.cc
index 53c362b..47fbeb4 100644
--- a/src/kudu/util/group_varint.cc
+++ b/src/kudu/util/group_varint.cc
@@ -15,8 +15,11 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include <stdint.h>
-#include <string.h>
+#include <cstdint>
+#include <cstring>
+#include <ostream>
+#include <string>
+
 #include <boost/utility/binary.hpp>
 #include <glog/logging.h>
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/hash_util-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/hash_util-test.cc b/src/kudu/util/hash_util-test.cc
index a88f275..4e40dd5 100644
--- a/src/kudu/util/hash_util-test.cc
+++ b/src/kudu/util/hash_util-test.cc
@@ -15,7 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include "kudu/util/test_util.h"
+#include <cstdint>
+
+#include <gtest/gtest.h>
 
 #include "kudu/util/hash_util.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/hdr_histogram-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/hdr_histogram-test.cc b/src/kudu/util/hdr_histogram-test.cc
index bf1c101..5d51e98 100644
--- a/src/kudu/util/hdr_histogram-test.cc
+++ b/src/kudu/util/hdr_histogram-test.cc
@@ -14,11 +14,14 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
+
+#include <cstdint>
+
 #include <gtest/gtest.h>
 
 #include "kudu/util/hdr_histogram.h"
-#include "kudu/util/status.h"
 #include "kudu/util/test_util.h"
+#include "kudu/util/test_macros.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/hdr_histogram.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/hdr_histogram.cc b/src/kudu/util/hdr_histogram.cc
index e510df3..68894c7 100644
--- a/src/kudu/util/hdr_histogram.cc
+++ b/src/kudu/util/hdr_histogram.cc
@@ -26,6 +26,10 @@
 #include <algorithm>
 #include <cmath>
 #include <limits>
+#include <ostream>
+#include <string>
+
+#include <glog/logging.h>
 
 #include "kudu/gutil/atomicops.h"
 #include "kudu/gutil/bits.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/hdr_histogram.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/hdr_histogram.h b/src/kudu/util/hdr_histogram.h
index 19e31cc..14b5e95 100644
--- a/src/kudu/util/hdr_histogram.h
+++ b/src/kudu/util/hdr_histogram.h
@@ -52,12 +52,12 @@
 
 #include "kudu/gutil/atomicops.h"
 #include "kudu/gutil/gscoped_ptr.h"
+#include "kudu/gutil/macros.h"
+#include "kudu/gutil/port.h"
 
 namespace kudu {
 
-class AbstractHistogramIterator;
 class Status;
-class RecordedValuesIterator;
 
 // This implementation allows you to specify a range and accuracy (significant
 // digits) to support in an instance of a histogram. The class takes care of

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/hexdump.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/hexdump.cc b/src/kudu/util/hexdump.cc
index 8f7c6cd..59634c2 100644
--- a/src/kudu/util/hexdump.cc
+++ b/src/kudu/util/hexdump.cc
@@ -18,6 +18,8 @@
 #include "kudu/util/hexdump.h"
 
 #include <algorithm>
+#include <cctype>
+#include <cstdint>
 #include <string>
 
 #include "kudu/gutil/stringprintf.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/init.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/init.cc b/src/kudu/util/init.cc
index 3fa634a..bd97d79 100644
--- a/src/kudu/util/init.cc
+++ b/src/kudu/util/init.cc
@@ -20,8 +20,11 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#include <cstdlib>
 #include <string>
 
+#include <glog/logging.h>
+
 #include "kudu/gutil/cpu.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/status.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/init.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/init.h b/src/kudu/util/init.h
index 3f7916c..84e36e1 100644
--- a/src/kudu/util/init.h
+++ b/src/kudu/util/init.h
@@ -17,7 +17,6 @@
 #ifndef KUDU_UTIL_INIT_H
 #define KUDU_UTIL_INIT_H
 
-#include "kudu/gutil/macros.h"
 #include "kudu/util/status.h"
 
 namespace kudu {

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/inline_slice-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/inline_slice-test.cc b/src/kudu/util/inline_slice-test.cc
index df69028..8435bb0 100644
--- a/src/kudu/util/inline_slice-test.cc
+++ b/src/kudu/util/inline_slice-test.cc
@@ -15,12 +15,16 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <cstddef>
+#include <cstdint>
+#include <string>
+
 #include <gtest/gtest.h>
-#include <vector>
 
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/util/inline_slice.h"
 #include "kudu/util/memory/arena.h"
+#include "kudu/util/slice.h"
 
 namespace kudu {
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 b547595..df143d3 100644
--- a/src/kudu/util/interval_tree-test.cc
+++ b/src/kudu/util/interval_tree-test.cc
@@ -17,13 +17,18 @@
 
 // All rights reserved.
 
-#include <stdlib.h>
-
 #include <algorithm>
-#include <tuple>
-
-#include <boost/optional.hpp>
-#include <glog/stl_logging.h>
+#include <cstdlib>
+#include <map>
+#include <memory>
+#include <ostream>
+#include <string>
+#include <tuple>  // IWYU pragma: keep
+#include <utility>
+#include <vector>
+
+#include <boost/optional/optional.hpp>
+#include <glog/logging.h>
 #include <gtest/gtest.h>
 
 #include "kudu/gutil/stringprintf.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/jsonreader-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/jsonreader-test.cc b/src/kudu/util/jsonreader-test.cc
index 3c54cc7..d9bf65b 100644
--- a/src/kudu/util/jsonreader-test.cc
+++ b/src/kudu/util/jsonreader-test.cc
@@ -15,14 +15,18 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <cstddef>
+#include <cstdint>
 #include <string>
 #include <vector>
 
 #include <gtest/gtest.h>
+#include <rapidjson/document.h>
 
 #include "kudu/gutil/integral_types.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/jsonreader.h"
+#include "kudu/util/status.h"
 #include "kudu/util/test_macros.h"
 
 using rapidjson::Value;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/jsonreader.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/jsonreader.cc b/src/kudu/util/jsonreader.cc
index e39761d..826449d 100644
--- a/src/kudu/util/jsonreader.cc
+++ b/src/kudu/util/jsonreader.cc
@@ -17,6 +17,9 @@
 
 #include "kudu/util/jsonreader.h"
 
+#include <algorithm>
+
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/substitute.h"
 
 using rapidjson::Value;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/jsonreader.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/jsonreader.h b/src/kudu/util/jsonreader.h
index 2d9e982..4799f73 100644
--- a/src/kudu/util/jsonreader.h
+++ b/src/kudu/util/jsonreader.h
@@ -17,13 +17,12 @@
 #ifndef KUDU_UTIL_JSONREADER_H_
 #define KUDU_UTIL_JSONREADER_H_
 
-#include <stdint.h>
+#include <cstdint>
 #include <string>
 #include <vector>
 
 #include <rapidjson/document.h>
 
-#include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/util/status.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/jsonwriter-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/jsonwriter-test.cc b/src/kudu/util/jsonwriter-test.cc
index 08d54de..9dc7e69 100644
--- a/src/kudu/util/jsonwriter-test.cc
+++ b/src/kudu/util/jsonwriter-test.cc
@@ -15,12 +15,12 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <gflags/gflags.h>
 #include <gtest/gtest.h>
 
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/util/jsonwriter.h"
 #include "kudu/util/jsonwriter_test.pb.h"
-#include "kudu/util/logging.h"
 #include "kudu/util/test_util.h"
 
 using jsonwriter_test::TestAllTypes;

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/jsonwriter.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/jsonwriter.cc b/src/kudu/util/jsonwriter.cc
index ef9d5ba..d2f1f65 100644
--- a/src/kudu/util/jsonwriter.cc
+++ b/src/kudu/util/jsonwriter.cc
@@ -14,8 +14,10 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
+
 #include "kudu/util/jsonwriter.h"
 
+#include <new>
 #include <sstream>
 #include <string>
 #include <vector>
@@ -24,9 +26,11 @@
 #include <google/protobuf/descriptor.h>
 #include <google/protobuf/descriptor.pb.h>
 #include <google/protobuf/message.h>
+#include <rapidjson/writer.h>
 #include <rapidjson/prettywriter.h>
 #include <rapidjson/rapidjson.h>
 
+#include "kudu/gutil/port.h"
 #include "kudu/util/logging.h"
 #include "kudu/util/pb_util.pb.h"
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/jsonwriter.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/jsonwriter.h b/src/kudu/util/jsonwriter.h
index d3fb604..860bfaa 100644
--- a/src/kudu/util/jsonwriter.h
+++ b/src/kudu/util/jsonwriter.h
@@ -17,8 +17,9 @@
 #ifndef KUDU_UTIL_JSONWRITER_H
 #define KUDU_UTIL_JSONWRITER_H
 
-#include <inttypes.h>
-
+#include <cstddef>
+#include <cstdint>
+#include <iosfwd>
 #include <memory>
 #include <string>
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/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 a7097d8..b11c305 100644
--- a/src/kudu/util/kernel_stack_watchdog.cc
+++ b/src/kudu/util/kernel_stack_watchdog.cc
@@ -17,16 +17,24 @@
 
 #include "kudu/util/kernel_stack_watchdog.h"
 
+#include <cstdint>
+#include <cstring>
+#include <mutex>
+#include <ostream>
+#include <string>
+#include <utility>
+
 #include <boost/bind.hpp>
 #include <glog/logging.h>
 #include <gflags/gflags.h>
-#include <string>
 
+#include "kudu/gutil/dynamic_annotations.h"
 #include "kudu/util/debug-util.h"
 #include "kudu/util/debug/leakcheck_disabler.h"
 #include "kudu/util/env.h"
 #include "kudu/util/faststring.h"
 #include "kudu/util/flag_tags.h"
+#include "kudu/util/monotime.h"
 #include "kudu/util/thread.h"
 #include "kudu/util/status.h"
 #include "kudu/gutil/map-util.h"

http://git-wip-us.apache.org/repos/asf/kudu/blob/0f6dcf83/src/kudu/util/kernel_stack_watchdog.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/kernel_stack_watchdog.h b/src/kudu/util/kernel_stack_watchdog.h
index 79b6087..26b8253 100644
--- a/src/kudu/util/kernel_stack_watchdog.h
+++ b/src/kudu/util/kernel_stack_watchdog.h
@@ -53,18 +53,22 @@
 #ifndef KUDU_UTIL_KERNEL_STACK_WATCHDOG_H
 #define KUDU_UTIL_KERNEL_STACK_WATCHDOG_H
 
+#include <ctime>
 #include <string>
 #include <unordered_map>
 #include <vector>
 
+#include <glog/logging.h>
+
+#include "kudu/gutil/atomicops.h"
 #include "kudu/gutil/gscoped_ptr.h"
 #include "kudu/gutil/macros.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/gutil/singleton.h"
 #include "kudu/gutil/walltime.h"
 #include "kudu/util/countdown_latch.h"
 #include "kudu/util/locks.h"
-#include "kudu/util/monotime.h"
 #include "kudu/util/mutex.h"
 #include "kudu/util/threadlocal.h"
 


Mime
View raw message