1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +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

View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<Calpont Version="V1.0.0">
<MessageLog>
<MessageLogFile>./MessageFile.txt</MessageLogFile>
</MessageLog>
<Messageq>
<Dir>/var/tmp</Dir>
</Messageq>
<ExeMgr>
<IPAddr>127.0.0.1</IPAddr>
<Port>8601</Port>
</ExeMgr>
<JobProc>
<IPAddr>127.0.0.1</IPAddr>
<Port>8602</Port>
</JobProc>
<CEC1>
<IPAddr>127.0.0.1</IPAddr>
<Port>8604</Port>
</CEC1>
<ProcMgr>
<IPAddr>127.0.0.1</IPAddr>
<Port>8606</Port>
</ProcMgr>
<CFE1>
<IPAddr>127.0.0.1</IPAddr>
<Port>8608</Port>
</CFE1>
<CDE1>
<IPAddr>127.0.0.1</IPAddr>
<Port>8609</Port>
</CDE1>
<CalpontConsole>
<IPAddr>127.0.0.1</IPAddr>
<Port>8610</Port>
</CalpontConsole>
<DDLProc>
<IPAddr>127.0.0.1</IPAddr>
<Port>8612</Port>
</DDLProc>
<DMLProc>
<IPAddr>127.0.0.1</IPAddr>
<Port>8614</Port>
</DMLProc>
<SystemConfig>
<SystemOpState>MAN_OFFLINE</SystemOpState>
<SystemVersion>V1.0.0.0</SystemVersion>
<SystemDebugLevel>10</SystemDebugLevel>
<AlarmLogKept>7</AlarmLogKept>
<AlarmLogSize>64000</AlarmLogSize>
<SystemLogKept>7</SystemLogKept>
<SystemLogSize>64000</SystemLogSize>
<ServerHeartbeatPeriod>1</ServerHeartbeatPeriod>
<ServerHeartbeatCount>3</ServerHeartbeatCount>
<ProcessHeartbeatPeriod>1</ProcessHeartbeatPeriod>
<ProcessHeartbeatCount>3</ProcessHeartbeatCount>
<MemorySize>0</MemorySize>
<MemoryDictionary>33</MemoryDictionary>
<MemoryPointers>33</MemoryPointers>
<MemoryCache>34</MemoryCache>
<FPGAVersion>v1.0.0.0</FPGAVersion>
<ISMCard1>ISM</ISMCard1>
<ISMCard2>ISM</ISMCard2>
<ISMCard3>ISM</ISMCard3>
<ISMCard4>ISM</ISMCard4>
<ISMCard5>SQL</ISMCard5>
<ISMCard6>INSERT</ISMCard6>
<ISMCard7>SPARE</ISMCard7>
</SystemConfig>
<SystemServerConfig>
<ServerOpState1>MAN_OFFLINE</ServerOpState1>
<ServerName1>CFE1</ServerName1>
<ServerIPAddr1>127.0.0.1</ServerIPAddr1>
<ServerVersion1>V1.0.0.0</ServerVersion1>
<ServerCPUCriticalThreshold1>9000</ServerCPUCriticalThreshold1>
<ServerCPUMajorThreshold1>8000</ServerCPUMajorThreshold1>
<ServerCPULowThreshold1>7000</ServerCPULowThreshold1>
<ServerCPULowClearThreshold1>6000</ServerCPULowClearThreshold1>
<ServerSerialNum1>0</ServerSerialNum1>
<ServerOpState2>MAN_OFFLINE</ServerOpState2>
<ServerName2>CEC1</ServerName2>
<ServerIPAddr2>127.0.0.1</ServerIPAddr2>
<ServerVersion2>V1.0.0.0</ServerVersion2>
<ServerSerialNum2>0</ServerSerialNum2>
<ServerCPUCriticalThreshold2>9000</ServerCPUCriticalThreshold2>
<ServerCPUMajorThreshold2>8000</ServerCPUMajorThreshold2>
<ServerCPULowThreshold2>7000</ServerCPULowThreshold2>
<ServerCPULowClearThreshold2>6000</ServerCPULowClearThreshold2>
<ServerOpState3>MAN_OFFLINE</ServerOpState3>
<ServerName3>CDE1</ServerName3>
<ServerIPAddr3>127.0.0.1</ServerIPAddr3>
<ServerVersion3>V1.0.0.0</ServerVersion3>
<ServerSerialNum3>0</ServerSerialNum3>
<ServerCPUCriticalThreshold3>9000</ServerCPUCriticalThreshold3>
<ServerCPUMajorThreshold3>8000</ServerCPUMajorThreshold3>
<ServerCPULowThreshold3>7000</ServerCPULowThreshold3>
<ServerCPULowClearThreshold3>6000</ServerCPULowClearThreshold3>
</SystemServerConfig>
</Calpont>

View File

@ -0,0 +1,199 @@
# $Id: ErrorMessage.txt 3830 2013-05-23 22:28:07Z xlou $
#
# This file maps error ID's to error texts.
#
# When you need a new message text, you put it here and you add a detailed description
# in the error message descriptions document in the Software docs folder
#
# There must be three tokens on each line:
#
# token 1: error ID
# token 2: internal error name
# token 3: error message text to describe the error
#
# The tokens should be separated by one tab character. The error message text may contain
# any character(s) except tab. The line must end with a single '\n'.
# Non support errors 1000 ~ 2000.
# The query will go through the optimizer again with some optimization turned off
1000 ERR_MISS_JOIN %1% not joined.
1001 ERR_NON_SUPPORTED_FUNCTION Function '%1%' can only be used in the outermost select or order by clause and cannot be used in conjunction with an aggregate function.
1002 ERR_INCOMPATIBLE_JOIN %1% incompatible column type specified for join condition.
1003 ERR_CIRCULAR_JOIN Circular joins are not supported.
1004 ERR_MIX_JOIN Mixed %1% JOIN is not supported.
1005 ERR_UPDATE_SUB update with subselect in select clause is currently not supported in InfiniDB.
1006 ERR_DATATYPE_NOT_SUPPORT Function called with unsupported datatype.
1007 ERR_DML_NOT_SUPPORT_FEATURE This version of InfiniDB does not yet support the use of '%1%' in an update or delete statement.
1008 ERR_CREATE_DATATYPE_NOT_SUPPORT The syntax or the data type(s) is not supported by InfiniDB. Please check the InfiniDB syntax guide for supported syntax or data types.
# 1009 ERR_CREATE_DATACOMPRESSION_NOT_SUPPORT The compression type is not supported in InfiniDB Community.
1009 ERR_ENTERPRISE_ONLY %1% is only available in InfiniDB Enterprise.
1010 ERR_AGGREGATE_TYPE_NOT_SUPPORT '%1%' for column type '%2%' isn't supported.
1011 ERR_DML_VIEW %1% on VIEW is currently not supported.
1012 ERR_UPDATE_NOT_SUPPORT_FEATURE This version of InfiniDB supports update of only one table at a time.
1013 ERR_CREATE_AUTOINCREMENT_NOT_SUPPORT Autoincrement columns are only available in InfiniDB Enterprise.
1014 ERR_ROLLUP_NOT_SUPPORT Rollup is currently not supported.
1015 ERR_OUTER_JOIN_SUBSELECT Subquery on OUTER JOIN ON clause is currently not supported.
1016 ERR_PARTITION_BY_RANGE The column type %1% is currently not supported in %2% function.
1017 ERR_SP_FUNCTION_NOT_SUPPORT Stored function is currently not supported in InfiniDB.
1018 ERR_DBJ_ANTI_NULL Cannot currently process a disk-based antijoin with a function filter and a NULL join column in the large-side table.
# Other errors ...
2001 ERR_JOIN_TOO_BIG Join or subselect exceeds memory limit.
2002 ERR_UNION_TOO_BIG Union memory limit exceeded.
2003 ERR_AGGREGATION_TOO_BIG Aggregation/Distinct memory limit is exceeded.
#2004 Connector can not connect to ExeMgr
2004 ERR_LOST_CONN_EXEMGR Cannot connect to ExeMgr.
#2005 Connector can connect to ExeMgr, but ExeMgr fail to respond. possibly PrimProc issue
2005 ERR_EXEMGR_MALFUNCTION ExeMgr is not functioning correctly.
2006 ERR_TABLE_NOT_IN_CATALOG %1% does not exist in InfiniDB.
2007 ERR_DICTBUFFER_OVERFLOW The dictionary buffer is too small for this query; increase <PrimitiveServers><DictBufferSize> and try again.
2008 ERR_VERSIONBUFFER_OVERFLOW The version buffer overflowed. Increase VersionBufferFileSize or limit the rows to be processed.
2009 ERR_TABLE_LOCKED Unable to perform the operation because %1% with PID %2% is currently holding the table lock for session %3%.
2010 ERR_ACTIVE_TRANSACTION Unable to perform DDL/DML because session %1% has an active transaction.
2011 ERR_VIOLATE_NOT_NULL Column ' %1% ' cannot be null.
2012 ERR_EXTENT_DISK_SPACE Not able to add extent; adding extent would exceed max file system disk usage. %1%
2013 ERR_NON_NUMERIC_DATA Not able to convert the input data; Data value %1% does not match data type.
2014 ERR_JOBLIST Error in making/executing job steps in DML
2015 ERR_ORDERBY_TOO_BIG Sorting length exceeded. Session variable max_length_for_sort_data needs to be set higher.
2016 ERR_NON_SUPPORT_GROUP_BY Non supported item %1% on the GROUP BY list.
2017 ERR_IN_DELIVERY ExeMgr failed to deliver result set to connector.
2018 ERR_LIMIT_TOO_BIG Not enough memory to process the LIMIT. Consider raising TotalUmMemory or reducing memory usage.
2019 ERR_IN_PROCESS Caught exception in process: %1%.
2020 ERR_MUL_ARG_AGG Multiple arguments in aggregate function is currently not supported.
2021 ERR_NOT_GROUPBY_EXPRESSION %1% is not in GROUP BY clause. All non-aggregate columns in the SELECT and ORDER BY clause must be included in the GROUP BY clause.
2022 ERR_ORDERBY_NOT_IN_DISTINCT ORDER BY column not in DISTINCT list.
2023 ERR_NO_PRIMPROC PrimProc is not running (or connection to PrimProc dropped).
2024 ERR_FUNC_MULTI_COL Multiple columns operand is only supported with "IN", "NOT IN", "=" and "<>" operators.
2025 WARN_DATA_TRUNC Data truncated for column %1%
2026 ERR_AGG_IN_WHERE Group function is not allowed in WHERE clause.
2027 ERR_NON_SUPPORT_AGG_ARGS Non supported item in aggregate function %1%.
2028 ERR_NO_FROM FROM keyword not found where expected.
2029 ERR_LOCK_TABLE Lock table command is currently not supported in InfiniDB.
2030 ERR_FILTER_COND_EXP Predicate and Logic operators can not be used where an expression is expected.
2031 ERR_BRM_LOOKUP Blocks are missing. Alter or drop table in progress?
2032 ERR_INCORRECT_VALUE Incorrect %1% value: '%2%'.
2033 ERR_SYSTEM_CATALOG Error occurred when calling system catalog.
2034 ERR_DATA_OFFLINE At least one DBRoot required for that query is offline.
2035 ERR_ASSERTION_FAILURE An internal error occurred. Check the error log file & contact support.
2036 ERR_PARTITION_NO_SCHEMA No schema is specified for this partition function.
2037 ERR_INVALID_FUNC_ARGUMENT %1% in function arguments.
2038 ERR_O_DIRECT Failed to open file. The DirectIO setting in Calpont.xml may not be compatible with the file system.
2039 ERR_ENOENT Data file does not exist, please contact your system administrator for more information.
2040 WARN_NO_PARTITION_FOUND No partition found for the given value range.
2041 SYSTABLE_PARTITION Systables' partition cannot be modified.
2042 WARN_NO_PARTITION_PERFORMED No partitions are %1%.
# a couple generic error msgs, for calls converted from the old logging system
2043 ERR_DICTIONARY_SCAN An internal error occurred. Check the error log file & contact support.
2044 ERR_TUPLE_BPS An internal error occurred. Check the error log file & contact support.
2045 ERR_PRIMPROC_DOWN At least one PrimProc closed the connection unexpectedly.
2046 ERR_READ_INPUT_DATALIST Input datalist read error.
2047 ERR_LOCAL_QUERY_UM Query attempted on UM (no PM) with infinidb_local_query set.
# disk-based join runtime errors from supported queries
2048 ERR_DBJ_FILE_IO_ERROR There was an IO error doing a disk-based join.
2049 ERR_DBJ_UNKNOWN_ERROR An unknown error error occured doing a disk-based join. Check the error log & contact support.
2050 ERR_DBJ_DISK_USAGE_LIMIT This query exceeded the temp disk usage limit. Raise infinidb_diskjoin_smallsidelimit if possible and try again.
2051 ERR_DBJ_DATA_DISTRIBUTION The data distribution in this query overflowed a disk-based join bucket. If possible, raise infinidb_diskjoin_bucketsize and try again.
2052 INFO_SWITCHING_TO_DJS Out of UM memory, switching to disk-based join.
# Sub-query errors
3001 ERR_NON_SUPPORT_SUB_QUERY_TYPE This subquery type is not supported yet.
3002 ERR_MORE_THAN_1_ROW Subquery returns more than 1 row.
3003 ERR_MEMORY_MAX_FOR_LIMIT_TOO_LOW MAX memory for LIMIT is set too low.
3004 ERR_CORRELATE_SCOPE_NOT_SUPPORTED Skipped correlate scope is not supported yet.
3005 ERR_CORRELATED_DATA_TYPE_INCOMPATIBLE Correlated data type is not compatible.
3006 ERR_INVALID_OPERATOR_WITH_LIST This operator cannot be used with lists.
3007 ERR_CORRELATE_FAIL Mapping correlated data failed.
3008 ERR_AGG_EXISTS Aggregate function in EXISTS subquery is currently not supported.
3009 ERR_UNKNOWN_COL Unknown column '%1%'.
3010 ERR_AMBIGUOUS_COL Ambiguous column '%1%'.
3011 ERR_NON_SUPPORT_ORDER_BY Non-supported item in Order By clause.
3012 ERR_NON_SUPPORT_SCALAR Scalar filter and semi join are not from the same pair of tables.
3013 ERR_UNION_IN_SUBQUERY Subquery with union is currently only supported in the FROM clause.
3014 ERR_ALL_SOME_IN_SUBQUERY Scalar subquery with ALL/SOME/ANY is currently not supported.
3015 ERR_NON_SUPPORT_HAVING Correlated subquery in HAVING clause is currently not supported.
3016 ERR_NON_SUPPORT_SELECT_SUB Function or Operator with sub query on the SELECT clause is currently not supported.
3017 ERR_NON_SUPPORT_DELETE_SUB Subquery in DELETE statements is currently not supported.
3018 ERR_MISS_JOIN_IN_SUB %1% table is not joined in the subquery.
3019 ERR_NON_SUPPORT_LIMIT_SUB Limit within a correlated subquery is currently not supported.
3020 ERR_NON_SUPPORT_INSERT_SUB Subquery in INSERT statements is currently not supported.
3021 ERR_SUB_EXPRESSION Subquery cannot be used within an expression.
3022 ERR_NON_SUPPORT_FUNC_SUB Scalar subquery within a function is currently not supported.
3033 ERR_CORRELATED_SUB_OR Correlated subquery within OR operator is currently not supported.
3034 ERR_CORRELATE_COL_MISSING Query is not supported. Unknown column '%1%' in subquery.
3035 ERR_NON_SUPPORT_NEQ_AGG_SUB Not equal comparison between a column within a subquery with an aggregate result and a column outside of the subquery is not supported.
# DDL & DML Errors
4001 ERR_INVALID_LAST_PARTITION Partition(s) %1% %2% in the last "physical" partition for a DBRoot and cannot be disabled or dropped.
4002 ERR_PARTITION_ALREADY_DISABLED One or more partitions have already been disabled. The states of those partitions remain unchanged.
4003 ERR_PARTITION_NOT_EXIST Partition "%1%" does not exist.
4004 ERR_PARTITION_ALREADY_ENABLED One or more partitions have already been enabled. The states of those partitions remain unchanged.
4005 NO_VALID_TRANSACTION_ID There is no valid transaction ID for this session.
4006 ERR_INVALID_START_VALUE The provided start value is invalid.
4007 ERR_INVALID_COMPRESSION_TYPE The provided compression type is not supported.
4008 ERR_INVALID_AUTOINCREMENT_TYPE Autoincrement column must be an integral data type.
4009 ERR_INVALID_NUMBER_AUTOINCREMENT Only one column in the table may be specified as autoincrement.
4010 ERR_NEGATIVE_STARTVALUE The starting autoincrement value must be greater than 0.
4011 ERR_INVALID_STARTVALUE The specified starting autoincrement value is too large.
4012 ERR_EXCEED_LIMIT The maximum allowed value has been exceeded for the autoincrement column data type.
4013 ERR_INVALID_VARBINARYVALUE The value is not varbinary.
4014 ERR_CONSTRAINTS Constraints are currently not supported in InfiniDB.
4015 ERR_NOT_NULL_CONSTRAINTS Column '%1%' cannot be null.
4016 ERR_DML_DDL_SLAVE DML and DDL statements for InfiniDB tables can only be run from the replication master.
4017 ERR_DML_DDL_LOCAL DML and DDL statements are not allowed when infinidb_local_query is greater than 0.
4018 ERR_NON_SUPPORT_SYNTAX The statement is not supported in InfiniDB.
# UDF
5001 ERR_FUNC_NON_IMPLEMENT %1%:%2% is not implemented.
5002 ERR_PSEUDOCOL_IDB_ONLY Pseudo column function '%1%' is only supported in InfiniDB.
5003 ERR_PSEUDOCOL_WRONG_ARG Argument of pseudo column function '%1%' is invalid.
# DBRM Errors
6001 ERR_NETWORK DBRM encountered a network error, check the controllernode.
6002 ERR_BRM_MUTEX A process crashed while holding the BRM mutex. The lock state is unreliable. Please restart InfiniDB.
6003 ERR_UNRECOVERABLE_LOCK_STATE Unrecoverable BRM lock state detected. Diagnostic values: r=%1% rwt=%2 w=%3% wwt=%4%. Please restart InfiniDB.
6004 ERR_RECOVERABLE_LOCK_STATE Attempting to fix the BRM lock state. Diagnostic values: r=%1% rwt=%2 w=%3% wwt=%4%.
6005 ERR_SUCCESSFUL_RECOVERY BRM lock state appears to be functional again.
6006 ERR_HARD_FAILURE DBRM encountered, most likely, a network or disk problem performing that operation.
# MySQL daemon Errors (7001~8000 reserved. Do not change the error numbers)
7001 ERR_NON_IDB_TABLE Non Calpont table(s) on the FROM clause.
# Cross Engine Errors
8001 ERR_CROSS_ENGINE_CONFIG CrossEngineSupport section in Calpont.xml is not properly configured.
8002 ERR_CROSS_ENGINE_CONNECT Error: %1%.
# Window Function Errors
#9001 is generic unknown error. should not be thrown when feature gets stable.
9001 ERR_WF_NON_SUPPORT Non supported item in window function.
9002 ERR_WF_WINDOW_WITHOUT_ORDER Missing ORDER BY expression in the window specification.
9003 ERR_WF_FUNCTION_NOT_EXISTS Window function '%1%' does not exist.
9004 ERR_WF_INVALID_WINDOW Invalid window aggregation group in the window specification.
9005 ERR_WF_ORDER_BY_DISTINCT Order By is not allowed when DISTINCT is specified for window function.
9006 ERR_WF_INVALID_BOUND Bound is out of range in the Window specification.
9007 ERR_WF_INVALID_ORDER_KEY Only one sort key is allowed for the RANGE window specified.
9008 ERR_WF_BOUND_OUT_OF_RANGE Bound '%1%' is out of range in the window specification.
9009 ERR_WF_WINDOW_FUNC_NOT_ALLOWED Window functions are not allowed here.
9010 ERR_WF_INVALID_ORDER_TYPE Invalid datatype for order by column in window function: '%1%'.
9011 ERR_WF_INVALID_BOUND_TYPE Invalid datatype for window frame bound: '%1%'.
9012 ERR_WF_WRONG_ARGS Incorrect parameter count or type in the call to window function '%1%'
9013 ERR_WF_ORDER_MISSING Order By clause is missing for window function '%1%'.
9014 ERR_WF_WINDOW_CLAUSE Window clause is not allowed for window function '%1%'.
9015 ERR_WF_UPDATE Can not use window function in UPDATE.
9016 ERR_WF_ORDER_BY OrderBy is not allowed for window function '%1%'.
9017 ERR_WF_INVALID_ORDER_KEY_WITHIN Only one sort key is allowed for WITHIN GROUP clause.
9018 ERR_WF_NOT_SUPPORT Window Function '%1%' is currently not supported in InfiniDB.
9019 ERR_WF_UNKNOWN_COL_TYPE Unknown column type encountered: '%1%'.
9020 ERR_EXECUTE_WINDOW_FUNCTION Exception caught when process window function.
9021 ERR_WINDOW_FUNCTION_WRAPPER Exception caught by window function wrapper.
9022 ERR_WF_INVALID_PARM_TYPE Invalid datatype for window function: '%1%'.
9023 ERR_WF_OVERFLOW '%1%' overflow.
9024 ERR_WF_COLUMN_MISSING '%1%' is not in tuple.
9025 ERR_WF_UNKNOWN_BOUND Unknown window frame start/bound type: '%1%'.
9026 ERR_WF_NOT_IN_COL_MAP Returned column not in intermediate result set.
9027 ERR_WF_ARG_OUT_OF_RANGE Argument '%1%' is out of range.
9028 ERR_WF_NOT_ALLOWED Window functions are not allowed in %1%.
9029 ERR_WF_IDB_ONLY Window function are only supported for InfiniDB tables.
9030 ERR_WF_DATA_SET_TOO_BIG Window function data set exceeds memory limit.

