1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

the begginning

This commit is contained in:
david hill
2016-01-06 14:08:59 -06:00
parent 66a31debcb
commit f6afc42dd0
18251 changed files with 16460679 additions and 2 deletions

111
writeengine/client/Makefile Executable file
View File

@ -0,0 +1,111 @@
# Copyright (C) 2014 InfiniDB, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 of
# the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
# $Id: Makefile 2966 2011-05-12 11:58:33Z dcathey $
include ../../rules.mak
include ../build/we_rules.mak
.PHONY: install clean test docs coverage leakcheck
PROGRAM=libwriteengineclient.so
VERSION=1.0.0
LIBRARY=$(PROGRAM).$(VERSION)
TLIBS=-L. -lddlpackage -L$(EXPORT_ROOT)/lib -lmessageqcpp -lloggingcpp -lconfigcpp -lxml2 -lcppunit -ldl
GLIBS=-L$(EXPORT_ROOT)/lib -lmessageqcpp -lloggingcpp -lconfigcpp -lxml2 -lcppunit -ldl
LLIBS=-L$(CALPONT_LIBRARY_PATH) -lbrm -lcacheutils -ldm
SRCS=we_clients.cpp \
we_ddlcommandclient.cpp \
we_dmlcommandclient.cpp
LINCLUDES=we_clients.h \
we_ddlcommandclient.h \
we_dmlcommandclient.h
OBJS=$(SRCS:.cpp=.o)
$(LIBRARY): $(OBJS)
$(LINK.cpp) -shared -o $(LIBRARY) $(OBJS)
rm -f $(PROGRAM)
ln -s $(LIBRARY) $(PROGRAM)
make install
install: bootstrap $(LIBRARY)
umask 002; \
mkdir -p $(INSTALL_ROOT_LIB) $(INSTALL_ROOT_INCLUDE); \
pushd $(INSTALL_ROOT_LIB) >/dev/null; \
rm -f $(LIBRARY) $(PROGRAM); \
ln -s $(LIBRARY) $(PROGRAM); \
popd >/dev/null; \
$(INSTALL) $(LIBRARY) $(INSTALL_ROOT_LIB)
bootstrap:
$(INSTALL) $(LINCLUDES) $(INSTALL_ROOT_INCLUDE)
clean:
rm -f $(LIBDIR)/tdriver.o $(OBJS) tdriver.o $(PROGRAM) $(LIBRARY) tdriver core *~ *.tag *-gcov.* *.gcov tdriver-gcov *.d *.swp *.dat
rm -rf html
docs:
doxygen $(EXPORT_ROOT)/etc/Doxyfile
tdriver: tdriver.o
$(LINK.cpp) -o $@ $^ $(TLIBS)
test:
xtest: $(LIBRARY) tdriver
$(IPCS_CLEANUP)
LD_LIBRARY_PATH=.:$(EXPORT_ROOT)/lib:/usr/local/lib ./tdriver
%-gcov.o: %.cpp
$(COMPILE.cpp) -o $@ $^
tdriver-gcov: CXXFLAGS+=-fprofile-arcs -ftest-coverage
tdriver-gcov: tdriver-gcov.o $(subst .o,-gcov.o,$(OBJS))
$(LINK.cpp) -o $@ $^ $(GLIBS)
coverage:
xcoverage: tdriver-gcov
$(IPCS_CLEANUP)
rm -f *.gcda
LD_LIBRARY_PATH=$(EXPORT_ROOT)/lib:/usr/local/lib ./tdriver-gcov
for file in $(SRCS); do \
bfile=`basename $$file .cpp`; \
gcov -o $${bfile}-gcov $$file >/dev/null; \
done
/usr/local/bin/genCoverage.pl $(SRCS)
leakcheck:
xleakcheck: $(LIBRARY) tdriver
$(IPCS_CLEANUP)
LD_LIBRARY_PATH=.:$(EXPORT_ROOT)/lib:/usr/local/lib valgrind --tool=memcheck --leak-check=yes ./tdriver
%.d: %.cpp
@set -e; rm -f $@; \
$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
ifndef BOOTSTRAP
-include $(SRCS:.cpp=.d) tdriver.d
endif

