Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
in-process-servers.h
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef IMPALA_TESTUTIL_IN_PROCESS_SERVERS_H
16 #define IMPALA_TESTUTIL_IN_PROCESS_SERVERS_H
17 
18 #include <boost/scoped_ptr.hpp>
19 #include <boost/shared_ptr.hpp>
20 
21 #include "common/status.h"
22 #include "util/thread.h"
23 #include "runtime/exec-env.h"
24 
25 namespace impala {
26 
27 class ImpalaServer;
28 class ThriftServer;
29 class Webserver;
30 class MetricGroup;
31 class Statestore;
32 
35 //
40  public:
43  InProcessImpalaServer(const std::string& hostname, int backend_port,
44  int subscriber_port, int webserver_port,
45  const std::string& statestore_host, int statestore_port);
46 
50  Status StartWithClientServers(int beeswax_port, int hs2_port, bool use_statestore);
51 
54  Status StartAsBackendOnly(bool use_statestore);
55 
58  Status Join();
59 
61 
62  MetricGroup* metrics() { return exec_env_->metrics(); }
63 
66  void SetCatalogInitialized();
67 
68  private:
70  const std::string hostname_;
71 
73  const uint32_t backend_port_;
74 
79 
81  boost::scoped_ptr<ExecEnv> exec_env_;
82 
84  boost::scoped_ptr<ThriftServer> be_server_;
85 
87  boost::scoped_ptr<ThriftServer> hs2_server_;
88 
90  boost::scoped_ptr<ThriftServer> beeswax_server_;
91 
92 };
93 
96  public:
98  InProcessStatestore(int statestore_port, int webserver_port);
99 
101  Status Start();
102 
103  uint32_t port() { return statestore_port_; }
104 
105  private:
107  boost::scoped_ptr<Webserver> webserver_;
108 
110  boost::scoped_ptr<MetricGroup> metrics_;
111 
114 
116  boost::scoped_ptr<Statestore> statestore_;
117 
119  boost::scoped_ptr<ThriftServer> statestore_server_;
120 
121  boost::scoped_ptr<Thread> statestore_main_loop_;
122 };
123 
124 }
125 
126 #endif
An in-process statestore, with webserver and metrics.
MetricGroups may be organised hierarchically as a tree.
Definition: metrics.h:200
InProcessImpalaServer(const std::string &hostname, int backend_port, int subscriber_port, int webserver_port, const std::string &statestore_host, int statestore_port)
boost::scoped_ptr< ExecEnv > exec_env_
ExecEnv holds much of the per-service state.
InProcessStatestore(int statestore_port, int webserver_port)
Constructs but does not start the statestore.
boost::scoped_ptr< Thread > statestore_main_loop_
boost::scoped_ptr< Statestore > statestore_
The statestore instance.
const std::string hostname_
Hostname for this server, usually FLAGS_hostname.
boost::scoped_ptr< MetricGroup > metrics_
MetricGroup object.
boost::scoped_ptr< Webserver > webserver_
Websever object to serve debug pages through.
boost::scoped_ptr< ThriftServer > hs2_server_
Frontend HiveServer2 server.
uint32_t statestore_port_
Port to start the statestore on.
const uint32_t backend_port_
Port to start the backend server on.
Status Start()
Starts the statestore server, and the processing thread.
boost::scoped_ptr< ThriftServer > statestore_server_
Statestore Thrift server.
Status StartWithClientServers(int beeswax_port, int hs2_port, bool use_statestore)
boost::scoped_ptr< ThriftServer > be_server_
Backend Thrift server.
boost::scoped_ptr< ThriftServer > beeswax_server_
Frontend Beeswax server.
Status StartAsBackendOnly(bool use_statestore)