108
utils/loggingcpp/Makefile Executable file
View File

@ -0,0 +1,108 @@
#******************************************************************************************
# $Id: Makefile 3464 2012-12-20 20:03:38Z rdempsey $
#
# Copyright (C) 2009-2012 Calpont Corporation
# All rights reserved
#*****************************************************************************************/
include ../../rules.mak
.PHONY: install clean test docs coverage leakcheck
PROGRAM=libloggingcpp.so
VERSION=1.0.0
LIBRARY=$(PROGRAM).$(VERSION)
CPPFLAGS=-I. -I$(EXPORT_ROOT)/include -I/usr/include/libxml2
CXXFLAGS+=$(DEBUG_FLAGS) -Wall -fpic
CLIBS=$(CXXFLAGS) -L$(EXPORT_ROOT)/lib -lconfigcpp -lxml2 -lcppunit -ldl
TLIBS=-L. -lloggingcpp $(CLIBS) -lmessageqcpp -lboost_idb
GLIBS=$(CLIBS) -lmessageqcpp
LLIBS=-L$(CALPONT_LIBRARY_PATH) -lconfigcpp
SRCS=message.cpp messagelog.cpp logger.cpp errorcodes.cpp sqllogger.cpp stopwatch.cpp idberrorinfo.cpp
LINCLUDES=loggingid.h messageobj.h messagelog.h messageids.h logger.h errorcodes.h exceptclasses.h sqllogger.h stopwatch.h \
errorids.h idberrorinfo.h
OBJS=$(SRCS:.cpp=.o)
$(LIBRARY): $(OBJS)
$(LINK.cpp) -shared -o $(LIBRARY) $(OBJS)
rm -f $(PROGRAM)
ln -s $(LIBRARY) $(PROGRAM)
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: messageids.h errorids.h
$(INSTALL) $(LINCLUDES) $(INSTALL_ROOT_INCLUDE)
$(INSTALL) MessageFile.txt ErrorMessage.txt $(INSTALL_ROOT_ETC)
clean:
rm -f $(OBJS) tdriver.o $(PROGRAM) $(LIBRARY) tdriver core *~ *.tag *-gcov.* *.gcov tdriver-gcov *.d
rm -rf html
docs:
doxygen $(EXPORT_ROOT)/etc/Doxyfile
tdriver: tdriver.o
$(LINK.cpp) -o $@ $^ $(TLIBS)
test: $(LIBRARY) tdriver
LD_LIBRARY_PATH=.:$(EXPORT_ROOT)/lib:$(LD_LIBRARY_PATH):/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: tdriver-gcov
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: $(LIBRARY) tdriver
LD_LIBRARY_PATH=.:$(EXPORT_ROOT)/lib:/usr/local/lib valgrind --tool=memcheck --leak-check=yes ./tdriver
%.d: %.cpp messageids.h errorids.h
@set -e; rm -f $@; \
$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
messageids.h: MessageFile.txt genMsgId.pl
./genMsgId.pl > messageids-temp.h
diff -abBq messageids-temp.h messageids.h >/dev/null 2>&1; \
if [ $$? -ne 0 ]; then \
mv -f messageids-temp.h messageids.h; \
else \
touch messageids.h; \
fi; \
rm -f messageids-temp.h
errorids.h: ErrorMessage.txt genErrId.pl
./genErrId.pl > errorids-temp.h
diff -abBq errorids-temp.h errorids.h >/dev/null 2>&1; \
if [ $$? -ne 0 ]; then \
mv -f errorids-temp.h errorids.h; \
else \
touch errorids.h; \
fi; \
rm -f errorids-temp.h
ifndef BOOTSTRAP
-include $(SRCS:.cpp=.d) tdriver.d
endif

View File

@ -0,0 +1,60 @@
# 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 3048 2012-04-04 15:33:45Z rdempsey $
## 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 = libloggingcpp.la
libloggingcpp_la_SOURCES = message.cpp messagelog.cpp logger.cpp errorcodes.cpp sqllogger.cpp stopwatch.cpp idberrorinfo.cpp
include_HEADERS = loggingid.h messageobj.h messagelog.h messageids.h logger.h errorcodes.h exceptclasses.h sqllogger.h stopwatch.h idberrorinfo.h errorids.h
dist_sysconf_DATA = MessageFile.txt ErrorMessage.txt
BUILT_SOURCES = messageids.h errorids.h
test:
coverage:
leakcheck:
docs:
bootstrap: install-data-am
messageids.h: MessageFile.txt genMsgId.pl
./genMsgId.pl > messageids-temp.h
diff -abBq messageids-temp.h messageids.h >/dev/null 2>&1; \
if [ $$? -ne 0 ]; then \
mv -f messageids-temp.h messageids.h; \
else \
touch messageids.h; \
fi; \
rm -f messageids-temp.h
errorids.h: ErrorMessage.txt genErrId.pl
./genErrId.pl > errorids-temp.h
diff -abBq errorids-temp.h errorids.h >/dev/null 2>&1; \
if [ $$? -ne 0 ]; then \
mv -f errorids-temp.h errorids.h; \
else \
touch errorids.h; \
fi; \
rm -f errorids-temp.h

View File

