IMPALA-3734: C++11 - Replace boost:shared_ptr with std:: equivalent We retain boost::shared_ptr in some files to maintain compatibility with Thrift's API.
Change-Id: I6b52ec7167999d6ac1d1c56a0ee9cef52dc1615e Reviewed-on: http://gerrit.cloudera.org:8080/3563 Reviewed-by: Henry Robinson <[email protected]> Tested-by: Internal Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/f4fbd791 Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/f4fbd791 Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/f4fbd791 Branch: refs/heads/master Commit: f4fbd7914c8756e8b657d630a3e5d7d1f010dfa1 Parents: 4680252 Author: Henry Robinson <[email protected]> Authored: Fri Jul 1 16:45:53 2016 -0700 Committer: Taras Bobrovytsky <[email protected]> Committed: Thu Jul 14 19:04:44 2016 +0000 ---------------------------------------------------------------------- be/src/benchmarks/network-perf-benchmark.cc | 7 ++-- be/src/catalog/catalogd-main.cc | 4 +- be/src/common/names.h | 22 +++++----- be/src/exec/exchange-node.h | 2 +- be/src/exec/hash-table.h | 8 ++-- be/src/resourcebroker/resource-broker.cc | 2 +- be/src/rpc/authentication.cc | 15 +++---- be/src/rpc/thrift-server-test.cc | 6 +-- be/src/rpc/thrift-server.cc | 43 ++++++++++---------- be/src/rpc/thrift-thread.cc | 12 +++--- be/src/rpc/thrift-util.cc | 5 +-- be/src/runtime/buffered-block-mgr.h | 6 +-- be/src/runtime/client-cache.h | 12 +++--- be/src/runtime/coordinator.h | 2 +- be/src/runtime/data-stream-mgr.h | 11 +++-- be/src/runtime/data-stream-sender.cc | 1 - be/src/runtime/data-stream-test.cc | 4 +- be/src/runtime/mem-tracker.cc | 5 ++- be/src/runtime/mem-tracker.h | 6 +-- be/src/runtime/plan-fragment-executor.h | 1 - be/src/runtime/runtime-state.h | 7 ++-- be/src/runtime/test-env.cc | 6 ++- be/src/runtime/test-env.h | 2 +- be/src/scheduling/query-resource-mgr.h | 9 ++--- be/src/service/fragment-mgr.h | 5 +-- be/src/service/impala-hs2-server.cc | 2 +- be/src/service/impala-server.cc | 21 +++++----- be/src/service/impala-server.h | 51 ++++++++++++------------ be/src/service/query-exec-state.h | 4 +- be/src/statestore/statestore-subscriber.cc | 5 ++- be/src/statestore/statestore-subscriber.h | 2 +- be/src/statestore/statestore.h | 2 +- be/src/statestore/statestored-main.cc | 4 +- be/src/testutil/impalad-query-executor.h | 1 - be/src/testutil/in-process-servers.cc | 3 +- be/src/testutil/in-process-servers.h | 1 - be/src/transport/TSaslServerTransport.cpp | 16 ++++---- be/src/transport/TSaslServerTransport.h | 7 ++-- be/src/udf/uda-test-harness-impl.h | 6 +-- be/src/udf/uda-test-harness.h | 1 - be/src/util/parquet-reader.cc | 9 +++-- 41 files changed, 167 insertions(+), 171 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/benchmarks/network-perf-benchmark.cc ---------------------------------------------------------------------- diff --git a/be/src/benchmarks/network-perf-benchmark.cc b/be/src/benchmarks/network-perf-benchmark.cc index b218c97..188419d 100644 --- a/be/src/benchmarks/network-perf-benchmark.cc +++ b/be/src/benchmarks/network-perf-benchmark.cc @@ -214,9 +214,10 @@ int main(int argc, char** argv) { } // Start up server and client shell - shared_ptr<TestServer> handler(new TestServer); - shared_ptr<ThreadFactory> thread_factory(new ThriftThreadFactory("test", "test")); - shared_ptr<TProcessor> processor(new NetworkTestServiceProcessor(handler)); + boost::shared_ptr<TestServer> handler(new TestServer); + boost::shared_ptr<ThreadFactory> thread_factory( + new ThriftThreadFactory("test", "test")); + boost::shared_ptr<TProcessor> processor(new NetworkTestServiceProcessor(handler)); ThriftServer* server = new ThriftServer("Network Test Server", processor, FLAGS_port, NULL, NULL, 100, ThriftServer::ThreadPool); thread* server_thread = new thread(&TestServer::Server, handler.get(), server); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/catalog/catalogd-main.cc ---------------------------------------------------------------------- diff --git a/be/src/catalog/catalogd-main.cc b/be/src/catalog/catalogd-main.cc index 5e4b186..2a84390 100644 --- a/be/src/catalog/catalogd-main.cc +++ b/be/src/catalog/catalogd-main.cc @@ -75,9 +75,9 @@ int CatalogdMain(int argc, char** argv) { CatalogServer catalog_server(metrics.get()); ABORT_IF_ERROR(catalog_server.Start()); catalog_server.RegisterWebpages(webserver.get()); - shared_ptr<TProcessor> processor( + boost::shared_ptr<TProcessor> processor( new CatalogServiceProcessor(catalog_server.thrift_iface())); - shared_ptr<TProcessorEventHandler> event_handler( + boost::shared_ptr<TProcessorEventHandler> event_handler( new RpcEventHandler("catalog-server", metrics.get())); processor->setEventHandler(event_handler); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/common/names.h ---------------------------------------------------------------------- diff --git a/be/src/common/names.h b/be/src/common/names.h index 7817e84..12240cb 100644 --- a/be/src/common/names.h +++ b/be/src/common/names.h @@ -12,14 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -/// The motivation for the using declarations below is to allow accessing the most relevant -/// and most frequently used library classes without having to explicitly pull them into -/// the global namespace. The goal is that when readers sees a usage of vector (etc.) without -/// any further specialization they can rely on the fact that it will be a std::vector. +/// The motivation for the using declarations below is to allow accessing the most +/// relevant and most frequently used library classes without having to explicitly pull +/// them into the global namespace. The goal is that when readers sees a usage of vector +/// (etc.) without any further specialization they can rely on the fact that it will be a +/// std::vector. // /// Instead of actually including the header files for the symbols, this file only checks -/// if certain include guards are defined before applying the using declaration. This makes sure -/// that including this file has no impact on the compile time. +/// if certain include guards are defined before applying the using declaration. This +/// makes sure that including this file has no impact on the compile time. // /// Please make sure that this file is included last in the cc file's include list to make /// sure that all relevant include guards are defined. @@ -109,6 +110,11 @@ using std::max; using std::sort; #endif +#ifdef _GLIBCXX_MEMORY +using std::make_shared; +using std::shared_ptr; +#endif + #ifdef BOOST_THREAD_THREAD_COMMON_HPP using boost::thread; #endif @@ -147,10 +153,6 @@ using boost::shared_lock; using boost::upgrade_lock; #endif -#ifdef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED -using boost::shared_ptr; -#endif - #ifdef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED using boost::scoped_ptr; #endif http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/exec/exchange-node.h ---------------------------------------------------------------------- diff --git a/be/src/exec/exchange-node.h b/be/src/exec/exchange-node.h index 0e8fc86..79e9484 100644 --- a/be/src/exec/exchange-node.h +++ b/be/src/exec/exchange-node.h @@ -69,7 +69,7 @@ class ExchangeNode : public ExecNode { /// The underlying DataStreamRecvr instance. Ownership is shared between this /// exchange node instance and the DataStreamMgr used to create the receiver. /// stream_recvr_->Close() must be called before this instance is destroyed. - boost::shared_ptr<DataStreamRecvr> stream_recvr_; + std::shared_ptr<DataStreamRecvr> stream_recvr_; /// our input rows are a prefix of the rows we produce RowDescriptor input_row_desc_; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/exec/hash-table.h ---------------------------------------------------------------------- diff --git a/be/src/exec/hash-table.h b/be/src/exec/hash-table.h index 5b466dc..b6c0b8c 100644 --- a/be/src/exec/hash-table.h +++ b/be/src/exec/hash-table.h @@ -51,10 +51,10 @@ class HashTable; /// joins and aggregation where the input/build tuple row descriptor is different from the /// find/probe descriptor. The implementation is designed to allow codegen for some paths. // -/// In addition to the hash table there is also an accompanying hash table context that -/// is used for insertions and probes. For example, the hash table context stores -/// evaluated expr results for the current row being processed when possible into a -/// contiguous memory buffer. This allows for efficient hash computation. +/// In addition to the hash table there is also an accompanying hash table context that is +/// used for insertions and probes. For example, the hash table context stores evaluated +/// expr results for the current row being processed when possible into a contiguous +/// memory buffer. This allows for efficient hash computation. // /// The hash table does not support removes. The hash table is not thread safe. /// The table is optimized for the partition hash aggregation and hash joins and is not http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/resourcebroker/resource-broker.cc ---------------------------------------------------------------------- diff --git a/be/src/resourcebroker/resource-broker.cc b/be/src/resourcebroker/resource-broker.cc index e4a933a..8a70ab1 100644 --- a/be/src/resourcebroker/resource-broker.cc +++ b/be/src/resourcebroker/resource-broker.cc @@ -151,7 +151,7 @@ Status ResourceBroker::Init() { return Status("No Llama addresses configured (see --llama_addresses)"); } - shared_ptr<TProcessor> llama_callback_proc( + boost::shared_ptr<TProcessor> llama_callback_proc( new llama::LlamaNotificationServiceProcessor(llama_callback_thrift_iface_)); llama_callback_server_.reset(new ThriftServer("llama-callback", llama_callback_proc, llama_callback_address_.port, NULL, metrics_, 5)); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/rpc/authentication.cc ---------------------------------------------------------------------- diff --git a/be/src/rpc/authentication.cc b/be/src/rpc/authentication.cc index afd4a7c..5c02168 100644 --- a/be/src/rpc/authentication.cc +++ b/be/src/rpc/authentication.cc @@ -830,7 +830,7 @@ Status SaslAuthProvider::Start() { } Status SaslAuthProvider::GetServerTransportFactory( - shared_ptr<TTransportFactory>* factory) { + boost::shared_ptr<TTransportFactory>* factory) { DCHECK(!principal_.empty() || has_ldap_); // This is the heart of the link between this file and thrift. Here we @@ -868,10 +868,10 @@ Status SaslAuthProvider::GetServerTransportFactory( } Status SaslAuthProvider::WrapClientTransport(const string& hostname, - shared_ptr<TTransport> raw_transport, const string& service_name, - shared_ptr<TTransport>* wrapped_transport) { + boost::shared_ptr<TTransport> raw_transport, const string& service_name, + boost::shared_ptr<TTransport>* wrapped_transport) { - shared_ptr<sasl::TSasl> sasl_client; + boost::shared_ptr<sasl::TSasl> sasl_client; const map<string, string> props; // Empty; unused by thrift const string auth_id; // Empty; unused by thrift @@ -898,15 +898,16 @@ Status SaslAuthProvider::WrapClientTransport(const string& hostname, return Status::OK(); } -Status NoAuthProvider::GetServerTransportFactory(shared_ptr<TTransportFactory>* factory) { +Status NoAuthProvider::GetServerTransportFactory( + boost::shared_ptr<TTransportFactory>* factory) { // No Sasl - yawn. Here, have a regular old buffered transport. factory->reset(new ThriftServer::BufferedTransportFactory()); return Status::OK(); } Status NoAuthProvider::WrapClientTransport(const string& hostname, - shared_ptr<TTransport> raw_transport, const string& dummy_service, - shared_ptr<TTransport>* wrapped_transport) { + boost::shared_ptr<TTransport> raw_transport, const string& dummy_service, + boost::shared_ptr<TTransport>* wrapped_transport) { // No Sasl - yawn. Don't do any transport wrapping for clients. *wrapped_transport = raw_transport; return Status::OK(); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/rpc/thrift-server-test.cc ---------------------------------------------------------------------- diff --git a/be/src/rpc/thrift-server-test.cc b/be/src/rpc/thrift-server-test.cc index 6b010d6..f1e45ad 100644 --- a/be/src/rpc/thrift-server-test.cc +++ b/be/src/rpc/thrift-server-test.cc @@ -52,9 +52,9 @@ class DummyStatestoreService : public StatestoreServiceIf { } }; -shared_ptr<TProcessor> MakeProcessor() { - shared_ptr<DummyStatestoreService> service(new DummyStatestoreService()); - return shared_ptr<TProcessor>(new StatestoreServiceProcessor(service)); +boost::shared_ptr<TProcessor> MakeProcessor() { + boost::shared_ptr<DummyStatestoreService> service(new DummyStatestoreService()); + return boost::shared_ptr<TProcessor>(new StatestoreServiceProcessor(service)); } int GetServerPort() { http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/rpc/thrift-server.cc ---------------------------------------------------------------------- diff --git a/be/src/rpc/thrift-server.cc b/be/src/rpc/thrift-server.cc index f3ec770..f1b2ff3 100644 --- a/be/src/rpc/thrift-server.cc +++ b/be/src/rpc/thrift-server.cc @@ -91,14 +91,15 @@ class ThriftServer::ThriftServerEventProcessor : public TServerEventHandler { // Called when a client connects; we create per-client state and call any // ConnectionHandlerIf handler. - virtual void* createContext(shared_ptr<TProtocol> input, shared_ptr<TProtocol> output); + virtual void* createContext(boost::shared_ptr<TProtocol> input, + boost::shared_ptr<TProtocol> output); // Called when a client starts an RPC; we set the thread-local connection context. - virtual void processContext(void* context, shared_ptr<TTransport> output); + virtual void processContext(void* context, boost::shared_ptr<TTransport> output); // Called when a client disconnects; we call any ConnectionHandlerIf handler. - virtual void deleteContext(void* serverContext, shared_ptr<TProtocol> input, - shared_ptr<TProtocol> output); + virtual void deleteContext(void* serverContext, boost::shared_ptr<TProtocol> input, + boost::shared_ptr<TProtocol> output); // Waits for a timeout of TIMEOUT_MS for a server to signal that it has started // correctly. @@ -218,12 +219,12 @@ const ThriftServer::ConnectionContext* ThriftServer::GetThreadConnectionContext( return __connection_context__; } -void* ThriftServer::ThriftServerEventProcessor::createContext(shared_ptr<TProtocol> input, - shared_ptr<TProtocol> output) { +void* ThriftServer::ThriftServerEventProcessor::createContext( + boost::shared_ptr<TProtocol> input, boost::shared_ptr<TProtocol> output) { TSocket* socket = NULL; TTransport* transport = input->getTransport().get(); - shared_ptr<ConnectionContext> connection_ptr = - shared_ptr<ConnectionContext>(new ConnectionContext); + boost::shared_ptr<ConnectionContext> connection_ptr = + boost::shared_ptr<ConnectionContext>(new ConnectionContext); TTransport* underlying_transport = (static_cast<TBufferedTransport*>(transport))->getUnderlyingTransport().get(); if (!thrift_server_->auth_provider_->is_sasl()) { @@ -267,12 +268,12 @@ void* ThriftServer::ThriftServerEventProcessor::createContext(shared_ptr<TProtoc } void ThriftServer::ThriftServerEventProcessor::processContext(void* context, - shared_ptr<TTransport> transport) { + boost::shared_ptr<TTransport> transport) { __connection_context__ = reinterpret_cast<ConnectionContext*>(context); } void ThriftServer::ThriftServerEventProcessor::deleteContext(void* serverContext, - shared_ptr<TProtocol> input, shared_ptr<TProtocol> output) { + boost::shared_ptr<TProtocol> input, boost::shared_ptr<TProtocol> output) { __connection_context__ = (ConnectionContext*) serverContext; if (thrift_server_->connection_handler_ != NULL) { @@ -289,9 +290,9 @@ void ThriftServer::ThriftServerEventProcessor::deleteContext(void* serverContext } } -ThriftServer::ThriftServer(const string& name, const shared_ptr<TProcessor>& processor, - int port, AuthProvider* auth_provider, MetricGroup* metrics, int num_worker_threads, - ServerType server_type) +ThriftServer::ThriftServer(const string& name, + const boost::shared_ptr<TProcessor>& processor, int port, AuthProvider* auth_provider, + MetricGroup* metrics, int num_worker_threads, ServerType server_type) : started_(false), port_(port), ssl_enabled_(false), @@ -336,11 +337,11 @@ class ImpalaSslSocketFactory : public TSSLSocketFactory { const string password_; }; -Status ThriftServer::CreateSocket(shared_ptr<TServerTransport>* socket) { +Status ThriftServer::CreateSocket(boost::shared_ptr<TServerTransport>* socket) { if (ssl_enabled()) { // This 'factory' is only called once, since CreateSocket() is only called from // Start() - shared_ptr<TSSLSocketFactory> socket_factory( + boost::shared_ptr<TSSLSocketFactory> socket_factory( new ImpalaSslSocketFactory(key_password_)); socket_factory->overrideDefaultPasswordCallback(); try { @@ -390,20 +391,20 @@ Status ThriftServer::EnableSsl(const string& certificate, const string& private_ Status ThriftServer::Start() { DCHECK(!started_); - shared_ptr<TProtocolFactory> protocol_factory(new TBinaryProtocolFactory()); - shared_ptr<ThreadFactory> thread_factory( + boost::shared_ptr<TProtocolFactory> protocol_factory(new TBinaryProtocolFactory()); + boost::shared_ptr<ThreadFactory> thread_factory( new ThriftThreadFactory("thrift-server", name_)); // Note - if you change the transport types here, you must check that the // logic in createContext is still accurate. - shared_ptr<TServerTransport> server_socket; - shared_ptr<TTransportFactory> transport_factory; + boost::shared_ptr<TServerTransport> server_socket; + boost::shared_ptr<TTransportFactory> transport_factory; RETURN_IF_ERROR(CreateSocket(&server_socket)); RETURN_IF_ERROR(auth_provider_->GetServerTransportFactory(&transport_factory)); switch (server_type_) { case ThreadPool: { - shared_ptr<ThreadManager> thread_mgr( + boost::shared_ptr<ThreadManager> thread_mgr( ThreadManager::newSimpleThreadManager(num_worker_threads_)); thread_mgr->threadFactory(thread_factory); thread_mgr->start(); @@ -421,7 +422,7 @@ Status ThriftServer::Start() { LOG(ERROR) << error_msg.str(); return Status(error_msg.str()); } - shared_ptr<ThriftServer::ThriftServerEventProcessor> event_processor( + boost::shared_ptr<ThriftServer::ThriftServerEventProcessor> event_processor( new ThriftServer::ThriftServerEventProcessor(this)); server_->setServerEventHandler(event_processor); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/rpc/thrift-thread.cc ---------------------------------------------------------------------- diff --git a/be/src/rpc/thrift-thread.cc b/be/src/rpc/thrift-thread.cc index e76d8dc..e94cbf0 100644 --- a/be/src/rpc/thrift-thread.cc +++ b/be/src/rpc/thrift-thread.cc @@ -41,17 +41,17 @@ void ThriftThread::join() { impala_thread_->Join(); } -shared_ptr<atc::Thread> ThriftThreadFactory::newThread( - shared_ptr<atc::Runnable> runnable) const { +boost::shared_ptr<atc::Thread> ThriftThreadFactory::newThread( + boost::shared_ptr<atc::Runnable> runnable) const { stringstream name; name << prefix_ << "-" << count_++; - shared_ptr<ThriftThread> result = - shared_ptr<ThriftThread>(new ThriftThread(group_, name.str(), runnable)); + boost::shared_ptr<ThriftThread> result = + boost::shared_ptr<ThriftThread>(new ThriftThread(group_, name.str(), runnable)); runnable->thread(result); return result; } -void ThriftThread::RunRunnable(shared_ptr<atc::Runnable> runnable, +void ThriftThread::RunRunnable(boost::shared_ptr<atc::Runnable> runnable, Promise<atc::Thread::id_t>* promise) { promise->Set(get_current()); // Passing runnable in to this method (rather than reading from this->runnable()) @@ -66,7 +66,7 @@ atc::Thread::id_t ThriftThreadFactory::getCurrentThreadId() const { } ThriftThread::ThriftThread(const string& group, const string& name, - shared_ptr<atc::Runnable> runnable) + boost::shared_ptr<atc::Runnable> runnable) : group_(group), name_(name) { // Sets this::runnable (and no, I don't know why it's not protected in atc::Thread) this->Thread::runnable(runnable); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/rpc/thrift-util.cc ---------------------------------------------------------------------- diff --git a/be/src/rpc/thrift-util.cc b/be/src/rpc/thrift-util.cc index db965f2..4677237 100644 --- a/be/src/rpc/thrift-util.cc +++ b/be/src/rpc/thrift-util.cc @@ -14,7 +14,6 @@ #include "rpc/thrift-util.h" -#include <boost/shared_ptr.hpp> #include <boost/thread.hpp> #include "util/hash-util.h" @@ -74,8 +73,8 @@ ThriftSerializer::ThriftSerializer(bool compact, int initial_buffer_size) : } } -shared_ptr<TProtocol> CreateDeserializeProtocol( - shared_ptr<TMemoryBuffer> mem, bool compact) { +boost::shared_ptr<TProtocol> CreateDeserializeProtocol( + boost::shared_ptr<TMemoryBuffer> mem, bool compact) { if (compact) { TCompactProtocolFactoryT<TMemoryBuffer> tproto_factory; return tproto_factory.getProtocol(mem); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/runtime/buffered-block-mgr.h ---------------------------------------------------------------------- diff --git a/be/src/runtime/buffered-block-mgr.h b/be/src/runtime/buffered-block-mgr.h index 416751e..141943f 100644 --- a/be/src/runtime/buffered-block-mgr.h +++ b/be/src/runtime/buffered-block-mgr.h @@ -15,8 +15,6 @@ #ifndef IMPALA_RUNTIME_BUFFERED_BLOCK_MGR #define IMPALA_RUNTIME_BUFFERED_BLOCK_MGR -#include <boost/shared_ptr.hpp> - #include "runtime/disk-io-mgr.h" #include "runtime/tmp-file-mgr.h" @@ -305,7 +303,7 @@ class BufferedBlockMgr { /// - buffer_size: maximum size of each buffer. static Status Create(RuntimeState* state, MemTracker* parent, RuntimeProfile* profile, TmpFileMgr* tmp_file_mgr, int64_t mem_limit, - int64_t buffer_size, boost::shared_ptr<BufferedBlockMgr>* block_mgr); + int64_t buffer_size, std::shared_ptr<BufferedBlockMgr>* block_mgr); ~BufferedBlockMgr(); @@ -637,7 +635,7 @@ class BufferedBlockMgr { /// map contains only weak ptrs. BufferedBlockMgrs that are handed out are shared ptrs. /// When all the shared ptrs are no longer referenced, the BufferedBlockMgr /// d'tor will be called at which point the weak ptr will be removed from the map. - typedef boost::unordered_map<TUniqueId, boost::weak_ptr<BufferedBlockMgr>> + typedef boost::unordered_map<TUniqueId, std::weak_ptr<BufferedBlockMgr>> BlockMgrsMap; static BlockMgrsMap query_to_block_mgrs_; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/runtime/client-cache.h ---------------------------------------------------------------------- diff --git a/be/src/runtime/client-cache.h b/be/src/runtime/client-cache.h index 350bdd6..0028167 100644 --- a/be/src/runtime/client-cache.h +++ b/be/src/runtime/client-cache.h @@ -141,20 +141,20 @@ class ClientCacheHelper { boost::mutex cache_lock_; /// Map from an address to a PerHostCache containing a list of keys that have entries in - /// client_map_ for that host. The value type is wrapped in a shared_ptr so that the copy - /// c'tor for PerHostCache is not required. + /// client_map_ for that host. The value type is wrapped in a shared_ptr so that the + /// copy c'tor for PerHostCache is not required. typedef boost::unordered_map< - TNetworkAddress, boost::shared_ptr<PerHostCache>> PerHostCacheMap; + TNetworkAddress, std::shared_ptr<PerHostCache>> PerHostCacheMap; PerHostCacheMap per_host_caches_; /// Protects client_map_. boost::mutex client_map_lock_; /// Map from client key back to its associated ThriftClientImpl transport. This is where - /// all the clients are actually stored, and client instances are owned by this class and - /// persist for exactly as long as they are present in this map. + /// all the clients are actually stored, and client instances are owned by this class + /// and persist for exactly as long as they are present in this map. /// We use a map (vs. unordered_map) so we get iterator consistency across operations. - typedef std::map<ClientKey, boost::shared_ptr<ThriftClientImpl>> ClientMap; + typedef std::map<ClientKey, std::shared_ptr<ThriftClientImpl>> ClientMap; ClientMap client_map_; /// Number of attempts to make to open a connection. 0 means retry indefinitely. http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/runtime/coordinator.h ---------------------------------------------------------------------- diff --git a/be/src/runtime/coordinator.h b/be/src/runtime/coordinator.h index 9994e1e..015fcaf 100644 --- a/be/src/runtime/coordinator.h +++ b/be/src/runtime/coordinator.h @@ -260,7 +260,7 @@ class Coordinator { /// is no coordinator fragment (i.e. executor_ == NULL). If executor_ is not NULL, /// this->runtime_state()->query_mem_tracker() returns the query mem tracker. /// (See this->query_mem_tracker()) - boost::shared_ptr<MemTracker> query_mem_tracker_; + std::shared_ptr<MemTracker> query_mem_tracker_; /// owned by plan root, which resides in runtime_state_'s pool const RowDescriptor* row_desc_; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/runtime/data-stream-mgr.h ---------------------------------------------------------------------- diff --git a/be/src/runtime/data-stream-mgr.h b/be/src/runtime/data-stream-mgr.h index 2b2b253..b4c422f 100644 --- a/be/src/runtime/data-stream-mgr.h +++ b/be/src/runtime/data-stream-mgr.h @@ -19,7 +19,6 @@ #include <list> #include <set> #include <boost/thread/mutex.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread/condition_variable.hpp> #include <boost/unordered_map.hpp> #include <boost/unordered_set.hpp> @@ -71,7 +70,7 @@ class DataStreamMgr { /// single stream. /// Ownership of the receiver is shared between this DataStream mgr instance and the /// caller. - boost::shared_ptr<DataStreamRecvr> CreateRecvr( + std::shared_ptr<DataStreamRecvr> CreateRecvr( RuntimeState* state, const RowDescriptor& row_desc, const TUniqueId& fragment_instance_id, PlanNodeId dest_node_id, int num_senders, int buffer_size, RuntimeProfile* profile, @@ -122,7 +121,7 @@ class DataStreamMgr { /// we don't want to create a map<pair<TUniqueId, PlanNodeId>, DataStreamRecvr*>, /// because that requires a bunch of copying of ids for lookup typedef boost::unordered_multimap<uint32_t, - boost::shared_ptr<DataStreamRecvr>> RecvrMap; + std::shared_ptr<DataStreamRecvr>> RecvrMap; RecvrMap receiver_map_; /// (Fragment instance id, Plan node id) pair that uniquely identifies a stream. @@ -155,7 +154,7 @@ class DataStreamMgr { /// Return the receiver for given fragment_instance_id/node_id, or NULL if not found. If /// 'acquire_lock' is false, assumes lock_ is already being held and won't try to /// acquire it. - boost::shared_ptr<DataStreamRecvr> FindRecvr(const TUniqueId& fragment_instance_id, + std::shared_ptr<DataStreamRecvr> FindRecvr(const TUniqueId& fragment_instance_id, PlanNodeId node_id, bool acquire_lock = true); /// Calls FindRecvr(), but if NULL is returned, wait for up to @@ -172,7 +171,7 @@ class DataStreamMgr { /// /// 2. *already_unregistered == false: the receiver has yet to arrive when this method /// returns, and the timeout has expired - boost::shared_ptr<DataStreamRecvr> FindRecvrOrWait( + std::shared_ptr<DataStreamRecvr> FindRecvrOrWait( const TUniqueId& fragment_instance_id, PlanNodeId node_id, bool* already_unregistered); @@ -182,7 +181,7 @@ class DataStreamMgr { inline uint32_t GetHashValue(const TUniqueId& fragment_instance_id, PlanNodeId node_id); /// The coordination primitive used to signal the arrival of a waited-for receiver - typedef Promise<boost::shared_ptr<DataStreamRecvr>> RendezvousPromise; + typedef Promise<std::shared_ptr<DataStreamRecvr>> RendezvousPromise; /// A reference-counted promise-wrapper used to coordinate between senders and /// receivers. The ref_count field tracks the number of senders waiting for the arrival http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/runtime/data-stream-sender.cc ---------------------------------------------------------------------- diff --git a/be/src/runtime/data-stream-sender.cc b/be/src/runtime/data-stream-sender.cc index 0a10963..61e8b85 100644 --- a/be/src/runtime/data-stream-sender.cc +++ b/be/src/runtime/data-stream-sender.cc @@ -15,7 +15,6 @@ #include "runtime/data-stream-sender.h" #include <iostream> -#include <boost/shared_ptr.hpp> #include <thrift/protocol/TDebugProtocol.h> #include "common/logging.h" http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/runtime/data-stream-test.cc ---------------------------------------------------------------------- diff --git a/be/src/runtime/data-stream-test.cc b/be/src/runtime/data-stream-test.cc index 54b38b1..57dfeef 100644 --- a/be/src/runtime/data-stream-test.cc +++ b/be/src/runtime/data-stream-test.cc @@ -446,8 +446,8 @@ class DataStreamTest : public testing::Test { // Start backend in separate thread. void StartBackend() { - shared_ptr<ImpalaTestBackend> handler(new ImpalaTestBackend(stream_mgr_)); - shared_ptr<TProcessor> processor(new ImpalaInternalServiceProcessor(handler)); + boost::shared_ptr<ImpalaTestBackend> handler(new ImpalaTestBackend(stream_mgr_)); + boost::shared_ptr<TProcessor> processor(new ImpalaInternalServiceProcessor(handler)); server_ = new ThriftServer("DataStreamTest backend", processor, FLAGS_port, NULL); server_->Start(); } http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/runtime/mem-tracker.cc ---------------------------------------------------------------------- diff --git a/be/src/runtime/mem-tracker.cc b/be/src/runtime/mem-tracker.cc index 66b0a8d..9749599 100644 --- a/be/src/runtime/mem-tracker.cc +++ b/be/src/runtime/mem-tracker.cc @@ -206,8 +206,9 @@ shared_ptr<MemTracker> MemTracker::GetQueryMemTracker( } else { // First time this id registered, make a new object. Give a shared ptr to // the caller and put a weak ptr in the map. - shared_ptr<MemTracker> tracker(new MemTracker(byte_limit, rm_reserved_limit, - Substitute("Query($0) Limit", lexical_cast<string>(id)), parent)); + shared_ptr<MemTracker> tracker = make_shared<MemTracker>(byte_limit, + rm_reserved_limit, Substitute("Query($0) Limit", lexical_cast<string>(id)), + parent); tracker->auto_unregister_ = true; tracker->query_id_ = id; request_to_mem_trackers_[id] = tracker; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/runtime/mem-tracker.h ---------------------------------------------------------------------- diff --git a/be/src/runtime/mem-tracker.h b/be/src/runtime/mem-tracker.h index 7700b06..aae37c5 100644 --- a/be/src/runtime/mem-tracker.h +++ b/be/src/runtime/mem-tracker.h @@ -19,8 +19,6 @@ #include <stdint.h> #include <map> #include <vector> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> #include <boost/thread/mutex.hpp> #include <boost/unordered_map.hpp> @@ -92,7 +90,7 @@ class MemTracker { /// 'parent' as the parent tracker. /// byte_limit and parent must be the same for all GetMemTracker() calls with the /// same id. - static boost::shared_ptr<MemTracker> GetQueryMemTracker(const TUniqueId& id, + static std::shared_ptr<MemTracker> GetQueryMemTracker(const TUniqueId& id, int64_t byte_limit, int64_t rm_reserved_limit, MemTracker* parent, QueryResourceMgr* res_mgr); @@ -408,7 +406,7 @@ class MemTracker { /// contains only weak ptrs. MemTrackers that are handed out via GetQueryMemTracker() /// are shared ptrs. When all the shared ptrs are no longer referenced, the MemTracker /// d'tor will be called at which point the weak ptr will be removed from the map. - typedef boost::unordered_map<TUniqueId, boost::weak_ptr<MemTracker>> + typedef boost::unordered_map<TUniqueId, std::weak_ptr<MemTracker>> RequestTrackersMap; static RequestTrackersMap request_to_mem_trackers_; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/runtime/plan-fragment-executor.h ---------------------------------------------------------------------- diff --git a/be/src/runtime/plan-fragment-executor.h b/be/src/runtime/plan-fragment-executor.h index 9511a3e..7bbe319 100644 --- a/be/src/runtime/plan-fragment-executor.h +++ b/be/src/runtime/plan-fragment-executor.h @@ -18,7 +18,6 @@ #include <vector> #include <boost/scoped_ptr.hpp> -#include <boost/shared_ptr.hpp> #include <boost/function.hpp> #include "common/status.h" http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/runtime/runtime-state.h ---------------------------------------------------------------------- diff --git a/be/src/runtime/runtime-state.h b/be/src/runtime/runtime-state.h index f104724..a5e560e 100644 --- a/be/src/runtime/runtime-state.h +++ b/be/src/runtime/runtime-state.h @@ -17,7 +17,6 @@ #define IMPALA_RUNTIME_RUNTIME_STATE_H #include <boost/scoped_ptr.hpp> -#include <boost/shared_ptr.hpp> #include <vector> #include <string> @@ -266,7 +265,7 @@ class RuntimeState { Status CreateCodegen(); /// Use a custom block manager for the query for testing purposes. - void set_block_mgr(const boost::shared_ptr<BufferedBlockMgr>& block_mgr) { + void set_block_mgr(const std::shared_ptr<BufferedBlockMgr>& block_mgr) { block_mgr_ = block_mgr; } @@ -326,7 +325,7 @@ class RuntimeState { /// MemTracker that is shared by all fragment instances running on this host. /// The query mem tracker must be released after the instance_mem_tracker_. - boost::shared_ptr<MemTracker> query_mem_tracker_; + std::shared_ptr<MemTracker> query_mem_tracker_; /// Memory usage of this fragment instance boost::scoped_ptr<MemTracker> instance_mem_tracker_; @@ -350,7 +349,7 @@ class RuntimeState { /// BufferedBlockMgr object used to allocate and manage blocks of input data in memory /// with a fixed memory budget. /// The block mgr is shared by all fragments for this query. - boost::shared_ptr<BufferedBlockMgr> block_mgr_; + std::shared_ptr<BufferedBlockMgr> block_mgr_; /// This is the node id of the root node for this plan fragment. This is used as the /// hash seed and has two useful properties: http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/runtime/test-env.cc ---------------------------------------------------------------------- diff --git a/be/src/runtime/test-env.cc b/be/src/runtime/test-env.cc index 223ecad..7a3c896 100644 --- a/be/src/runtime/test-env.cc +++ b/be/src/runtime/test-env.cc @@ -16,7 +16,11 @@ #include "util/disk-info.h" #include "util/impalad-metrics.h" -using namespace boost; +#include <memory> + +#include "common/names.h" + +using boost::scoped_ptr; namespace impala { http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/runtime/test-env.h ---------------------------------------------------------------------- diff --git a/be/src/runtime/test-env.h b/be/src/runtime/test-env.h index 900bb3e..69e1eb8 100644 --- a/be/src/runtime/test-env.h +++ b/be/src/runtime/test-env.h @@ -74,7 +74,7 @@ class TestEnv { boost::scoped_ptr<TmpFileMgr> tmp_file_mgr_; /// Per-query states with associated block managers. - vector<boost::shared_ptr<RuntimeState>> query_states_; + vector<std::shared_ptr<RuntimeState>> query_states_; }; } http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/scheduling/query-resource-mgr.h ---------------------------------------------------------------------- diff --git a/be/src/scheduling/query-resource-mgr.h b/be/src/scheduling/query-resource-mgr.h index c6080e8..d29394b 100644 --- a/be/src/scheduling/query-resource-mgr.h +++ b/be/src/scheduling/query-resource-mgr.h @@ -28,7 +28,6 @@ #include <boost/thread/mutex.hpp> #include <boost/unordered_map.hpp> #include <boost/unordered_set.hpp> -#include <boost/shared_ptr.hpp> #include <string> namespace impala { @@ -195,12 +194,12 @@ class QueryResourceMgr { /// parent QueryResourceMgr has been destroyed. /// TODO: Combine with ShouldExit(), and replace with AtomicBool when we have such a /// thing. - boost::shared_ptr<AtomicInt32> early_exit_; + std::shared_ptr<AtomicInt32> early_exit_; /// Signals to the destructor that the vcore acquisition thread is currently in an /// Expand() RPC. If so, the destructor does not need to wait for the acquisition thread /// to exit. - boost::shared_ptr<AtomicInt32> thread_in_expand_; + std::shared_ptr<AtomicInt32> thread_in_expand_; /// Creates the llama resource for the memory and/or cores specified, associated with /// the reservation context. @@ -209,8 +208,8 @@ class QueryResourceMgr { /// Run as a thread owned by acquire_cpu_thread_. Waits for notification from /// NotifyThreadUsageChange(), then checks the subscription level to decide if more /// VCores are needed, and starts a new expansion request if so. - void AcquireVcoreResources(boost::shared_ptr<AtomicInt32 > thread_in_expand, - boost::shared_ptr<AtomicInt32> early_exit); + void AcquireVcoreResources(std::shared_ptr<AtomicInt32 > thread_in_expand, + std::shared_ptr<AtomicInt32> early_exit); /// True if thread:VCore subscription is too high, meaning more VCores are required. /// Must be called holding threads_running_ lock. http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/service/fragment-mgr.h ---------------------------------------------------------------------- diff --git a/be/src/service/fragment-mgr.h b/be/src/service/fragment-mgr.h index 68eac15..4ec2253 100644 --- a/be/src/service/fragment-mgr.h +++ b/be/src/service/fragment-mgr.h @@ -15,7 +15,6 @@ #ifndef IMPALA_SERVICE_FRAGMENT_MGR_H #define IMPALA_SERVICE_FRAGMENT_MGR_H -#include <boost/shared_ptr.hpp> #include <boost/thread/mutex.hpp> #include <boost/unordered_map.hpp> @@ -58,7 +57,7 @@ class FragmentMgr { /// Returns a shared pointer to the FragmentExecState if one can be found for the /// given id. If the id is not found, the shared pointer will contain NULL. - boost::shared_ptr<FragmentExecState> GetFragmentExecState( + std::shared_ptr<FragmentExecState> GetFragmentExecState( const TUniqueId& fragment_instance_id); /// Publishes a global runtime filter to a local fragment. @@ -71,7 +70,7 @@ class FragmentMgr { /// Map from fragment instance id to exec state; FragmentExecState is owned by us and /// referenced as a shared_ptr to allow asynchronous calls to CancelPlanFragment() - typedef boost::unordered_map<TUniqueId, boost::shared_ptr<FragmentExecState>> + typedef boost::unordered_map<TUniqueId, std::shared_ptr<FragmentExecState>> FragmentExecStateMap; FragmentExecStateMap fragment_exec_state_map_; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/service/impala-hs2-server.cc ---------------------------------------------------------------------- diff --git a/be/src/service/impala-hs2-server.cc b/be/src/service/impala-hs2-server.cc index 803242e..709c733 100644 --- a/be/src/service/impala-hs2-server.cc +++ b/be/src/service/impala-hs2-server.cc @@ -590,7 +590,7 @@ void ImpalaServer::OpenSession(TOpenSessionResp& return_val, // query options. // TODO: put secret in session state map and check it // TODO: Fix duplication of code between here and ConnectionStart(). - shared_ptr<SessionState> state(new SessionState()); + shared_ptr<SessionState> state = make_shared<SessionState>(); state->closed = false; state->start_time = TimestampValue::LocalTime(); state->session_type = TSessionType::HIVESERVER2; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/service/impala-server.cc ---------------------------------------------------------------------- diff --git a/be/src/service/impala-server.cc b/be/src/service/impala-server.cc index e092f4b..a4e7cda 100644 --- a/be/src/service/impala-server.cc +++ b/be/src/service/impala-server.cc @@ -1069,7 +1069,7 @@ Status ImpalaServer::GetSessionState(const TUniqueId& session_id, lock_guard<mutex> l(session_state_map_lock_); SessionStateMap::iterator i = session_state_map_.find(session_id); if (i == session_state_map_.end()) { - *session_state = boost::shared_ptr<SessionState>(); + *session_state = std::shared_ptr<SessionState>(); return Status("Invalid session id"); } else { if (mark_active) { @@ -1839,13 +1839,13 @@ Status CreateImpalaServer(ExecEnv* exec_env, int beeswax_port, int hs2_port, int DCHECK((hs2_port == 0) == (hs2_server == NULL)); DCHECK((be_port == 0) == (be_server == NULL)); - shared_ptr<ImpalaServer> handler(new ImpalaServer(exec_env)); + boost::shared_ptr<ImpalaServer> handler(new ImpalaServer(exec_env)); if (beeswax_port != 0 && beeswax_server != NULL) { // Beeswax FE must be a TThreadPoolServer because ODBC and Hue only support // TThreadPoolServer. - shared_ptr<TProcessor> beeswax_processor(new ImpalaServiceProcessor(handler)); - shared_ptr<TProcessorEventHandler> event_handler( + boost::shared_ptr<TProcessor> beeswax_processor(new ImpalaServiceProcessor(handler)); + boost::shared_ptr<TProcessorEventHandler> event_handler( new RpcEventHandler("beeswax", exec_env->metrics())); beeswax_processor->setEventHandler(event_handler); *beeswax_server = new ThriftServer(BEESWAX_SERVER_NAME, beeswax_processor, @@ -1864,9 +1864,9 @@ Status CreateImpalaServer(ExecEnv* exec_env, int beeswax_port, int hs2_port, int if (hs2_port != 0 && hs2_server != NULL) { // HiveServer2 JDBC driver does not support non-blocking server. - shared_ptr<TProcessor> hs2_fe_processor( + boost::shared_ptr<TProcessor> hs2_fe_processor( new ImpalaHiveServer2ServiceProcessor(handler)); - shared_ptr<TProcessorEventHandler> event_handler( + boost::shared_ptr<TProcessorEventHandler> event_handler( new RpcEventHandler("hs2", exec_env->metrics())); hs2_fe_processor->setEventHandler(event_handler); @@ -1885,11 +1885,12 @@ Status CreateImpalaServer(ExecEnv* exec_env, int beeswax_port, int hs2_port, int } if (be_port != 0 && be_server != NULL) { - shared_ptr<FragmentMgr> fragment_mgr(new FragmentMgr()); - shared_ptr<ImpalaInternalService> thrift_if( + boost::shared_ptr<FragmentMgr> fragment_mgr(new FragmentMgr()); + boost::shared_ptr<ImpalaInternalService> thrift_if( new ImpalaInternalService(handler, fragment_mgr)); - shared_ptr<TProcessor> be_processor(new ImpalaInternalServiceProcessor(thrift_if)); - shared_ptr<TProcessorEventHandler> event_handler( + boost::shared_ptr<TProcessor> be_processor( + new ImpalaInternalServiceProcessor(thrift_if)); + boost::shared_ptr<TProcessorEventHandler> event_handler( new RpcEventHandler("backend", exec_env->metrics())); be_processor->setEventHandler(event_handler); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/service/impala-server.h ---------------------------------------------------------------------- diff --git a/be/src/service/impala-server.h b/be/src/service/impala-server.h index 9069d75..35b866d 100644 --- a/be/src/service/impala-server.h +++ b/be/src/service/impala-server.h @@ -314,11 +314,11 @@ class ImpalaServer : public ImpalaServiceIf, public ImpalaHiveServer2ServiceIf, /// Return exec state for given query_id, or NULL if not found. /// If 'lock' is true, the returned exec state's lock() will be acquired before /// the query_exec_state_map_lock_ is released. - boost::shared_ptr<QueryExecState> GetQueryExecState( + std::shared_ptr<QueryExecState> GetQueryExecState( const TUniqueId& query_id, bool lock); - /// Writes the session id, if found, for the given query to the output parameter. Returns - /// false if no query with the given ID is found. + /// Writes the session id, if found, for the given query to the output + /// parameter. Returns false if no query with the given ID is found. bool GetSessionIdForQuery(const TUniqueId& query_id, TUniqueId* session_id); /// Updates the number of databases / tables metrics from the FE catalog @@ -333,20 +333,20 @@ class ImpalaServer : public ImpalaServiceIf, public ImpalaHiveServer2ServiceIf, /// query_session_state is a snapshot of session state that changes when the /// query was run. (e.g. default database). Status Execute(TQueryCtx* query_ctx, - boost::shared_ptr<SessionState> session_state, - boost::shared_ptr<QueryExecState>* exec_state); + std::shared_ptr<SessionState> session_state, + std::shared_ptr<QueryExecState>* exec_state); /// Implements Execute() logic, but doesn't unregister query on error. Status ExecuteInternal(const TQueryCtx& query_ctx, - boost::shared_ptr<SessionState> session_state, + std::shared_ptr<SessionState> session_state, bool* registered_exec_state, - boost::shared_ptr<QueryExecState>* exec_state); + std::shared_ptr<QueryExecState>* exec_state); /// Registers the query exec state with query_exec_state_map_ using the globally /// unique query_id and add the query id to session state's open query list. /// The caller must have checked out the session state. - Status RegisterQuery(boost::shared_ptr<SessionState> session_state, - const boost::shared_ptr<QueryExecState>& exec_state); + Status RegisterQuery(std::shared_ptr<SessionState> session_state, + const std::shared_ptr<QueryExecState>& exec_state); /// Adds the query to the set of in-flight queries for the session. The query remains /// in-flight until the query is unregistered. Until a query is in-flight, an attempt @@ -357,8 +357,8 @@ class ImpalaServer : public ImpalaServiceIf, public ImpalaHiveServer2ServiceIf, /// (e.g. via an RPC) and the session close path can close (cancel and unregister) it. /// The query must have already been registered using RegisterQuery(). The caller /// must have checked out the session state. - Status SetQueryInflight(boost::shared_ptr<SessionState> session_state, - const boost::shared_ptr<QueryExecState>& exec_state); + Status SetQueryInflight(std::shared_ptr<SessionState> session_state, + const std::shared_ptr<QueryExecState>& exec_state); /// Unregister the query by cancelling it, removing exec_state from /// query_exec_state_map_, and removing the query id from session state's in-flight @@ -695,7 +695,7 @@ class ImpalaServer : public ImpalaServiceIf, public ImpalaHiveServer2ServiceIf, /// map from query id to exec state; QueryExecState is owned by us and referenced /// as a shared_ptr to allow asynchronous deletion - typedef boost::unordered_map<TUniqueId, boost::shared_ptr<QueryExecState>> + typedef boost::unordered_map<TUniqueId, std::shared_ptr<QueryExecState>> QueryExecStateMap; QueryExecStateMap query_exec_state_map_; boost::mutex query_exec_state_map_lock_; // protects query_exec_state_map_ @@ -792,11 +792,11 @@ class ImpalaServer : public ImpalaServiceIf, public ImpalaHiveServer2ServiceIf, public: ScopedSessionState(ImpalaServer* impala) : impala_(impala) { } - /// Marks a session as in-use, and saves it so that it can be unmarked when this object - /// goes out of scope. Returns OK unless there is an error in GetSessionState. + /// Marks a session as in-use, and saves it so that it can be unmarked when this + /// object goes out of scope. Returns OK unless there is an error in GetSessionState. /// Must only be called once per ScopedSessionState. Status WithSession(const TUniqueId& session_id, - boost::shared_ptr<SessionState>* session = NULL) { + std::shared_ptr<SessionState>* session = NULL) { DCHECK(session_.get() == NULL); RETURN_IF_ERROR(impala_->GetSessionState(session_id, &session_, true)); if (session != NULL) (*session) = session_; @@ -812,7 +812,7 @@ class ImpalaServer : public ImpalaServiceIf, public ImpalaHiveServer2ServiceIf, private: /// Reference-counted pointer to the session state object. - boost::shared_ptr<SessionState> session_; + std::shared_ptr<SessionState> session_; /// Saved so that we can access ImpalaServer methods to get / return session state. ImpalaServer* impala_; @@ -822,22 +822,21 @@ class ImpalaServer : public ImpalaServiceIf, public ImpalaHiveServer2ServiceIf, friend class ScopedSessionState; /// Protects session_state_map_. Should be taken before any query exec-state locks, - /// including query_exec_state_map_lock_. Should be taken before individual session-state - /// locks. + /// including query_exec_state_map_lock_. Should be taken before individual + /// session-state locks. boost::mutex session_state_map_lock_; /// A map from session identifier to a structure containing per-session information - typedef boost::unordered_map<TUniqueId, boost::shared_ptr<SessionState>> - SessionStateMap; + typedef boost::unordered_map<TUniqueId, std::shared_ptr<SessionState>> SessionStateMap; SessionStateMap session_state_map_; /// Protects connection_to_sessions_map_. May be taken before session_state_map_lock_. boost::mutex connection_to_sessions_map_lock_; - /// Map from a connection ID to the associated list of sessions so that all can be closed - /// when the connection ends. HS2 allows for multiplexing several sessions across a - /// single connection. If a session has already been closed (only possible via HS2) it is - /// not removed from this map to avoid the cost of looking it up. + /// Map from a connection ID to the associated list of sessions so that all can be + /// closed when the connection ends. HS2 allows for multiplexing several sessions across + /// a single connection. If a session has already been closed (only possible via HS2) it + /// is not removed from this map to avoid the cost of looking it up. typedef boost::unordered_map<TUniqueId, std::vector<TUniqueId>> ConnectionToSessionMap; ConnectionToSessionMap connection_to_sessions_map_; @@ -847,11 +846,11 @@ class ImpalaServer : public ImpalaServiceIf, public ImpalaHiveServer2ServiceIf, /// If mark_active is true, also checks if the session is expired or closed and /// increments the session's reference counter if it is still alive. Status GetSessionState(const TUniqueId& session_id, - boost::shared_ptr<SessionState>* session_state, bool mark_active = false); + std::shared_ptr<SessionState>* session_state, bool mark_active = false); /// Decrement the session's reference counter and mark last_accessed_ms so that state /// expiration can proceed. - inline void MarkSessionInactive(boost::shared_ptr<SessionState> session) { + inline void MarkSessionInactive(std::shared_ptr<SessionState> session) { boost::lock_guard<boost::mutex> l(session->lock); DCHECK_GT(session->ref_count, 0); --session->ref_count; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/service/query-exec-state.h ---------------------------------------------------------------------- diff --git a/be/src/service/query-exec-state.h b/be/src/service/query-exec-state.h index c2459cf..0c56451 100644 --- a/be/src/service/query-exec-state.h +++ b/be/src/service/query-exec-state.h @@ -56,7 +56,7 @@ class QueryExecStateCleaner; class ImpalaServer::QueryExecState { public: QueryExecState(const TQueryCtx& query_ctx, ExecEnv* exec_env, Frontend* frontend, - ImpalaServer* server, boost::shared_ptr<ImpalaServer::SessionState> session); + ImpalaServer* server, std::shared_ptr<ImpalaServer::SessionState> session); ~QueryExecState(); @@ -228,7 +228,7 @@ class ImpalaServer::QueryExecState { bool is_block_on_wait_joining_; /// Session that this query is from - boost::shared_ptr<SessionState> session_; + std::shared_ptr<SessionState> session_; /// Resource assignment determined by scheduler. Owned by obj_pool_. boost::scoped_ptr<QuerySchedule> schedule_; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/statestore/statestore-subscriber.cc ---------------------------------------------------------------------- diff --git a/be/src/statestore/statestore-subscriber.cc b/be/src/statestore/statestore-subscriber.cc index 4df9aa7..aac51a0 100644 --- a/be/src/statestore/statestore-subscriber.cc +++ b/be/src/statestore/statestore-subscriber.cc @@ -178,8 +178,9 @@ Status StatestoreSubscriber::Start() { LOG(INFO) << "Starting statestore subscriber"; // Backend must be started before registration - shared_ptr<TProcessor> processor(new StatestoreSubscriberProcessor(thrift_iface_)); - shared_ptr<TProcessorEventHandler> event_handler( + boost::shared_ptr<TProcessor> processor( + new StatestoreSubscriberProcessor(thrift_iface_)); + boost::shared_ptr<TProcessorEventHandler> event_handler( new RpcEventHandler("statestore-subscriber", metrics_)); processor->setEventHandler(event_handler); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/statestore/statestore-subscriber.h ---------------------------------------------------------------------- diff --git a/be/src/statestore/statestore-subscriber.h b/be/src/statestore/statestore-subscriber.h index ddf663e..be0c37e 100644 --- a/be/src/statestore/statestore-subscriber.h +++ b/be/src/statestore/statestore-subscriber.h @@ -133,7 +133,7 @@ class StatestoreSubscriber { boost::shared_ptr<StatestoreSubscriberIf> thrift_iface_; /// Container for the heartbeat server. - boost::shared_ptr<ThriftServer> heartbeat_server_; + std::shared_ptr<ThriftServer> heartbeat_server_; /// Failure detector that tracks heartbeat messages from the statestore. boost::scoped_ptr<impala::TimeoutFailureDetector> failure_detector_; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/statestore/statestore.h ---------------------------------------------------------------------- diff --git a/be/src/statestore/statestore.h b/be/src/statestore/statestore.h index 2061e38..edc9d39 100644 --- a/be/src/statestore/statestore.h +++ b/be/src/statestore/statestore.h @@ -350,7 +350,7 @@ class Statestore { /// Subscribers are held in shared_ptrs so that RegisterSubscriber() may overwrite their /// entry in this map while UpdateSubscriber() tries to update an existing registration /// without risk of use-after-free. - typedef boost::unordered_map<SubscriberId, boost::shared_ptr<Subscriber>> + typedef boost::unordered_map<SubscriberId, std::shared_ptr<Subscriber>> SubscriberMap; SubscriberMap subscribers_; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/statestore/statestored-main.cc ---------------------------------------------------------------------- diff --git a/be/src/statestore/statestored-main.cc b/be/src/statestore/statestored-main.cc index 450459c..c344cea 100644 --- a/be/src/statestore/statestored-main.cc +++ b/be/src/statestore/statestored-main.cc @@ -70,9 +70,9 @@ int StatestoredMain(int argc, char** argv) { Statestore statestore(metrics.get()); statestore.RegisterWebpages(webserver.get()); - shared_ptr<TProcessor> processor( + boost::shared_ptr<TProcessor> processor( new StatestoreServiceProcessor(statestore.thrift_iface())); - shared_ptr<TProcessorEventHandler> event_handler( + boost::shared_ptr<TProcessorEventHandler> event_handler( new RpcEventHandler("statestore", metrics.get())); processor->setEventHandler(event_handler); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/testutil/impalad-query-executor.h ---------------------------------------------------------------------- diff --git a/be/src/testutil/impalad-query-executor.h b/be/src/testutil/impalad-query-executor.h index f0448f8..137092f 100644 --- a/be/src/testutil/impalad-query-executor.h +++ b/be/src/testutil/impalad-query-executor.h @@ -19,7 +19,6 @@ #include <string> #include <vector> #include <boost/scoped_ptr.hpp> -#include <boost/shared_ptr.hpp> #include <boost/thread/thread.hpp> #include "rpc/thrift-client.h" http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/testutil/in-process-servers.cc ---------------------------------------------------------------------- diff --git a/be/src/testutil/in-process-servers.cc b/be/src/testutil/in-process-servers.cc index c4bbcbd..7ff1136 100644 --- a/be/src/testutil/in-process-servers.cc +++ b/be/src/testutil/in-process-servers.cc @@ -34,7 +34,6 @@ DECLARE_string(ssl_private_key); using namespace apache::thrift; using namespace impala; -using boost::shared_ptr; InProcessImpalaServer* InProcessImpalaServer::StartWithEphemeralPorts( const string& statestore_host, int statestore_port) { @@ -153,7 +152,7 @@ InProcessStatestore::InProcessStatestore(int statestore_port, int webserver_port Status InProcessStatestore::Start() { webserver_->Start(); - shared_ptr<TProcessor> processor( + boost::shared_ptr<TProcessor> processor( new StatestoreServiceProcessor(statestore_->thrift_iface())); statestore_server_.reset(new ThriftServer("StatestoreService", processor, http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/testutil/in-process-servers.h ---------------------------------------------------------------------- diff --git a/be/src/testutil/in-process-servers.h b/be/src/testutil/in-process-servers.h index f670115..49acc8a 100644 --- a/be/src/testutil/in-process-servers.h +++ b/be/src/testutil/in-process-servers.h @@ -16,7 +16,6 @@ #define IMPALA_TESTUTIL_IN_PROCESS_SERVERS_H #include <boost/scoped_ptr.hpp> -#include <boost/shared_ptr.hpp> #include "common/status.h" #include "util/thread.h" http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/transport/TSaslServerTransport.cpp ---------------------------------------------------------------------- diff --git a/be/src/transport/TSaslServerTransport.cpp b/be/src/transport/TSaslServerTransport.cpp index 1dfa99e..b867c31 100644 --- a/be/src/transport/TSaslServerTransport.cpp +++ b/be/src/transport/TSaslServerTransport.cpp @@ -39,7 +39,7 @@ using namespace sasl; namespace apache { namespace thrift { namespace transport { -TSaslServerTransport::TSaslServerTransport(shared_ptr<TTransport> transport) +TSaslServerTransport::TSaslServerTransport(boost::shared_ptr<TTransport> transport) : TSaslTransport(transport) { } @@ -50,7 +50,7 @@ TSaslServerTransport::TSaslServerTransport(const string& mechanism, unsigned flags, const map<string, string>& props, const vector<struct sasl_callback>& callbacks, - shared_ptr<TTransport> transport) + boost::shared_ptr<TTransport> transport) : TSaslTransport(transport) { addServerDefinition(mechanism, protocol, serverName, realm, flags, props, callbacks); @@ -112,8 +112,8 @@ void TSaslServerTransport::handleSaslStartMessage() { } -shared_ptr<TTransport> TSaslServerTransport::Factory::getTransport( - shared_ptr<TTransport> trans) { +boost::shared_ptr<TTransport> TSaslServerTransport::Factory::getTransport( + boost::shared_ptr<TTransport> trans) { lock_guard<mutex> l(transportMap_mutex_); // Thrift servers use both an input and an output transport to communicate with // clients. In principal, these can be different, but for SASL clients we require them @@ -135,13 +135,13 @@ shared_ptr<TTransport> TSaslServerTransport::Factory::getTransport( // ensure that when ret_transport is eventually deleted, its corresponding map entry is // removed. That is likely to be error prone given the locking involved; for now we go // with the simple solution. - map<shared_ptr<TTransport>, shared_ptr<TBufferedTransport>>::iterator trans_map = - transportMap_.find(trans); + TransportMap::iterator trans_map = transportMap_.find(trans); VLOG_EVERY_N(2, 100) << "getTransport(): transportMap_ size is: " << transportMap_.size(); - shared_ptr<TBufferedTransport> ret_transport; + boost::shared_ptr<TBufferedTransport> ret_transport; if (trans_map == transportMap_.end()) { - shared_ptr<TTransport> wrapped(new TSaslServerTransport(serverDefinitionMap_, trans)); + boost::shared_ptr<TTransport> wrapped( + new TSaslServerTransport(serverDefinitionMap_, trans)); ret_transport.reset(new TBufferedTransport(wrapped, impala::ThriftServer::BufferedTransportFactory::DEFAULT_BUFFER_SIZE_BYTES)); ret_transport.get()->open(); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/transport/TSaslServerTransport.h ---------------------------------------------------------------------- diff --git a/be/src/transport/TSaslServerTransport.h b/be/src/transport/TSaslServerTransport.h index 31041b3..28d17e6 100644 --- a/be/src/transport/TSaslServerTransport.h +++ b/be/src/transport/TSaslServerTransport.h @@ -33,7 +33,7 @@ namespace apache { namespace thrift { namespace transport { /** - * + * * This transport implements the Simple Authentication and Security Layer (SASL). * see: http://www.ietf.org/rfc/rfc2222.txt. It is based on and depends * on the presence of the cyrus-sasl library. @@ -173,8 +173,9 @@ class TSaslServerTransport : public TSaslTransport { std::map<std::string, TSaslServerDefinition*> serverDefinitionMap_; /* Map from a transport to its Sasl Transport (wrapped by a TBufferedTransport). */ - std::map<boost::shared_ptr<TTransport>, - boost::shared_ptr<TBufferedTransport>> transportMap_; + typedef std::map<boost::shared_ptr<TTransport>, + boost::shared_ptr<TBufferedTransport>> TransportMap; + TransportMap transportMap_; /* Lock to synchronize the transport map. */ boost::mutex transportMap_mutex_; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/udf/uda-test-harness-impl.h ---------------------------------------------------------------------- diff --git a/be/src/udf/uda-test-harness-impl.h b/be/src/udf/uda-test-harness-impl.h index 8be05ca..ecd4db8 100644 --- a/be/src/udf/uda-test-harness-impl.h +++ b/be/src/udf/uda-test-harness-impl.h @@ -20,8 +20,6 @@ #include <sstream> #include <vector> -#include <boost/shared_ptr.hpp> - namespace impala_udf { /// Utility class to help test UDAs. This can be used to test the correctness of the @@ -181,7 +179,7 @@ RESULT UdaTestHarnessBase<RESULT, INTERMEDIATE>::ExecuteSingleNode( template<typename RESULT, typename INTERMEDIATE> RESULT UdaTestHarnessBase<RESULT, INTERMEDIATE>::ExecuteOneLevel(int num_nodes, ScopedFunctionContext* result_context) { - std::vector<boost::shared_ptr<ScopedFunctionContext>> contexts; + std::vector<std::shared_ptr<ScopedFunctionContext>> contexts; std::vector<INTERMEDIATE> intermediates; contexts.resize(num_nodes); @@ -237,7 +235,7 @@ RESULT UdaTestHarnessBase<RESULT, INTERMEDIATE>::ExecuteOneLevel(int num_nodes, template<typename RESULT, typename INTERMEDIATE> RESULT UdaTestHarnessBase<RESULT, INTERMEDIATE>::ExecuteTwoLevel( int num1, int num2, ScopedFunctionContext* result_context) { - std::vector<boost::shared_ptr<ScopedFunctionContext>> level1_contexts, level2_contexts; + std::vector<std::shared_ptr<ScopedFunctionContext>> level1_contexts, level2_contexts; std::vector<INTERMEDIATE> level1_intermediates, level2_intermediates; level1_contexts.resize(num1); level2_contexts.resize(num2); http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/udf/uda-test-harness.h ---------------------------------------------------------------------- diff --git a/be/src/udf/uda-test-harness.h b/be/src/udf/uda-test-harness.h index 5391e4d..772acb4 100644 --- a/be/src/udf/uda-test-harness.h +++ b/be/src/udf/uda-test-harness.h @@ -21,7 +21,6 @@ #include <vector> #include <boost/scoped_ptr.hpp> -#include <boost/shared_ptr.hpp> #include "udf/udf.h" #include "udf/udf-debug.h" http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4fbd791/be/src/util/parquet-reader.cc ---------------------------------------------------------------------- diff --git a/be/src/util/parquet-reader.cc b/be/src/util/parquet-reader.cc index 47f69a5..e4bec3e 100644 --- a/be/src/util/parquet-reader.cc +++ b/be/src/util/parquet-reader.cc @@ -48,8 +48,8 @@ using std::min; // Some code is replicated to make this more stand-alone. const uint8_t PARQUET_VERSION_NUMBER[] = {'P', 'A', 'R', '1'}; -shared_ptr<TProtocol> CreateDeserializeProtocol( - shared_ptr<TMemoryBuffer> mem, bool compact) { +boost::shared_ptr<TProtocol> CreateDeserializeProtocol( + boost::shared_ptr<TMemoryBuffer> mem, bool compact) { if (compact) { TCompactProtocolFactoryT<TMemoryBuffer> tproto_factory; return tproto_factory.getProtocol(mem); @@ -66,8 +66,9 @@ template <class T> bool DeserializeThriftMsg(uint8_t* buf, uint32_t* len, bool compact, T* deserialized_msg) { // Deserialize msg bytes into c++ thrift msg using memory transport. - shared_ptr<TMemoryBuffer> tmem_transport(new TMemoryBuffer(buf, *len)); - shared_ptr<TProtocol> tproto = CreateDeserializeProtocol(tmem_transport, compact); + boost::shared_ptr<TMemoryBuffer> tmem_transport(new TMemoryBuffer(buf, *len)); + boost::shared_ptr<TProtocol> tproto = + CreateDeserializeProtocol(tmem_transport, compact); try { deserialized_msg->read(tproto.get()); } catch (apache::thrift::protocol::TProtocolException& e) {
