From 74225daf460808766d1a8e504e6e570a5d9b64fb Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Thu, 26 Jan 2017 12:43:48 +0200 Subject: [PATCH] Remove memlog and rdtsc Neither of these were actively used, so they and any associated tests were removed. --- cmake/CheckPlatform.cmake | 2 - include/maxscale/memlog.h | 65 --- include/maxscale/rdtsc.h | 60 --- server/core/CMakeLists.txt | 2 +- server/core/gateway.cc | 2 - server/core/memlog.c | 273 ---------- server/core/poll.c | 11 - server/core/test/CMakeLists.txt | 3 - server/core/test/testmemlog.c | 503 ------------------ server/modules/routing/binlogrouter/blr.h | 1 - .../modules/routing/binlogrouter/blr_master.c | 1 - 11 files changed, 1 insertion(+), 922 deletions(-) delete mode 100644 include/maxscale/memlog.h delete mode 100644 include/maxscale/rdtsc.h delete mode 100644 server/core/memlog.c delete mode 100644 server/core/test/testmemlog.c diff --git a/cmake/CheckPlatform.cmake b/cmake/CheckPlatform.cmake index a35bd4339..b5758be16 100644 --- a/cmake/CheckPlatform.cmake +++ b/cmake/CheckPlatform.cmake @@ -16,14 +16,12 @@ check_include_files(ftw.h HAVE_FTW) check_include_files(getopt.h HAVE_GETOPT) check_include_files(ini.h HAVE_INI) check_include_files(math.h HAVE_MATH) -check_include_files(memlog.h HAVE_MEMLOG) check_include_files(netdb.h HAVE_NETDB) check_include_files(netinet/in.h HAVE_NETINET_IN) check_include_files(openssl/aes.h HAVE_OPENSSL_AES) check_include_files(openssl/sha.h HAVE_OPENSSL_SHA) check_include_files(pthread.h HAVE_PTHREAD) check_include_files(pwd.h HAVE_PWD) -check_include_files(rdtsc.h HAVE_RDTSC) check_include_files(regex.h HAVE_REGEX) check_include_files(signal.h HAVE_SIGNAL) check_include_files(stdarg.h HAVE_STDARG) diff --git a/include/maxscale/memlog.h b/include/maxscale/memlog.h deleted file mode 100644 index 8d609af3d..000000000 --- a/include/maxscale/memlog.h +++ /dev/null @@ -1,65 +0,0 @@ -#pragma once -/* - * Copyright (c) 2016 MariaDB Corporation Ab - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file and at www.mariadb.com/bsl. - * - * Change Date: 2019-07-01 - * - * On the date above, in accordance with the Business Source License, use - * of this software will be governed by version 2 or later of the General - * Public License. - */ - -/** - * @file memlog.h The memory logging mechanism - * - * @verbatim - * Revision History - * - * Date Who Description - * 26/09/14 Mark Riddoch Initial implementation - * - * @endverbatim - */ - -#include -#include - -MXS_BEGIN_DECLS - -typedef enum { ML_INT, ML_LONG, ML_LONGLONG, ML_STRING } MEMLOGTYPE; - -typedef struct memlog -{ - char *name; - SPINLOCK lock; - void *values; - int offset; - int size; - MEMLOGTYPE type; - unsigned int flags; - unsigned int iflags; - struct memlog *next; -} MEMLOG; - -/* - * MEMLOG flag bits - */ -#define MLNOAUTOFLUSH 0x0001 - -/* - * MEMLOG internal flags - */ -#define MLWRAPPED 0x0001 - - -extern MEMLOG *memlog_create(char *, MEMLOGTYPE, int); -extern void memlog_destroy(MEMLOG *); -extern void memlog_set(MEMLOG *, unsigned int); -extern void memlog_log(MEMLOG *, void *); -extern void memlog_flush_all(); -extern void memlog_flush(MEMLOG *); - -MXS_END_DECLS diff --git a/include/maxscale/rdtsc.h b/include/maxscale/rdtsc.h deleted file mode 100644 index c87f96129..000000000 --- a/include/maxscale/rdtsc.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once -/* - * Copyright (c) 2016 MariaDB Corporation Ab - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file and at www.mariadb.com/bsl. - * - * Change Date: 2019-07-01 - * - * On the date above, in accordance with the Business Source License, use - * of this software will be governed by version 2 or later of the General - * Public License. - */ - -/** - * @file rdtsc.h Access the process time-stamp counter - * - * This is an Intel only facilty that is used to access an accurate time - * value, the granularity of which is related to the processor clock speed - * and the overhead for access is much lower than using any system call - * mechanism. - * - * - * @verbatim - * Revision History - * - * Date Who Description - * 19/09/2014 Mark Riddoch Initial implementation - * - * @endverbatim - */ - -#include - -MXS_BEGIN_DECLS - -typedef unsigned long long CYCLES; - -/** - * Get the current time-stamp counter value from the processor. This is the - * count of CPU cyceles as a 64 bit value. - * - * The value returned is related to the clock speed, to obtian a value in - * seconds divide the returned value by the clock frequency for the processor. - * - * Note, on multi-processsor systems care much be taken to avoid the thread - * moving to a different processor when taken succsive value of RDTSC to - * obtian accurate timing. This may be done by setting pocessor affinity for - * the thread. See sched_setaffinity/sched_getaffinity. - * - * @return CPU cycle count - */ -static __inline__ CYCLES rdtsc(void) -{ - unsigned long long int x; - __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)); - return x; -} - -MXS_END_DECLS diff --git a/server/core/CMakeLists.txt b/server/core/CMakeLists.txt index 33d2b9a25..b12bf4d6f 100644 --- a/server/core/CMakeLists.txt +++ b/server/core/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(maxscale-common SHARED adminusers.c alloc.c authenticator.c atomic.c buffer.c config.c config_runtime.c dcb.c filter.c filter.cc externcmd.c paths.c hashtable.c hint.c housekeeper.c load_utils.c log_manager.cc maxscale_pcre2.c memlog.c misc.c mlist.c modutil.c monitor.c queuemanager.c query_classifier.c poll.c random_jkiss.c resultset.c secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c skygw_utils.cc statistics.c listener.c ssl.c mysql_utils.c mysql_binlog.c modulecmd.c ) +add_library(maxscale-common SHARED adminusers.c alloc.c authenticator.c atomic.c buffer.c config.c config_runtime.c dcb.c filter.c filter.cc externcmd.c paths.c hashtable.c hint.c housekeeper.c load_utils.c log_manager.cc maxscale_pcre2.c misc.c mlist.c modutil.c monitor.c queuemanager.c query_classifier.c poll.c random_jkiss.c resultset.c secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c skygw_utils.cc statistics.c listener.c ssl.c mysql_utils.c mysql_binlog.c modulecmd.c ) target_link_libraries(maxscale-common ${MARIADB_CONNECTOR_LIBRARIES} ${LZMA_LINK_FLAGS} ${PCRE2_LIBRARIES} ${CURL_LIBRARIES} ssl pthread crypt dl crypto inih z rt m stdc++) diff --git a/server/core/gateway.cc b/server/core/gateway.cc index 8e943d6fe..bd06fdd89 100644 --- a/server/core/gateway.cc +++ b/server/core/gateway.cc @@ -60,7 +60,6 @@ #include #include #include -#include #include #include #include @@ -2049,7 +2048,6 @@ int maxscale_shutdown() service_shutdown(); poll_shutdown(); hkshutdown(); - memlog_flush_all(); log_flush_shutdown(); } diff --git a/server/core/memlog.c b/server/core/memlog.c deleted file mode 100644 index a22cd36d5..000000000 --- a/server/core/memlog.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (c) 2016 MariaDB Corporation Ab - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file and at www.mariadb.com/bsl. - * - * Change Date: 2019-07-01 - * - * On the date above, in accordance with the Business Source License, use - * of this software will be governed by version 2 or later of the General - * Public License. - */ - -/** - * @file memlog.c - Implementation of memory logging mechanism for debug purposes - * - * @verbatim - * Revision History - * - * Date Who Description - * 26/09/14 Mark Riddoch Initial implementation - * - * @endverbatim - */ -#include -#include -#include -#include -#include -#include -#include - -static MEMLOG *memlogs = NULL; -static SPINLOCK memlock = SPINLOCK_INIT; - -/** - * Create a new instance of a memory logger. - * - * @param name The name of the memory log - * @param type The type of item being logged - * @param size The number of items to store in memory before flushign to disk - * - * @return MEMLOG* A memory log handle - */ -MEMLOG * -memlog_create(char *name, MEMLOGTYPE type, int size) -{ - name = MXS_STRDUP(name); - - MEMLOG *log = (MEMLOG *)MXS_MALLOC(sizeof(MEMLOG)); - - if (!name || !log) - { - MXS_FREE(name); - MXS_FREE(log); - return NULL; - } - - log->name = name; - spinlock_init(&log->lock); - log->type = type; - log->offset = 0; - log->size = size; - log->flags = 0; - switch (type) - { - case ML_INT: - log->values = MXS_MALLOC(sizeof(int) * size); - break; - case ML_LONG: - log->values = MXS_MALLOC(sizeof(long) * size); - break; - case ML_LONGLONG: - log->values = MXS_MALLOC(sizeof(long long) * size); - break; - case ML_STRING: - log->values = MXS_MALLOC(sizeof(char *) * size); - break; - } - if (log->values == NULL) - { - MXS_FREE(name); - MXS_FREE(log); - return NULL; - } - spinlock_acquire(&memlock); - log->next = memlogs; - memlogs = log; - spinlock_release(&memlock); - - return log; -} - -/** - * Destroy a memory logger any unwritten data will be flushed to disk - * - * @param log The memory log to destroy - */ -void -memlog_destroy(MEMLOG *log) -{ - MEMLOG *ptr; - - if ((log->flags & MLNOAUTOFLUSH) == 0) - { - memlog_flush(log); - } - MXS_FREE(log->values); - - spinlock_acquire(&memlock); - if (memlogs == log) - { - memlogs = log->next; - } - else - { - ptr = memlogs; - while (ptr && ptr->next != log) - { - ptr = ptr->next; - } - if (ptr) - { - ptr->next = log->next; - } - } - spinlock_release(&memlock); - MXS_FREE(log->name); - MXS_FREE(log); -} - -/** - * Log a data item to the memory logger - * - * @param log The memory logger - * @param value The value to log - */ -void -memlog_log(MEMLOG *log, void *value) -{ - if (!log) - { - return; - } - spinlock_acquire(&log->lock); - switch (log->type) - { - case ML_INT: - ((int *)(log->values))[log->offset] = (intptr_t)value; - break; - case ML_LONG: - ((long *)(log->values))[log->offset] = (long)value; - break; - case ML_LONGLONG: - ((long long *)(log->values))[log->offset] = (long long)value; - break; - case ML_STRING: - ((char **)(log->values))[log->offset] = (char *)value; - break; - } - log->offset++; - if (log->offset == log->size) - { - if ((log->flags & MLNOAUTOFLUSH) == 0) - { - memlog_flush(log); - } - log->offset = 0; - log->iflags = MLWRAPPED; - } - spinlock_release(&log->lock); -} - -/** - * Flush all memlogs to disk, called during shutdown - * - */ -void -memlog_flush_all() -{ - MEMLOG *log; - - spinlock_acquire(&memlock); - log = memlogs; - while (log) - { - spinlock_acquire(&log->lock); - memlog_flush(log); - spinlock_release(&log->lock); - log = log->next; - } - spinlock_release(&memlock); -} - -/** - * Set the flags for a memlog - * - * @param log The memlog to set the flags for - * @param flags The new flags values - */ -void -memlog_set(MEMLOG *log, unsigned int flags) -{ - log->flags = flags; -} - -/** - * Flush a memory log to disk - * - * Assumes the the log->lock has been acquired by the caller - * - * @param log The memory log to flush - */ -void -memlog_flush(MEMLOG *log) -{ - FILE *fp; - int i; - - if ((fp = fopen(log->name, "a")) == NULL) - { - return; - } - if ((log->flags & MLNOAUTOFLUSH) && (log->iflags & MLWRAPPED)) - { - for (i = 0; i < log->size; i++) - { - int ind = (i + log->offset) % log->size; - switch (log->type) - { - case ML_INT: - fprintf(fp, "%d\n", - ((int *)(log->values))[ind]); - break; - case ML_LONG: - fprintf(fp, "%ld\n", - ((long *)(log->values))[ind]); - break; - case ML_LONGLONG: - fprintf(fp, "%lld\n", - ((long long *)(log->values))[ind]); - break; - case ML_STRING: - fprintf(fp, "%s\n", - ((char **)(log->values))[ind]); - break; - } - } - } - else - { - for (i = 0; i < log->offset; i++) - { - switch (log->type) - { - case ML_INT: - fprintf(fp, "%d\n", ((int *)(log->values))[i]); - break; - case ML_LONG: - fprintf(fp, "%ld\n", ((long *)(log->values))[i]); - break; - case ML_LONGLONG: - fprintf(fp, "%lld\n", ((long long *)(log->values))[i]); - break; - case ML_STRING: - fprintf(fp, "%s\n", ((char **)(log->values))[i]); - break; - } - } - } - log->offset = 0; - fclose(fp); -} diff --git a/server/core/poll.c b/server/core/poll.c index a84ad8f6c..2ffe8f96f 100644 --- a/server/core/poll.c +++ b/server/core/poll.c @@ -44,11 +44,7 @@ #define PROFILE_POLL 0 #if PROFILE_POLL -#include -#include - extern unsigned long hkheartbeat; -MEMLOG *plog; #endif int number_poll_spins; @@ -320,10 +316,6 @@ poll_init() number_poll_spins = config_nbpolls(); max_poll_sleep = config_pollsleep(); - -#if PROFILE_POLL - plog = memlog_create("EventQueueWaitTime", ML_LONG, 10000); -#endif } int poll_add_dcb(DCB *dcb) @@ -909,9 +901,6 @@ process_pollq(int thread_id, struct epoll_event *event) uint32_t ev = event->events; DCB *dcb = event->data.ptr; ss_dassert(dcb->thread.id == thread_id || dcb->dcb_role == DCB_ROLE_SERVICE_LISTENER); -#if PROFILE_POLL - memlog_log(plog, hkheartbeat - dcb->evq.inserted); -#endif /** Calculate event queue statistics */ uint64_t started = hkheartbeat; diff --git a/server/core/test/CMakeLists.txt b/server/core/test/CMakeLists.txt index 99be06bae..2c873ba4a 100644 --- a/server/core/test/CMakeLists.txt +++ b/server/core/test/CMakeLists.txt @@ -16,7 +16,6 @@ add_executable(test_spinlock testspinlock.c) add_executable(test_users testusers.c) add_executable(testfeedback testfeedback.c) add_executable(testmaxscalepcre2 testmaxscalepcre2.c) -add_executable(testmemlog testmemlog.c) add_executable(testmodulecmd testmodulecmd.c) add_executable(testconfig testconfig.c) target_link_libraries(test_adminusers maxscale-common) @@ -37,7 +36,6 @@ target_link_libraries(test_spinlock maxscale-common) target_link_libraries(test_users maxscale-common) target_link_libraries(testfeedback maxscale-common) target_link_libraries(testmaxscalepcre2 maxscale-common) -target_link_libraries(testmemlog maxscale-common) target_link_libraries(testmodulecmd maxscale-common) target_link_libraries(testconfig maxscale-common) add_test(TestAdminUsers test_adminusers) @@ -50,7 +48,6 @@ add_test(TestLog test_log) add_test(NAME TestLogOrder COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/logorder.sh 200 0 1000 ${CMAKE_CURRENT_BINARY_DIR}/logorder.log) add_test(TestLogThrottling test_logthrottling) add_test(TestMaxScalePCRE2 testmaxscalepcre2) -add_test(TestMemlog testmemlog) add_test(TestModutil test_modutil) add_test(NAME TestMaxPasswd COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testmaxpasswd.sh) add_test(TestPoll test_poll) diff --git a/server/core/test/testmemlog.c b/server/core/test/testmemlog.c deleted file mode 100644 index d37d0064d..000000000 --- a/server/core/test/testmemlog.c +++ /dev/null @@ -1,503 +0,0 @@ -/* - * Copyright (c) 2016 MariaDB Corporation Ab - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file and at www.mariadb.com/bsl. - * - * Change Date: 2019-07-01 - * - * On the date above, in accordance with the Business Source License, use - * of this software will be governed by version 2 or later of the General - * Public License. - */ - -/** - * - * @verbatim - * Revision History - * - * Date Who Description - * 30/09/2014 Mark Riddoch Initial implementation - * - * @endverbatim - */ - -// To ensure that ss_info_assert asserts also when builing in non-debug mode. -#if !defined(SS_DEBUG) -#define SS_DEBUG -#endif -#if defined(NDEBUG) -#undef NDEBUG -#endif -#include -#include -#include -#include -#include - -/** - * Count the number of lines in a file - * - * @param file The name of the file - * @return -1 if the file could not be opened or the numebr of lines - */ -int -linecount(char *file) -{ - FILE *fp; - int i = 0; - char buffer[180]; - - if ((fp = fopen(file, "r")) == NULL) - { - return -1; - } - while (fgets(buffer, 180, fp) != NULL) - { - i++; - } - fclose(fp); - return i; -} - -/* Some strings to log */ -char *strings[] = -{ - "First log entry", - "Second entry", - "Third", - "The fourth thing to log", - "Add a final 5th item" -}; - -int -main() -{ - MEMLOG *log, *log2; - long int i; - long j; - long long k; - int failures = 0; - - unlink("memlog1"); - if ((log = memlog_create("memlog1", ML_INT, 100)) == NULL) - { - printf("Memlog Creation: Failed\n"); - failures++; - } - else - { - printf("Memlog Creation: Passed\n"); - if (access("memlog1", R_OK) == 0) - { - printf("File existance 1: Failed\n"); - failures++; - } - else - { - printf("File existance 1: Passed\n"); - } - for (i = 0; i < 50; i++) - { - memlog_log(log, (void *)i); - } - if (access("memlog1", R_OK) == 0) - { - printf("File existance 2: Failed\n"); - failures++; - } - else - { - printf("File existance 2: Passed\n"); - } - for (i = 0; i < 50; i++) - { - memlog_log(log, (void *)i); - } - if (access("memlog1", R_OK) != 0) - { - printf("File existance 3: Failed\n"); - failures++; - } - else - { - printf("File existance 3: Passed\n"); - } - if (linecount("memlog1") != 100) - { - printf("Incorrect entry count: Failed\n"); - failures++; - } - else - { - printf("Incorrect entry count: Passed\n"); - } - for (i = 0; i < 50; i++) - { - memlog_log(log, (void *)i); - } - if (linecount("memlog1") != 100) - { - printf("Premature Flushing: Failed\n"); - failures++; - } - else - { - printf("Premature Flushing: Passed\n"); - } - memlog_destroy(log); - if (linecount("memlog1") != 150) - { - printf("Flush on destroy: Failed\n"); - failures++; - } - else - { - printf("Flush on destroy: Passed\n"); - } - } - - unlink("memlog2"); - if ((log = memlog_create("memlog2", ML_LONG, 100)) == NULL) - { - printf("Memlog Creation: Failed\n"); - failures++; - } - else - { - printf("Memlog Creation: Passed\n"); - if (access("memlog2", R_OK) == 0) - { - printf("File existance 1: Failed\n"); - failures++; - } - else - { - printf("File existance 1: Passed\n"); - } - for (j = 0; j < 50; j++) - { - memlog_log(log, (void *)j); - } - if (access("memlog2", R_OK) == 0) - { - printf("File existance 2: Failed\n"); - failures++; - } - else - { - printf("File existance 2: Passed\n"); - } - for (j = 0; j < 50; j++) - { - memlog_log(log, (void *)j); - } - if (access("memlog2", R_OK) != 0) - { - printf("File existance 3: Failed\n"); - failures++; - } - else - { - printf("File existance 3: Passed\n"); - } - if (linecount("memlog2") != 100) - { - printf("Incorrect entry count: Failed\n"); - failures++; - } - else - { - printf("Incorrect entry count: Passed\n"); - } - for (j = 0; j < 50; j++) - { - memlog_log(log, (void *)j); - } - if (linecount("memlog2") != 100) - { - printf("Premature Flushing: Failed\n"); - failures++; - } - else - { - printf("Premature Flushing: Passed\n"); - } - memlog_destroy(log); - if (linecount("memlog2") != 150) - { - printf("Flush on destroy: Failed\n"); - failures++; - } - else - { - printf("Flush on destroy: Passed\n"); - } - } - - unlink("memlog3"); - if ((log = memlog_create("memlog3", ML_LONGLONG, 100)) == NULL) - { - printf("Memlog Creation: Failed\n"); - failures++; - } - else - { - printf("Memlog Creation: Passed\n"); - if (access("memlog3", R_OK) == 0) - { - printf("File existance 1: Failed\n"); - failures++; - } - else - { - printf("File existance 1: Passed\n"); - } - for (k = 0; k < 50; k++) - { - memlog_log(log, (void *)k); - } - if (access("memlog3", R_OK) == 0) - { - printf("File existance 2: Failed\n"); - failures++; - } - else - { - printf("File existance 2: Passed\n"); - } - for (k = 0; k < 50; k++) - { - memlog_log(log, (void *)k); - } - if (access("memlog3", R_OK) != 0) - { - printf("File existance 3: Failed\n"); - failures++; - } - else - { - printf("File existance 3: Passed\n"); - } - if (linecount("memlog3") != 100) - { - printf("Incorrect entry count: Failed\n"); - failures++; - } - else - { - printf("Incorrect entry count: Passed\n"); - } - for (k = 0; k < 50; k++) - { - memlog_log(log, (void *)k); - } - if (linecount("memlog3") != 100) - { - printf("Premature Flushing: Failed\n"); - failures++; - } - else - { - printf("Premature Flushing: Passed\n"); - } - memlog_destroy(log); - if (linecount("memlog3") != 150) - { - printf("Flush on destroy: Failed\n"); - failures++; - } - else - { - printf("Flush on destroy: Passed\n"); - } - } - - unlink("memlog4"); - if ((log = memlog_create("memlog4", ML_STRING, 100)) == NULL) - { - printf("Memlog Creation: Failed\n"); - failures++; - } - else - { - printf("Memlog Creation: Passed\n"); - if (access("memlog4", R_OK) == 0) - { - printf("File existance 1: Failed\n"); - failures++; - } - else - { - printf("File existance 1: Passed\n"); - } - for (i = 0; i < 50; i++) - { - memlog_log(log, strings[i % 5]); - } - if (access("memlog4", R_OK) == 0) - { - printf("File existance 2: Failed\n"); - failures++; - } - else - { - printf("File existance 2: Passed\n"); - } - for (i = 0; i < 50; i++) - { - memlog_log(log, strings[i % 5]); - } - if (access("memlog4", R_OK) != 0) - { - printf("File existance 3: Failed\n"); - failures++; - } - else - { - printf("File existance 3: Passed\n"); - } - if (linecount("memlog4") != 100) - { - printf("Incorrect entry count: Failed\n"); - failures++; - } - else - { - printf("Incorrect entry count: Passed\n"); - } - for (i = 0; i < 50; i++) - { - memlog_log(log, strings[i % 5]); - } - if (linecount("memlog4") != 100) - { - printf("Premature Flushing: Failed\n"); - failures++; - } - else - { - printf("Premature Flushing: Passed\n"); - } - memlog_destroy(log); - if (linecount("memlog4") != 150) - { - printf("Flush on destroy: Failed\n"); - failures++; - } - else - { - printf("Flush on destroy: Passed\n"); - } - } - - unlink("memlog5"); - unlink("memlog6"); - if ((log = memlog_create("memlog5", ML_INT, 100)) == NULL) - { - printf("Memlog Creation: Failed\n"); - failures++; - } - else - { - printf("Memlog Creation: Passed\n"); - if ((log2 = memlog_create("memlog6", ML_INT, 100)) == NULL) - { - printf("Memlog Creation: Failed\n"); - failures++; - } - else - { - printf("Memlog Creation: Passed\n"); - for (i = 0; i < 40; i++) - { - memlog_log(log, (void *)i); - } - for (i = 0; i < 30; i++) - { - memlog_log(log2, (void *)i); - } - memlog_flush_all(); - if (linecount("memlog5") != 40 || - linecount("memlog6") != 30) - { - printf( - "Memlog flush all: Failed\n"); - failures++; - } - else - printf( - "Memlog flush all: Passed\n"); - } - } - - unlink("memlog7"); - if ((log = memlog_create("memlog7", ML_INT, 100)) == NULL) - { - printf("Memlog Creation: Failed\n"); - failures++; - } - else - { - printf("Memlog Creation: Passed\n"); - if (access("memlog7", R_OK) == 0) - { - printf("File existance 1: Failed\n"); - failures++; - } - else - { - printf("File existance 1: Passed\n"); - } - for (i = 0; i < 5050; i++) - { - memlog_log(log, (void *)i); - } - if (access("memlog7", R_OK) != 0) - { - printf("File existance 3: Failed\n"); - failures++; - } - else - { - printf("File existance 3: Passed\n"); - } - if (linecount("memlog7") != 5000) - { - printf("Incorrect entry count: Failed\n"); - failures++; - } - else - { - printf("Incorrect entry count: Passed\n"); - } - for (i = 0; i < 50; i++) - { - memlog_log(log, (void *)i); - } - if (linecount("memlog7") != 5100) - { - printf("Residual flushing: Failed\n"); - failures++; - } - else - { - printf("Premature Flushing: Passed\n"); - } - for (i = 0; i < 10120; i++) - { - memlog_log(log, (void *)i); - } - memlog_destroy(log); - if (linecount("memlog7") != 15220) - { - printf("Flush on destroy: Failed\n"); - failures++; - } - else - { - printf("Flush on destroy: Passed\n"); - } - } - exit(failures); -} diff --git a/server/modules/routing/binlogrouter/blr.h b/server/modules/routing/binlogrouter/blr.h index 630247fb9..dbe98d61a 100644 --- a/server/modules/routing/binlogrouter/blr.h +++ b/server/modules/routing/binlogrouter/blr.h @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include diff --git a/server/modules/routing/binlogrouter/blr_master.c b/server/modules/routing/binlogrouter/blr_master.c index cfa09f5c6..ae6fa24e0 100644 --- a/server/modules/routing/binlogrouter/blr_master.c +++ b/server/modules/routing/binlogrouter/blr_master.c @@ -76,7 +76,6 @@ #include -#include #include /* Temporary requirement for auth data */