@ -0,0 +1,598 @@
# 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 3048 2012-04-04 15:33:45Z rdempsey $
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 = utils/loggingcpp
DIST_COMMON = $(dist_sysconf_DATA) $(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)$(sysconfdir)" \
"$(DESTDIR)$(includedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libloggingcpp_la_LIBADD =
am_libloggingcpp_la_OBJECTS = message.lo messagelog.lo logger.lo \
errorcodes.lo sqllogger.lo stopwatch.lo idberrorinfo.lo
libloggingcpp_la_OBJECTS = $(am_libloggingcpp_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 = $(libloggingcpp_la_SOURCES)
DIST_SOURCES = $(libloggingcpp_la_SOURCES)
dist_sysconfDATA_INSTALL = $(INSTALL_DATA)
DATA = $(dist_sysconf_DATA)
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 = libloggingcpp.la
libloggingcpp_la_SOURCES = message.cpp messagelog.cpp logger.cpp errorcodes.cpp sqllogger.cpp stopwatch.cpp idberrorinfo.cpp
include_HEADERS = loggingid.h messageobj.h messagelog.h messageids.h logger.h errorcodes.h exceptclasses.h sqllogger.h stopwatch.h idberrorinfo.h errorids.h
dist_sysconf_DATA = MessageFile.txt ErrorMessage.txt
BUILT_SOURCES = messageids.h errorids.h
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) 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 utils/loggingcpp/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu utils/loggingcpp/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
libloggingcpp.la: $(libloggingcpp_la_OBJECTS) $(libloggingcpp_la_DEPENDENCIES)
$(CXXLINK) -rpath $(libdir) $(libloggingcpp_la_LDFLAGS) $(libloggingcpp_la_OBJECTS) $(libloggingcpp_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/errorcodes.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idberrorinfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logger.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/message.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/messagelog.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqllogger.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stopwatch.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-dist_sysconfDATA: $(dist_sysconf_DATA)
@$(NORMAL_INSTALL)
test -z "$(sysconfdir)" || $(mkdir_p) "$(DESTDIR)$(sysconfdir)"
@list='$(dist_sysconf_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(dist_sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f'"; \
$(dist_sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f"; \
done
uninstall-dist_sysconfDATA:
@$(NORMAL_UNINSTALL)
@list='$(dist_sysconf_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(sysconfdir)/$$f'"; \
rm -f "$(DESTDIR)$(sysconfdir)/$$f"; \
done
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: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sysconfdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) 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."
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
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-dist_sysconfDATA 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-dist_sysconfDATA 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-dist_sysconfDATA 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-dist_sysconfDATA \
uninstall-includeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
test:
coverage:
leakcheck:
docs:
bootstrap: install-data-am
messageids.h: MessageFile.txt genMsgId.pl
./genMsgId.pl > messageids-temp.h
diff -abBq messageids-temp.h messageids.h >/dev/null 2>&1; \
if [ $$? -ne 0 ]; then \
mv -f messageids-temp.h messageids.h; \
else \
touch messageids.h; \
fi; \
rm -f messageids-temp.h
errorids.h: ErrorMessage.txt genErrId.pl
./genErrId.pl > errorids-temp.h
diff -abBq errorids-temp.h errorids.h >/dev/null 2>&1; \
if [ $$? -ne 0 ]; then \
mv -f errorids-temp.h errorids.h; \
else \
touch errorids.h; \
fi; \
rm -f errorids-temp.h
# 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,116 @@
# $Id: MessageFile.txt 3174 2012-07-04 12:09:47Z dcathey $
#
# This file maps message ID's to message texts.
#
# When you need a new message text, you put it here and you add a detailed description
# in the error message descriptions document in the Software docs folder
#
# The first token on a line must be the message ID. Everything else up to the the end of
# the line is the message text. There must be exactly one tab character
# separating the message id from the message text. The message text may
# contain any character(s) except tab. The line must end with a single '\n'.
0 %1% %2% %3% %4% %5% %6% %7% %8% %9% %10%
1 %1% %2% %3% %4%
2 %1% %2%
3 %1% %2%
4 %1% %2%
5 %1% %2%
6 %1%
7 %1% %2% %3% %4%
8 %1% %2%
9 %1% %2% %3% %4%
10 %1%
11 %1% %2%
12 %1% %2%
13 DML statement: >%1%<
14 Error communicating with DMLProc: %1%
15 Error processing DML statement: %1% : %2%
16 Error setting maximum open files: %1%
17 DML %1%
18 DDL %1%
19 CMD %1%
20 Replay Transaction Log Started: %1%
21 Replay Transaction Log Completed: %1%
22 Bulk Load Started: %1%
23 Bulk Load Completed: %1%
24 Backup Started: %1%
25 Backup Completed: %1%
26 DbProf: Start Transaction
27 DbProf: End Transaction: %1%
28 DbProf: Start Statement: Statement-%1% Ver-%2% SQL-%3%
29 DbProf: End Statement: Statement-%1%
30 DbProf: Start Step: Statement-%1% StepId-%2% StepName-%3%
31 DbProf: End Step: Statement-%1% StepId-%2% BlockedFifoIn-%3% BlockedFifoOut-%4% MsgBytesIn-%5% MsgBytesOut-%6%
32 DbProf: I/O: Statement-%1% StepId-%2% ObjectId-%3% PhysRead-%4% CacheRead-%5% CPBlks-%6%
33 bad column width of %1%
34 bad COP of %1% passed to %2%
35 output buffer is too small (%1%)
36 SQL trace: %1%
37 failed to convert a filter string to a regexp
38 bad offset (%1%) passed to p_Dictionary
39 bad BOP of %1% passed to %2%
40 idxList(): bad index list entry
41 Start SQL statement: %1%
42 End SQL statement
43 FATAL ERROR: ExeMgr could not find any PrimProc's to talk to! ExeMgr is restarting.
44 FATAL ERROR: ExeMgr has allocated too much memory! Percent allocation-%1%, allowed-%2%. ExeMgr is restarting.
45 FATAL ERROR: PrimProc has allocated too much memory! PrimProc is restarting.
46 DbProf: Processing Times: Statement-%1% StepId-%2% FirstRead-%3% LastRead-%4% FirstWrite-%5% LastWrite-%6%
47 DbProf: Summary: Statement-%1% MaxMemPct-%2% TempFileCnt-%3% TempFileSpace-%4% PhysRead-%5% CacheRead-%6% MsgsRcvd-%7% MsgBytesIn-%8% MsgBytesOut-%9% CPBlks-%10%
48 Startup Tests: %1%: running test %2%
49 Startup Tests: %1%: %2%
50 Startup Tests: %1%: FATAL ERROR running test %2%: %3%
51 Startup Tests: FATAL ERROR running test suite %1%: module will not start
52 Startup Tests: %1%: test %2% succeeded
53 PrimProc could not open file for OID %1%; %2%
54 Startup Tests: all tests passed
55 ERROR: ExeMgr has caught an exception. %1%
56 Error communicating with DDLProc: %1%
57 Error processing DDL statement: %1% : %2%
58 PrimProc socket destination selection error: %1%
59 JobListFactory makeJoblist error: %1%
60 dbbuilder system catalog %1%: %2%
61 PrimProc error reading file for OID %1%; %2%
62 ResourceManager: %1% request %2% %3% available, %4% requested
63 ResourceManager: %1% request %2% WAIT %3% available, %4% requested
64 ResourceManager: %1% return %2% %3% available, %4% returned
65 Incompatible column types specified for join condition
66 ResourceManager change to %1%: new value %2%, default value %3%
67 ResourceManager unsuccessful change to %1%: new value %2% cannot be greater than total value %3% Set to total.
68 Invalid token value %1% lbid %2% rid %3%.
69 Error loading UDF ordinal %1% from library
70 TransportReceiverThread error: %1%
71 %1%: socket read error: %2%; %3%; Will retry.
72 ClearTableLock: Rollback extents for table %1%.
73 ClearTableLock: Rollback extents for table %1%, column %2%. %3%
74 ClearTableLock: Rollback extentMap for table %1%, column %2%. %3%
75 ClearTableLock: Rollback dbfile for table %1%, column %2%. %3%
76 Out of disk space for DB file: %1%
77 PrimProc: Remount performed to open file-%1%; OID-%2%; tries-%3%; elapsedTime-%4% secs; status-%5%
78 Error executing VB copy; unable to fseek to DB file for OID %1%, offset %2%; %3%
79 Error executing VB copy; unable to fseek to VB file for OID %1%, offset %2%; %3%
80 Compression Handling: %1%
81 Start BulkLoad: JobId-%1%; db-%2%
82 End BulkLoad: JobId-%1%; status-%2%
83 BulkLoad: JobId-%1%; finished loading table %2%; %3% rows inserted
84 ClearTableLock: Starting bulk rollback for table %1%; lock-%2%; initiated by %3%.
85 ClearTableLock: Ending bulk rollback for table %1%; lock-%2%; initiated by %3%.
86 Initiating BulkLoad: %1%
87 BulkLoad Error: %1%
88 ClearTableLock: Initiating %1% for table %2%; lock-%3%
89 ClearTableLock: %1% for table %2%; lock-%3%. %4%
90 ClearTableLock: Nothing to rollback for table %1% on DBRoot%2%
91 BBRM encountered network error, check the controllernode.
92 A process crashed while holding the BRM mutex. The lock state is unreliable. Please restart InfiniDB
93 Unrecoverable BRM lock state detected. Diagnostic values: r=%1% rwt=%2% w=%3% wwt=%4%. Please restart InfiniDB.
94 Attempting to fix the BRM lock state. Diagnostic values: r=%1% rwt=%2% w=%3% wwt=%4%.
95 BRM lock state appears to be functional again.
96 Table %s%.%2% (OID-%3%) was NOT successfully loaded. %4%.
97 %1%.%2% : ERROR : %3%.
98 Received a Cpimport Pass from PM%1%.
99 Received ErrReport from PM%1%.
100 Received BadData Report from PM%1%.
101 Rollback Failed on PM%1%.
102 Cleanup Failed on PM%1%.
103 Starting FBO for new %1% extent too large for current db file; %2%

View File

@ -0,0 +1,40 @@
# $Id: SubsystemIDs.txt 3929 2013-06-20 18:27:03Z dhill $
#
# This file contains the mapping of numeric Subsystem IDs to actual software and
# hardware subsystems. This file is intended as a simple mechanism to control the
# issue of subsystem IDs and is not consulted by the message logging source code.
# But it does match SubsystemID[] in messagelog.cpp.
01 - ddljoblist
02 - ddlpackage
03 - dmlpackage
04 - execplan
05 - joblist
06 - resultset
07 - calpontConsole
08 - oamcpp
09 - servermonitor
10 - traphandler
11 - snmpmanager
12 - configcpp
13 - loggingcpp
14 - messageqcpp
15 - ddlproc
16 - exemgr
17 - procmgr
18 - procmon
19 - writeengine
20 - dmlproc
21 - dmlpackageproc
22 - threadpool
23 - ddlpackageproc
24 - dbcon
25 - diskmanager
26 - routemsg
27 - sqlbuffmgr
28 - primproc
29 - masterdbrm
30 - slavedbrm
31 - messagequeue
32 - writeengineserver
33 - writeenginesplit

View File

@ -0,0 +1,97 @@
/* 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: errorcodes.cpp 3495 2013-01-21 14:09:51Z rdempsey $
*
*
***********************************************************************/
#include <string>
using namespace std;
#include "errorcodes.h"
namespace logging {
ErrorCodes::ErrorCodes(): fErrorCodes(), fPreamble("An unexpected condition within the query caused an internal processing error within InfiniDB. Please check the log files for more details. Additional Information: ")
{
fErrorCodes[batchPrimitiveStepErr] = "error in BatchPrimitiveStep.";
fErrorCodes[tupleBPSErr] = "error in TupleBPS.";
fErrorCodes[batchPrimitiveStepLargeDataListFileErr] = "error in BatchPrimitiveStep LargeDataList File handling.";
fErrorCodes[bucketReuseStepErr] = "error in BucketReuseStep.";
fErrorCodes[bucketReuseStepLargeDataListFileErr] = "error in bucketReuseStep LargeDataList File handling.";
fErrorCodes[aggregateFilterStepErr] = "error in AggregateFilterStep.";
fErrorCodes[filterStepErr] = "error in FilterStep.";
fErrorCodes[functionStepErr] = "error in FunctionStep.";
fErrorCodes[hashJoinStepErr] = "error in HashJoinStep.";
fErrorCodes[hashJoinStepLargeDataListFileErr] = "error in HashJoinStep LargeDataList File handling.";
fErrorCodes[largeHashJoinErr] = "error in LargeHashJoin.";
fErrorCodes[largeHashJoinLargeDataListFileErr] = "error in LargeHashJoin LargeDataList File handling.";
fErrorCodes[stringHashJoinStepErr] = "error in StringHashJoinStep.";
fErrorCodes[stringHashJoinStepLargeDataListFileErr] = "error in StringHashJoinStep LargeDataList File handling.";
fErrorCodes[tupleHashJoinTooBigErr] = "error in TupleHashJoin: join is too big.";
fErrorCodes[threadResourceErr] = "error in ExeMgr: too many threads on the system.";
fErrorCodes[pDictionaryScanErr] = "error in pDictionaryScan.";
fErrorCodes[pDictionaryScanLargeDataListFileErr] = "error in pDictionaryScan LargeDataList File handling.";
fErrorCodes[pIdxListErr] = "error in pIdxList.";
fErrorCodes[pIdxWalkErr] = "error in pIdxWalk.";
fErrorCodes[pnlJoinErr] = "error in PNLJoinErr.";
fErrorCodes[reduceStepErr] = "error in ReduceStep.";
fErrorCodes[reduceStepLargeDataListFileErr] = "error in ReduceStep LargeDataList File handling.";
fErrorCodes[unionStepErr] = "error in UnionStep.";
fErrorCodes[unionStepLargeDataListFileErr] = "error in UnionStep LargeDataList File handling.";
fErrorCodes[unionStepTooBigErr] = "the union required too much memory.";
fErrorCodes[tupleAggregateStepErr] = "error in TupleAggregateStep.";
fErrorCodes[tupleConstantStepErr] = "error in TupleConstantStep.";
fErrorCodes[tupleHavingStepErr] = "error in TupleHavingStep.";
fErrorCodes[aggregateResourceErr] = "Memory required to perform aggregation exceeds the RowAggregation/MaxMemory setting.";
fErrorCodes[makeJobListErr] = "error in MakeJobList.";
fErrorCodes[aggregateFuncErr] = "unsupported aggregation function.";
fErrorCodes[aggregateDataErr] = "aggregation data overflow.";
fErrorCodes[batchPrimitiveProcessorErr] = "error in BatchPrimitiveProcessor.";
fErrorCodes[bppSeederErr] = "error in bppSeeder.";
fErrorCodes[primitiveServerErr] = "error in PrimitiveServer.";
fErrorCodes[projectResultErr] = "error in BatchPrimitiveProcessor projectResult. Please check crit.log for more details.";
fErrorCodes[hwmRangeSizeErr] = "error in PrimitiveServer load block with HWM. Please check crit.log for more details.";
fErrorCodes[formatErr] = "format mismatch.";
fErrorCodes[dataTypeErr] = "data type unknown.";
fErrorCodes[incompatJoinCols] = "incompatible column types specified for join condition.";
fErrorCodes[incompatFilterCols] = "incompatible column types specified for filter condition.";
}
string ErrorCodes::errorString(uint16_t code) const
{
CodeMap::const_iterator iter;
CodeMap::key_type key = static_cast<CodeMap::key_type>(code);
CodeMap::mapped_type msg;
iter = fErrorCodes.find(key);
if (iter == fErrorCodes.end())
{
msg = "was an unknown internal error.";
}
else
{
msg = iter->second;
}
return (fPreamble + msg);
}
} //namespace logging
// vim:ts=4 sw=4:

View File

@ -0,0 +1,100 @@
/* 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: errorcodes.h 3495 2013-01-21 14:09:51Z rdempsey $
*
*
***********************************************************************/
/** @file */
#ifndef LOGGING_ERRORCODES_H
#define LOGGING_ERRORCODES_H
#include <sys/types.h>
#include <map>
#include <string>
#include <stdint.h>
namespace logging
{
enum ErrorCodeValues
{
batchPrimitiveStepErr = 1,
tupleBPSErr,
batchPrimitiveStepLargeDataListFileErr,
bucketReuseStepErr,
bucketReuseStepLargeDataListFileErr,
aggregateFilterStepErr,
filterStepErr,
functionStepErr,
hashJoinStepErr,
hashJoinStepLargeDataListFileErr,
largeHashJoinErr,
largeHashJoinLargeDataListFileErr,
stringHashJoinStepErr,
stringHashJoinStepLargeDataListFileErr,
tupleHashJoinTooBigErr,
threadResourceErr,
pDictionaryScanErr,
pDictionaryScanLargeDataListFileErr,
pIdxListErr,
pIdxWalkErr,
pnlJoinErr,
reduceStepErr,
reduceStepLargeDataListFileErr,
unionStepErr,
unionStepLargeDataListFileErr,
unionStepTooBigErr,
tupleAggregateStepErr,
tupleConstantStepErr,
tupleHavingStepErr,
makeJobListErr,
aggregateFuncErr,
aggregateDataErr,
//don't use 100, same as SQL_NOT_FOUND
batchPrimitiveProcessorErr = 101,
bppSeederErr,
primitiveServerErr,
projectResultErr,
hwmRangeSizeErr,
// user input data error
formatErr = 201,
dataTypeErr,
incompatJoinCols,
incompatFilterCols,
aggregateResourceErr
};
struct ErrorCodes
{
ErrorCodes();
std::string errorString(uint16_t code) const;
private:
typedef std::map<ErrorCodeValues, std::string> CodeMap;
//defaults okay
//ErrorCodes(const ErrorCodes& rhs);
//ErrorCodes& operator=(const ErrorCodes& rhs);
CodeMap fErrorCodes;
const std::string fPreamble;
};
}
#endif //LOGGING_ERRORCODES_H

189
utils/loggingcpp/errorids.h Normal file
View File

@ -0,0 +1,189 @@
/* 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: genErrId.pl 3048 2012-04-04 15:33:45Z rdempsey $
*
******************************************************************************************/
/**
* @file
*/
#ifndef LOGGING_ERRORIDS_H
#define LOGGING_ERRORIDS_H
namespace logging {
const unsigned ERR_MISS_JOIN = 1000;
const unsigned ERR_NON_SUPPORTED_FUNCTION = 1001;
const unsigned ERR_INCOMPATIBLE_JOIN = 1002;
const unsigned ERR_CIRCULAR_JOIN = 1003;
const unsigned ERR_MIX_JOIN = 1004;
const unsigned ERR_UPDATE_SUB = 1005;
const unsigned ERR_DATATYPE_NOT_SUPPORT = 1006;
const unsigned ERR_DML_NOT_SUPPORT_FEATURE = 1007;
const unsigned ERR_CREATE_DATATYPE_NOT_SUPPORT = 1008;
const unsigned ERR_ENTERPRISE_ONLY = 1009;
const unsigned ERR_AGGREGATE_TYPE_NOT_SUPPORT = 1010;
const unsigned ERR_DML_VIEW = 1011;
const unsigned ERR_UPDATE_NOT_SUPPORT_FEATURE = 1012;
const unsigned ERR_CREATE_AUTOINCREMENT_NOT_SUPPORT = 1013;
const unsigned ERR_ROLLUP_NOT_SUPPORT = 1014;
const unsigned ERR_OUTER_JOIN_SUBSELECT = 1015;
const unsigned ERR_PARTITION_BY_RANGE = 1016;
const unsigned ERR_SP_FUNCTION_NOT_SUPPORT = 1017;
const unsigned ERR_DBJ_ANTI_NULL = 1018;
const unsigned ERR_JOIN_TOO_BIG = 2001;
const unsigned ERR_UNION_TOO_BIG = 2002;
const unsigned ERR_AGGREGATION_TOO_BIG = 2003;
const unsigned ERR_LOST_CONN_EXEMGR = 2004;
const unsigned ERR_EXEMGR_MALFUNCTION = 2005;
const unsigned ERR_TABLE_NOT_IN_CATALOG = 2006;
const unsigned ERR_DICTBUFFER_OVERFLOW = 2007;
const unsigned ERR_VERSIONBUFFER_OVERFLOW = 2008;
const unsigned ERR_TABLE_LOCKED = 2009;
const unsigned ERR_ACTIVE_TRANSACTION = 2010;
const unsigned ERR_VIOLATE_NOT_NULL = 2011;
const unsigned ERR_EXTENT_DISK_SPACE = 2012;
const unsigned ERR_NON_NUMERIC_DATA = 2013;
const unsigned ERR_JOBLIST = 2014;
const unsigned ERR_ORDERBY_TOO_BIG = 2015;
const unsigned ERR_NON_SUPPORT_GROUP_BY = 2016;
const unsigned ERR_IN_DELIVERY = 2017;
const unsigned ERR_LIMIT_TOO_BIG = 2018;
const unsigned ERR_IN_PROCESS = 2019;
const unsigned ERR_MUL_ARG_AGG = 2020;
const unsigned ERR_NOT_GROUPBY_EXPRESSION = 2021;
const unsigned ERR_ORDERBY_NOT_IN_DISTINCT = 2022;
const unsigned ERR_NO_PRIMPROC = 2023;
const unsigned ERR_FUNC_MULTI_COL = 2024;
const unsigned WARN_DATA_TRUNC = 2025;
const unsigned ERR_AGG_IN_WHERE = 2026;
const unsigned ERR_NON_SUPPORT_AGG_ARGS = 2027;
const unsigned ERR_NO_FROM = 2028;
const unsigned ERR_LOCK_TABLE = 2029;
const unsigned ERR_FILTER_COND_EXP = 2030;
const unsigned ERR_BRM_LOOKUP = 2031;
const unsigned ERR_INCORRECT_VALUE = 2032;
const unsigned ERR_SYSTEM_CATALOG = 2033;
const unsigned ERR_DATA_OFFLINE = 2034;
const unsigned ERR_ASSERTION_FAILURE = 2035;
const unsigned ERR_PARTITION_NO_SCHEMA = 2036;
const unsigned ERR_INVALID_FUNC_ARGUMENT = 2037;
const unsigned ERR_O_DIRECT = 2038;
const unsigned ERR_ENOENT = 2039;
const unsigned WARN_NO_PARTITION_FOUND = 2040;
const unsigned SYSTABLE_PARTITION = 2041;
const unsigned WARN_NO_PARTITION_PERFORMED = 2042;
const unsigned ERR_DICTIONARY_SCAN = 2043;
const unsigned ERR_TUPLE_BPS = 2044;
const unsigned ERR_PRIMPROC_DOWN = 2045;
const unsigned ERR_READ_INPUT_DATALIST = 2046;
const unsigned ERR_LOCAL_QUERY_UM = 2047;
const unsigned ERR_DBJ_FILE_IO_ERROR = 2048;
const unsigned ERR_DBJ_UNKNOWN_ERROR = 2049;
const unsigned ERR_DBJ_DISK_USAGE_LIMIT = 2050;
const unsigned ERR_DBJ_DATA_DISTRIBUTION = 2051;
const unsigned INFO_SWITCHING_TO_DJS = 2052;
const unsigned ERR_NON_SUPPORT_SUB_QUERY_TYPE = 3001;
const unsigned ERR_MORE_THAN_1_ROW = 3002;
const unsigned ERR_MEMORY_MAX_FOR_LIMIT_TOO_LOW = 3003;
const unsigned ERR_CORRELATE_SCOPE_NOT_SUPPORTED = 3004;
const unsigned ERR_CORRELATED_DATA_TYPE_INCOMPATIBLE = 3005;
const unsigned ERR_INVALID_OPERATOR_WITH_LIST = 3006;
const unsigned ERR_CORRELATE_FAIL = 3007;
const unsigned ERR_AGG_EXISTS = 3008;
const unsigned ERR_UNKNOWN_COL = 3009;
const unsigned ERR_AMBIGUOUS_COL = 3010;
const unsigned ERR_NON_SUPPORT_ORDER_BY = 3011;
const unsigned ERR_NON_SUPPORT_SCALAR = 3012;
const unsigned ERR_UNION_IN_SUBQUERY = 3013;
const unsigned ERR_ALL_SOME_IN_SUBQUERY = 3014;
const unsigned ERR_NON_SUPPORT_HAVING = 3015;
const unsigned ERR_NON_SUPPORT_SELECT_SUB = 3016;
const unsigned ERR_NON_SUPPORT_DELETE_SUB = 3017;
const unsigned ERR_MISS_JOIN_IN_SUB = 3018;
const unsigned ERR_NON_SUPPORT_LIMIT_SUB = 3019;
const unsigned ERR_NON_SUPPORT_INSERT_SUB = 3020;
const unsigned ERR_SUB_EXPRESSION = 3021;
const unsigned ERR_NON_SUPPORT_FUNC_SUB = 3022;
const unsigned ERR_CORRELATED_SUB_OR = 3033;
const unsigned ERR_CORRELATE_COL_MISSING = 3034;
const unsigned ERR_NON_SUPPORT_NEQ_AGG_SUB = 3035;
const unsigned ERR_INVALID_LAST_PARTITION = 4001;
const unsigned ERR_PARTITION_ALREADY_DISABLED = 4002;
const unsigned ERR_PARTITION_NOT_EXIST = 4003;
const unsigned ERR_PARTITION_ALREADY_ENABLED = 4004;
const unsigned NO_VALID_TRANSACTION_ID = 4005;
const unsigned ERR_INVALID_START_VALUE = 4006;
const unsigned ERR_INVALID_COMPRESSION_TYPE = 4007;
const unsigned ERR_INVALID_AUTOINCREMENT_TYPE = 4008;
const unsigned ERR_INVALID_NUMBER_AUTOINCREMENT = 4009;
const unsigned ERR_NEGATIVE_STARTVALUE = 4010;
const unsigned ERR_INVALID_STARTVALUE = 4011;
const unsigned ERR_EXCEED_LIMIT = 4012;
const unsigned ERR_INVALID_VARBINARYVALUE = 4013;
const unsigned ERR_CONSTRAINTS = 4014;
const unsigned ERR_NOT_NULL_CONSTRAINTS = 4015;
const unsigned ERR_DML_DDL_SLAVE = 4016;
const unsigned ERR_DML_DDL_LOCAL = 4017;
const unsigned ERR_NON_SUPPORT_SYNTAX = 4018;
const unsigned ERR_FUNC_NON_IMPLEMENT = 5001;
const unsigned ERR_PSEUDOCOL_IDB_ONLY = 5002;
const unsigned ERR_PSEUDOCOL_WRONG_ARG = 5003;
const unsigned ERR_NETWORK = 6001;
const unsigned ERR_BRM_MUTEX = 6002;
const unsigned ERR_UNRECOVERABLE_LOCK_STATE = 6003;
const unsigned ERR_RECOVERABLE_LOCK_STATE = 6004;
const unsigned ERR_SUCCESSFUL_RECOVERY = 6005;
const unsigned ERR_HARD_FAILURE = 6006;
const unsigned ERR_NON_IDB_TABLE = 7001;
const unsigned ERR_CROSS_ENGINE_CONFIG = 8001;
const unsigned ERR_CROSS_ENGINE_CONNECT = 8002;
const unsigned ERR_WF_NON_SUPPORT = 9001;
const unsigned ERR_WF_WINDOW_WITHOUT_ORDER = 9002;
const unsigned ERR_WF_FUNCTION_NOT_EXISTS = 9003;
const unsigned ERR_WF_INVALID_WINDOW = 9004;
const unsigned ERR_WF_ORDER_BY_DISTINCT = 9005;
const unsigned ERR_WF_INVALID_BOUND = 9006;
const unsigned ERR_WF_INVALID_ORDER_KEY = 9007;
const unsigned ERR_WF_BOUND_OUT_OF_RANGE = 9008;
const unsigned ERR_WF_WINDOW_FUNC_NOT_ALLOWED = 9009;
const unsigned ERR_WF_INVALID_ORDER_TYPE = 9010;
const unsigned ERR_WF_INVALID_BOUND_TYPE = 9011;
const unsigned ERR_WF_WRONG_ARGS = 9012;
const unsigned ERR_WF_ORDER_MISSING = 9013;
const unsigned ERR_WF_WINDOW_CLAUSE = 9014;
const unsigned ERR_WF_UPDATE = 9015;
const unsigned ERR_WF_ORDER_BY = 9016;
const unsigned ERR_WF_INVALID_ORDER_KEY_WITHIN = 9017;
const unsigned ERR_WF_NOT_SUPPORT = 9018;
const unsigned ERR_WF_UNKNOWN_COL_TYPE = 9019;
const unsigned ERR_EXECUTE_WINDOW_FUNCTION = 9020;
const unsigned ERR_WINDOW_FUNCTION_WRAPPER = 9021;
const unsigned ERR_WF_INVALID_PARM_TYPE = 9022;
const unsigned ERR_WF_OVERFLOW = 9023;
const unsigned ERR_WF_COLUMN_MISSING = 9024;
const unsigned ERR_WF_UNKNOWN_BOUND = 9025;
const unsigned ERR_WF_NOT_IN_COL_MAP = 9026;
const unsigned ERR_WF_ARG_OUT_OF_RANGE = 9027;
const unsigned ERR_WF_NOT_ALLOWED = 9028;
const unsigned ERR_WF_IDB_ONLY = 9029;
const unsigned ERR_WF_DATA_SET_TOO_BIG = 9030;
}//namespace logging
#endif //LOGGING_ERRORIDS_H

View File

@ -0,0 +1,263 @@
/* 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: exceptclasses.h 3857 2013-06-04 18:19:28Z pleblanc $
*
*****************************************************************************/
/** @file */
#ifndef LOGGING_EXCEPTCLASSES_H
#define LOGGING_EXCEPTCLASSES_H
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <string>
#include "errorcodes.h"
#include "errorids.h"
#include "idberrorinfo.h"
#include "logger.h"
namespace logging
{
/** @brief specific error exception class
*
*
*/
class IDBExcept : public std::runtime_error
{
public:
IDBExcept(uint16_t code) :
std::runtime_error(IDBErrorInfo::instance()->errorMsg(code)), fErrCode(code) {}
IDBExcept(uint16_t code, const Message::Args& args) :
std::runtime_error(IDBErrorInfo::instance()->errorMsg(code, args)), fErrCode(code){}
IDBExcept(const std::string& msg, uint16_t code) :
std::runtime_error(msg), fErrCode(code){ }
void errorCode(uint16_t code) { fErrCode = code; }
uint16_t errorCode() const { return fErrCode; }
protected:
unsigned fErrCode;
};
class DictionaryBufferOverflow : public IDBExcept
{
public:
DictionaryBufferOverflow() : IDBExcept(ERR_DICTBUFFER_OVERFLOW)
{ }
};
class LargeDataListExcept : public std::runtime_error
{
public:
/** Takes a character string describing the error. */
explicit LargeDataListExcept(const std::string& msg) : std::runtime_error(msg) { }
virtual ~LargeDataListExcept() throw() { }
};
/** @brief specific error exception class for query data
* @bug 1155
*
*/
class QueryDataExcept : public IDBExcept
{
public:
/** Takes a character string describing the error. */
QueryDataExcept(const std::string& msg, uint16_t code) :
IDBExcept(msg, code) { }
virtual ~QueryDataExcept() throw() { }
private:
//defaults okay
//QueryDataExcept(const QueryDataExcept& rhs);
//QueryDataExcept& operator=(const QueryDataExcept& rhs);
};
/** @brief specific error exception class for VBBM Version Buffer overflow
* @bug 1949
*
*/
class VBBMBufferOverFlowExcept : public std::runtime_error
{
public:
/** Takes a character string describing the error. */
VBBMBufferOverFlowExcept(const std::string& msg) :
std::runtime_error(msg), fErrorCode(8) { }
//ERR_VBBM_OVERFLOW = 8 defined in brmtypes.h
int8_t errorCode() const { return fErrorCode; }
private:
int8_t fErrorCode;
};
/** @brief specific error exception class for VBBM Version Buffer overflow
* @bug 1949
*
*/
class PrimitiveColumnProjectResultExcept : public QueryDataExcept
{
public:
/** Takes a character string describing the error. */
PrimitiveColumnProjectResultExcept(const std::string& msg) :
QueryDataExcept(msg, projectResultErr) { }
};
/** @brief specific error exception class for PrimProc invalid HWM
* @bug 2173
*
*/
class InvalidRangeHWMExcept : public QueryDataExcept
{
public:
/** Takes a character string describing the error. */
InvalidRangeHWMExcept(const std::string& msg) :
QueryDataExcept(msg, hwmRangeSizeErr){ }
};
/** @brief Exception for F&E framework to throw
* Invalid Operation Exception
*/
class InvalidOperationExcept : public std::runtime_error
{
public:
/** Takes a character string describing the error. */
InvalidOperationExcept(const std::string& msg) :
std::runtime_error(msg){ }
};
/** @brief Exception for F&E framework to throw
* Invalid Conversion Exception
*/
class InvalidConversionExcept : public std::runtime_error
{
public:
/** Takes a character string describing the error. */
InvalidConversionExcept(const std::string& msg) :
std::runtime_error(msg){ }
};
/** @brief Exception for F&E framework -- function evaluation to throw
* Invalid Argument Exception
*/
class InvalidArgumentExcept : public std::runtime_error
{
public:
/** Takes a character string describing the error. */
InvalidArgumentExcept(const std::string& msg) :
std::runtime_error(msg){ }
};
/** @brief Exception for F&E framework -- function evaluation to throw
* Invalid Argument Exception
*/
class NotImplementedExcept : public std::runtime_error
{
public:
/** Takes a character string describing the error. */
NotImplementedExcept(const std::string& msg) :
std::runtime_error(msg){ }
};
/** @brief specific error exception class for getSysData in Calpontsystemcatalog.
* @bug 2574
*
*/
class NoTableExcept : public std::runtime_error
{
public:
/** Takes a character string describing the error. */
NoTableExcept(const std::string& msg) :
std::runtime_error(msg){ }
};
class MoreThan1RowExcept : public IDBExcept
{
public:
MoreThan1RowExcept() :
IDBExcept(ERR_MORE_THAN_1_ROW)
{ }
};
class CorrelateFailExcept : public IDBExcept
{
public:
CorrelateFailExcept() :
IDBExcept(ERR_CORRELATE_FAIL)
{ }
};
class DBRMException : public std::runtime_error
{
public:
DBRMException(const std::string& emsg) :
std::runtime_error(emsg) {}
};
class ProtocolError : public std::logic_error
{
public:
ProtocolError(const std::string &emsg) : std::logic_error(emsg) { }
};
#ifndef __STRING
#define __STRING(x) #x
#endif
#define idbassert(x) do { \
if (!(x)) { \
std::ostringstream os; \
\
os << __FILE__ << "@" << __LINE__ << ": assertion \'" << __STRING(x) << "\' failed"; \
std::cerr << os.str() << std::endl; \
logging::MessageLog logger((logging::LoggingID())); \
logging::Message message; \
logging::Message::Args args; \
\
args.add(os.str()); \
message.format(args); \
logger.logErrorMessage(message); \
throw logging::IDBExcept(logging::ERR_ASSERTION_FAILURE); \
} \
} while (0)
#define idbassert_s(x, s) do { \
if (!(x)) { \
std::ostringstream os; \
\
os << __FILE__ << "@" << __LINE__ << ": assertion \'" << __STRING(x) << "\' failed. Error msg \'" << s << "\'"; \
std::cerr << os.str() << std::endl; \
logging::MessageLog logger((logging::LoggingID())); \
logging::Message message; \
logging::Message::Args args; \
\
args.add(os.str()); \
message.format(args); \
logger.logErrorMessage(message); \
throw logging::IDBExcept(logging::ERR_ASSERTION_FAILURE); \
} \
} while (0)
}
#endif
// vim:ts=4 sw=4:

