You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
Reformat all code to coding standard
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -10,425 +10,490 @@
|
||||
#include <thrift/TDispatchProcessor.h>
|
||||
#include "querytele_types.h"
|
||||
|
||||
namespace querytele {
|
||||
namespace querytele
|
||||
{
|
||||
|
||||
class QueryTeleServiceIf {
|
||||
public:
|
||||
virtual ~QueryTeleServiceIf() {}
|
||||
virtual void postQuery(const QueryTele& query) = 0;
|
||||
virtual void postStep(const StepTele& query) = 0;
|
||||
virtual void postImport(const ImportTele& query) = 0;
|
||||
class QueryTeleServiceIf
|
||||
{
|
||||
public:
|
||||
virtual ~QueryTeleServiceIf() {}
|
||||
virtual void postQuery(const QueryTele& query) = 0;
|
||||
virtual void postStep(const StepTele& query) = 0;
|
||||
virtual void postImport(const ImportTele& query) = 0;
|
||||
};
|
||||
|
||||
class QueryTeleServiceIfFactory {
|
||||
public:
|
||||
typedef QueryTeleServiceIf Handler;
|
||||
class QueryTeleServiceIfFactory
|
||||
{
|
||||
public:
|
||||
typedef QueryTeleServiceIf Handler;
|
||||
|
||||
virtual ~QueryTeleServiceIfFactory() {}
|
||||
virtual ~QueryTeleServiceIfFactory() {}
|
||||
|
||||
virtual QueryTeleServiceIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0;
|
||||
virtual void releaseHandler(QueryTeleServiceIf* /* handler */) = 0;
|
||||
virtual QueryTeleServiceIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0;
|
||||
virtual void releaseHandler(QueryTeleServiceIf* /* handler */) = 0;
|
||||
};
|
||||
|
||||
class QueryTeleServiceIfSingletonFactory : virtual public QueryTeleServiceIfFactory {
|
||||
public:
|
||||
QueryTeleServiceIfSingletonFactory(const boost::shared_ptr<QueryTeleServiceIf>& iface) : iface_(iface) {}
|
||||
virtual ~QueryTeleServiceIfSingletonFactory() {}
|
||||
class QueryTeleServiceIfSingletonFactory : virtual public QueryTeleServiceIfFactory
|
||||
{
|
||||
public:
|
||||
QueryTeleServiceIfSingletonFactory(const boost::shared_ptr<QueryTeleServiceIf>& iface) : iface_(iface) {}
|
||||
virtual ~QueryTeleServiceIfSingletonFactory() {}
|
||||
|
||||
virtual QueryTeleServiceIf* getHandler(const ::apache::thrift::TConnectionInfo&) {
|
||||
return iface_.get();
|
||||
}
|
||||
virtual void releaseHandler(QueryTeleServiceIf* /* handler */) {}
|
||||
virtual QueryTeleServiceIf* getHandler(const ::apache::thrift::TConnectionInfo&)
|
||||
{
|
||||
return iface_.get();
|
||||
}
|
||||
virtual void releaseHandler(QueryTeleServiceIf* /* handler */) {}
|
||||
|
||||
protected:
|
||||
boost::shared_ptr<QueryTeleServiceIf> iface_;
|
||||
protected:
|
||||
boost::shared_ptr<QueryTeleServiceIf> iface_;
|
||||
};
|
||||
|
||||
class QueryTeleServiceNull : virtual public QueryTeleServiceIf {
|
||||
public:
|
||||
virtual ~QueryTeleServiceNull() {}
|
||||
void postQuery(const QueryTele& /* query */) {
|
||||
return;
|
||||
}
|
||||
void postStep(const StepTele& /* query */) {
|
||||
return;
|
||||
}
|
||||
void postImport(const ImportTele& /* query */) {
|
||||
return;
|
||||
}
|
||||
class QueryTeleServiceNull : virtual public QueryTeleServiceIf
|
||||
{
|
||||
public:
|
||||
virtual ~QueryTeleServiceNull() {}
|
||||
void postQuery(const QueryTele& /* query */)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void postStep(const StepTele& /* query */)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void postImport(const ImportTele& /* query */)
|
||||
{
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct _QueryTeleService_postQuery_args__isset {
|
||||
_QueryTeleService_postQuery_args__isset() : query(false) {}
|
||||
bool query;
|
||||
typedef struct _QueryTeleService_postQuery_args__isset
|
||||
{
|
||||
_QueryTeleService_postQuery_args__isset() : query(false) {}
|
||||
bool query;
|
||||
} _QueryTeleService_postQuery_args__isset;
|
||||
|
||||
class QueryTeleService_postQuery_args {
|
||||
public:
|
||||
class QueryTeleService_postQuery_args
|
||||
{
|
||||
public:
|
||||
|
||||
QueryTeleService_postQuery_args() {
|
||||
}
|
||||
QueryTeleService_postQuery_args()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~QueryTeleService_postQuery_args() throw() {}
|
||||
virtual ~QueryTeleService_postQuery_args() throw() {}
|
||||
|
||||
QueryTele query;
|
||||
QueryTele query;
|
||||
|
||||
_QueryTeleService_postQuery_args__isset __isset;
|
||||
_QueryTeleService_postQuery_args__isset __isset;
|
||||
|
||||
void __set_query(const QueryTele& val) {
|
||||
query = val;
|
||||
}
|
||||
void __set_query(const QueryTele& val)
|
||||
{
|
||||
query = val;
|
||||
}
|
||||
|
||||
bool operator == (const QueryTeleService_postQuery_args & rhs) const
|
||||
{
|
||||
if (!(query == rhs.query))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
bool operator != (const QueryTeleService_postQuery_args &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
bool operator == (const QueryTeleService_postQuery_args& rhs) const
|
||||
{
|
||||
if (!(query == rhs.query))
|
||||
return false;
|
||||
|
||||
bool operator < (const QueryTeleService_postQuery_args & ) const;
|
||||
return true;
|
||||
}
|
||||
bool operator != (const QueryTeleService_postQuery_args& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
bool operator < (const QueryTeleService_postQuery_args& ) const;
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QueryTeleService_postQuery_pargs {
|
||||
public:
|
||||
class QueryTeleService_postQuery_pargs
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual ~QueryTeleService_postQuery_pargs() throw() {}
|
||||
virtual ~QueryTeleService_postQuery_pargs() throw() {}
|
||||
|
||||
const QueryTele* query;
|
||||
const QueryTele* query;
|
||||
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QueryTeleService_postQuery_result {
|
||||
public:
|
||||
class QueryTeleService_postQuery_result
|
||||
{
|
||||
public:
|
||||
|
||||
QueryTeleService_postQuery_result() {
|
||||
}
|
||||
QueryTeleService_postQuery_result()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~QueryTeleService_postQuery_result() throw() {}
|
||||
virtual ~QueryTeleService_postQuery_result() throw() {}
|
||||
|
||||
|
||||
bool operator == (const QueryTeleService_postQuery_result & /* rhs */) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool operator != (const QueryTeleService_postQuery_result &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
bool operator == (const QueryTeleService_postQuery_result& /* rhs */) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool operator != (const QueryTeleService_postQuery_result& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
bool operator < (const QueryTeleService_postQuery_result & ) const;
|
||||
bool operator < (const QueryTeleService_postQuery_result& ) const;
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QueryTeleService_postQuery_presult {
|
||||
public:
|
||||
class QueryTeleService_postQuery_presult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual ~QueryTeleService_postQuery_presult() throw() {}
|
||||
virtual ~QueryTeleService_postQuery_presult() throw() {}
|
||||
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
|
||||
};
|
||||
|
||||
typedef struct _QueryTeleService_postStep_args__isset {
|
||||
_QueryTeleService_postStep_args__isset() : query(false) {}
|
||||
bool query;
|
||||
typedef struct _QueryTeleService_postStep_args__isset
|
||||
{
|
||||
_QueryTeleService_postStep_args__isset() : query(false) {}
|
||||
bool query;
|
||||
} _QueryTeleService_postStep_args__isset;
|
||||
|
||||
class QueryTeleService_postStep_args {
|
||||
public:
|
||||
class QueryTeleService_postStep_args
|
||||
{
|
||||
public:
|
||||
|
||||
QueryTeleService_postStep_args() {
|
||||
}
|
||||
QueryTeleService_postStep_args()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~QueryTeleService_postStep_args() throw() {}
|
||||
virtual ~QueryTeleService_postStep_args() throw() {}
|
||||
|
||||
StepTele query;
|
||||
StepTele query;
|
||||
|
||||
_QueryTeleService_postStep_args__isset __isset;
|
||||
_QueryTeleService_postStep_args__isset __isset;
|
||||
|
||||
void __set_query(const StepTele& val) {
|
||||
query = val;
|
||||
}
|
||||
void __set_query(const StepTele& val)
|
||||
{
|
||||
query = val;
|
||||
}
|
||||
|
||||
bool operator == (const QueryTeleService_postStep_args & rhs) const
|
||||
{
|
||||
if (!(query == rhs.query))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
bool operator != (const QueryTeleService_postStep_args &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
bool operator == (const QueryTeleService_postStep_args& rhs) const
|
||||
{
|
||||
if (!(query == rhs.query))
|
||||
return false;
|
||||
|
||||
bool operator < (const QueryTeleService_postStep_args & ) const;
|
||||
return true;
|
||||
}
|
||||
bool operator != (const QueryTeleService_postStep_args& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
bool operator < (const QueryTeleService_postStep_args& ) const;
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QueryTeleService_postStep_pargs {
|
||||
public:
|
||||
class QueryTeleService_postStep_pargs
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual ~QueryTeleService_postStep_pargs() throw() {}
|
||||
virtual ~QueryTeleService_postStep_pargs() throw() {}
|
||||
|
||||
const StepTele* query;
|
||||
const StepTele* query;
|
||||
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QueryTeleService_postStep_result {
|
||||
public:
|
||||
class QueryTeleService_postStep_result
|
||||
{
|
||||
public:
|
||||
|
||||
QueryTeleService_postStep_result() {
|
||||
}
|
||||
QueryTeleService_postStep_result()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~QueryTeleService_postStep_result() throw() {}
|
||||
virtual ~QueryTeleService_postStep_result() throw() {}
|
||||
|
||||
|
||||
bool operator == (const QueryTeleService_postStep_result & /* rhs */) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool operator != (const QueryTeleService_postStep_result &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
bool operator == (const QueryTeleService_postStep_result& /* rhs */) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool operator != (const QueryTeleService_postStep_result& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
bool operator < (const QueryTeleService_postStep_result & ) const;
|
||||
bool operator < (const QueryTeleService_postStep_result& ) const;
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QueryTeleService_postStep_presult {
|
||||
public:
|
||||
class QueryTeleService_postStep_presult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual ~QueryTeleService_postStep_presult() throw() {}
|
||||
virtual ~QueryTeleService_postStep_presult() throw() {}
|
||||
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
|
||||
};
|
||||
|
||||
typedef struct _QueryTeleService_postImport_args__isset {
|
||||
_QueryTeleService_postImport_args__isset() : query(false) {}
|
||||
bool query;
|
||||
typedef struct _QueryTeleService_postImport_args__isset
|
||||
{
|
||||
_QueryTeleService_postImport_args__isset() : query(false) {}
|
||||
bool query;
|
||||
} _QueryTeleService_postImport_args__isset;
|
||||
|
||||
class QueryTeleService_postImport_args {
|
||||
public:
|
||||
class QueryTeleService_postImport_args
|
||||
{
|
||||
public:
|
||||
|
||||
QueryTeleService_postImport_args() {
|
||||
}
|
||||
|
||||
virtual ~QueryTeleService_postImport_args() throw() {}
|
||||
|
||||
ImportTele query;
|
||||
|
||||
_QueryTeleService_postImport_args__isset __isset;
|
||||
|
||||
void __set_query(const ImportTele& val) {
|
||||
query = val;
|
||||
}
|
||||
|
||||
bool operator == (const QueryTeleService_postImport_args & rhs) const
|
||||
{
|
||||
if (!(query == rhs.query))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
bool operator != (const QueryTeleService_postImport_args &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
bool operator < (const QueryTeleService_postImport_args & ) const;
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QueryTeleService_postImport_pargs {
|
||||
public:
|
||||
|
||||
|
||||
virtual ~QueryTeleService_postImport_pargs() throw() {}
|
||||
|
||||
const ImportTele* query;
|
||||
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QueryTeleService_postImport_result {
|
||||
public:
|
||||
|
||||
QueryTeleService_postImport_result() {
|
||||
}
|
||||
|
||||
virtual ~QueryTeleService_postImport_result() throw() {}
|
||||
|
||||
|
||||
bool operator == (const QueryTeleService_postImport_result & /* rhs */) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool operator != (const QueryTeleService_postImport_result &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
bool operator < (const QueryTeleService_postImport_result & ) const;
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QueryTeleService_postImport_presult {
|
||||
public:
|
||||
|
||||
|
||||
virtual ~QueryTeleService_postImport_presult() throw() {}
|
||||
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
|
||||
};
|
||||
|
||||
class QueryTeleServiceClient : virtual public QueryTeleServiceIf {
|
||||
public:
|
||||
QueryTeleServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) :
|
||||
piprot_(prot),
|
||||
poprot_(prot) {
|
||||
iprot_ = prot.get();
|
||||
oprot_ = prot.get();
|
||||
}
|
||||
QueryTeleServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) :
|
||||
piprot_(iprot),
|
||||
poprot_(oprot) {
|
||||
iprot_ = iprot.get();
|
||||
oprot_ = oprot.get();
|
||||
}
|
||||
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
|
||||
return piprot_;
|
||||
}
|
||||
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {
|
||||
return poprot_;
|
||||
}
|
||||
void postQuery(const QueryTele& query);
|
||||
void send_postQuery(const QueryTele& query);
|
||||
void recv_postQuery();
|
||||
void postStep(const StepTele& query);
|
||||
void send_postStep(const StepTele& query);
|
||||
void recv_postStep();
|
||||
void postImport(const ImportTele& query);
|
||||
void send_postImport(const ImportTele& query);
|
||||
void recv_postImport();
|
||||
protected:
|
||||
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
|
||||
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
|
||||
::apache::thrift::protocol::TProtocol* iprot_;
|
||||
::apache::thrift::protocol::TProtocol* oprot_;
|
||||
};
|
||||
|
||||
class QueryTeleServiceProcessor : public ::apache::thrift::TDispatchProcessor {
|
||||
protected:
|
||||
boost::shared_ptr<QueryTeleServiceIf> iface_;
|
||||
virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext);
|
||||
private:
|
||||
typedef void (QueryTeleServiceProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*);
|
||||
typedef std::map<std::string, ProcessFunction> ProcessMap;
|
||||
ProcessMap processMap_;
|
||||
void process_postQuery(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
|
||||
void process_postStep(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
|
||||
void process_postImport(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
|
||||
public:
|
||||
QueryTeleServiceProcessor(boost::shared_ptr<QueryTeleServiceIf> iface) :
|
||||
iface_(iface) {
|
||||
processMap_["postQuery"] = &QueryTeleServiceProcessor::process_postQuery;
|
||||
processMap_["postStep"] = &QueryTeleServiceProcessor::process_postStep;
|
||||
processMap_["postImport"] = &QueryTeleServiceProcessor::process_postImport;
|
||||
}
|
||||
|
||||
virtual ~QueryTeleServiceProcessor() {}
|
||||
};
|
||||
|
||||
class QueryTeleServiceProcessorFactory : public ::apache::thrift::TProcessorFactory {
|
||||
public:
|
||||
QueryTeleServiceProcessorFactory(const ::boost::shared_ptr< QueryTeleServiceIfFactory >& handlerFactory) :
|
||||
handlerFactory_(handlerFactory) {}
|
||||
|
||||
::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);
|
||||
|
||||
protected:
|
||||
::boost::shared_ptr< QueryTeleServiceIfFactory > handlerFactory_;
|
||||
};
|
||||
|
||||
class QueryTeleServiceMultiface : virtual public QueryTeleServiceIf {
|
||||
public:
|
||||
QueryTeleServiceMultiface(std::vector<boost::shared_ptr<QueryTeleServiceIf> >& ifaces) : ifaces_(ifaces) {
|
||||
}
|
||||
virtual ~QueryTeleServiceMultiface() {}
|
||||
protected:
|
||||
std::vector<boost::shared_ptr<QueryTeleServiceIf> > ifaces_;
|
||||
QueryTeleServiceMultiface() {}
|
||||
void add(boost::shared_ptr<QueryTeleServiceIf> iface) {
|
||||
ifaces_.push_back(iface);
|
||||
}
|
||||
public:
|
||||
void postQuery(const QueryTele& query) {
|
||||
size_t sz = ifaces_.size();
|
||||
size_t i = 0;
|
||||
for (; i < (sz - 1); ++i) {
|
||||
ifaces_[i]->postQuery(query);
|
||||
QueryTeleService_postImport_args()
|
||||
{
|
||||
}
|
||||
ifaces_[i]->postQuery(query);
|
||||
}
|
||||
|
||||
void postStep(const StepTele& query) {
|
||||
size_t sz = ifaces_.size();
|
||||
size_t i = 0;
|
||||
for (; i < (sz - 1); ++i) {
|
||||
ifaces_[i]->postStep(query);
|
||||
}
|
||||
ifaces_[i]->postStep(query);
|
||||
}
|
||||
virtual ~QueryTeleService_postImport_args() throw() {}
|
||||
|
||||
void postImport(const ImportTele& query) {
|
||||
size_t sz = ifaces_.size();
|
||||
size_t i = 0;
|
||||
for (; i < (sz - 1); ++i) {
|
||||
ifaces_[i]->postImport(query);
|
||||
ImportTele query;
|
||||
|
||||
_QueryTeleService_postImport_args__isset __isset;
|
||||
|
||||
void __set_query(const ImportTele& val)
|
||||
{
|
||||
query = val;
|
||||
}
|
||||
|
||||
bool operator == (const QueryTeleService_postImport_args& rhs) const
|
||||
{
|
||||
if (!(query == rhs.query))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
bool operator != (const QueryTeleService_postImport_args& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
bool operator < (const QueryTeleService_postImport_args& ) const;
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QueryTeleService_postImport_pargs
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual ~QueryTeleService_postImport_pargs() throw() {}
|
||||
|
||||
const ImportTele* query;
|
||||
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QueryTeleService_postImport_result
|
||||
{
|
||||
public:
|
||||
|
||||
QueryTeleService_postImport_result()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~QueryTeleService_postImport_result() throw() {}
|
||||
|
||||
|
||||
bool operator == (const QueryTeleService_postImport_result& /* rhs */) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool operator != (const QueryTeleService_postImport_result& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
bool operator < (const QueryTeleService_postImport_result& ) const;
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class QueryTeleService_postImport_presult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual ~QueryTeleService_postImport_presult() throw() {}
|
||||
|
||||
|
||||
uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
|
||||
|
||||
};
|
||||
|
||||
class QueryTeleServiceClient : virtual public QueryTeleServiceIf
|
||||
{
|
||||
public:
|
||||
QueryTeleServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) :
|
||||
piprot_(prot),
|
||||
poprot_(prot)
|
||||
{
|
||||
iprot_ = prot.get();
|
||||
oprot_ = prot.get();
|
||||
}
|
||||
QueryTeleServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) :
|
||||
piprot_(iprot),
|
||||
poprot_(oprot)
|
||||
{
|
||||
iprot_ = iprot.get();
|
||||
oprot_ = oprot.get();
|
||||
}
|
||||
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol()
|
||||
{
|
||||
return piprot_;
|
||||
}
|
||||
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol()
|
||||
{
|
||||
return poprot_;
|
||||
}
|
||||
void postQuery(const QueryTele& query);
|
||||
void send_postQuery(const QueryTele& query);
|
||||
void recv_postQuery();
|
||||
void postStep(const StepTele& query);
|
||||
void send_postStep(const StepTele& query);
|
||||
void recv_postStep();
|
||||
void postImport(const ImportTele& query);
|
||||
void send_postImport(const ImportTele& query);
|
||||
void recv_postImport();
|
||||
protected:
|
||||
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
|
||||
boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
|
||||
::apache::thrift::protocol::TProtocol* iprot_;
|
||||
::apache::thrift::protocol::TProtocol* oprot_;
|
||||
};
|
||||
|
||||
class QueryTeleServiceProcessor : public ::apache::thrift::TDispatchProcessor
|
||||
{
|
||||
protected:
|
||||
boost::shared_ptr<QueryTeleServiceIf> iface_;
|
||||
virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext);
|
||||
private:
|
||||
typedef void (QueryTeleServiceProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*);
|
||||
typedef std::map<std::string, ProcessFunction> ProcessMap;
|
||||
ProcessMap processMap_;
|
||||
void process_postQuery(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
|
||||
void process_postStep(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
|
||||
void process_postImport(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
|
||||
public:
|
||||
QueryTeleServiceProcessor(boost::shared_ptr<QueryTeleServiceIf> iface) :
|
||||
iface_(iface)
|
||||
{
|
||||
processMap_["postQuery"] = &QueryTeleServiceProcessor::process_postQuery;
|
||||
processMap_["postStep"] = &QueryTeleServiceProcessor::process_postStep;
|
||||
processMap_["postImport"] = &QueryTeleServiceProcessor::process_postImport;
|
||||
}
|
||||
|
||||
virtual ~QueryTeleServiceProcessor() {}
|
||||
};
|
||||
|
||||
class QueryTeleServiceProcessorFactory : public ::apache::thrift::TProcessorFactory
|
||||
{
|
||||
public:
|
||||
QueryTeleServiceProcessorFactory(const ::boost::shared_ptr< QueryTeleServiceIfFactory >& handlerFactory) :
|
||||
handlerFactory_(handlerFactory) {}
|
||||
|
||||
::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);
|
||||
|
||||
protected:
|
||||
::boost::shared_ptr< QueryTeleServiceIfFactory > handlerFactory_;
|
||||
};
|
||||
|
||||
class QueryTeleServiceMultiface : virtual public QueryTeleServiceIf
|
||||
{
|
||||
public:
|
||||
QueryTeleServiceMultiface(std::vector<boost::shared_ptr<QueryTeleServiceIf> >& ifaces) : ifaces_(ifaces)
|
||||
{
|
||||
}
|
||||
virtual ~QueryTeleServiceMultiface() {}
|
||||
protected:
|
||||
std::vector<boost::shared_ptr<QueryTeleServiceIf> > ifaces_;
|
||||
QueryTeleServiceMultiface() {}
|
||||
void add(boost::shared_ptr<QueryTeleServiceIf> iface)
|
||||
{
|
||||
ifaces_.push_back(iface);
|
||||
}
|
||||
public:
|
||||
void postQuery(const QueryTele& query)
|
||||
{
|
||||
size_t sz = ifaces_.size();
|
||||
size_t i = 0;
|
||||
|
||||
for (; i < (sz - 1); ++i)
|
||||
{
|
||||
ifaces_[i]->postQuery(query);
|
||||
}
|
||||
|
||||
ifaces_[i]->postQuery(query);
|
||||
}
|
||||
|
||||
void postStep(const StepTele& query)
|
||||
{
|
||||
size_t sz = ifaces_.size();
|
||||
size_t i = 0;
|
||||
|
||||
for (; i < (sz - 1); ++i)
|
||||
{
|
||||
ifaces_[i]->postStep(query);
|
||||
}
|
||||
|
||||
ifaces_[i]->postStep(query);
|
||||
}
|
||||
|
||||
void postImport(const ImportTele& query)
|
||||
{
|
||||
size_t sz = ifaces_.size();
|
||||
size_t i = 0;
|
||||
|
||||
for (; i < (sz - 1); ++i)
|
||||
{
|
||||
ifaces_[i]->postImport(query);
|
||||
}
|
||||
|
||||
ifaces_[i]->postImport(query);
|
||||
}
|
||||
ifaces_[i]->postImport(query);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@ -26,10 +26,10 @@ namespace querytele
|
||||
class QueryStepParms
|
||||
{
|
||||
public:
|
||||
explicit QueryStepParms(StepTeleStats::StepType st=StepTeleStats::T_INVALID) : stepType(st) { }
|
||||
~QueryStepParms() { }
|
||||
explicit QueryStepParms(StepTeleStats::StepType st = StepTeleStats::T_INVALID) : stepType(st) { }
|
||||
~QueryStepParms() { }
|
||||
|
||||
StepTeleStats::StepType stepType;
|
||||
StepTeleStats::StepType stepType;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -39,20 +39,20 @@ namespace querytele
|
||||
/*static*/
|
||||
uuids::uuid QueryTeleClient::genUUID()
|
||||
{
|
||||
mutex::scoped_lock lk(uuidgenMtx);
|
||||
return uuidgen();
|
||||
mutex::scoped_lock lk(uuidgenMtx);
|
||||
return uuidgen();
|
||||
}
|
||||
|
||||
/*static*/
|
||||
int64_t QueryTeleClient::timeNowms()
|
||||
{
|
||||
int64_t nowms=-1;
|
||||
struct timeval tv;
|
||||
int64_t nowms = -1;
|
||||
struct timeval tv;
|
||||
|
||||
if (gettimeofday(&tv, 0) == 0)
|
||||
nowms = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
|
||||
if (gettimeofday(&tv, 0) == 0)
|
||||
nowms = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
|
||||
|
||||
return nowms;
|
||||
return nowms;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,11 +6,13 @@
|
||||
*/
|
||||
#include "querytele_constants.h"
|
||||
|
||||
namespace querytele {
|
||||
namespace querytele
|
||||
{
|
||||
|
||||
const queryteleConstants g_querytele_constants;
|
||||
|
||||
queryteleConstants::queryteleConstants() {
|
||||
queryteleConstants::queryteleConstants()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -9,11 +9,13 @@
|
||||
|
||||
#include "querytele_types.h"
|
||||
|
||||
namespace querytele {
|
||||
namespace querytele
|
||||
{
|
||||
|
||||
class queryteleConstants {
|
||||
public:
|
||||
queryteleConstants();
|
||||
class queryteleConstants
|
||||
{
|
||||
public:
|
||||
queryteleConstants();
|
||||
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ using namespace std;
|
||||
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
namespace bu=boost::uuids;
|
||||
namespace bu = boost::uuids;
|
||||
|
||||
#include "queryteleserverparms.h"
|
||||
#include "querytele_types.h"
|
||||
@ -39,125 +39,141 @@ using namespace querytele;
|
||||
#define QT_ASSIGN_(x) out. __set_ ## x (qts. x)
|
||||
QueryTele qts2qt(const QueryTeleStats& qts)
|
||||
{
|
||||
QueryTele out;
|
||||
QueryTele out;
|
||||
|
||||
out.query_uuid = bu::to_string(qts.query_uuid);
|
||||
switch (qts.msg_type)
|
||||
{
|
||||
case QueryTeleStats::QT_SUMMARY:
|
||||
out.msg_type = QTType::QT_SUMMARY;
|
||||
break;
|
||||
case QueryTeleStats::QT_PROGRESS:
|
||||
out.msg_type = QTType::QT_PROGRESS;
|
||||
break;
|
||||
case QueryTeleStats::QT_START:
|
||||
out.msg_type = QTType::QT_START;
|
||||
break;
|
||||
default:
|
||||
out.msg_type = QTType::QT_INVALID;
|
||||
break;
|
||||
}
|
||||
QT_ASSIGN_(max_mem_pct);
|
||||
QT_ASSIGN_(num_files);
|
||||
QT_ASSIGN_(phy_io);
|
||||
QT_ASSIGN_(cache_io);
|
||||
QT_ASSIGN_(msg_rcv_cnt);
|
||||
QT_ASSIGN_(cp_blocks_skipped);
|
||||
QT_ASSIGN_(msg_bytes_in);
|
||||
QT_ASSIGN_(msg_bytes_out);
|
||||
QT_ASSIGN_(rows);
|
||||
QT_ASSIGN_(start_time);
|
||||
QT_ASSIGN_(end_time);
|
||||
QT_ASSIGN_(error_no);
|
||||
QT_ASSIGN_(blocks_changed);
|
||||
QT_ASSIGN_(session_id);
|
||||
QT_ASSIGN_(query_type);
|
||||
QT_ASSIGN_(query);
|
||||
QT_ASSIGN_(user);
|
||||
QT_ASSIGN_(host);
|
||||
QT_ASSIGN_(priority);
|
||||
QT_ASSIGN_(priority_level);
|
||||
QT_ASSIGN_(system_name);
|
||||
QT_ASSIGN_(module_name);
|
||||
QT_ASSIGN_(local_query);
|
||||
QT_ASSIGN_(schema_name);
|
||||
out.query_uuid = bu::to_string(qts.query_uuid);
|
||||
|
||||
return out;
|
||||
switch (qts.msg_type)
|
||||
{
|
||||
case QueryTeleStats::QT_SUMMARY:
|
||||
out.msg_type = QTType::QT_SUMMARY;
|
||||
break;
|
||||
|
||||
case QueryTeleStats::QT_PROGRESS:
|
||||
out.msg_type = QTType::QT_PROGRESS;
|
||||
break;
|
||||
|
||||
case QueryTeleStats::QT_START:
|
||||
out.msg_type = QTType::QT_START;
|
||||
break;
|
||||
|
||||
default:
|
||||
out.msg_type = QTType::QT_INVALID;
|
||||
break;
|
||||
}
|
||||
|
||||
QT_ASSIGN_(max_mem_pct);
|
||||
QT_ASSIGN_(num_files);
|
||||
QT_ASSIGN_(phy_io);
|
||||
QT_ASSIGN_(cache_io);
|
||||
QT_ASSIGN_(msg_rcv_cnt);
|
||||
QT_ASSIGN_(cp_blocks_skipped);
|
||||
QT_ASSIGN_(msg_bytes_in);
|
||||
QT_ASSIGN_(msg_bytes_out);
|
||||
QT_ASSIGN_(rows);
|
||||
QT_ASSIGN_(start_time);
|
||||
QT_ASSIGN_(end_time);
|
||||
QT_ASSIGN_(error_no);
|
||||
QT_ASSIGN_(blocks_changed);
|
||||
QT_ASSIGN_(session_id);
|
||||
QT_ASSIGN_(query_type);
|
||||
QT_ASSIGN_(query);
|
||||
QT_ASSIGN_(user);
|
||||
QT_ASSIGN_(host);
|
||||
QT_ASSIGN_(priority);
|
||||
QT_ASSIGN_(priority_level);
|
||||
QT_ASSIGN_(system_name);
|
||||
QT_ASSIGN_(module_name);
|
||||
QT_ASSIGN_(local_query);
|
||||
QT_ASSIGN_(schema_name);
|
||||
|
||||
return out;
|
||||
}
|
||||
#undef QT_ASSIGN_
|
||||
|
||||
#define QT_ASSIGN_(x) out. __set_ ## x (sts. x)
|
||||
StepTele sts2st(const StepTeleStats& sts)
|
||||
{
|
||||
StepTele out;
|
||||
StepTele out;
|
||||
|
||||
out.query_uuid = bu::to_string(sts.query_uuid);
|
||||
switch (sts.msg_type)
|
||||
{
|
||||
case StepTeleStats::ST_SUMMARY:
|
||||
out.msg_type = STType::ST_SUMMARY;
|
||||
break;
|
||||
case StepTeleStats::ST_PROGRESS:
|
||||
out.msg_type = STType::ST_PROGRESS;
|
||||
break;
|
||||
case StepTeleStats::ST_START:
|
||||
out.msg_type = STType::ST_START;
|
||||
break;
|
||||
default:
|
||||
out.msg_type = STType::ST_INVALID;
|
||||
break;
|
||||
}
|
||||
out.step_uuid = bu::to_string(sts.step_uuid);
|
||||
QT_ASSIGN_(phy_io);
|
||||
QT_ASSIGN_(cache_io);
|
||||
QT_ASSIGN_(msg_rcv_cnt);
|
||||
QT_ASSIGN_(cp_blocks_skipped);
|
||||
QT_ASSIGN_(msg_bytes_in);
|
||||
QT_ASSIGN_(msg_bytes_out);
|
||||
QT_ASSIGN_(rows);
|
||||
QT_ASSIGN_(start_time);
|
||||
QT_ASSIGN_(end_time);
|
||||
QT_ASSIGN_(total_units_of_work);
|
||||
QT_ASSIGN_(units_of_work_completed);
|
||||
out.query_uuid = bu::to_string(sts.query_uuid);
|
||||
|
||||
return out;
|
||||
switch (sts.msg_type)
|
||||
{
|
||||
case StepTeleStats::ST_SUMMARY:
|
||||
out.msg_type = STType::ST_SUMMARY;
|
||||
break;
|
||||
|
||||
case StepTeleStats::ST_PROGRESS:
|
||||
out.msg_type = STType::ST_PROGRESS;
|
||||
break;
|
||||
|
||||
case StepTeleStats::ST_START:
|
||||
out.msg_type = STType::ST_START;
|
||||
break;
|
||||
|
||||
default:
|
||||
out.msg_type = STType::ST_INVALID;
|
||||
break;
|
||||
}
|
||||
|
||||
out.step_uuid = bu::to_string(sts.step_uuid);
|
||||
QT_ASSIGN_(phy_io);
|
||||
QT_ASSIGN_(cache_io);
|
||||
QT_ASSIGN_(msg_rcv_cnt);
|
||||
QT_ASSIGN_(cp_blocks_skipped);
|
||||
QT_ASSIGN_(msg_bytes_in);
|
||||
QT_ASSIGN_(msg_bytes_out);
|
||||
QT_ASSIGN_(rows);
|
||||
QT_ASSIGN_(start_time);
|
||||
QT_ASSIGN_(end_time);
|
||||
QT_ASSIGN_(total_units_of_work);
|
||||
QT_ASSIGN_(units_of_work_completed);
|
||||
|
||||
return out;
|
||||
}
|
||||
#undef QT_ASSIGN_
|
||||
|
||||
#define QT_ASSIGN_(x) out. __set_ ## x (its. x)
|
||||
ImportTele its2it(const ImportTeleStats& its)
|
||||
{
|
||||
ImportTele out;
|
||||
ImportTele out;
|
||||
|
||||
out.job_uuid = bu::to_string(its.job_uuid);
|
||||
out.import_uuid = bu::to_string(its.import_uuid);
|
||||
switch (its.msg_type)
|
||||
{
|
||||
case ImportTeleStats::IT_SUMMARY:
|
||||
out.msg_type = ITType::IT_SUMMARY;
|
||||
break;
|
||||
case ImportTeleStats::IT_PROGRESS:
|
||||
out.msg_type = ITType::IT_PROGRESS;
|
||||
break;
|
||||
case ImportTeleStats::IT_START:
|
||||
out.msg_type = ITType::IT_START;
|
||||
break;
|
||||
case ImportTeleStats::IT_TERM:
|
||||
out.msg_type = ITType::IT_TERM;
|
||||
break;
|
||||
default:
|
||||
out.msg_type = ITType::IT_INVALID;
|
||||
break;
|
||||
}
|
||||
QT_ASSIGN_(start_time);
|
||||
QT_ASSIGN_(end_time);
|
||||
QT_ASSIGN_(table_list);
|
||||
QT_ASSIGN_(rows_so_far);
|
||||
QT_ASSIGN_(system_name);
|
||||
QT_ASSIGN_(module_name);
|
||||
QT_ASSIGN_(schema_name);
|
||||
out.job_uuid = bu::to_string(its.job_uuid);
|
||||
out.import_uuid = bu::to_string(its.import_uuid);
|
||||
|
||||
return out;
|
||||
switch (its.msg_type)
|
||||
{
|
||||
case ImportTeleStats::IT_SUMMARY:
|
||||
out.msg_type = ITType::IT_SUMMARY;
|
||||
break;
|
||||
|
||||
case ImportTeleStats::IT_PROGRESS:
|
||||
out.msg_type = ITType::IT_PROGRESS;
|
||||
break;
|
||||
|
||||
case ImportTeleStats::IT_START:
|
||||
out.msg_type = ITType::IT_START;
|
||||
break;
|
||||
|
||||
case ImportTeleStats::IT_TERM:
|
||||
out.msg_type = ITType::IT_TERM;
|
||||
break;
|
||||
|
||||
default:
|
||||
out.msg_type = ITType::IT_INVALID;
|
||||
break;
|
||||
}
|
||||
|
||||
QT_ASSIGN_(start_time);
|
||||
QT_ASSIGN_(end_time);
|
||||
QT_ASSIGN_(table_list);
|
||||
QT_ASSIGN_(rows_so_far);
|
||||
QT_ASSIGN_(system_name);
|
||||
QT_ASSIGN_(module_name);
|
||||
QT_ASSIGN_(schema_name);
|
||||
|
||||
return out;
|
||||
}
|
||||
#undef QT_ASSIGN_
|
||||
|
||||
@ -167,96 +183,108 @@ namespace querytele
|
||||
{
|
||||
|
||||
QueryTeleClient::QueryTeleClient(const QueryTeleServerParms& sp) :
|
||||
fProtoImpl(0),
|
||||
fServerParms(sp)
|
||||
fProtoImpl(0),
|
||||
fServerParms(sp)
|
||||
{
|
||||
if (fServerParms.host.empty() || fServerParms.port == 0) return;
|
||||
fProtoImpl = new QueryTeleProtoImpl(fServerParms);
|
||||
if (fServerParms.host.empty() || fServerParms.port == 0) return;
|
||||
|
||||
fProtoImpl = new QueryTeleProtoImpl(fServerParms);
|
||||
}
|
||||
|
||||
QueryTeleClient::~QueryTeleClient()
|
||||
{
|
||||
delete fProtoImpl;
|
||||
delete fProtoImpl;
|
||||
}
|
||||
|
||||
QueryTeleClient::QueryTeleClient(const QueryTeleClient& rhs) :
|
||||
fProtoImpl(0)
|
||||
fProtoImpl(0)
|
||||
{
|
||||
fServerParms = rhs.fServerParms;
|
||||
if (rhs.fProtoImpl)
|
||||
{
|
||||
fProtoImpl = new QueryTeleProtoImpl(*rhs.fProtoImpl);
|
||||
}
|
||||
fServerParms = rhs.fServerParms;
|
||||
|
||||
if (rhs.fProtoImpl)
|
||||
{
|
||||
fProtoImpl = new QueryTeleProtoImpl(*rhs.fProtoImpl);
|
||||
}
|
||||
}
|
||||
|
||||
QueryTeleClient& QueryTeleClient::operator=(const QueryTeleClient& rhs)
|
||||
{
|
||||
if (&rhs != this)
|
||||
{
|
||||
fProtoImpl = 0;
|
||||
fServerParms = rhs.fServerParms;
|
||||
if (rhs.fProtoImpl)
|
||||
{
|
||||
fProtoImpl = new QueryTeleProtoImpl(*rhs.fProtoImpl);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
if (&rhs != this)
|
||||
{
|
||||
fProtoImpl = 0;
|
||||
fServerParms = rhs.fServerParms;
|
||||
|
||||
if (rhs.fProtoImpl)
|
||||
{
|
||||
fProtoImpl = new QueryTeleProtoImpl(*rhs.fProtoImpl);
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void QueryTeleClient::serverParms(const QueryTeleServerParms& sp)
|
||||
{
|
||||
fServerParms = sp;
|
||||
delete fProtoImpl;
|
||||
fProtoImpl = 0;
|
||||
if (fServerParms.host.empty() || fServerParms.port == 0) return;
|
||||
fProtoImpl = new QueryTeleProtoImpl(fServerParms);
|
||||
fServerParms = sp;
|
||||
delete fProtoImpl;
|
||||
fProtoImpl = 0;
|
||||
|
||||
if (fServerParms.host.empty() || fServerParms.port == 0) return;
|
||||
|
||||
fProtoImpl = new QueryTeleProtoImpl(fServerParms);
|
||||
}
|
||||
|
||||
void QueryTeleClient::postQueryTele(const QueryTeleStats& qts)
|
||||
{
|
||||
if (!fProtoImpl) return;
|
||||
QueryTele qtdata = qts2qt(qts);
|
||||
fProtoImpl->enqQueryTele(qtdata);
|
||||
if (!fProtoImpl) return;
|
||||
|
||||
QueryTele qtdata = qts2qt(qts);
|
||||
fProtoImpl->enqQueryTele(qtdata);
|
||||
}
|
||||
|
||||
#define QT_STYPE_CASE_(x) case StepTeleStats:: x: {stdata.step_type = StepType:: x; break;}
|
||||
void QueryTeleClient::postStepTele(const StepTeleStats& sts)
|
||||
{
|
||||
if (!fProtoImpl) return;
|
||||
StepTele stdata = sts2st(sts);
|
||||
switch (fStepParms.stepType)
|
||||
{
|
||||
QT_STYPE_CASE_(T_HJS);
|
||||
QT_STYPE_CASE_(T_DSS);
|
||||
QT_STYPE_CASE_(T_CES);
|
||||
QT_STYPE_CASE_(T_SQS);
|
||||
QT_STYPE_CASE_(T_TAS);
|
||||
QT_STYPE_CASE_(T_TNS);
|
||||
QT_STYPE_CASE_(T_BPS);
|
||||
QT_STYPE_CASE_(T_TCS);
|
||||
QT_STYPE_CASE_(T_HVS);
|
||||
QT_STYPE_CASE_(T_WFS);
|
||||
QT_STYPE_CASE_(T_SAS);
|
||||
QT_STYPE_CASE_(T_TUN);
|
||||
default:
|
||||
stdata.step_type = StepType::T_INVALID;
|
||||
break;
|
||||
}
|
||||
fProtoImpl->enqStepTele(stdata);
|
||||
if (!fProtoImpl) return;
|
||||
|
||||
StepTele stdata = sts2st(sts);
|
||||
|
||||
switch (fStepParms.stepType)
|
||||
{
|
||||
QT_STYPE_CASE_(T_HJS);
|
||||
QT_STYPE_CASE_(T_DSS);
|
||||
QT_STYPE_CASE_(T_CES);
|
||||
QT_STYPE_CASE_(T_SQS);
|
||||
QT_STYPE_CASE_(T_TAS);
|
||||
QT_STYPE_CASE_(T_TNS);
|
||||
QT_STYPE_CASE_(T_BPS);
|
||||
QT_STYPE_CASE_(T_TCS);
|
||||
QT_STYPE_CASE_(T_HVS);
|
||||
QT_STYPE_CASE_(T_WFS);
|
||||
QT_STYPE_CASE_(T_SAS);
|
||||
QT_STYPE_CASE_(T_TUN);
|
||||
|
||||
default:
|
||||
stdata.step_type = StepType::T_INVALID;
|
||||
break;
|
||||
}
|
||||
|
||||
fProtoImpl->enqStepTele(stdata);
|
||||
}
|
||||
#undef QT_STYPE_CASE_
|
||||
|
||||
void QueryTeleClient::postImportTele(const ImportTeleStats& its)
|
||||
{
|
||||
if (!fProtoImpl) return;
|
||||
ImportTele itdata = its2it(its);
|
||||
fProtoImpl->enqImportTele(itdata);
|
||||
if (!fProtoImpl) return;
|
||||
|
||||
ImportTele itdata = its2it(its);
|
||||
fProtoImpl->enqImportTele(itdata);
|
||||
}
|
||||
|
||||
void QueryTeleClient::waitForQueues()
|
||||
{
|
||||
if (fProtoImpl)
|
||||
fProtoImpl->waitForQueues();
|
||||
if (fProtoImpl)
|
||||
fProtoImpl->waitForQueues();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,35 +42,47 @@ class QueryTeleProtoImpl;
|
||||
class QueryTeleClient
|
||||
{
|
||||
public:
|
||||
QueryTeleClient() : fProtoImpl(0) { }
|
||||
EXPORT explicit QueryTeleClient(const QueryTeleServerParms&);
|
||||
EXPORT ~QueryTeleClient();
|
||||
QueryTeleClient() : fProtoImpl(0) { }
|
||||
EXPORT explicit QueryTeleClient(const QueryTeleServerParms&);
|
||||
EXPORT ~QueryTeleClient();
|
||||
|
||||
EXPORT QueryTeleClient(const QueryTeleClient& rhs);
|
||||
EXPORT QueryTeleClient& operator=(const QueryTeleClient& rhs);
|
||||
EXPORT QueryTeleClient(const QueryTeleClient& rhs);
|
||||
EXPORT QueryTeleClient& operator=(const QueryTeleClient& rhs);
|
||||
|
||||
EXPORT void postQueryTele(const QueryTeleStats&);
|
||||
EXPORT void postStepTele(const StepTeleStats&);
|
||||
EXPORT void postImportTele(const ImportTeleStats&);
|
||||
EXPORT void postQueryTele(const QueryTeleStats&);
|
||||
EXPORT void postStepTele(const StepTeleStats&);
|
||||
EXPORT void postImportTele(const ImportTeleStats&);
|
||||
|
||||
EXPORT void serverParms(const QueryTeleServerParms&);
|
||||
inline const QueryTeleServerParms& serverParms() const { return fServerParms; }
|
||||
EXPORT void serverParms(const QueryTeleServerParms&);
|
||||
inline const QueryTeleServerParms& serverParms() const
|
||||
{
|
||||
return fServerParms;
|
||||
}
|
||||
|
||||
inline void stepParms(const QueryStepParms& sp) { fStepParms = sp; }
|
||||
inline const QueryStepParms& stepParms() const { return fStepParms; }
|
||||
inline QueryStepParms& stepParms() { return fStepParms; }
|
||||
inline void stepParms(const QueryStepParms& sp)
|
||||
{
|
||||
fStepParms = sp;
|
||||
}
|
||||
inline const QueryStepParms& stepParms() const
|
||||
{
|
||||
return fStepParms;
|
||||
}
|
||||
inline QueryStepParms& stepParms()
|
||||
{
|
||||
return fStepParms;
|
||||
}
|
||||
|
||||
EXPORT void waitForQueues();
|
||||
EXPORT void waitForQueues();
|
||||
|
||||
EXPORT static boost::uuids::uuid genUUID();
|
||||
EXPORT static int64_t timeNowms();
|
||||
EXPORT static boost::uuids::uuid genUUID();
|
||||
EXPORT static int64_t timeNowms();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
QueryTeleProtoImpl* fProtoImpl;
|
||||
QueryTeleServerParms fServerParms;
|
||||
QueryStepParms fStepParms;
|
||||
QueryTeleProtoImpl* fProtoImpl;
|
||||
QueryTeleServerParms fServerParms;
|
||||
QueryStepParms fStepParms;
|
||||
|
||||
};
|
||||
|
||||
|
@ -26,10 +26,10 @@ using namespace std;
|
||||
|
||||
#include "thrift/transport/TSocket.h"
|
||||
#include "thrift/transport/TBufferTransports.h"
|
||||
namespace att=apache::thrift::transport;
|
||||
namespace att = apache::thrift::transport;
|
||||
|
||||
#include "thrift/protocol/TBinaryProtocol.h"
|
||||
namespace atp=apache::thrift::protocol;
|
||||
namespace atp = apache::thrift::protocol;
|
||||
|
||||
#include "atomicops.h"
|
||||
|
||||
@ -41,22 +41,22 @@ namespace atp=apache::thrift::protocol;
|
||||
|
||||
namespace
|
||||
{
|
||||
const size_t MaxQueueElems=1000;
|
||||
const size_t MaxQueueElems = 1000;
|
||||
|
||||
template <class T>
|
||||
struct TsTeleQueue
|
||||
{
|
||||
typedef std::queue<T> TeleQueue;
|
||||
typedef std::queue<T> TeleQueue;
|
||||
|
||||
TeleQueue queue;
|
||||
boost::mutex queueMtx;
|
||||
TeleQueue queue;
|
||||
boost::mutex queueMtx;
|
||||
};
|
||||
|
||||
TsTeleQueue<querytele::StepTele> stQueue;
|
||||
TsTeleQueue<querytele::QueryTele> qtQueue;
|
||||
TsTeleQueue<querytele::ImportTele> itQueue;
|
||||
|
||||
volatile bool isInited=false;
|
||||
volatile bool isInited = false;
|
||||
boost::mutex initMux;
|
||||
|
||||
boost::shared_ptr<att::TSocket> fSocket;
|
||||
@ -71,11 +71,11 @@ struct QStats
|
||||
int stqueuedrops;
|
||||
int stqueuedups;
|
||||
int itqueuedrops;
|
||||
QStats() :
|
||||
qtqueuedrops(0),
|
||||
stqueuedrops(0),
|
||||
stqueuedups(0),
|
||||
itqueuedrops(0) { ; }
|
||||
QStats() :
|
||||
qtqueuedrops(0),
|
||||
stqueuedrops(0),
|
||||
stqueuedups(0),
|
||||
itqueuedrops(0) { ; }
|
||||
};
|
||||
|
||||
QStats fQStats;
|
||||
@ -96,184 +96,246 @@ string get_trace_file()
|
||||
|
||||
void log_query(const querytele::QueryTele& qtdata)
|
||||
{
|
||||
ofstream trace(get_trace_file().c_str(), ios::out | ios::app);
|
||||
trace << "Query,"
|
||||
<< qtdata.query_uuid << ","
|
||||
<< ","; // skip step uuid
|
||||
if (qtdata.msg_type == querytele::QTType::QT_SUMMARY)
|
||||
trace << "SUMMARY,";
|
||||
else if (qtdata.msg_type == querytele::QTType::QT_START)
|
||||
trace << "START,";
|
||||
else
|
||||
trace << "PROGRESS,";
|
||||
ofstream trace(get_trace_file().c_str(), ios::out | ios::app);
|
||||
trace << "Query,"
|
||||
<< qtdata.query_uuid << ","
|
||||
<< ","; // skip step uuid
|
||||
|
||||
trace << ","; // sktp step type
|
||||
if (qtdata.msg_type == querytele::QTType::QT_SUMMARY)
|
||||
trace << "SUMMARY,";
|
||||
else if (qtdata.msg_type == querytele::QTType::QT_START)
|
||||
trace << "START,";
|
||||
else
|
||||
trace << "PROGRESS,";
|
||||
|
||||
trace << qtdata.start_time << ",";
|
||||
trace << qtdata.end_time << ",";
|
||||
trace << ","; // sktp step type
|
||||
|
||||
trace << qtdata.cache_io << ",";
|
||||
trace << qtdata.msg_rcv_cnt << ",";
|
||||
trace << qtdata.rows << ",";
|
||||
trace << qtdata.max_mem_pct << ",";
|
||||
trace << qtdata.start_time << ",";
|
||||
trace << qtdata.end_time << ",";
|
||||
|
||||
trace << qtdata.query_type << ",";
|
||||
trace << qtdata.schema_name << ",";
|
||||
trace << qtdata.query << ",";
|
||||
trace << qtdata.system_name;
|
||||
trace << endl;
|
||||
trace.close();
|
||||
trace << qtdata.cache_io << ",";
|
||||
trace << qtdata.msg_rcv_cnt << ",";
|
||||
trace << qtdata.rows << ",";
|
||||
trace << qtdata.max_mem_pct << ",";
|
||||
|
||||
trace << qtdata.query_type << ",";
|
||||
trace << qtdata.schema_name << ",";
|
||||
trace << qtdata.query << ",";
|
||||
trace << qtdata.system_name;
|
||||
trace << endl;
|
||||
trace.close();
|
||||
}
|
||||
|
||||
const string st2str(enum querytele::StepType::type t)
|
||||
{
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
case querytele::StepType::T_HJS: return "HJS";
|
||||
case querytele::StepType::T_DSS: return "DSS";
|
||||
case querytele::StepType::T_CES: return "CES";
|
||||
case querytele::StepType::T_SQS: return "SQS";
|
||||
case querytele::StepType::T_TAS: return "TAS";
|
||||
case querytele::StepType::T_TNS: return "TNS";
|
||||
case querytele::StepType::T_BPS: return "BPS";
|
||||
case querytele::StepType::T_TCS: return "TCS";
|
||||
case querytele::StepType::T_HVS: return "HVS";
|
||||
case querytele::StepType::T_WFS: return "WFS";
|
||||
case querytele::StepType::T_SAS: return "SAS";
|
||||
case querytele::StepType::T_TUN: return "TUN";
|
||||
default: return "INV";
|
||||
case querytele::StepType::T_HJS:
|
||||
return "HJS";
|
||||
|
||||
case querytele::StepType::T_DSS:
|
||||
return "DSS";
|
||||
|
||||
case querytele::StepType::T_CES:
|
||||
return "CES";
|
||||
|
||||
case querytele::StepType::T_SQS:
|
||||
return "SQS";
|
||||
|
||||
case querytele::StepType::T_TAS:
|
||||
return "TAS";
|
||||
|
||||
case querytele::StepType::T_TNS:
|
||||
return "TNS";
|
||||
|
||||
case querytele::StepType::T_BPS:
|
||||
return "BPS";
|
||||
|
||||
case querytele::StepType::T_TCS:
|
||||
return "TCS";
|
||||
|
||||
case querytele::StepType::T_HVS:
|
||||
return "HVS";
|
||||
|
||||
case querytele::StepType::T_WFS:
|
||||
return "WFS";
|
||||
|
||||
case querytele::StepType::T_SAS:
|
||||
return "SAS";
|
||||
|
||||
case querytele::StepType::T_TUN:
|
||||
return "TUN";
|
||||
|
||||
default:
|
||||
return "INV";
|
||||
}
|
||||
|
||||
return "INV";
|
||||
}
|
||||
|
||||
void log_step(const querytele::StepTele& stdata)
|
||||
{
|
||||
ofstream trace(get_trace_file().c_str(), ios::out | ios::app);
|
||||
ofstream trace(get_trace_file().c_str(), ios::out | ios::app);
|
||||
|
||||
trace << "Step,"
|
||||
<< stdata.query_uuid << ","
|
||||
<< stdata.step_uuid << ",";
|
||||
if (stdata.msg_type == querytele::STType::ST_SUMMARY)
|
||||
trace << "SUMMARY,";
|
||||
else if (stdata.msg_type == querytele::STType::ST_START)
|
||||
trace << "START,";
|
||||
else
|
||||
trace << "PROGRESS,";
|
||||
trace << st2str(stdata.step_type) << ",";
|
||||
trace << "Step,"
|
||||
<< stdata.query_uuid << ","
|
||||
<< stdata.step_uuid << ",";
|
||||
|
||||
trace << stdata.start_time << ",";
|
||||
trace << stdata.end_time << ",";
|
||||
if (stdata.msg_type == querytele::STType::ST_SUMMARY)
|
||||
trace << "SUMMARY,";
|
||||
else if (stdata.msg_type == querytele::STType::ST_START)
|
||||
trace << "START,";
|
||||
else
|
||||
trace << "PROGRESS,";
|
||||
|
||||
trace << stdata.cache_io << ",";
|
||||
trace << stdata.msg_rcv_cnt << ",";
|
||||
trace << stdata.rows << ",";
|
||||
trace << st2str(stdata.step_type) << ",";
|
||||
|
||||
if (stdata.total_units_of_work > 0)
|
||||
trace << stdata.units_of_work_completed*100/stdata.total_units_of_work << ",";
|
||||
else
|
||||
trace << "-1,";
|
||||
trace << stdata.start_time << ",";
|
||||
trace << stdata.end_time << ",";
|
||||
|
||||
trace << ",,,"; // skip qtype, schemo, etc.
|
||||
trace << fQStats.stqueuedrops << "," << fQStats.stqueuedups << "," << stQueue.queue.size();
|
||||
trace << stdata.cache_io << ",";
|
||||
trace << stdata.msg_rcv_cnt << ",";
|
||||
trace << stdata.rows << ",";
|
||||
|
||||
if (stdata.total_units_of_work > 0)
|
||||
trace << stdata.units_of_work_completed * 100 / stdata.total_units_of_work << ",";
|
||||
else
|
||||
trace << "-1,";
|
||||
|
||||
trace << ",,,"; // skip qtype, schemo, etc.
|
||||
trace << fQStats.stqueuedrops << "," << fQStats.stqueuedups << "," << stQueue.queue.size();
|
||||
trace << endl;
|
||||
trace.close();
|
||||
trace.close();
|
||||
}
|
||||
|
||||
void TeleConsumer()
|
||||
{
|
||||
bool didSomeWork=false;
|
||||
boost::mutex::scoped_lock itlk(itQueue.queueMtx, boost::defer_lock);
|
||||
boost::mutex::scoped_lock qtlk(qtQueue.queueMtx, boost::defer_lock);
|
||||
boost::mutex::scoped_lock stlk(stQueue.queueMtx, boost::defer_lock);
|
||||
querytele::QueryTeleServiceClient client(fProtocol);
|
||||
bool didSomeWork = false;
|
||||
boost::mutex::scoped_lock itlk(itQueue.queueMtx, boost::defer_lock);
|
||||
boost::mutex::scoped_lock qtlk(qtQueue.queueMtx, boost::defer_lock);
|
||||
boost::mutex::scoped_lock stlk(stQueue.queueMtx, boost::defer_lock);
|
||||
querytele::QueryTeleServiceClient client(fProtocol);
|
||||
|
||||
try {
|
||||
for (;;)
|
||||
{
|
||||
didSomeWork=false;
|
||||
try
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
didSomeWork = false;
|
||||
|
||||
itlk.lock();
|
||||
// Empty the import queue first...
|
||||
while (!itQueue.queue.empty())
|
||||
{
|
||||
querytele::ImportTele itdata = itQueue.queue.front();
|
||||
itQueue.queue.pop();
|
||||
itlk.unlock();
|
||||
try {
|
||||
fTransport->open();
|
||||
client.postImport(itdata);
|
||||
fTransport->close();
|
||||
} catch (...) {
|
||||
try {
|
||||
fTransport->close();
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
didSomeWork = true;
|
||||
itlk.lock();
|
||||
}
|
||||
itlk.unlock();
|
||||
itlk.lock();
|
||||
|
||||
qtlk.lock();
|
||||
// Now empty the query queue...
|
||||
while (!qtQueue.queue.empty())
|
||||
{
|
||||
querytele::QueryTele qtdata = qtQueue.queue.front();
|
||||
qtQueue.queue.pop();
|
||||
qtlk.unlock();
|
||||
try {
|
||||
fTransport->open();
|
||||
// Empty the import queue first...
|
||||
while (!itQueue.queue.empty())
|
||||
{
|
||||
querytele::ImportTele itdata = itQueue.queue.front();
|
||||
itQueue.queue.pop();
|
||||
itlk.unlock();
|
||||
|
||||
try
|
||||
{
|
||||
fTransport->open();
|
||||
client.postImport(itdata);
|
||||
fTransport->close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
try
|
||||
{
|
||||
fTransport->close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
didSomeWork = true;
|
||||
itlk.lock();
|
||||
}
|
||||
|
||||
itlk.unlock();
|
||||
|
||||
qtlk.lock();
|
||||
|
||||
// Now empty the query queue...
|
||||
while (!qtQueue.queue.empty())
|
||||
{
|
||||
querytele::QueryTele qtdata = qtQueue.queue.front();
|
||||
qtQueue.queue.pop();
|
||||
qtlk.unlock();
|
||||
|
||||
try
|
||||
{
|
||||
fTransport->open();
|
||||
#ifdef QUERY_TELE_DEBUG
|
||||
log_query(qtdata);
|
||||
log_query(qtdata);
|
||||
#endif
|
||||
client.postQuery(qtdata);
|
||||
fTransport->close();
|
||||
} catch (...) {
|
||||
try {
|
||||
fTransport->close();
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
didSomeWork = true;
|
||||
qtlk.lock();
|
||||
}
|
||||
qtlk.unlock();
|
||||
client.postQuery(qtdata);
|
||||
fTransport->close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
try
|
||||
{
|
||||
fTransport->close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
stlk.lock();
|
||||
// Finally empty the step queue...
|
||||
// @bug6088 - Added check for query queue and import queue in while statment below to
|
||||
// keep the step logs from starving the query and import logs.
|
||||
while (!stQueue.queue.empty() && qtQueue.queue.empty() && itQueue.queue.empty())
|
||||
{
|
||||
querytele::StepTele stdata = stQueue.queue.front();
|
||||
stQueue.queue.pop();
|
||||
stlk.unlock();
|
||||
try {
|
||||
fTransport->open();
|
||||
didSomeWork = true;
|
||||
qtlk.lock();
|
||||
}
|
||||
|
||||
qtlk.unlock();
|
||||
|
||||
stlk.lock();
|
||||
|
||||
// Finally empty the step queue...
|
||||
// @bug6088 - Added check for query queue and import queue in while statment below to
|
||||
// keep the step logs from starving the query and import logs.
|
||||
while (!stQueue.queue.empty() && qtQueue.queue.empty() && itQueue.queue.empty())
|
||||
{
|
||||
querytele::StepTele stdata = stQueue.queue.front();
|
||||
stQueue.queue.pop();
|
||||
stlk.unlock();
|
||||
|
||||
try
|
||||
{
|
||||
fTransport->open();
|
||||
#ifdef QUERY_TELE_DEBUG
|
||||
log_step(stdata);
|
||||
log_step(stdata);
|
||||
#endif
|
||||
client.postStep(stdata);
|
||||
fTransport->close();
|
||||
} catch (...) {
|
||||
try {
|
||||
fTransport->close();
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
didSomeWork = true;
|
||||
stlk.lock();
|
||||
}
|
||||
stlk.unlock();
|
||||
client.postStep(stdata);
|
||||
fTransport->close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
try
|
||||
{
|
||||
fTransport->close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (!didSomeWork)
|
||||
{
|
||||
usleep(50000);
|
||||
}
|
||||
}
|
||||
} catch (...) {
|
||||
//we're probably shutting down, just let this thread die quietly...
|
||||
}
|
||||
didSomeWork = true;
|
||||
stlk.lock();
|
||||
}
|
||||
|
||||
stlk.unlock();
|
||||
|
||||
if (!didSomeWork)
|
||||
{
|
||||
usleep(50000);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
//we're probably shutting down, just let this thread die quietly...
|
||||
}
|
||||
}
|
||||
|
||||
boost::thread* consThd;
|
||||
@ -284,105 +346,125 @@ namespace querytele
|
||||
{
|
||||
|
||||
QueryTeleProtoImpl::QueryTeleProtoImpl(const QueryTeleServerParms& sp) :
|
||||
fServerParms(sp)
|
||||
fServerParms(sp)
|
||||
{
|
||||
if (fServerParms.host.empty() || fServerParms.port == 0) return;
|
||||
if (fServerParms.host.empty() || fServerParms.port == 0) return;
|
||||
|
||||
boost::mutex::scoped_lock lk(initMux);
|
||||
boost::mutex::scoped_lock lk(initMux);
|
||||
|
||||
atomicops::atomicMb();
|
||||
if (isInited) return;
|
||||
atomicops::atomicMb();
|
||||
|
||||
fSocket.reset(new att::TSocket(fServerParms.host, fServerParms.port));
|
||||
fTransport.reset(new att::TBufferedTransport(fSocket));
|
||||
fProtocol.reset(new atp::TBinaryProtocol(fTransport));
|
||||
if (isInited) return;
|
||||
|
||||
consThd = new boost::thread(&TeleConsumer);
|
||||
fSocket.reset(new att::TSocket(fServerParms.host, fServerParms.port));
|
||||
fTransport.reset(new att::TBufferedTransport(fSocket));
|
||||
fProtocol.reset(new atp::TBinaryProtocol(fTransport));
|
||||
|
||||
atomicops::atomicMb();
|
||||
isInited = true;
|
||||
consThd = new boost::thread(&TeleConsumer);
|
||||
|
||||
atomicops::atomicMb();
|
||||
isInited = true;
|
||||
}
|
||||
|
||||
int QueryTeleProtoImpl::enqStepTele(const StepTele& stdata)
|
||||
{
|
||||
try {
|
||||
boost::mutex::scoped_lock lk(stQueue.queueMtx);
|
||||
// @bug6088 - Added conditions below to always log progress SUMMARY and START messages to avoid completed queries showing up with progress 0
|
||||
// and no steps.
|
||||
if (stQueue.queue.size() >= MaxQueueElems && stdata.msg_type != querytele::STType::ST_SUMMARY && stdata.msg_type != querytele::STType::ST_START)
|
||||
{
|
||||
fQStats.stqueuedrops++;
|
||||
return -1;
|
||||
}
|
||||
if( stdata.step_uuid != gLastStep.step_uuid ||
|
||||
stdata.msg_type != gLastStep.msg_type ||
|
||||
stdata.step_type != gLastStep.step_type ||
|
||||
stdata.total_units_of_work != gLastStep.total_units_of_work ||
|
||||
stdata.units_of_work_completed != gLastStep.units_of_work_completed )
|
||||
{
|
||||
stQueue.queue.push(stdata);
|
||||
gLastStep = stdata;
|
||||
}
|
||||
else
|
||||
{
|
||||
fQStats.stqueuedups++;
|
||||
}
|
||||
} catch (...) {
|
||||
return -2;
|
||||
}
|
||||
try
|
||||
{
|
||||
boost::mutex::scoped_lock lk(stQueue.queueMtx);
|
||||
|
||||
return 0;
|
||||
// @bug6088 - Added conditions below to always log progress SUMMARY and START messages to avoid completed queries showing up with progress 0
|
||||
// and no steps.
|
||||
if (stQueue.queue.size() >= MaxQueueElems && stdata.msg_type != querytele::STType::ST_SUMMARY && stdata.msg_type != querytele::STType::ST_START)
|
||||
{
|
||||
fQStats.stqueuedrops++;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( stdata.step_uuid != gLastStep.step_uuid ||
|
||||
stdata.msg_type != gLastStep.msg_type ||
|
||||
stdata.step_type != gLastStep.step_type ||
|
||||
stdata.total_units_of_work != gLastStep.total_units_of_work ||
|
||||
stdata.units_of_work_completed != gLastStep.units_of_work_completed )
|
||||
{
|
||||
stQueue.queue.push(stdata);
|
||||
gLastStep = stdata;
|
||||
}
|
||||
else
|
||||
{
|
||||
fQStats.stqueuedups++;
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QueryTeleProtoImpl::enqQueryTele(const QueryTele& qtdata)
|
||||
{
|
||||
try {
|
||||
boost::mutex::scoped_lock lk(qtQueue.queueMtx);
|
||||
if (qtQueue.queue.size() >= MaxQueueElems)
|
||||
{
|
||||
fQStats.qtqueuedrops++;
|
||||
return -1;
|
||||
}
|
||||
qtQueue.queue.push(qtdata);
|
||||
} catch (...) {
|
||||
return -2;
|
||||
}
|
||||
try
|
||||
{
|
||||
boost::mutex::scoped_lock lk(qtQueue.queueMtx);
|
||||
|
||||
return 0;
|
||||
if (qtQueue.queue.size() >= MaxQueueElems)
|
||||
{
|
||||
fQStats.qtqueuedrops++;
|
||||
return -1;
|
||||
}
|
||||
|
||||
qtQueue.queue.push(qtdata);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QueryTeleProtoImpl::enqImportTele(const ImportTele& itdata)
|
||||
{
|
||||
try {
|
||||
boost::mutex::scoped_lock lk(itQueue.queueMtx);
|
||||
if (itQueue.queue.size() >= MaxQueueElems)
|
||||
{
|
||||
fQStats.itqueuedrops++;
|
||||
return -1;
|
||||
}
|
||||
itQueue.queue.push(itdata);
|
||||
} catch (...) {
|
||||
return -2;
|
||||
}
|
||||
try
|
||||
{
|
||||
boost::mutex::scoped_lock lk(itQueue.queueMtx);
|
||||
|
||||
return 0;
|
||||
if (itQueue.queue.size() >= MaxQueueElems)
|
||||
{
|
||||
fQStats.itqueuedrops++;
|
||||
return -1;
|
||||
}
|
||||
|
||||
itQueue.queue.push(itdata);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QueryTeleProtoImpl::waitForQueues()
|
||||
{
|
||||
try {
|
||||
boost::mutex::scoped_lock lk(itQueue.queueMtx);
|
||||
while (!itQueue.queue.empty())
|
||||
{
|
||||
lk.unlock();
|
||||
usleep(100000);
|
||||
lk.lock();
|
||||
}
|
||||
} catch (...) {
|
||||
return -1;
|
||||
}
|
||||
try
|
||||
{
|
||||
boost::mutex::scoped_lock lk(itQueue.queueMtx);
|
||||
|
||||
return 0;
|
||||
while (!itQueue.queue.empty())
|
||||
{
|
||||
lk.unlock();
|
||||
usleep(100000);
|
||||
lk.lock();
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} //namespace querytele
|
||||
|
@ -26,22 +26,22 @@ namespace querytele
|
||||
class QueryTeleProtoImpl
|
||||
{
|
||||
public:
|
||||
explicit QueryTeleProtoImpl(const QueryTeleServerParms&);
|
||||
~QueryTeleProtoImpl() { }
|
||||
explicit QueryTeleProtoImpl(const QueryTeleServerParms&);
|
||||
~QueryTeleProtoImpl() { }
|
||||
|
||||
int enqStepTele(const StepTele&);
|
||||
int enqImportTele(const ImportTele&);
|
||||
int enqQueryTele(const QueryTele&);
|
||||
int enqStepTele(const StepTele&);
|
||||
int enqImportTele(const ImportTele&);
|
||||
int enqQueryTele(const QueryTele&);
|
||||
|
||||
/**
|
||||
* Wait for the consumer thread to post all messages
|
||||
**/
|
||||
int waitForQueues();
|
||||
/**
|
||||
* Wait for the consumer thread to post all messages
|
||||
**/
|
||||
int waitForQueues();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
QueryTeleServerParms fServerParms;
|
||||
QueryTeleServerParms fServerParms;
|
||||
|
||||
};
|
||||
|
||||
|
@ -26,12 +26,12 @@ namespace querytele
|
||||
class QueryTeleServerParms
|
||||
{
|
||||
public:
|
||||
QueryTeleServerParms() : port(0) { }
|
||||
QueryTeleServerParms(const std::string h, int p) : host(h), port(p) { }
|
||||
~QueryTeleServerParms() { }
|
||||
QueryTeleServerParms() : port(0) { }
|
||||
QueryTeleServerParms(const std::string h, int p) : host(h), port(p) { }
|
||||
~QueryTeleServerParms() { }
|
||||
|
||||
std::string host;
|
||||
int port;
|
||||
std::string host;
|
||||
int port;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -31,10 +31,10 @@ using namespace boost;
|
||||
#include "thrift/transport/TTransport.h"
|
||||
#include "thrift/transport/TBufferTransports.h"
|
||||
#include "thrift/server/TSimpleServer.h"
|
||||
namespace at=apache::thrift;
|
||||
namespace atp=at::protocol;
|
||||
namespace att=at::transport;
|
||||
namespace ats=at::server;
|
||||
namespace at = apache::thrift;
|
||||
namespace atp = at::protocol;
|
||||
namespace att = at::transport;
|
||||
namespace ats = at::server;
|
||||
|
||||
#include "QueryTeleService.h"
|
||||
using namespace querytele;
|
||||
@ -45,9 +45,9 @@ namespace
|
||||
class QueryTeleServiceHandler : public QueryTeleServiceIf
|
||||
{
|
||||
public:
|
||||
void postQuery(const QueryTele&);
|
||||
void postStep(const StepTele&);
|
||||
void postImport(const ImportTele&);
|
||||
void postQuery(const QueryTele&);
|
||||
void postStep(const StepTele&);
|
||||
void postImport(const ImportTele&);
|
||||
|
||||
protected:
|
||||
|
||||
@ -57,140 +57,177 @@ private:
|
||||
|
||||
const string st2str(enum StepType::type t)
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
case StepType::T_HJS: return "HJS";
|
||||
case StepType::T_DSS: return "DSS";
|
||||
case StepType::T_CES: return "CES";
|
||||
case StepType::T_SQS: return "SQS";
|
||||
case StepType::T_TAS: return "TAS";
|
||||
case StepType::T_TNS: return "TNS";
|
||||
case StepType::T_BPS: return "BPS";
|
||||
case StepType::T_TCS: return "TCS";
|
||||
case StepType::T_HVS: return "HVS";
|
||||
case StepType::T_WFS: return "WFS";
|
||||
case StepType::T_SAS: return "SAS";
|
||||
case StepType::T_TUN: return "TUN";
|
||||
default: return "INV";
|
||||
}
|
||||
return "INV";
|
||||
switch (t)
|
||||
{
|
||||
case StepType::T_HJS:
|
||||
return "HJS";
|
||||
|
||||
case StepType::T_DSS:
|
||||
return "DSS";
|
||||
|
||||
case StepType::T_CES:
|
||||
return "CES";
|
||||
|
||||
case StepType::T_SQS:
|
||||
return "SQS";
|
||||
|
||||
case StepType::T_TAS:
|
||||
return "TAS";
|
||||
|
||||
case StepType::T_TNS:
|
||||
return "TNS";
|
||||
|
||||
case StepType::T_BPS:
|
||||
return "BPS";
|
||||
|
||||
case StepType::T_TCS:
|
||||
return "TCS";
|
||||
|
||||
case StepType::T_HVS:
|
||||
return "HVS";
|
||||
|
||||
case StepType::T_WFS:
|
||||
return "WFS";
|
||||
|
||||
case StepType::T_SAS:
|
||||
return "SAS";
|
||||
|
||||
case StepType::T_TUN:
|
||||
return "TUN";
|
||||
|
||||
default:
|
||||
return "INV";
|
||||
}
|
||||
|
||||
return "INV";
|
||||
}
|
||||
|
||||
void QueryTeleServiceHandler::postQuery(const QueryTele& qt)
|
||||
{
|
||||
cout << "postQuery: " << endl;
|
||||
cout << " uuid: " << qt.query_uuid << endl;
|
||||
if (qt.msg_type == QTType::QT_SUMMARY)
|
||||
cout << " mt: SUMMARY" << endl;
|
||||
else if (qt.msg_type == QTType::QT_START)
|
||||
cout << " mt: START" << endl;
|
||||
else
|
||||
cout << " mt: PROGRESS" << endl;
|
||||
cout << " qry: " << qt.query << endl;
|
||||
cout << " mmpct: " << qt.max_mem_pct << endl;
|
||||
cout << " cache: " << qt.cache_io << endl;
|
||||
cout << " nmsgs: " << qt.msg_rcv_cnt << endl;
|
||||
cout << " rows: " << qt.rows << endl;
|
||||
cout << " qt: " << qt.query_type << endl;
|
||||
int64_t tt = qt.start_time;
|
||||
cout << " st: (" << tt << ") ";
|
||||
tt /= 1000;
|
||||
cout << ctime(&tt);
|
||||
tt = qt.end_time;
|
||||
cout << " et: (" << tt << ") ";
|
||||
tt /= 1000;
|
||||
cout << ctime(&tt);
|
||||
cout << " sn: " << qt.system_name << endl;
|
||||
cout << " mn: " << qt.module_name << endl;
|
||||
cout << " lq: " << qt.local_query << endl;
|
||||
cout << " dn: " << qt.schema_name << endl;
|
||||
cout << endl;
|
||||
cout << "postQuery: " << endl;
|
||||
cout << " uuid: " << qt.query_uuid << endl;
|
||||
|
||||
if (qt.msg_type == QTType::QT_SUMMARY)
|
||||
cout << " mt: SUMMARY" << endl;
|
||||
else if (qt.msg_type == QTType::QT_START)
|
||||
cout << " mt: START" << endl;
|
||||
else
|
||||
cout << " mt: PROGRESS" << endl;
|
||||
|
||||
cout << " qry: " << qt.query << endl;
|
||||
cout << " mmpct: " << qt.max_mem_pct << endl;
|
||||
cout << " cache: " << qt.cache_io << endl;
|
||||
cout << " nmsgs: " << qt.msg_rcv_cnt << endl;
|
||||
cout << " rows: " << qt.rows << endl;
|
||||
cout << " qt: " << qt.query_type << endl;
|
||||
int64_t tt = qt.start_time;
|
||||
cout << " st: (" << tt << ") ";
|
||||
tt /= 1000;
|
||||
cout << ctime(&tt);
|
||||
tt = qt.end_time;
|
||||
cout << " et: (" << tt << ") ";
|
||||
tt /= 1000;
|
||||
cout << ctime(&tt);
|
||||
cout << " sn: " << qt.system_name << endl;
|
||||
cout << " mn: " << qt.module_name << endl;
|
||||
cout << " lq: " << qt.local_query << endl;
|
||||
cout << " dn: " << qt.schema_name << endl;
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
void QueryTeleServiceHandler::postStep(const StepTele& qt)
|
||||
{
|
||||
cout << "postStep: " << endl;
|
||||
cout << " quuid: " << qt.query_uuid << endl;
|
||||
cout << " uuid: " << qt.step_uuid << endl;
|
||||
if (qt.msg_type == STType::ST_SUMMARY)
|
||||
cout << " mt: SUMMARY" << endl;
|
||||
else if (qt.msg_type == STType::ST_START)
|
||||
cout << " mt: START" << endl;
|
||||
else
|
||||
cout << " mt: PROGRESS" << endl;
|
||||
cout << " st: " << st2str(qt.step_type) << endl;
|
||||
cout << " cache: " << qt.cache_io << endl;
|
||||
cout << " nmsgs: " << qt.msg_rcv_cnt << endl;
|
||||
cout << " rows: " << qt.rows << endl;
|
||||
if (qt.total_units_of_work > 0)
|
||||
cout << " pct: " << qt.units_of_work_completed*100/qt.total_units_of_work << endl;
|
||||
else
|
||||
cout << " pct: n/a" << endl;
|
||||
int64_t tt = qt.start_time;
|
||||
cout << " st: (" << tt << ") ";
|
||||
tt /= 1000;
|
||||
cout << ctime(&tt);
|
||||
tt = qt.end_time;
|
||||
cout << " et: (" << tt << ") ";
|
||||
tt /= 1000;
|
||||
cout << ctime(&tt);
|
||||
cout << endl;
|
||||
cout << "postStep: " << endl;
|
||||
cout << " quuid: " << qt.query_uuid << endl;
|
||||
cout << " uuid: " << qt.step_uuid << endl;
|
||||
|
||||
if (qt.msg_type == STType::ST_SUMMARY)
|
||||
cout << " mt: SUMMARY" << endl;
|
||||
else if (qt.msg_type == STType::ST_START)
|
||||
cout << " mt: START" << endl;
|
||||
else
|
||||
cout << " mt: PROGRESS" << endl;
|
||||
|
||||
cout << " st: " << st2str(qt.step_type) << endl;
|
||||
cout << " cache: " << qt.cache_io << endl;
|
||||
cout << " nmsgs: " << qt.msg_rcv_cnt << endl;
|
||||
cout << " rows: " << qt.rows << endl;
|
||||
|
||||
if (qt.total_units_of_work > 0)
|
||||
cout << " pct: " << qt.units_of_work_completed * 100 / qt.total_units_of_work << endl;
|
||||
else
|
||||
cout << " pct: n/a" << endl;
|
||||
|
||||
int64_t tt = qt.start_time;
|
||||
cout << " st: (" << tt << ") ";
|
||||
tt /= 1000;
|
||||
cout << ctime(&tt);
|
||||
tt = qt.end_time;
|
||||
cout << " et: (" << tt << ") ";
|
||||
tt /= 1000;
|
||||
cout << ctime(&tt);
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
void QueryTeleServiceHandler::postImport(const ImportTele& qt)
|
||||
{
|
||||
cout << "importStep: " << endl;
|
||||
cout << " juuid: " << qt.job_uuid << endl;
|
||||
cout << " iuuid: " << qt.import_uuid << endl;
|
||||
if (qt.msg_type == ITType::IT_SUMMARY)
|
||||
cout << " mt: SUMMARY" << endl;
|
||||
else if (qt.msg_type == ITType::IT_START)
|
||||
cout << " mt: START" << endl;
|
||||
else if (qt.msg_type == ITType::IT_TERM)
|
||||
cout << " mt: TERM" << endl;
|
||||
else
|
||||
cout << " mt: PROGRESS" << endl;
|
||||
if (qt.table_list.empty())
|
||||
cout << " tn: " << "(empty)" << endl;
|
||||
else
|
||||
cout << " tn: " << qt.table_list[0] << endl;
|
||||
if (qt.rows_so_far.empty())
|
||||
cout << " rows: " << "(empty)" << endl;
|
||||
else
|
||||
cout << " rows: " << qt.rows_so_far[0] << endl;
|
||||
int64_t tt = qt.start_time;
|
||||
cout << " st: (" << tt << ") ";
|
||||
tt /= 1000;
|
||||
cout << ctime(&tt);
|
||||
tt = qt.end_time;
|
||||
cout << " et: (" << tt << ") ";
|
||||
tt /= 1000;
|
||||
cout << ctime(&tt);
|
||||
cout << " sn: " << qt.system_name << endl;
|
||||
cout << " mn: " << qt.module_name << endl;
|
||||
cout << " dn: " << qt.schema_name << endl;
|
||||
cout << endl;
|
||||
cout << "importStep: " << endl;
|
||||
cout << " juuid: " << qt.job_uuid << endl;
|
||||
cout << " iuuid: " << qt.import_uuid << endl;
|
||||
|
||||
if (qt.msg_type == ITType::IT_SUMMARY)
|
||||
cout << " mt: SUMMARY" << endl;
|
||||
else if (qt.msg_type == ITType::IT_START)
|
||||
cout << " mt: START" << endl;
|
||||
else if (qt.msg_type == ITType::IT_TERM)
|
||||
cout << " mt: TERM" << endl;
|
||||
else
|
||||
cout << " mt: PROGRESS" << endl;
|
||||
|
||||
if (qt.table_list.empty())
|
||||
cout << " tn: " << "(empty)" << endl;
|
||||
else
|
||||
cout << " tn: " << qt.table_list[0] << endl;
|
||||
|
||||
if (qt.rows_so_far.empty())
|
||||
cout << " rows: " << "(empty)" << endl;
|
||||
else
|
||||
cout << " rows: " << qt.rows_so_far[0] << endl;
|
||||
|
||||
int64_t tt = qt.start_time;
|
||||
cout << " st: (" << tt << ") ";
|
||||
tt /= 1000;
|
||||
cout << ctime(&tt);
|
||||
tt = qt.end_time;
|
||||
cout << " et: (" << tt << ") ";
|
||||
tt /= 1000;
|
||||
cout << ctime(&tt);
|
||||
cout << " sn: " << qt.system_name << endl;
|
||||
cout << " mn: " << qt.module_name << endl;
|
||||
cout << " dn: " << qt.schema_name << endl;
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
shared_ptr<atp::TProtocolFactory> protocolFactory(new atp::TBinaryProtocolFactory());
|
||||
shared_ptr<QueryTeleServiceHandler> handler(new QueryTeleServiceHandler());
|
||||
shared_ptr<at::TProcessor> processor(new QueryTeleServiceProcessor(handler));
|
||||
shared_ptr<att::TServerTransport> serverTransport(new att::TServerSocket(9990));
|
||||
shared_ptr<att::TTransportFactory> transportFactory(new att::TBufferedTransportFactory());
|
||||
shared_ptr<atp::TProtocolFactory> protocolFactory(new atp::TBinaryProtocolFactory());
|
||||
shared_ptr<QueryTeleServiceHandler> handler(new QueryTeleServiceHandler());
|
||||
shared_ptr<at::TProcessor> processor(new QueryTeleServiceProcessor(handler));
|
||||
shared_ptr<att::TServerTransport> serverTransport(new att::TServerSocket(9990));
|
||||
shared_ptr<att::TTransportFactory> transportFactory(new att::TBufferedTransportFactory());
|
||||
|
||||
ats::TSimpleServer server(processor,
|
||||
serverTransport,
|
||||
transportFactory,
|
||||
protocolFactory);
|
||||
ats::TSimpleServer server(processor,
|
||||
serverTransport,
|
||||
transportFactory,
|
||||
protocolFactory);
|
||||
|
||||
|
||||
cout << "Starting the server..." << endl;
|
||||
server.serve();
|
||||
cout << "done." << endl;
|
||||
return 0;
|
||||
cout << "Starting the server..." << endl;
|
||||
server.serve();
|
||||
cout << "done." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -20,52 +20,52 @@ using namespace std;
|
||||
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_generators.hpp>
|
||||
namespace bu=boost::uuids;
|
||||
namespace bu = boost::uuids;
|
||||
|
||||
#include "querytele.h"
|
||||
using namespace querytele;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
bu::random_generator rg;
|
||||
QueryTeleServerParms qtsp;
|
||||
qtsp.host = "localhost";
|
||||
qtsp.port = 9090;
|
||||
QueryTeleClient qtc(qtsp);
|
||||
QueryTeleClient qtc1(qtc);
|
||||
QueryTeleClient qtc2;
|
||||
qtc2 = qtc;
|
||||
QueryTeleStats qts;
|
||||
qts.query_uuid = rg();
|
||||
qts.msg_type = QueryTeleStats::QT_START;
|
||||
qts.query = "SELECT * FROM NATION;";
|
||||
qtc.postQueryTele(qts);
|
||||
bu::random_generator rg;
|
||||
QueryTeleServerParms qtsp;
|
||||
qtsp.host = "localhost";
|
||||
qtsp.port = 9090;
|
||||
QueryTeleClient qtc(qtsp);
|
||||
QueryTeleClient qtc1(qtc);
|
||||
QueryTeleClient qtc2;
|
||||
qtc2 = qtc;
|
||||
QueryTeleStats qts;
|
||||
qts.query_uuid = rg();
|
||||
qts.msg_type = QueryTeleStats::QT_START;
|
||||
qts.query = "SELECT * FROM NATION;";
|
||||
qtc.postQueryTele(qts);
|
||||
|
||||
sleep(1);
|
||||
sleep(1);
|
||||
|
||||
StepTeleStats sts;
|
||||
sts.query_uuid = qts.query_uuid;
|
||||
sts.step_uuid = rg();
|
||||
sts.msg_type = StepTeleStats::ST_START;
|
||||
qtc.postStepTele(sts);
|
||||
StepTeleStats sts;
|
||||
sts.query_uuid = qts.query_uuid;
|
||||
sts.step_uuid = rg();
|
||||
sts.msg_type = StepTeleStats::ST_START;
|
||||
qtc.postStepTele(sts);
|
||||
|
||||
sleep(1);
|
||||
sleep(1);
|
||||
|
||||
sts.msg_type = StepTeleStats::ST_PROGRESS;
|
||||
qtc.postStepTele(sts);
|
||||
sts.msg_type = StepTeleStats::ST_PROGRESS;
|
||||
qtc.postStepTele(sts);
|
||||
|
||||
sleep(1);
|
||||
sleep(1);
|
||||
|
||||
sts.msg_type = StepTeleStats::ST_SUMMARY;
|
||||
qtc.postStepTele(sts);
|
||||
sts.msg_type = StepTeleStats::ST_SUMMARY;
|
||||
qtc.postStepTele(sts);
|
||||
|
||||
sleep(1);
|
||||
sleep(1);
|
||||
|
||||
qts.msg_type = QueryTeleStats::QT_SUMMARY;
|
||||
qtc.postQueryTele(qts);
|
||||
qts.msg_type = QueryTeleStats::QT_SUMMARY;
|
||||
qtc.postQueryTele(qts);
|
||||
|
||||
sleep(20);
|
||||
sleep(20);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -32,158 +32,164 @@ namespace querytele
|
||||
|
||||
struct QueryTeleStats
|
||||
{
|
||||
enum QTType
|
||||
{
|
||||
QT_INVALID,
|
||||
QT_SUMMARY,
|
||||
QT_PROGRESS,
|
||||
QT_START,
|
||||
};
|
||||
enum QTType
|
||||
{
|
||||
QT_INVALID,
|
||||
QT_SUMMARY,
|
||||
QT_PROGRESS,
|
||||
QT_START,
|
||||
};
|
||||
|
||||
QueryTeleStats() :
|
||||
msg_type(QT_INVALID),
|
||||
max_mem_pct(0),
|
||||
num_files(0),
|
||||
phy_io(0),
|
||||
cache_io(0),
|
||||
msg_rcv_cnt(0),
|
||||
cp_blocks_skipped(0),
|
||||
msg_bytes_in(0),
|
||||
msg_bytes_out(0),
|
||||
rows(0),
|
||||
start_time(-1),
|
||||
end_time(-1),
|
||||
error_no(0),
|
||||
blocks_changed(0),
|
||||
session_id(0),
|
||||
priority_level(0),
|
||||
local_query(0)
|
||||
{ query_uuid = boost::uuids::nil_generator()(); }
|
||||
QueryTeleStats() :
|
||||
msg_type(QT_INVALID),
|
||||
max_mem_pct(0),
|
||||
num_files(0),
|
||||
phy_io(0),
|
||||
cache_io(0),
|
||||
msg_rcv_cnt(0),
|
||||
cp_blocks_skipped(0),
|
||||
msg_bytes_in(0),
|
||||
msg_bytes_out(0),
|
||||
rows(0),
|
||||
start_time(-1),
|
||||
end_time(-1),
|
||||
error_no(0),
|
||||
blocks_changed(0),
|
||||
session_id(0),
|
||||
priority_level(0),
|
||||
local_query(0)
|
||||
{
|
||||
query_uuid = boost::uuids::nil_generator()();
|
||||
}
|
||||
|
||||
~QueryTeleStats() { }
|
||||
~QueryTeleStats() { }
|
||||
|
||||
boost::uuids::uuid query_uuid;
|
||||
QTType msg_type;
|
||||
int64_t max_mem_pct;
|
||||
int64_t num_files;
|
||||
int64_t phy_io;
|
||||
int64_t cache_io;
|
||||
int64_t msg_rcv_cnt;
|
||||
int64_t cp_blocks_skipped;
|
||||
int64_t msg_bytes_in;
|
||||
int64_t msg_bytes_out;
|
||||
int64_t rows;
|
||||
int64_t start_time;
|
||||
int64_t end_time;
|
||||
int64_t error_no;
|
||||
int64_t blocks_changed;
|
||||
int64_t session_id;
|
||||
std::string query_type;
|
||||
std::string query;
|
||||
std::string user;
|
||||
std::string host;
|
||||
std::string priority;
|
||||
int32_t priority_level;
|
||||
std::string system_name;
|
||||
std::string module_name;
|
||||
int32_t local_query;
|
||||
std::string schema_name;
|
||||
boost::uuids::uuid query_uuid;
|
||||
QTType msg_type;
|
||||
int64_t max_mem_pct;
|
||||
int64_t num_files;
|
||||
int64_t phy_io;
|
||||
int64_t cache_io;
|
||||
int64_t msg_rcv_cnt;
|
||||
int64_t cp_blocks_skipped;
|
||||
int64_t msg_bytes_in;
|
||||
int64_t msg_bytes_out;
|
||||
int64_t rows;
|
||||
int64_t start_time;
|
||||
int64_t end_time;
|
||||
int64_t error_no;
|
||||
int64_t blocks_changed;
|
||||
int64_t session_id;
|
||||
std::string query_type;
|
||||
std::string query;
|
||||
std::string user;
|
||||
std::string host;
|
||||
std::string priority;
|
||||
int32_t priority_level;
|
||||
std::string system_name;
|
||||
std::string module_name;
|
||||
int32_t local_query;
|
||||
std::string schema_name;
|
||||
};
|
||||
|
||||
struct StepTeleStats
|
||||
{
|
||||
enum STType
|
||||
{
|
||||
ST_INVALID,
|
||||
ST_SUMMARY,
|
||||
ST_PROGRESS,
|
||||
ST_START,
|
||||
};
|
||||
enum STType
|
||||
{
|
||||
ST_INVALID,
|
||||
ST_SUMMARY,
|
||||
ST_PROGRESS,
|
||||
ST_START,
|
||||
};
|
||||
|
||||
enum StepType
|
||||
{
|
||||
T_INVALID,
|
||||
T_HJS, //TupleHashJoinStep
|
||||
T_DSS, //DictionaryScanStep
|
||||
T_CES, //CrossEngineStep
|
||||
T_SQS, //SubQueryStep
|
||||
T_TAS, //TupleAggregateStep
|
||||
T_TNS, //TupleAnnexStep
|
||||
T_BPS, //TupleBPS
|
||||
T_TCS, //TupleConstantStep
|
||||
T_HVS, //TupleHavingStep
|
||||
T_WFS, //WindowFunctionStep
|
||||
T_SAS, //SubAdapterStep
|
||||
T_TUN, //TupleUnion
|
||||
};
|
||||
enum StepType
|
||||
{
|
||||
T_INVALID,
|
||||
T_HJS, //TupleHashJoinStep
|
||||
T_DSS, //DictionaryScanStep
|
||||
T_CES, //CrossEngineStep
|
||||
T_SQS, //SubQueryStep
|
||||
T_TAS, //TupleAggregateStep
|
||||
T_TNS, //TupleAnnexStep
|
||||
T_BPS, //TupleBPS
|
||||
T_TCS, //TupleConstantStep
|
||||
T_HVS, //TupleHavingStep
|
||||
T_WFS, //WindowFunctionStep
|
||||
T_SAS, //SubAdapterStep
|
||||
T_TUN, //TupleUnion
|
||||
};
|
||||
|
||||
StepTeleStats() :
|
||||
msg_type(ST_INVALID),
|
||||
step_type(T_INVALID),
|
||||
phy_io(0),
|
||||
cache_io(0),
|
||||
msg_rcv_cnt(0),
|
||||
cp_blocks_skipped(0),
|
||||
msg_bytes_in(0),
|
||||
msg_bytes_out(0),
|
||||
rows(0),
|
||||
start_time(-1),
|
||||
end_time(-1),
|
||||
total_units_of_work(0),
|
||||
units_of_work_completed(0)
|
||||
{ query_uuid = boost::uuids::nil_generator()();
|
||||
step_uuid = boost::uuids::nil_generator()(); }
|
||||
StepTeleStats() :
|
||||
msg_type(ST_INVALID),
|
||||
step_type(T_INVALID),
|
||||
phy_io(0),
|
||||
cache_io(0),
|
||||
msg_rcv_cnt(0),
|
||||
cp_blocks_skipped(0),
|
||||
msg_bytes_in(0),
|
||||
msg_bytes_out(0),
|
||||
rows(0),
|
||||
start_time(-1),
|
||||
end_time(-1),
|
||||
total_units_of_work(0),
|
||||
units_of_work_completed(0)
|
||||
{
|
||||
query_uuid = boost::uuids::nil_generator()();
|
||||
step_uuid = boost::uuids::nil_generator()();
|
||||
}
|
||||
|
||||
~StepTeleStats() { }
|
||||
~StepTeleStats() { }
|
||||
|
||||
boost::uuids::uuid query_uuid;
|
||||
STType msg_type;
|
||||
StepType step_type;
|
||||
boost::uuids::uuid step_uuid;
|
||||
int64_t phy_io;
|
||||
int64_t cache_io;
|
||||
int64_t msg_rcv_cnt;
|
||||
int64_t cp_blocks_skipped;
|
||||
int64_t msg_bytes_in;
|
||||
int64_t msg_bytes_out;
|
||||
int64_t rows;
|
||||
int64_t start_time;
|
||||
int64_t end_time;
|
||||
int32_t total_units_of_work;
|
||||
int32_t units_of_work_completed;
|
||||
boost::uuids::uuid query_uuid;
|
||||
STType msg_type;
|
||||
StepType step_type;
|
||||
boost::uuids::uuid step_uuid;
|
||||
int64_t phy_io;
|
||||
int64_t cache_io;
|
||||
int64_t msg_rcv_cnt;
|
||||
int64_t cp_blocks_skipped;
|
||||
int64_t msg_bytes_in;
|
||||
int64_t msg_bytes_out;
|
||||
int64_t rows;
|
||||
int64_t start_time;
|
||||
int64_t end_time;
|
||||
int32_t total_units_of_work;
|
||||
int32_t units_of_work_completed;
|
||||
};
|
||||
|
||||
struct ImportTeleStats
|
||||
{
|
||||
typedef std::vector<std::string> StringList;
|
||||
typedef std::vector<int64_t> I64List;
|
||||
typedef std::vector<std::string> StringList;
|
||||
typedef std::vector<int64_t> I64List;
|
||||
|
||||
enum ITType
|
||||
{
|
||||
IT_INVALID,
|
||||
IT_SUMMARY,
|
||||
IT_PROGRESS,
|
||||
IT_START,
|
||||
IT_TERM,
|
||||
};
|
||||
enum ITType
|
||||
{
|
||||
IT_INVALID,
|
||||
IT_SUMMARY,
|
||||
IT_PROGRESS,
|
||||
IT_START,
|
||||
IT_TERM,
|
||||
};
|
||||
|
||||
ImportTeleStats() :
|
||||
msg_type(IT_INVALID),
|
||||
start_time(-1),
|
||||
end_time(-1)
|
||||
{ job_uuid = boost::uuids::nil_generator()();
|
||||
import_uuid = boost::uuids::nil_generator()(); }
|
||||
ImportTeleStats() :
|
||||
msg_type(IT_INVALID),
|
||||
start_time(-1),
|
||||
end_time(-1)
|
||||
{
|
||||
job_uuid = boost::uuids::nil_generator()();
|
||||
import_uuid = boost::uuids::nil_generator()();
|
||||
}
|
||||
|
||||
boost::uuids::uuid job_uuid;
|
||||
boost::uuids::uuid import_uuid;
|
||||
ITType msg_type;
|
||||
int64_t start_time;
|
||||
int64_t end_time;
|
||||
StringList table_list;
|
||||
I64List rows_so_far;
|
||||
std::string system_name;
|
||||
std::string module_name;
|
||||
std::string schema_name;
|
||||
boost::uuids::uuid job_uuid;
|
||||
boost::uuids::uuid import_uuid;
|
||||
ITType msg_type;
|
||||
int64_t start_time;
|
||||
int64_t end_time;
|
||||
StringList table_list;
|
||||
I64List rows_so_far;
|
||||
std::string system_name;
|
||||
std::string module_name;
|
||||
std::string schema_name;
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user