View File

@ -0,0 +1,40 @@
# Copyright (C) 2014 InfiniDB, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 of
# the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
# $Id: Makefile.am 3022 2012-03-22 12:58:08Z pleblanc $
## Process this file with automake to produce Makefile.in
AM_CPPFLAGS = $(idb_common_includes) $(idb_cppflags)
AM_CFLAGS = $(idb_cflags)
AM_CXXFLAGS = $(idb_cxxflags)
AM_LDFLAGS = -version-info 1:0:0 $(idb_ldflags)
lib_LTLIBRARIES = libwriteengineclient.la
libwriteengineclient_la_SOURCES = we_clients.cpp \
we_ddlcommandclient.cpp \
we_dmlcommandclient.cpp
include_HEADERS = we_clients.h we_ddlcommandclient.h we_dmlcommandclient.h
test:
coverage:
leakcheck:
docs:
bootstrap: install-data-am

View File

@ -0,0 +1,550 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Copyright (C) 2014 InfiniDB, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 of
# the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
# $Id: Makefile.am 3022 2012-03-22 12:58:08Z pleblanc $
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = writeengine/client
DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/compilerflags.m4 \
$(top_srcdir)/m4/functions.m4 $(top_srcdir)/m4/install.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libwriteengineclient_la_LIBADD =
am_libwriteengineclient_la_OBJECTS = we_clients.lo \
we_ddlcommandclient.lo we_dmlcommandclient.lo
libwriteengineclient_la_OBJECTS = \
$(am_libwriteengineclient_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libwriteengineclient_la_SOURCES)
DIST_SOURCES = $(libwriteengineclient_la_SOURCES)
includeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POW_LIB = @POW_LIB@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XML2_CONFIG = @XML2_CONFIG@
XML_CPPFLAGS = @XML_CPPFLAGS@
XML_LIBS = @XML_LIBS@
YACC = @YACC@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
etcdir = @etcdir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
idb_brm_libs = @idb_brm_libs@
idb_cflags = @idb_cflags@
idb_common_includes = @idb_common_includes@
idb_common_ldflags = @idb_common_ldflags@
idb_common_libs = @idb_common_libs@
idb_cppflags = @idb_cppflags@
idb_cxxflags = @idb_cxxflags@
idb_exec_libs = @idb_exec_libs@
idb_ldflags = @idb_ldflags@
idb_oam_libs = @idb_oam_libs@
idb_write_libs = @idb_write_libs@
idbinstall = @idbinstall@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localdir = @localdir@
localstatedir = @localstatedir@
mandir = @mandir@
march_flags = @march_flags@
mibdir = @mibdir@
mkdir_p = @mkdir_p@
mysqldir = @mysqldir@
netsnmp_libs = @netsnmp_libs@
netsnmpagntdir = @netsnmpagntdir@
netsnmpdir = @netsnmpdir@
netsnmplibrdir = @netsnmplibrdir@
netsnmpmachdir = @netsnmpmachdir@
netsnmpsysdir = @netsnmpsysdir@
oldincludedir = @oldincludedir@
postdir = @postdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedir = @sharedir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
toolsdir = @toolsdir@
AM_CPPFLAGS = $(idb_common_includes) $(idb_cppflags)
AM_CFLAGS = $(idb_cflags)
AM_CXXFLAGS = $(idb_cxxflags)
AM_LDFLAGS = -version-info 1:0:0 $(idb_ldflags)
lib_LTLIBRARIES = libwriteengineclient.la
libwriteengineclient_la_SOURCES = we_clients.cpp \
we_ddlcommandclient.cpp \
we_dmlcommandclient.cpp
include_HEADERS = we_clients.h we_ddlcommandclient.h we_dmlcommandclient.h
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu writeengine/client/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu writeengine/client/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libwriteengineclient.la: $(libwriteengineclient_la_OBJECTS) $(libwriteengineclient_la_DEPENDENCIES)
$(CXXLINK) -rpath $(libdir) $(libwriteengineclient_la_LDFLAGS) $(libwriteengineclient_la_OBJECTS) $(libwriteengineclient_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/we_clients.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/we_ddlcommandclient.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/we_dmlcommandclient.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
$(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
rm -f "$(DESTDIR)$(includedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-includeHEADERS
install-exec-am: install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-includeHEADERS install-info \
install-info-am install-libLTLIBRARIES install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-includeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
test:
coverage:
leakcheck:
docs:
bootstrap: install-data-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,515 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
// $Id: weclients.h 525 2010-01-19 23:18:05Z xlou $
//
/** @file */
#include <sstream>
#include <stdexcept>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <unistd.h>
#ifndef _MSC_VER
#include <arpa/inet.h>
#if __FreeBSD__
#include <sys/socket.h>
#endif
#endif
using namespace std;
#include <boost/thread/mutex.hpp>
using namespace boost;
#include "messagequeue.h"
#include "bytestream.h"
using namespace messageqcpp;
#include "configcpp.h"
using namespace config;
#include "errorids.h"
#include "exceptclasses.h"
#include "messagelog.h"
#include "messageobj.h"
#include "loggingid.h"
using namespace logging;
#include "liboamcpp.h"
#include "snmpmanager.h"
using namespace snmpmanager;
using namespace oam;
#include "we_clients.h"
#include "we_messages.h"
using namespace WriteEngine;
#include "atomicops.h"
namespace {
void writeToLog(const char* file, int line, const string& msg, LOG_TYPE logto = LOG_TYPE_INFO)
{
LoggingID lid(05);
MessageLog ml(lid);
Message::Args args;
Message m(0);
args.add(file);
args.add("@");
args.add(line);
args.add(msg);
m.format(args);
switch (logto)
{
case LOG_TYPE_DEBUG: ml.logDebugMessage(m); break;
case LOG_TYPE_INFO: ml.logInfoMessage(m); break;
case LOG_TYPE_WARNING: ml.logWarningMessage(m); break;
case LOG_TYPE_ERROR: ml.logErrorMessage(m); break;
case LOG_TYPE_CRITICAL: ml.logCriticalMessage(m); break;
}
}
string getModuleNameByIPAddr(oam::ModuleTypeConfig moduletypeconfig,
string ipAddress)
{
string modulename = "pm1";
DeviceNetworkList::iterator pt = moduletypeconfig.ModuleNetworkList.begin();
for( ; pt != moduletypeconfig.ModuleNetworkList.end() ; pt++)
{
modulename = (*pt).DeviceName;
HostConfigList::iterator pt1 = (*pt).hostConfigList.begin();
for( ; pt1 != (*pt).hostConfigList.end() ; pt1++)
{
if (ipAddress == (*pt1).IPAddr)
return modulename;
}
}
return modulename;
}
struct WEClientRunner
{
WEClientRunner(WriteEngine::WEClients *jl,
boost::shared_ptr<MessageQueueClient> cl, uint32_t connectionIndex) : jbl(jl), client(cl),
connIndex(connectionIndex) {}
WriteEngine::WEClients *jbl;
boost::shared_ptr<MessageQueueClient> client;
uint32_t connIndex;
void operator()()
{
//cout << "Listening on client at 0x" << hex << (ptrdiff_t)client << dec << endl;
try
{
jbl->Listen(client, connIndex);
//cout << "Listening connIndex " << connIndex << endl;
}
catch(std::exception& ex)
{
string what(ex.what());
cerr << "exception caught in WEClient: " << what << endl;
if (what.find("St9bad_alloc") != string::npos)
{
writeToLog(__FILE__, __LINE__, what, LOG_TYPE_CRITICAL);
// abort();
}
else writeToLog(__FILE__, __LINE__, what);
}
catch(...)
{
string msg("exception caught in WEClientRunner.");
writeToLog(__FILE__, __LINE__, msg);
cerr << msg << endl;
}
}
};
template <typename T>
struct QueueShutdown : public unary_function<T&, void>
{
void operator()(T& x)
{
x.shutdown();
}
};
inline const string sin_addr2String(const in_addr src)
{
string s;
#ifdef _MSC_VER
s = inet_ntoa(src);
#else
char dst[INET_ADDRSTRLEN];
s = inet_ntop(AF_INET, &src, dst, INET_ADDRSTRLEN);
#endif
return s;
}
}
namespace WriteEngine {
WEClients::WEClients(int PrgmID) :
fPrgmID(PrgmID),
pmCount(0)
{
closingConnection = 0;
Setup();
}
WEClients::~WEClients()
{
Close();
}
void WEClients::Setup()
{
makeBusy(true);
joblist::ResourceManager rm;
oam::Oam oam;
string ipAddress;
ModuleTypeConfig moduletypeconfig;
try {
oam.getSystemConfig("pm", moduletypeconfig);
} catch (...) {
writeToLog(__FILE__, __LINE__, "oam.getSystemConfig error, unknown exception", LOG_TYPE_ERROR);
throw runtime_error("Setup failed");
}
uint32_t pmCountConfig = moduletypeconfig.ModuleCount;
pmCount = 0;
int moduleID = 1;
char buff[32];
ByteStream bs, bsRead;
if (fPrgmID == DDLPROC)
{
bs << (ByteStream::byte) WE_SVR_DDL_KEEPALIVE;
bs << (ByteStream::octbyte) moduleID;
}
else if (fPrgmID == DMLPROC)
{
bs << (ByteStream::byte) WE_SVR_DML_KEEPALIVE;
bs << (ByteStream::octbyte) moduleID;
}
else if (fPrgmID == SPLITTER)
{
bs << (ByteStream::byte) WE_CLT_SRV_KEEPALIVE;
}
else if (fPrgmID == BATCHINSERTPROC)
{
bs << (ByteStream::byte) WE_SVR_BATCH_KEEPALIVE;
bs << (ByteStream::octbyte) moduleID;
}
for (unsigned i = 0; i < pmCountConfig; i++) {
//Find the module id
moduleID = atoi((moduletypeconfig.ModuleNetworkList[i]).DeviceName.substr(MAX_MODULE_TYPE_SIZE,MAX_MODULE_ID_SIZE).c_str());
//cout << "setting connection to moduleid " << moduleID << endl;
snprintf(buff, sizeof(buff), "pm%u_WriteEngineServer", moduleID);
string fServer (buff);
boost::shared_ptr<MessageQueueClient>
cl(new MessageQueueClient(fServer, rm.getConfig()));
boost::shared_ptr<boost::mutex> nl(new boost::mutex());
//Bug 5224. Take out the retrys. If connection fails, we assume the server is down.
try {
if (cl->connect()) {
try {
cl->write(bs);
}
catch (std::exception& ex1)
{
ostringstream oss;
oss << "Write to WES during connect failed due to " << ex1.what();
throw runtime_error(oss.str());
}
try
{
bsRead = cl->read();
if (bsRead.length() == 0)
throw runtime_error("Got byte 0 during reading " );
}
catch (std::exception& ex2) {
ostringstream oss;
oss << "Read from WES during connect failed due to " << ex2.what() << " and this = " << this;
throw runtime_error(oss.str());
}
fPmConnections[moduleID] = cl;
//cout << "connection is open. this = " << this << endl;
//cout << "set up connection to mudule " << moduleID << endl;
// assign the module name
//ipAddress = sin_addr2String(cl->serv_addr().sin_addr);
ipAddress = cl->addr2String();
cl->moduleName(getModuleNameByIPAddr(moduletypeconfig, ipAddress));
StartClientListener(cl, i);
pmCount++;
//ostringstream oss;
//oss << "WECLIENT: connected to " << fServer + " and this = " << this << " and pmcount is now " << pmCount;
//writeToLog(__FILE__, __LINE__, oss.str() , LOG_TYPE_DEBUG);
} else {
throw runtime_error("Connection refused");
}
} catch (std::exception& ex) {
writeToLog(__FILE__, __LINE__, "Could not connect to " + fServer + ": " + ex.what(), LOG_TYPE_ERROR);
cerr << "Could not connect to " << fServer << ": " << ex.what() << endl;
} catch (...) {
writeToLog(__FILE__, __LINE__, "Could not connect to " + fServer, LOG_TYPE_ERROR);
}
}
}
int WEClients::Close()
{
makeBusy(false);
closingConnection = 1;
ByteStream bs;
bs << (ByteStream::byte) WE_SVR_CLOSE_CONNECTION;
write_to_all(bs);
//cout << "connection is closed. this = " << this << " and closingConnection = " << closingConnection << endl;
for (uint32_t i=0; i < fWESReader.size(); i++)
{
fWESReader[i]->join();
}
fWESReader.clear();
fPmConnections.clear();
pmCount = 0;
//ostringstream oss;
//oss << "WECLIENT: closed connection to wes and this = " << this << " and pmcount is now " << pmCount;
//writeToLog(__FILE__, __LINE__, oss.str() , LOG_TYPE_DEBUG);
return 0;
}
void WEClients::Listen ( boost::shared_ptr<MessageQueueClient> client, uint32_t connIndex)
{
SBS sbs;
try {
while ( Busy() )
{
//TODO: This call blocks so setting Busy() in another thread doesn't work here...
sbs = client->read();
if ( sbs->length() != 0 )
{
//cout << "adding data to connIndex " << endl;
addDataToOutput(sbs, connIndex);
}
else // got zero bytes on read, nothing more will come
{
if (closingConnection > 0)
{
return;
}
cerr << "WEC got 0 byte message for object " << this << endl;
goto Error;
}
}
return;
} catch (std::exception& e)
{
cerr << "WEC Caught EXCEPTION: " << e.what() << endl;
goto Error;
}
catch (...)
{
cerr << "WEC Caught UNKNOWN EXCEPT" << endl;
goto Error;
}
Error:
// error condition! push 0 length bs to messagequeuemap and
// eventually let jobstep error out.
mutex::scoped_lock lk(fMlock);
MessageQueueMap::iterator map_tok;
sbs.reset(new ByteStream(0));
for (map_tok = fSessionMessages.begin(); map_tok != fSessionMessages.end(); ++map_tok)
{
map_tok->second->queue.clear();
(void)atomicops::atomicInc(&map_tok->second->unackedWork[0]);
map_tok->second->queue.push(sbs);
}
lk.unlock();
// reset the pmconnection map
{
mutex::scoped_lock onErrLock(fOnErrMutex);
string moduleName = client->moduleName();
ClientList::iterator itor = fPmConnections.begin();
while (itor != fPmConnections.end())
{
if (moduleName == (itor->second)->moduleName())
{
(fPmConnections[itor->first]).reset();
pmCount--;
ostringstream oss;
//oss << "WECLIENT: connection to is reset and this = " << this << " and pmcount is decremented.";
//writeToLog(__FILE__, __LINE__, oss.str() , LOG_TYPE_DEBUG);
}
itor++;
}
// send alarm
SNMPManager alarmMgr;
// string alarmItem = sin_addr2String(client->serv_addr().sin_addr);
string alarmItem = client->addr2String();
alarmItem.append(" WriteEngineServer");
alarmMgr.sendAlarmReport(alarmItem.c_str(), oam::CONN_FAILURE, SET);
}
return;
}
void WEClients::addQueue(uint32_t key)
{
bool b;
mutex* lock = new mutex();
condition* cond = new condition();
boost::shared_ptr<MQE> mqe(new MQE(pmCount));
mqe->queue = WESMsgQueue(lock, cond);
mutex::scoped_lock lk ( fMlock );
b = fSessionMessages.insert(pair<uint32_t, boost::shared_ptr<MQE> >(key, mqe)).second;
if (!b) {
ostringstream os;
os << "WEClient: attempt to add a queue with a duplicate ID " << key << endl;
throw runtime_error(os.str());
}
}
void WEClients::removeQueue(uint32_t key)
{
mutex::scoped_lock lk(fMlock);
MessageQueueMap::iterator map_tok = fSessionMessages.find(key);
if (map_tok == fSessionMessages.end())
return;
map_tok->second->queue.shutdown();
map_tok->second->queue.clear();
fSessionMessages.erase(map_tok);
}
void WEClients::shutdownQueue(uint32_t key)
{
mutex::scoped_lock lk(fMlock);
MessageQueueMap::iterator map_tok = fSessionMessages.find(key);
if (map_tok == fSessionMessages.end())
return;
map_tok->second->queue.shutdown();
map_tok->second->queue.clear();
}
void WEClients::read(uint32_t key, SBS &bs)
{
boost::shared_ptr<MQE> mqe;
//Find the StepMsgQueueList for this session
mutex::scoped_lock lk(fMlock);
MessageQueueMap::iterator map_tok = fSessionMessages.find(key);
if(map_tok == fSessionMessages.end())
{
ostringstream os;
//cout << " reading for key " << key << " not found" << endl;
os << "WEClient: attempt to read(bs) from a nonexistent queue\n";
throw runtime_error(os.str());
}
mqe = map_tok->second;
lk.unlock();
//this method can block: you can't hold any locks here...
(void)mqe->queue.pop(&bs);
if (!bs)
bs.reset(new ByteStream());
}
void WEClients::write(const messageqcpp::ByteStream &msg, uint32_t connection)
{
if (pmCount == 0)
{
ostringstream oss;
oss << "WECLIENT: There is no connection to WES and this = " << this ;
writeToLog(__FILE__, __LINE__, oss.str() , LOG_TYPE_DEBUG);
throw runtime_error("There is no WriteEngineServer to send message to.");
}
if (fPmConnections[connection] != 0)
fPmConnections[connection]->write(msg);
else {
ostringstream os;
os << "Lost connection to WriteEngineServer on pm" << connection;
throw runtime_error(os.str());
}
}
void WEClients::write_to_all(const messageqcpp::ByteStream &msg)
{
if (pmCount == 0)
{
ostringstream oss;
oss << "WECLIENT: There is no connection to WES and this = " << this ;
writeToLog(__FILE__, __LINE__, oss.str() , LOG_TYPE_DEBUG);
throw runtime_error("There is no WriteEngineServer to send message to.");
}
ClientList::iterator itor = fPmConnections.begin();
while (itor != fPmConnections.end())
{
if (itor->second != NULL)
{
itor->second->write(msg);
}
itor++;
}
}
void WEClients::StartClientListener(boost::shared_ptr<MessageQueueClient> cl, uint32_t connIndex)
{
boost::thread *thrd = new boost::thread(WEClientRunner(this, cl, connIndex));
fWESReader.push_back(thrd);
}
void WEClients::addDataToOutput(SBS sbs, uint32_t connIndex)
{
// ISMPacketHeader *hdr = (ISMPacketHeader*)(sbs->buf());
// PrimitiveHeader *p = (PrimitiveHeader *)(hdr+1);
//uint32_t uniqueId = p->UniqueID;
uint64_t uniqueId = 0;
*sbs >> uniqueId;
boost::shared_ptr<MQE> mqe;
mutex::scoped_lock lk(fMlock);
MessageQueueMap::iterator map_tok = fSessionMessages.find(uniqueId);
if(map_tok == fSessionMessages.end())
{
return;
}
mqe = map_tok->second;
lk.unlock();
if (pmCount > 0) {
atomicops::atomicInc(&mqe->unackedWork[connIndex % pmCount]);
}
(void)mqe->queue.push(sbs);
}
}
// vim:ts=4 sw=4:

View File

@ -0,0 +1,161 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
// $Id: weclients.h 525 2010-01-19 23:18:05Z xlou $
//
/** @file */
#ifndef WECLIENTS_H__
#define WECLIENTS_H__
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <boost/thread.hpp>
#include <boost/thread/condition.hpp>
#include <boost/scoped_array.hpp>
#include "bytestream.h"
//#include "we_message.h"
#include "threadsafequeue.h"
#include "rwlock_local.h"
#include "resourcemanager.h"
#if defined(_MSC_VER) && defined(xxxWECLIENTS_DLLEXPORT)
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
namespace WriteEngine {
class WEClients
{
public:
/**
* Constructors
*/
EXPORT WEClients(int PrgmID);
EXPORT ~WEClients();
//static boost::mutex map_mutex;
EXPORT void addQueue(uint32_t key);
EXPORT void removeQueue(uint32_t key);
EXPORT void shutdownQueue(uint32_t key);
/** @brief read a Write Engine Server response
*
* Returns the next message in the inbound queue for unique ids.
* @param bs A pointer to the ByteStream to fill in.
* @note: saves a copy vs read(uint32_t, uint32_t).
*/
EXPORT void read(uint32_t key, messageqcpp::SBS &);
/** @brief write function to write to specified PM
*/
EXPORT void write(const messageqcpp::ByteStream &msg, uint32_t connection);
/** @brief write function to write to all PMs
*/
EXPORT void write_to_all(const messageqcpp::ByteStream &msg);
/** @brief Shutdown this object
*
* Closes all the connections created during Setup() and cleans up other stuff.
*/
EXPORT int Close();
/** @brief Start listening for Write Engine Server responses
*
* Starts the current thread listening on the client socket for Write Engine Server response messages. Will not return
* until busy() returns false or a zero-length response is received.
*/
EXPORT void Listen(boost::shared_ptr<messageqcpp::MessageQueueClient> client, uint32_t connIndex);
/** @brief set/unset busy flag
*
* Set or unset the busy flag so Listen() can return.
*/
EXPORT void makeBusy(bool b) { fBusy = b; }
/** @brief fBusy accessor
*
*/
EXPORT bool Busy() const { return fBusy; }
EXPORT void Setup();
uint64_t connectedWEServers() const { return fPmConnections.size(); }
/** @brief accessor
*/
uint32_t getPmCount() { return pmCount; }
private:
WEClients(const WEClients& weClient);
WEClients& operator=(const WEClients& weClient);
typedef std::vector<boost::thread*> ReaderList;
typedef std::map<unsigned, boost::shared_ptr<messageqcpp::MessageQueueClient> > ClientList;
//A queue of ByteStreams coming in from Write Engine Server
typedef joblist::ThreadSafeQueue<messageqcpp::SBS> WESMsgQueue;
/* To keep some state associated with the connection */
struct MQE {
MQE(uint32_t pCount) : ackSocketIndex(0), pmCount(pCount){
unackedWork.reset(new volatile uint32_t[pmCount]);
memset((void *) unackedWork.get(), 0, pmCount * sizeof(uint32_t));
}
WESMsgQueue queue;
uint32_t ackSocketIndex;
boost::scoped_array<volatile uint32_t> unackedWork;
uint32_t pmCount;
};
//The mapping of session ids to StepMsgQueueLists
typedef std::map<unsigned, boost::shared_ptr<MQE> > MessageQueueMap;
void StartClientListener(boost::shared_ptr<messageqcpp::MessageQueueClient> cl, uint32_t connIndex);
/** @brief Add a message to the queue
*
*/
void addDataToOutput(messageqcpp::SBS, uint32_t connIndex);
int fPrgmID;
ClientList fPmConnections; // all the Write Engine servers
ReaderList fWESReader; // all the reader threads for the pm servers
MessageQueueMap fSessionMessages; // place to put messages from the pm server to be returned by the Read method
boost::mutex fMlock; //sessionMessages mutex
std::vector<boost::shared_ptr<boost::mutex> > fWlock; //WES socket write mutexes
bool fBusy;
volatile uint32_t closingConnection;
uint32_t pmCount;
boost::mutex fOnErrMutex; // to lock function scope to reset pmconnections under error condition
boost::mutex ackLock;
public:
enum {DDLPROC=0, SPLITTER, DMLPROC, BATCHINSERTPROC};
};
}
#undef EXPORT
#endif
// vim:ts=4 sw=4:

View File

@ -0,0 +1,94 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <unistd.h>
#include "bytestream.h"
using namespace messageqcpp;
#include "we_messages.h"
#include "we_clients.h"
#include "resourcemanager.h"
#include "ddlpkg.h"
#include "ddlpackageprocessor.h"
#include <boost/date_time/gregorian/gregorian.hpp>
using namespace boost::gregorian;
#include "dataconvert.h"
using namespace dataconvert;
using namespace ddlpackage;
using namespace ddlpackageprocessor;
#include "we_ddlcommandclient.h"
namespace WriteEngine {
WE_DDLCommandClient::WE_DDLCommandClient()
{
fWEClient = new WEClients(WEClients::DDLPROC);
}
WE_DDLCommandClient::~WE_DDLCommandClient()
{
delete fWEClient;
fWEClient = NULL;
}
uint8_t WE_DDLCommandClient::UpdateSyscolumnNextval(uint32_t columnOid, uint64_t nextVal, uint32_t sessionID)
{
ByteStream command, response;
uint8_t err = 0;
uint64_t uniqueId = fDbrm.getUnique64();
fWEClient->addQueue(uniqueId);
command << (ByteStream::byte)WE_UPDATE_NEXTVAL;
command << uniqueId;
command << columnOid;
command << nextVal;
command << sessionID;
uint16_t dbRoot;
BRM::OID_t oid = 1021;
fDbrm.getSysCatDBRoot(oid, dbRoot);
int pmNum = 1;
boost::shared_ptr<messageqcpp::ByteStream> bsIn;
try {
fOam.getDbrootPmConfig (dbRoot, pmNum);
fWEClient->write(command, pmNum);
while (1)
{
bsIn.reset(new ByteStream());
fWEClient->read(uniqueId, bsIn);
if ( bsIn->length() == 0 ) //read error
{
err = 1;
break;
}
else {
*bsIn >> err;
break;
}
}
}
catch (...)
{
err = 1;
}
fWEClient->removeQueue(uniqueId);
return err;
}
}

View File

@ -0,0 +1,67 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#ifndef WE_DDLCOMMANDCLIENT_H__
#define WE_DDLCOMMANDCLIENT_H__
#include <unistd.h>
#include "bytestream.h"
#include "we_messages.h"
#include "we_clients.h"
#include "dbrm.h"
#include "liboamcpp.h"
#include "writeengine.h"
#if defined(_MSC_VER) && defined(xxxWE_DDLCOMMANDCLIENT_DLLEXPORT)
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
#include <boost/date_time/gregorian/gregorian.hpp>
#include "dataconvert.h"
namespace WriteEngine
{
class WE_DDLCommandClient
{
public:
EXPORT WE_DDLCommandClient();
EXPORT ~WE_DDLCommandClient();
/** @brief Update SYSCOLUMN nextval column for the columnoid with nextVal.
*
* Update SYSCOLUMN nextval column for the columnoid with nexValue.
* @param columnOid (in) The column OID
* @param nextVal (in) The partition number
* @return 0 on success, non-0 on error.
*/
EXPORT uint8_t UpdateSyscolumnNextval(uint32_t columnOid, uint64_t nextVal, uint32_t sessionID = 0);
private:
BRM::DBRM fDbrm;
WEClients* fWEClient;
oam::Oam fOam;
};
}
#undef EXPORT
#endif

View File

@ -0,0 +1,50 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <unistd.h>
#include "bytestream.h"
using namespace messageqcpp;
#include "we_messages.h"
#include "we_clients.h"
#include "resourcemanager.h"
#include "dmlpkg.h"
#include "ddlpackageprocessor.h"
#include <boost/date_time/gregorian/gregorian.hpp>
using namespace boost::gregorian;
#include "dataconvert.h"
using namespace dataconvert;
using namespace dmlpackage;
#include "we_dmlcommandclient.h"
namespace WriteEngine {
WE_DMLCommandClient::WE_DMLCommandClient()
{
fWEClient = new WEClients(WEClients::DDLPROC);
}
WE_DMLCommandClient::~WE_DMLCommandClient()
{
delete fWEClient;
fWEClient = NULL;
}
}

View File

@ -0,0 +1,59 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#ifndef WE_DMLCOMMANDCLIENT_H__
#define WE_DMLCOMMANDCLIENT_H__
#include <unistd.h>
#include "bytestream.h"
#include "we_messages.h"
#include "we_clients.h"
#include "dbrm.h"
#include "liboamcpp.h"
#include "writeengine.h"
#if defined(_MSC_VER) && defined(xxxWE_DDLCOMMANDCLIENT_DLLEXPORT)
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
#include <boost/date_time/gregorian/gregorian.hpp>
#include "dataconvert.h"
namespace WriteEngine
{
class WE_DMLCommandClient
{
public:
EXPORT WE_DMLCommandClient();
EXPORT ~WE_DMLCommandClient();
private:
BRM::DBRM fDbrm;
WEClients* fWEClient;
oam::Oam fOam;
};
}
#undef EXPORT
#endif