61
utils/loggingcpp/genErrId.pl Executable file
View File

@ -0,0 +1,61 @@
#! /usr/bin/perl -w
#
# $Id: genErrId.pl 3048 2012-04-04 15:33:45Z rdempsey $
#
open FH, "< ./ErrorMessage.txt" or die;
$frontmatter = <<'EOD';
/* 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: genErrId.pl 3048 2012-04-04 15:33:45Z rdempsey $
*
******************************************************************************************/
/**
* @file
*/
#ifndef LOGGING_ERRORIDS_H
#define LOGGING_ERRORIDS_H
namespace logging {
EOD
$backmatter = <<'EOD';
}//namespace logging
#endif //LOGGING_ERRORIDS_H
EOD
print $frontmatter;
while (<FH>)
{
chomp;
next if (/^$/);
next if (/^#/);
($errid, $errname, undef) = split;
printf "const unsigned %s = %d;\n", $errname, $errid;
}
print $backmatter;
close FH;

61
utils/loggingcpp/genMsgId.pl Executable file
View File

@ -0,0 +1,61 @@
#! /usr/bin/perl -w
#
# $Id: genMsgId.pl 3048 2012-04-04 15:33:45Z rdempsey $
#
open FH, "< ./MessageFile.txt" or die;
$frontmatter = <<'EOD';
/* 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: genMsgId.pl 3048 2012-04-04 15:33:45Z rdempsey $
*
******************************************************************************************/
/**
* @file
*/
#ifndef LOGGING_MESSAGEIDS_H
#define LOGGING_MESSAGEIDS_H
namespace logging {
EOD
$backmatter = <<'EOD';
}//namespace logging
#endif //LOGGING_MESSAGEIDS_H
EOD
print $frontmatter;
while (<FH>)
{
chomp;
next if (/^$/);
next if (/^#/);
($msgid, undef) = split;
printf "const unsigned M%04d = %d;\n", $msgid, $msgid;
}
print $backmatter;
close FH;

View File

@ -0,0 +1,202 @@
/* 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: idberrorinfo.cpp 3626 2013-03-11 15:36:08Z xlou $
*
******************************************************************************************/
#include <iostream>
#include <iomanip>
#include <string>
#include <iterator>
#include <sstream>
#include <stdexcept>
#include <map>
#include <fstream>
using namespace std;
#include <boost/format.hpp>
#include <boost/tokenizer.hpp>
#include <boost/thread.hpp>
using namespace boost;
#include "configcpp.h"
using namespace config;
#include "loggingid.h"
#include "logger.h"
#include "idberrorinfo.h"
#include "installdir.h"
namespace logging {
IDBErrorInfo* IDBErrorInfo::fInstance = 0;
mutex mx;
IDBErrorInfo* IDBErrorInfo::instance()
{
mutex::scoped_lock lk(mx);
if (!fInstance)
fInstance = new IDBErrorInfo();
return fInstance;
}
IDBErrorInfo::IDBErrorInfo()
{
Config* cf = Config::makeConfig();
string configFile(cf->getConfig("SystemConfig", "ErrorMessageFile"));
if (configFile.length() == 0)
configFile = startup::StartUp::installDir() + "/etc/ErrorMessage.txt";
ifstream msgFile(configFile.c_str());
while (msgFile.good())
{
stringbuf* sb = new stringbuf;
msgFile.get(*sb);
string m = sb->str();
delete sb;
if (m.length() > 0 && m[0] != '#')
{
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
boost::char_separator<char> sep("\t");
tokenizer tokens(m, sep);
tokenizer::iterator tok_iter = tokens.begin();
if (tok_iter != tokens.end())
{
int msgid = atoi(tok_iter->c_str());
++tok_iter;
if (tok_iter != tokens.end())
{
++tok_iter;
if (tok_iter != tokens.end())
{
string msgtext = *tok_iter;
fErrMap[msgid] = msgtext;
}
}
}
}
ios_base::iostate st = msgFile.rdstate();
if ((st & ios_base::failbit) && !(st & ios_base::eofbit))
msgFile.clear();
(void)msgFile.get();
}
}
IDBErrorInfo::~IDBErrorInfo()
{
}
string IDBErrorInfo::errorMsg(const unsigned eid, const Message::Args& args)
{
string errMsg = lookupError(eid);
format(errMsg, args);
return errMsg;
}
string IDBErrorInfo::errorMsg(const unsigned eid)
{
string errMsg = lookupError(eid);
Message::Args args; // empty args
format(errMsg, args);
return errMsg;
}
string IDBErrorInfo::errorMsg(const unsigned eid, int i)
{
string errMsg = lookupError(eid);
Message::Args args;
args.add(i);
format(errMsg, args);
return errMsg;
}
string IDBErrorInfo::errorMsg(const unsigned eid, const string& s)
{
string errMsg = lookupError(eid);
Message::Args args;
args.add(s);
format(errMsg, args);
return errMsg;
}
string IDBErrorInfo::logError(const logging::LOG_TYPE logLevel,
const logging::LoggingID logid,
const unsigned eid,
const logging::Message::Args& args)
{
Logger logger(logid.fSubsysID);
Message message(errorMsg(eid, args));
return logger.logMessage(logLevel, message, logid);
}
void IDBErrorInfo::format(string& errMsg, const Message::Args& args)
{
Message::Args::AnyVec::const_iterator iter = args.args().begin();
Message::Args::AnyVec::const_iterator end = args.args().end();
boost::format fmt(errMsg);
fmt.exceptions(boost::io::no_error_bits);
while (iter != end)
{
if (iter->type() == typeid(long))
{
long l = any_cast<long>(*iter);
fmt % l;
}
else if (iter->type() == typeid(uint64_t))
{
uint64_t u64 = any_cast<uint64_t>(*iter);
fmt % u64;
}
else if (iter->type() == typeid(double))
{
double d = any_cast<double>(*iter);
fmt % d;
}
else if (iter->type() == typeid(string))
{
string s = any_cast<string>(*iter);
fmt % s;
}
else
{
throw logic_error("IDBErrorInfo::format: unexpected type in argslist");
}
++iter;
}
errMsg = fmt.str();
}
/* static */
string IDBErrorInfo::lookupError(const unsigned eid)
{
string msgstr;
ErrorMap::const_iterator iter = fErrMap.find(eid);
if (iter == fErrMap.end())
msgstr = "Unknown Error %1% %2% %3% %4% %5%";
else
msgstr = iter->second;
ostringstream oss;
oss << "IDB-" << setw(4) << setfill('0') << eid << ": " << msgstr;
return oss.str();
}
}

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. */
/******************************************************************************************
* $Id: idberrorinfo.h 3626 2013-03-11 15:36:08Z xlou $
*
******************************************************************************************/
/**
* @file
*/
#ifndef LOGGING_IDBERRORINFO_H
#define LOGGING_IDBERRORINFO_H
#include <string>
#include <map>
#include "messageobj.h"
#include "messagelog.h"
namespace logging {
/** @brief an IDB error info class
*
* Contains a error message map for looking up and constructing formatted message
*/
typedef std::map<unsigned, std::string> ErrorMap;
class IDBErrorInfo
{
public:
static IDBErrorInfo* instance();
std::string errorMsg(const unsigned eid, const Message::Args& args);
std::string errorMsg(const unsigned eid);
std::string errorMsg(const unsigned eid, int i);
std::string errorMsg(const unsigned eid, const std::string& s);
std::string logError(const logging::LOG_TYPE logLevel,
const LoggingID logid,
const unsigned eid,
const Message::Args& args);
~IDBErrorInfo();
private:
static IDBErrorInfo* fInstance;
ErrorMap fErrMap;
IDBErrorInfo();
void format(std::string& messageFormat, const Message::Args& args);
std::string lookupError(const unsigned eid);
};
}//namespace logging
#endif

109
utils/loggingcpp/logger.cpp Normal file
View File

@ -0,0 +1,109 @@
/* 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: logger.cpp 4037 2013-08-07 03:37:31Z bwilkinson $
*/
#include <string>
using namespace std;
#include <boost/thread.hpp>
using namespace boost;
#include "logger.h"
namespace logging
{
Logger::Logger(unsigned subsys) :
fMl1(LoggingID(subsys))
{
}
const string Logger::logMessage(LOG_TYPE logLevel, Message::MessageID mid, const Message::Args& args,
const LoggingID& logInfo)
{
MsgMap::mapped_type msg;
MsgMap::const_iterator msgIter = fMsgMap.find(mid);
//Default message if specified # not found
if (msgIter == fMsgMap.end())
msg = Message(M0000);
else
msg = msgIter->second;
msg.reset();
msg.format(args);
return logMessage(logLevel, msg, logInfo);
/*
mutex::scoped_lock lk(fLogLock);
fMl1.logData(logInfo);
switch (logLevel)
{
case LOG_TYPE_DEBUG:
default:
fMl1.logDebugMessage(msg);
break;
case LOG_TYPE_INFO:
fMl1.logInfoMessage(msg);
break;
case LOG_TYPE_WARNING:
fMl1.logWarningMessage(msg);
break;
case LOG_TYPE_ERROR:
fMl1.logErrorMessage(msg);
break;
case LOG_TYPE_CRITICAL:
fMl1.logCriticalMessage(msg);
break;
}
return msg.msg();*/
}
const std::string Logger::logMessage(LOG_TYPE logLevel, const Message& msg, const LoggingID& logInfo)
{
mutex::scoped_lock lk(fLogLock);
fMl1.logData(logInfo);
switch (logLevel)
{
case LOG_TYPE_DEBUG:
default:
fMl1.logDebugMessage(msg);
break;
case LOG_TYPE_INFO:
fMl1.logInfoMessage(msg);
break;
case LOG_TYPE_WARNING:
fMl1.logWarningMessage(msg);
break;
case LOG_TYPE_ERROR:
fMl1.logErrorMessage(msg);
break;
case LOG_TYPE_CRITICAL:
fMl1.logCriticalMessage(msg);
break;
}
return msg.msg();
}
}

90
utils/loggingcpp/logger.h Normal file
View File

@ -0,0 +1,90 @@
/* 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: logger.h 3495 2013-01-21 14:09:51Z rdempsey $
*/
/** @file */
#ifndef LOGGING_LOGGER_H_
#define LOGGING_LOGGER_H_
#include <string>
#include <map>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include "messageobj.h"
#include "messagelog.h"
#include "messageids.h"
namespace logging
{
typedef std::map<Message::MessageID, Message> MsgMap;
/** @brief message log wrapper class */
class Logger
{
public:
/** @brief ctor
*
* @param subsys the subsystem id
*/
explicit Logger(unsigned subsys);
/** @brief log a message
*
* Log a message at a certain debug level
*/
const std::string logMessage(LOG_TYPE logLevel, Message::MessageID mid,
const Message::Args& args, const LoggingID& logInfo);
/** @brief log a formated message
*
* For the error framework to use
*/
const std::string logMessage(LOG_TYPE logLevel, const Message& message, const LoggingID& logInfo);
/** @brief set the message map for this logger
*
* This method sets the message map for this logger. You need to call this (once and only once) before
* using the class. The map needs to be constructed before and given to this class.
*/
void msgMap(const MsgMap& msgMap) { fMsgMap = msgMap; }
/** @brief get the message map from this logger
*/
const MsgMap& msgMap() const { return fMsgMap; }
private:
// not copyable (because of the mutex)
Logger(const Logger& rhs);
Logger& operator=(const Logger& rhs);
MsgMap fMsgMap;
MessageLog fMl1;
boost::mutex fLogLock;
};
typedef boost::shared_ptr<Logger> SPL;
}
#endif

2416
utils/loggingcpp/logging.xmi Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
/* 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: loggingid.h 3495 2013-01-21 14:09:51Z rdempsey $
*
******************************************************************************************/
/**
* @file
*/
#ifndef LOGGING_LOGGINGID_H
#define LOGGING_LOGGINGID_H
#include <string>
namespace logging {
/** @brief a logging context structure
*
*/
struct LoggingID
{
/** @brief LoggingID ctor
*
*/
explicit LoggingID(unsigned subsysID=0, unsigned sessionID=0, unsigned txnID=0, unsigned ThdID=0)
: fSubsysID(subsysID), fSessionID(sessionID), fTxnID(txnID), fThdID(ThdID)
{}
unsigned fSubsysID; /// subsystem ID
unsigned fSessionID; /// session ID
unsigned fTxnID; /// transaction ID
unsigned fThdID; /// thread ID
};
}
#endif

View File

@ -0,0 +1,216 @@
/* 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: message.cpp 3495 2013-01-21 14:09:51Z rdempsey $
*
******************************************************************************************/
#include <iostream>
#include <iomanip>
#include <string>
#include <iterator>
#include <sstream>
#include <stdexcept>
#include <map>
#include <fstream>
using namespace std;
#include <boost/format.hpp>
#include <boost/tokenizer.hpp>
#include <boost/thread.hpp>
using namespace boost;
#include "configcpp.h"
using namespace config;
#include "messageobj.h"
#include "installdir.h"
namespace {
mutex mx;
bool catalogLoaded = false;
typedef map<int, string> CatMap;
CatMap catmap;
void loadCatalog()
{
Config* cf = Config::makeConfig();
string configFile(cf->getConfig("MessageLog", "MessageLogFile"));
if (configFile.length() == 0)
configFile = startup::StartUp::installDir() + "/etc/MessageFile.txt";
ifstream msgFile(configFile.c_str());
while (msgFile.good())
{
stringbuf* sb = new stringbuf;
msgFile.get(*sb);
string m = sb->str();
delete sb;
if (m.length() > 0 && m[0] != '#')
{
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
boost::char_separator<char> sep("\t");
tokenizer tokens(m, sep);
tokenizer::iterator tok_iter = tokens.begin();
if (tok_iter != tokens.end())
{
int msgid = atoi(tok_iter->c_str());
++tok_iter;
if (tok_iter != tokens.end())
{
string msgtext = *tok_iter;
catmap[msgid] = msgtext;
}
}
}
ios_base::iostate st = msgFile.rdstate();
if ((st & ios_base::failbit) && !(st & ios_base::eofbit))
msgFile.clear();
(void)msgFile.get();
}
}
}
namespace logging {
Message::Message(const MessageID msgid) :
fMsgID(msgid), fMsg(lookupMessage(msgid)), fConfig(Config::makeConfig())
{
}
Message::Message(const string msg):
fMsgID(0), fMsg(msg), fConfig(Config::makeConfig())
{
}
void Message::swap(Message& rhs)
{
std::swap(fMsgID, rhs.fMsgID);
std::swap(fMsg, rhs.fMsg);
std::swap(fConfig, rhs.fConfig);
}
void Message::Args::add(int i)
{
fArgs.push_back(long(i));
}
void Message::Args::add(uint64_t u64)
{
fArgs.push_back(u64);
}
void Message::Args::add(const string& s)
{
fArgs.push_back(s);
}
void Message::Args::add(double d)
{
fArgs.push_back(d);
}
void Message::Args::reset()
{
fArgs.clear();
}
void Message::format(const Args& args)
{
Args::AnyVec::const_iterator iter = args.args().begin();
Args::AnyVec::const_iterator end = args.args().end();
boost::format fmt(fMsg);
fmt.exceptions(boost::io::no_error_bits);
while (iter != end)
{
if (iter->type() == typeid(long))
{
long l = any_cast<long>(*iter);
fmt % l;
}
else if (iter->type() == typeid(uint64_t))
{
uint64_t u64 = any_cast<uint64_t>(*iter);
fmt % u64;
}
else if (iter->type() == typeid(double))
{
double d = any_cast<double>(*iter);
fmt % d;
}
else if (iter->type() == typeid(string))
{
string s = any_cast<string>(*iter);
fmt % s;
}
else
{
throw logic_error("Message::format: unexpected type in argslist");
}
++iter;
}
fMsg = fmt.str();
}
/* static */
const string Message::lookupMessage(const MessageID& msgid)
{
if (!catalogLoaded)
{
mutex::scoped_lock lock(mx);
if (!catalogLoaded)
{
loadCatalog();
catalogLoaded = true;
}
}
string msgstr;
CatMap::const_iterator iter = catmap.find(msgid);
if (iter == catmap.end())
{
iter = catmap.find(0);
if (iter == catmap.end())
{
msgstr = "%1% %2% %3% %4% %5%";
}
else
{
msgstr = iter->second;
}
}
else
{
msgstr = iter->second;
}
ostringstream oss;
oss << "CAL" << setw(4) << setfill('0') << msgid << ": " << msgstr;
return oss.str();
}
void Message::reset()
{
fMsg = lookupMessage(fMsgID);
}
}

View File

@ -0,0 +1,137 @@
/* 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: genMsgId.pl 3048 2012-04-04 15:33:45Z rdempsey $
*
******************************************************************************************/
/**
* @file
*/
#ifndef LOGGING_MESSAGEIDS_H
#define LOGGING_MESSAGEIDS_H
namespace logging {
const unsigned M0000 = 0;
const unsigned M0001 = 1;
const unsigned M0002 = 2;
const unsigned M0003 = 3;
const unsigned M0004 = 4;
const unsigned M0005 = 5;
const unsigned M0006 = 6;
const unsigned M0007 = 7;
const unsigned M0008 = 8;
const unsigned M0009 = 9;
const unsigned M0010 = 10;
const unsigned M0011 = 11;
const unsigned M0012 = 12;
const unsigned M0013 = 13;
const unsigned M0014 = 14;
const unsigned M0015 = 15;
const unsigned M0016 = 16;
const unsigned M0017 = 17;
const unsigned M0018 = 18;
const unsigned M0019 = 19;
const unsigned M0020 = 20;
const unsigned M0021 = 21;
const unsigned M0022 = 22;
const unsigned M0023 = 23;
const unsigned M0024 = 24;
const unsigned M0025 = 25;
const unsigned M0026 = 26;
const unsigned M0027 = 27;
const unsigned M0028 = 28;
const unsigned M0029 = 29;
const unsigned M0030 = 30;
const unsigned M0031 = 31;
const unsigned M0032 = 32;
const unsigned M0033 = 33;
const unsigned M0034 = 34;
const unsigned M0035 = 35;
const unsigned M0036 = 36;
const unsigned M0037 = 37;
const unsigned M0038 = 38;
const unsigned M0039 = 39;
const unsigned M0040 = 40;
const unsigned M0041 = 41;
const unsigned M0042 = 42;
const unsigned M0043 = 43;
const unsigned M0044 = 44;
const unsigned M0045 = 45;
const unsigned M0046 = 46;
const unsigned M0047 = 47;
const unsigned M0048 = 48;
const unsigned M0049 = 49;
const unsigned M0050 = 50;
const unsigned M0051 = 51;
const unsigned M0052 = 52;
const unsigned M0053 = 53;
const unsigned M0054 = 54;
const unsigned M0055 = 55;
const unsigned M0056 = 56;
const unsigned M0057 = 57;
const unsigned M0058 = 58;
const unsigned M0059 = 59;
const unsigned M0060 = 60;
const unsigned M0061 = 61;
const unsigned M0062 = 62;
const unsigned M0063 = 63;
const unsigned M0064 = 64;
const unsigned M0065 = 65;
const unsigned M0066 = 66;
const unsigned M0067 = 67;
const unsigned M0068 = 68;
const unsigned M0069 = 69;
const unsigned M0070 = 70;
const unsigned M0071 = 71;
const unsigned M0072 = 72;
const unsigned M0073 = 73;
const unsigned M0074 = 74;
const unsigned M0075 = 75;
const unsigned M0076 = 76;
const unsigned M0077 = 77;
const unsigned M0078 = 78;
const unsigned M0079 = 79;
const unsigned M0080 = 80;
const unsigned M0081 = 81;
const unsigned M0082 = 82;
const unsigned M0083 = 83;
const unsigned M0084 = 84;
const unsigned M0085 = 85;
const unsigned M0086 = 86;
const unsigned M0087 = 87;
const unsigned M0088 = 88;
const unsigned M0089 = 89;
const unsigned M0090 = 90;
const unsigned M0091 = 91;
const unsigned M0092 = 92;
const unsigned M0093 = 93;
const unsigned M0094 = 94;
const unsigned M0095 = 95;
const unsigned M0096 = 96;
const unsigned M0097 = 97;
const unsigned M0098 = 98;
const unsigned M0099 = 99;
const unsigned M0100 = 100;
const unsigned M0101 = 101;
const unsigned M0102 = 102;
const unsigned M0103 = 103;
}//namespace logging
#endif //LOGGING_MESSAGEIDS_H

View File

@ -0,0 +1,268 @@
/* 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: messagelog.cpp 3658 2013-03-22 20:26:02Z chao $
*
******************************************************************************************/
#include <sstream>
#include <iomanip>
#include <ctime>
#include <sys/time.h>
#include <syslog.h>
#include <iostream>
#include <unistd.h>
#include <vector>
#include <string>
using namespace std;
#include <boost/assign.hpp>
namespace ba=boost::assign;
#include "messagelog.h"
#include "loggingid.h"
#include "messageobj.h"
#include "messageids.h"
namespace {
using namespace logging;
/*
* This list matches SubsystemIDs.txt, but has names matching Process Config DB
*/
const vector<string> SubsystemID = ba::list_of
("Calpont") // id = 0 default
("ddljoblist") // id = 1
("ddlpackage") // id = 2
("dmlpackage") // id = 3
("execplan") // id = 4
("joblist") // id = 5
("resultset") // id = 6
("calpontConsole") // id = 7
("oamcpp") // id = 8
("ServerMonitor") // id = 9
("traphandler") // id = 10
("snmpmanager") // id = 11
("configcpp") // id = 12
("loggingcpp") // id = 13
("messageqcpp") // id = 14
("DDLProc") // id = 15
("ExeMgr") // id = 16
("ProcessManager") // id = 17
("ProcessMonitor") // id = 18
("writeengine") // id = 19
("DMLProc") // id = 20
("dmlpackageproc") // id = 21
("threadpool") // id = 22
("ddlpackageproc") // id = 23
("dbcon") // id = 24
("DiskManager") // id = 25
("RouteMsg") // id = 26
("SQLBuffMgr") // id = 27
("PrimProc") // id = 28
("controllernode") // id = 29
("workernode") // id = 30
("messagequeue") // id = 31
("writeengineserver")//id = 32
("writeenginesplit")// id = 33
("cpimport.bin") // id = 34
("IDBFile") // id = 35
;
string timestr()
{
struct tm tm;
struct timeval tv;
gettimeofday(&tv, 0);
#ifdef _MSC_VER
errno_t p = 0;
time_t t = (time_t)tv.tv_sec;
p = localtime_s(&tm, &t);
if (p != 0)
memset(&tm, 0, sizeof(tm));
#else
localtime_r(&tv.tv_sec, &tm);
#endif
ostringstream oss;
oss << setfill('0')
<< setw(2) << tm.tm_sec
<< '.'
<< setw(6) << tv.tv_usec
;
return oss.str();
}
void closeLog()
{
}
void openLog(unsigned subsystemid, int localLogNum)
{
if (subsystemid >= SubsystemID.size())
subsystemid = 0;
}
const string escape_pct(const string& in)
{
string out(in);
string::size_type pos;
pos = out.find('%', 0);
while (pos != string::npos)
{
out.replace(pos, 1, "%%");
pos = out.find('%', pos+2);
}
return out;
}
}
namespace logging {
MessageLog::MessageLog(const LoggingID& initData, int localLogNum) :
fLogData(initData), fFacility(localLogNum)
{
openLog(fLogData.fSubsysID, fFacility);
}
void MessageLog::logData(const LoggingID& logData)
{
if (fLogData.fSubsysID != logData.fSubsysID)
{
closeLog();
openLog(logData.fSubsysID, fFacility);
}
fLogData = logData;
}
MessageLog::~MessageLog()
{
closeLog();
}
const string MessageLog::format(const Message& msg, const char prefix)
{
ostringstream oss;
oss << timestr() << " |"
<< fLogData.fSessionID
<< '|' << fLogData.fTxnID
<< '|' << fLogData.fThdID
<< "| "
<< prefix << ' ' << setw(2) << setfill('0') << fLogData.fSubsysID
<< ' ' << msg.msg()
;
return escape_pct(oss.str());
}
void MessageLog::logDebugMessage(const Message& msg)
{
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0|LOG_PID, fFacility);
::syslog(LOG_DEBUG, format(msg, 'D').c_str());
::closelog();
}
void MessageLog::logInfoMessage(const Message& msg)
{
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0|LOG_PID, fFacility);
::syslog(LOG_INFO, format(msg, 'I').c_str());
::closelog();
}
void MessageLog::logWarningMessage(const Message& msg)
{
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0|LOG_PID, fFacility);
::syslog(LOG_WARNING, format(msg, 'W').c_str());
::closelog();
}
void MessageLog::logErrorMessage(const Message& msg)
{
// @bug 24 use 'E' instead of 'S'
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0|LOG_PID, fFacility);
::syslog(LOG_ERR, format(msg, 'E').c_str());
::closelog();
}
void MessageLog::logCriticalMessage(const Message& msg)
{
::openlog(SubsystemID[fLogData.fSubsysID].c_str(), 0|LOG_PID, fFacility);
::syslog(LOG_CRIT, format(msg, 'C').c_str());
::closelog();
}
//Bug 5218. comment out the following functions to alleviate issue where dml messages show up in crit.log. This
// will turn off data_mods.log.
void logDML(unsigned sessionId, unsigned txnId, const string& statement, const string& owner)
{
/* logging::Message::Args args;
unsigned subsystemId = 20; // DMLProc
unsigned threadId = 0; // 0 for now
logging::LoggingID loggingId(subsystemId, sessionId, txnId, threadId);
logging::MessageLog messageLog(loggingId, LOG_LOCAL2);
logging::Message m(M0017);
args.add("|" + owner + "|" + statement);
m.format(args);
messageLog.logCriticalMessage(m); */
}
void logDDL(unsigned sessionId, unsigned txnId, const string& statement, const string& owner)
{
/*
logging::Message::Args args;
unsigned subsystemId = 15; // DDLProc
unsigned threadId = 0; // 0 for now
logging::LoggingID loggingId(subsystemId, sessionId, txnId, threadId);
logging::MessageLog messageLog(loggingId, LOG_LOCAL2);
logging::Message m(M0018);
args.add("|" + owner + "|" + statement);
m.format(args);
messageLog.logCriticalMessage(m); */
}
void logCommand(unsigned sessionId, unsigned txnId, const string& statement) {
/* logging::Message::Args args;
unsigned subsystemId = 20; // DMLProc
unsigned threadId = 0; // 0 for now
logging::LoggingID loggingId(subsystemId, sessionId, txnId, threadId);
logging::MessageLog messageLog(loggingId, LOG_LOCAL2);
logging::Message m(M0019);
args.add("|" + statement);
m.format(args);
messageLog.logCriticalMessage(m); */
}
void logEventToDataLog(unsigned messageId, const string& messageText) {
/* logging::Message::Args args;
unsigned subsystemId = 20; // DMLProc
unsigned threadId = 0; // 0 for now
logging::LoggingID loggingId(subsystemId, 0, 0, threadId);
logging::MessageLog messageLog(loggingId, LOG_LOCAL2);
logging::Message m(messageId);
args.add(messageText);
m.format(args);
messageLog.logCriticalMessage(m); */
}
} //namespace logging

