Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
catalog-server.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_CATALOG_CATALOG_SERVER_H
16 #define IMPALA_CATALOG_CATALOG_SERVER_H
17 
18 #include <string>
19 #include <vector>
20 #include <boost/shared_ptr.hpp>
21 #include <boost/thread/mutex.hpp>
22 #include <boost/unordered_set.hpp>
23 
24 #include "gen-cpp/CatalogService.h"
25 #include "gen-cpp/Frontend_types.h"
26 #include "gen-cpp/Types_types.h"
27 #include "catalog/catalog.h"
29 #include "util/metrics.h"
30 #include "rapidjson/rapidjson.h"
31 
32 namespace impala {
33 
35 class Catalog;
36 class TGetAllCatalogObjectsResponse;
37 
58  public:
59  static std::string IMPALA_CATALOG_TOPIC;
60  CatalogServer(MetricGroup* metrics);
61 
64  Status Start();
65 
66  void RegisterWebpages(Webserver* webserver);
67 
69  const boost::shared_ptr<CatalogServiceIf>& thrift_iface() const {
70  return thrift_iface_;
71  }
72  Catalog* catalog() const { return catalog_.get(); }
73 
74  private:
76  boost::shared_ptr<CatalogServiceIf> thrift_iface_;
79  boost::scoped_ptr<Catalog> catalog_;
80  boost::scoped_ptr<StatestoreSubscriber> statestore_subscriber_;
81 
84 
86  boost::scoped_ptr<Thread> catalog_update_gathering_thread_;
87 
92  boost::unordered_set<std::string> catalog_topic_entry_keys_;
93 
96  boost::mutex catalog_lock_;
97 
102  boost::condition_variable catalog_update_cv_;
103 
107  std::vector<TTopicItem> pending_topic_updates_;
108 
115 
119 
124 
128 
144  const StatestoreSubscriber::TopicDeltaMap& incoming_topic_deltas,
145  std::vector<TTopicDelta>* subscriber_topic_updates);
146 
152 
166  void BuildTopicUpdates(const std::vector<TCatalogObject>& catalog_objects);
167 
187  rapidjson::Document* document);
188 
195  rapidjson::Document* document);
196 };
197 
198 }
199 
200 #endif
boost::mutex catalog_lock_
boost::condition_variable catalog_update_cv_
void CatalogObjectsUrlCallback(const Webserver::ArgumentMap &args, rapidjson::Document *document)
MetricGroups may be organised hierarchically as a tree.
Definition: metrics.h:200
boost::unordered_set< std::string > catalog_topic_entry_keys_
void BuildTopicUpdates(const std::vector< TCatalogObject > &catalog_objects)
static std::string IMPALA_CATALOG_TOPIC
boost::shared_ptr< CatalogServiceIf > thrift_iface_
Thrift API implementation which proxies requests onto this CatalogService.
boost::scoped_ptr< StatestoreSubscriber > statestore_subscriber_
std::map< std::string, std::string > ArgumentMap
Definition: webserver.h:36
boost::scoped_ptr< Thread > catalog_update_gathering_thread_
Thread that polls the catalog for any updates.
boost::scoped_ptr< Catalog > catalog_
const boost::shared_ptr< CatalogServiceIf > & thrift_iface() const
Returns the Thrift API interface that proxies requests onto the local CatalogService.
CatalogServer(MetricGroup *metrics)
int64_t catalog_objects_min_version_
void RegisterWebpages(Webserver *webserver)
std::map< Statestore::TopicId, TTopicDelta > TopicDeltaMap
A TopicDeltaMap is passed to each callback. See UpdateCallback for more details.
ThriftSerializer thrift_serializer_
Catalog * catalog() const
void CatalogUrlCallback(const Webserver::ArgumentMap &args, rapidjson::Document *document)
StatsMetric< double > * topic_processing_time_metric_
Metric that tracks the amount of time taken preparing a catalog update.
void UpdateCatalogTopicCallback(const StatestoreSubscriber::TopicDeltaMap &incoming_topic_deltas, std::vector< TTopicDelta > *subscriber_topic_updates)
int64_t catalog_objects_max_version_
MetricGroup * metrics_
std::vector< TTopicItem > pending_topic_updates_
int64_t last_sent_catalog_version_