View File

@ -0,0 +1,150 @@
/* 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: messagelog.h 3495 2013-01-21 14:09:51Z rdempsey $
*
******************************************************************************************/
/**
* @file
*/
#ifndef LOGGING_MESSAGELOG_H
#define LOGGING_MESSAGELOG_H
#include <syslog.h>
#include "loggingid.h"
class MessageLoggingTest;
namespace logging {
/** @brief Log Types
*/
enum LOG_TYPE
{
LOG_TYPE_DEBUG, // 0 = debug
LOG_TYPE_INFO, // 1 = info
LOG_TYPE_WARNING, // 2 = warning
LOG_TYPE_ERROR, // 3 = error
LOG_TYPE_CRITICAL // 4 = critical
};
class Message;
/** @brief a message log class
*
*/
class MessageLog
{
public:
/** @brief ctor
* @param initData the LogginID object.
* @param facility openLog will be called using this as the third parm.
*/
MessageLog(const LoggingID& initData, int facility=LOG_LOCAL1);
/** @brief dtor
*
*/
~MessageLog();
/** @brief log a debug message
*
* @param msg the message to log
*/
void logDebugMessage(const Message& msg);
/** @brief log an info message
*
* @param msg the message to log
*/
void logInfoMessage(const Message& msg);
/** @brief log a warning message
*
* @param msg the message to log
*/
void logWarningMessage(const Message& msg);
/** @brief log an error message
*
* @param msg the message to log
*/
void logErrorMessage(const Message& msg);
/** @brief log a serious message
*
* @param msg the message to log
* @note this is the same as calling logErrorMessage()
* @bug 24 add logErrorMessage() and make logSeriousMessage() call it
*/
void logSeriousMessage(const Message& msg) { logErrorMessage(msg); }
/** @brief log a critial message
*
* @param msg the message to log
*/
void logCriticalMessage(const Message& msg);
/** @brief LoggingID mutator
*
* @param logData the new LoggingID. If the subsystem id is changed, the syslog connection will be closed
* and reopened.
*/
void logData(const LoggingID& logData);
/** @brief LoggingID accessor
*
*/
const LoggingID& logData() const { return fLogData; }
friend class ::MessageLoggingTest;
protected:
const std::string format(const Message& msg, const char prefix='U');
private:
//defaults okay
//MessageLog(const MessageLog& rhs);
//MessageLog& operator=(const MessageLog& rhs);
LoggingID fLogData; /// the logging context data
int fFacility; /// the syslog facility number
};
/** @brief logs the DML statement using a Syslog critical message to LOG_LOCAL2.
*/
void logDML(unsigned sessionId, unsigned txnId, const std::string& statement, const std::string& owner);
/** @brief logs the DDL statement using a Syslog critical message to LOG_LOCAL2.
*/
void logDDL(unsigned sessionId, unsigned txnId, const std::string& statement, const std::string& owner);
/** @brief logs the commit or rollback statement using a Syslog critical message to LOG_LOCAL2.
*/
void logCommand(unsigned sessionId, unsigned txnId, const std::string& statement);
/** @brief logs the event using a Syslog critical message to LOG_LOCAL2. Used for messages 19..24.
*/
void logEventToDataLog(unsigned messageId, const std::string& messageText);
}
#endif

View File

@ -0,0 +1,158 @@
/* 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: messageobj.h 3495 2013-01-21 14:09:51Z rdempsey $
*
******************************************************************************************/
/**
* @file
*/
#ifndef LOGGING_MESSAGEOBJ_H
#define LOGGING_MESSAGEOBJ_H
#include <string>
#include <vector>
#include <boost/any.hpp>
#include <sys/types.h>
#include <stdint.h>
namespace config
{
class Config;
}
class MessageLoggingTest;
namespace logging {
/** @brief a message class
*
* Contains a message to be logged
*/
class Message
{
public:
/** @brief the args to a formatted message
*/
class Args
{
public:
/** @brief the args vector
*/
typedef std::vector<boost::any> AnyVec;
// default ctors & dtors okay
/** @brief add an int arg to the message
*/
void add(int i);
/** @brief add an unsigned 64 bit int arg to the message
*/
void add(uint64_t i);
/** @brief add a float arg to the message
*/
void add(double d);
/** @brief add a string arg to the message
*/
void add(const std::string& s);
/** @brief args accessor
*/
const AnyVec& args() const { return fArgs; }
/** @brief reset the args list
*
*/
void reset();
friend class ::MessageLoggingTest;
private:
AnyVec fArgs; /// the args vector
};
/** @brief the MessageID type
*/
typedef unsigned MessageID;
/** @brief default ctor
*/
explicit Message(const MessageID msgid=0);
/** @brief ctor turn a message string to a Message
*
* For error handling framework use to log error
*/
Message(const std::string msg);
/** @brief format message with args
*/
void format(const Args& args);
/** @brief msg accessor
*/
const std::string& msg() const { return fMsg; }
/** @brief swap
*/
void swap(Message& rhs);
/** @brief lookup the message format string
*
* looks up the message format string for msgid. Returns a reasonable
* default if one can't be found.
*/
static const std::string lookupMessage(const MessageID& msgid);
/** @brief reset the formated string
*
* The original, unformated string is restored, and this Message
* is then ready for a new call to format().
*/
void reset();
/** @brief msgID accessor
*/
const MessageID& msgID() const { return fMsgID; }
friend class ::MessageLoggingTest;
private:
//defaults okay
//Message(const Message& rhs);
//Message& operator=(const Message& rhs);
MessageID fMsgID; /// the msgID
std::string fMsg; /// the formated or unformated message
config::Config* fConfig; /// config file ptr
};
}//namespace logging
namespace std
{
template<> inline void swap<logging::Message>(logging::Message& lhs, logging::Message&rhs)
{
lhs.swap(rhs);
}
}//namespace std
#endif

View File

@ -0,0 +1,75 @@
/* 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: $
*
*
***********************************************************************/
#include <string>
using namespace std;
#include "messageobj.h"
#include "messageids.h"
#include "loggingid.h"
#include "sqllogger.h"
namespace logging
{
const unsigned LogDefaultMsg = M0000;
const unsigned LogStartSql = M0041;
const unsigned LogEndSql = M0042;
//We can't use a member Logger here. When used with DML and DDL, the syslog gets closed by calls to DMLLog and DDLLog.
SQLLogger::SQLLogger(const std::string sql, unsigned subsys, unsigned session, unsigned txn, unsigned thread)
: fLogId(subsys, session, txn, thread), fLog(!sql.empty())
{
makeMsgMap();
if (fLog) logMessage(LOG_TYPE_DEBUG, sql, LogStartSql);
}
SQLLogger::SQLLogger(const std::string sql, const LoggingID& logId)
: fLogId(logId.fSubsysID, logId.fSessionID, logId.fTxnID, logId.fThdID), fLog(!sql.empty())
{
makeMsgMap();
if (fLog) logMessage(LOG_TYPE_DEBUG, sql, LogStartSql);
}
void SQLLogger::makeMsgMap()
{
fMsgMap[LogDefaultMsg] = Message(LogDefaultMsg);
fMsgMap[LogStartSql] = Message(LogStartSql);
fMsgMap[LogEndSql] = Message(LogEndSql);
}
SQLLogger::~SQLLogger()
{
if (fLog) logMessage(LOG_TYPE_DEBUG, "", LogEndSql);
}
std::string SQLLogger::logMessage(logging::LOG_TYPE logLevel, const std::string& msg, logging::Message::MessageID mid )
{
logging::Message::Args args;
args.add(msg);
Logger logger(fLogId.fSubsysID);
logger.msgMap(fMsgMap);
return logger.logMessage(logLevel, mid, args, fLogId);
}
}

View File

@ -0,0 +1,64 @@
/* 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: $
*
*
***********************************************************************/
/** @file */
#ifndef LOGGING_SQLLOGGER_H_
#define LOGGING_SQLLOGGER_H_
#include <string>
#include "messageids.h"
#include "messageobj.h"
#include "loggingid.h"
#include "logger.h"
namespace logging
{
extern const unsigned LogDefaultMsg;
extern const unsigned LogStartSql;
extern const unsigned LogEndSql;
/** @brief writes sql start with sql statement in constructor and sql end in destructor in debug.log
if the sql text is not empty
*/
class SQLLogger
{
public:
SQLLogger(const std::string sql, unsigned subsys, unsigned session, unsigned txn = 0, unsigned thread = 0);
SQLLogger(const std::string sql, const LoggingID& logId);
~SQLLogger();
std::string logMessage(logging::LOG_TYPE logLevel, const std::string& msg, logging::Message::MessageID mid = LogDefaultMsg );
private:
void makeMsgMap();
MsgMap fMsgMap;
LoggingID fLogId;
bool fLog;
};
}
#endif

View File

@ -0,0 +1,220 @@
/* 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$
//
// Timer class used to spit out times and percentages. Temporarily lives in joblist.
// This is strictly a debugging utility class that accumulates times between .start() and
// .stop() calls for a particular string. It can be useful in tdrivers.
//
// It outputs a report when finish() is called with
// the total times by string and their percentage of the total. The total is tracked from
// the first time start() is called until finish() is called. You should always match your
// start and stop calls up.
//
// This works fine as long as you don't use it with huge numbers of calls. If you call start
// and stop too many times the overhead of the StopWatch class will start factoring in to your
// results.
//
// How to use:
//
// StopWatch timer;
// timer.start("Loop only");
// for(int i = 0; i < 6999075; i++)
// {
// }
// timer.stop("Loop only");
//
// timer.start("Loop Plus");
// for(int i = 0; i < 100000; i++)
// {
// timer.start("Inside loop");
// timer.stop("Inside loop");
// }
// timer.stop("Loop Plus");
// timer.finish();
//
// Produces this:
//
// Seconds Percentage Calls Description
// 0.02865 9.377% 1 Loop only
// 0.27680 90.59% 1 Loop Plus
// 0.12138 39.72% 100000 Inside loop
//
// 0.30553 100 % 1 Total
//
// Note that you can have overlapping timers which will make your percentages add up to more than 100%.
#include <iostream>
#include <fstream>
#include <list>
#include <sstream>
#include <time.h>
#include <sys/time.h>
#include <vector>
#include <stdexcept>
#include <sys/types.h>
#include <cstring>
#include <stdint.h>
#include "stopwatch.h"
using namespace std;
namespace logging
{
void StopWatch::stop(const string& message)
{
stop(message, 1);
}
bool StopWatch::stop(const string& message, const int limit) {
gettimeofday(&fTvLast, 0);
fOpenCalls--;
bool found = false;
uint32_t idx = 0;
for(uint32_t i = 0; i < fProcessStats.size(); i++) {
if(fProcessStats[i].fProcess == message) {
idx = i;
found = true;
break;
}
}
if(!found) {
//throw std::runtime_error("StopWatch::stop " + message + " called without calling start first.");
std::cerr << "StopWatch receiving STOP for unknown event: " << message << std::endl;
return false;
}
fProcessStats[idx].processStop();
if(fProcessStats[idx].fStopCount >= limit)
return true;
return false;
}
void StopWatch::start(const string& message) {
fOpenCalls++;
gettimeofday(&fTvLast, 0);
bool found = false;
uint32_t idx = 0;
ProcessStats processStats;
if(!fStarted) {
fStarted = true;
gettimeofday(&fTvStart, 0);
}
for(uint32_t i = 0; i < fProcessStats.size(); i++) {
if(fProcessStats[i].fProcess == message) {
idx = i;
found = true;
break;
}
}
if(!found) {
fProcessStats.push_back(processStats);
idx = fProcessStats.size() - 1;
}
fProcessStats[idx].fProcess = message;
fProcessStats[idx].processStart();
}
void StopWatch::finish() {
ostringstream oss;
oss << endl;
oss << "Seconds Percentage Calls Description" << endl;
// total seconds elapsed
double totalSeconds = 1.0;
// Add a last entry into the vector for total.
ProcessStats total;
total.fProcess = "Total";
if (fProcessStats.size() > 0)
{
// Calculate the total seconds elapsed.
totalSeconds =
(fTvLast.tv_sec + (fTvLast.tv_usec / 1000000.0)) -
(fTvStart.tv_sec + (fTvStart.tv_usec / 1000000.0));
total.fTotalSeconds = totalSeconds;
total.fStartCount = 1;
}
else
{
total.fTotalSeconds = 0.0;
total.fStartCount = 0;
}
fProcessStats.push_back(total);
for(uint32_t i = 0; i < fProcessStats.size(); i++) {
if(i == (fProcessStats.size() - 1)) {
oss << endl;
}
// Seconds.
string seconds;
ostringstream ossTemp;
ossTemp << fProcessStats[i].fTotalSeconds;
seconds = ossTemp.str();
seconds.resize(11, ' ');
oss << seconds << " ";
// Percentage.
string percentage;
ossTemp.str(""); // clear the stream.
ossTemp << (fProcessStats[i].fTotalSeconds / totalSeconds) * 100.0;
percentage = ossTemp.str();
percentage.resize(11, ' ');
oss << percentage << "% ";
// Times Initiated.
ossTemp.str(""); // clear the stream.
ossTemp << fProcessStats[i].fStartCount;
string timesInitiated = ossTemp.str();
timesInitiated.resize(10, ' ');
oss << timesInitiated << " ";
// Description.
if(fId >= 0)
oss << fId << ": " << fProcessStats[i].fProcess << endl;
else
oss << fProcessStats[i].fProcess << endl;
}
if(fOutputToFile) {
ofstream profLog;
profLog.open(fLogFile.c_str(), std::ios::app);
// Output the date and time.
time_t t = time(0);
char timeString[50];
ctime_r(&t, timeString);
timeString[ strlen(timeString)-1 ] = '\0';
profLog << endl << timeString;
// Output the stopwatch info.
profLog << oss.str();
}
else {
cout << oss.str();
}
// Clear everything out.
fStarted = false;
fProcessStats.clear();
}
} // end of logging namespace

View File

@ -0,0 +1,137 @@
/* 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$
//
// Timer class used to spit out times and percentages. Temporarily lives in joblist.
// This is strictly a debugging utility class that accumulates times between .start() and
// .stop() calls for a particular string. It can be useful in tdrivers.
//
// It outputs a report when finish() is called with
// the total times by string and their percentage of the total. The total is tracked from
// the first time start() is called until finish() is called. You should always match your
// start and stop calls up.
//
// This works fine as long as you don't use it with huge numbers of calls. If you call start
// and stop too many times the overhead of the StopWatch class will start factoring in to your
// results.
//
// How to use:
//
// StopWatch timer;
// timer.start("Loop only");
// for(int i = 0; i < 6999075; i++)
// {
// }
// timer.stop("Loop only");
//
// timer.start("Loop Plus");
// for(int i = 0; i < 100000; i++)
// {
// timer.start("Inside loop");
// timer.stop("Inside loop");
// }
// timer.stop("Loop Plus");
// timer.finish();
//
// Produces this:
//
// Seconds Percentage Calls Description
// 0.02865 9.377% 1 Loop only
// 0.27680 90.59% 1 Loop Plus
// 0.12138 39.72% 100000 Inside loop
//
// 0.30553 100 % 1 Total
//
// Note that you can have overlapping timers which will make your percentages add up to more than 100%.
#ifndef LOGGING_STOPWATCH_H
#define LOGGING_STOPWATCH_H
#include <iostream>
#include <fstream>
#include <list>
#include <sstream>
#include <time.h>
#include <sys/time.h>
#include <vector>
#include <stdexcept>
#include <map>
#include <unistd.h>
namespace logging
{
class StopWatch {
public:
void start(const std::string& message);
bool stop(const std::string& message, const int limit);
void stop(const std::string& message);
void finish();
bool isActive()
{
return fOpenCalls > 0;
}
StopWatch() : fStarted(false), fId(-1), fOpenCalls(0), fOutputToFile(false), fLogFile("") {};
StopWatch(int id) : fStarted(false), fId(id), fOpenCalls(0), fOutputToFile(false), fLogFile("") {};
StopWatch(const std::string& fileName) : fStarted(false), fId(-1), fOpenCalls(0), fOutputToFile(true), fLogFile(fileName) {}
struct ::timeval fTvLast;
int getId() { return fId; }
private:
class ProcessStats
{
public:
std::string fProcess;
struct timeval fTvProcessStarted;
double fTotalSeconds;
int64_t fStartCount;
int64_t fStopCount;
ProcessStats() : fProcess(""), fTotalSeconds(0.0), fStartCount(0), fStopCount(0) {};
void processStart()
{
gettimeofday(&fTvProcessStarted, 0);
fStartCount++;
}
void processStop()
{
struct timeval tvStop;
gettimeofday(&tvStop, 0);
fStopCount++;
fTotalSeconds +=
(tvStop.tv_sec + (tvStop.tv_usec / 1000000.0)) -
(fTvProcessStarted.tv_sec + (fTvProcessStarted.tv_usec / 1000000.0));
}
};
struct timeval fTvStart;
std::vector <ProcessStats> fProcessStats;
bool fStarted;
int fId;
int fOpenCalls;
bool fOutputToFile;
std::string fLogFile;
};
} // end of logging namespace
#endif // STOPWATCH_H

View File

@ -0,0 +1,370 @@
/* 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 <string>
using namespace std;
#include <cppunit/extensions/HelperMacros.h>
#include "messagelog.h"
#include "messageobj.h"
#include "loggingid.h"
#include "messageids.h"
using namespace logging;
using namespace config;
class MessageLoggingTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE( MessageLoggingTest );
CPPUNIT_TEST( m1 );
CPPUNIT_TEST( m2 );
CPPUNIT_TEST( m3 );
CPPUNIT_TEST( m4 );
CPPUNIT_TEST( m5 );
CPPUNIT_TEST_SUITE_END();
private:
LoggingID lid;
public:
void setUp() {
setenv("CALPONT_CONFIG_FILE", "./Calpont.xml", 1);
}
void tearDown() {
}
void m1()
{
Message::Args args;
args.add("hello");
args.add("world");
args.add(123);
args.add(1234.55);
Message m(100);
m.fMsg = "%1% %2% %3% %4%";
m.format(args);
//CPPUNIT_ASSERT(m.msg() == "hello world 123 1234.55");
m.reset();
m.fMsg = "%1% %2% %3% %4%";
args.reset();
m.format(args);
//CPPUNIT_ASSERT(m.msg() == " ");
LoggingID lid(7);
MessageLog ml(lid);
m.reset();
args.add("hello");
args.add("world");
args.add(123);
args.add(1234.55);
m.format(args);
ml.logDebugMessage(m);
args.reset();
args.add("begin CEP generation");
m.reset();
m.format(args);
ml.logInfoMessage(m);
args.reset();
args.add("end CEP generation");
m.reset();
m.format(args);
ml.logInfoMessage(m);
args.reset();
args.add("something took too long");
m.reset();
m.format(args);
ml.logWarningMessage(m);
args.reset();
args.add("something seriously took too long");
m.reset();
m.format(args);
ml.logSeriousMessage(m);
ml.logErrorMessage(m);
args.reset();
args.add("something critical took too long");
m.reset();
m.format(args);
ml.logCriticalMessage(m);
LoggingID lid1;
MessageLog ml1(lid1);
args.reset();
m.reset();
args.add("subsystem 0 = Calpont test");
m.format(args);
ml1.logDebugMessage(m);
LoggingID lid2(1000);
MessageLog ml2(lid2);
args.reset();
m.reset();
args.add("subsystem above MAX = Calpont test");
m.format(args);
ml2.logDebugMessage(m);
LoggingID lid3(7);
MessageLog ml3(lid3);
args.reset();
m.reset();
args.add("subsystem 7 = calpontConsole test");
m.format(args);
ml3.logDebugMessage(m);
Config::deleteInstanceMap();
}
void m2()
{
Message m1(100);
CPPUNIT_ASSERT(m1.msgID() == 100);
Message m2(10);
CPPUNIT_ASSERT(m2.msgID() == 10);
m2 = m1;
CPPUNIT_ASSERT(m2.msgID() == 100);
Message m3(m2);
CPPUNIT_ASSERT(m3.msgID() == m2.msgID());
Message m4(99);
Message m5(199);
CPPUNIT_ASSERT(m4.msgID() == 99);
CPPUNIT_ASSERT(m5.msgID() == 199);
m4.swap(m5);
CPPUNIT_ASSERT(m5.msgID() == 99);
CPPUNIT_ASSERT(m4.msgID() == 199);
Config::deleteInstanceMap();
}
void m3()
{
LoggingID lid1(1, 2, 3, 4);
MessageLog ml1(lid1);
CPPUNIT_ASSERT(ml1.fLogData.fSubsysID == 1);
LoggingID lid2(10, 20, 30, 40);
MessageLog ml2(lid2);
CPPUNIT_ASSERT(ml2.fLogData.fSubsysID == 10);
ml2 = ml1;
CPPUNIT_ASSERT(ml2.fLogData.fSubsysID == 1);
MessageLog ml3(ml2);
CPPUNIT_ASSERT(ml3.fLogData.fSubsysID == 1);
Config::deleteInstanceMap();
}
void m4()
{
LoggingID lid1(100, 200, 300, 400);
MessageLog ml1(lid1);
Message::Args args;
Message* m;
args.add("hello");
args.add("world");
args.add(123);
args.add(1234.55);
for (int i = 0; i < 4; i++)
{
m = new Message(i);
m->format(args);
ml1.logDebugMessage(*m);
delete m;
}
Config::deleteInstanceMap();
}
//------------------------------------------------------------------------------
// This method is intended to test the messages used to profile db performance.
// The method also provides an example on how to use these log messages.
// Test can be verified by viewing /var/log/Calpont/debug.log.
//
// Message types are:
//
// 26 Start Transaction
// 27 End Transaction
// 28 Start Statement
// 29 End Statement
// 30 Start Step
// 31 End Step
// 32 I/O Reads
//
// The messages should be logged in the following way:
//
// 1. The application should log a StartTransaction message at the beginning
// of a database transaction.
// 2. When the application begins processing a statement, the StartStatement
// message should be logged.
// 3. As each primitive step is executed, it's start time should be recorded
// by logging a StartStep message.
// 4. During the execution of a step, 1 or more I/O Read messages should be
// logged to record the I/O block count used in accessing each object. If
// necessary, more than 1 message can be logged for the same object and
// step. In these cases, the script that post-processes the syslog will
// add up the block counts for the same object and step.
// 5. Upon completion of each primitive step, an EndStep message should be
// logged. If multiple steps are executing in parallel, the EndStep msg
// should be logged as each step completes. After all these stpes are
// completed and logged, if needed, a new set of StartStep messages can
// be logged (for the same statement), for a new set of parallel steps.
// 6. Upon completion of each statement, an EndStatement msg should be logged.
// 7. Upon completion of each transaction, an EndTransaction msg should
// be logged.
//
// Some possible enhancements to simplify this profile logging for the
// application programmer:
//
// 1. Define enum or const ints in a common header file to represent the
// list of valid subSystem ids.
//
// 2. Add set of helper methods to MessageLog class to reduce the
// amount of work for the application. For example a method like:
//
// void logStartStatement ( int statement, int ver, string SQL );
//
// would allow the application to log a StartStatement by simply doing;
//
// Message msgStartStatement ( M0028 );
// int statementId = 11;
// int versionId = 22;
// string sql ("SELECT column1, column2 FROM table1 WHERE ...
// msgStartStatement.logStartStatement ( statementId, versionId, sql);
//
// 3. Could also do something similar to #2 except instead of adding helper
// methods to MessageLog, we could add specialized classes that derive
// from MessageLog or contain a MessageLog. One advantage of doing it
// this way is that a derived class like MessageLogStatement "could" be
// implemented to log the StartStatement, and its desctructor could then
// log the EndStatement automatically, on behalf of the application.
//
//------------------------------------------------------------------------------
void m5()
{
int subSystem = 5; // joblist subSystem
int session = 100;
int transaction = 1;
int thread = 0;
LoggingID lid1 ( subSystem, session, transaction, thread );
MessageLog msgLog ( lid1 );
Message::Args args;
// Log the start time of a transaction
Message msgStartTrans ( M0026 );
msgStartTrans.format ( args );
msgLog.logDebugMessage ( msgStartTrans );
// Log the start of execution time for a SQL statement
Message msgStartStatement ( M0028 );
int statementId = 11;
int versionId = 22;
string sql ("SELECT column1, column2 FROM table1 WHERE column1 = 345");
args.reset ( );
args.add ( statementId );
args.add ( versionId );
args.add ( sql );
msgStartStatement.format ( args );
msgLog.logDebugMessage ( msgStartStatement );
const string stepNames[] = { "steponeA", "steptwoA" ,"stepthreeA",
"stepfourB","stepfiveB","stepsixB" };
// To process this SQL statement, simulate executing 2 job steps,
// with each job step consisting of of 3 parallel primitive steps
for (int jobStep=0; jobStep<2; jobStep++)
{
int primStep1 = jobStep * 3;
// Log 3 parallel steps starting to execute
for (int i=primStep1; i<(primStep1+3); i++)
{
Message msgStartStep ( M0030 ); // Start Step
int stepId = i+1;
string stepName = stepNames[i];
args.reset ( );
args.add ( statementId );
args.add ( stepId );
args.add ( stepName );
msgStartStep.format ( args );
msgLog.logDebugMessage ( msgStartStep );
}
// Record I/O block count for 0 or more objects per step;
// for this example we just record I/O for 1 object per step.
// Then log the completion of each step.
for (int i=primStep1; i<(primStep1+3); i++)
{
Message msgBlockCount ( M0032 ); // I/O block count
int stepId = i+1;
int objectId = stepId * 20;
int phyCount = stepId * 30;
int logCount = phyCount + 5;
args.reset ( );
args.add ( statementId );
args.add ( stepId );
args.add ( objectId );
args.add ( phyCount );
args.add ( logCount );
msgBlockCount.format ( args );
msgLog.logDebugMessage ( msgBlockCount );
Message msgEndStep ( M0031 ); // End Step
args.reset ( );
args.add ( statementId );
args.add ( stepId );
msgEndStep.format ( args );
msgLog.logDebugMessage ( msgEndStep );
}
}
// Log the completion time of the SQL statement
Message msgEndStatement ( M0029 );
args.reset ( );
args.add ( statementId );
msgEndStatement.format ( args );
msgLog.logDebugMessage ( msgEndStatement );
// Log the completion time of the transaction
Message msgEndTrans ( M0027 );
args.reset ( );
args.add ( string("COMMIT") );
msgEndTrans.format ( args );
msgLog.logDebugMessage ( msgEndTrans );
Config::deleteInstanceMap();
}
}; // end of CppUnit::TestFixture class
CPPUNIT_TEST_SUITE_REGISTRATION( MessageLoggingTest );
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
int main( int argc, char **argv)
{
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
bool wasSuccessful = runner.run( "", false );
return (wasSuccessful ? 0 : 1);
}