MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:lars-erik.bjork Date:October 7 2008 8:03am
Subject:bzr commit into mysql-6.0-falcon-team branch (lars-erik.bjork:2859) Bug#39647
View as plain text  
#At file:///home/lb200670/devel/mysql/checkin/

 2859 lars-erik.bjork@stripped	2008-10-07
      This is a fix for bug#39647 (Warning about slow serial log writes should be prefixed with time stamp)
      
      This fix prefixes time stamps on all messages sent through the interface provided by the Log class. StorageInterface::logger is registered as a receiver of the log, and 
      all messages received are prefixed before being printed. This ensures that other future/historic receivers of the log are not forced to have the Falcon specific time 
      stamp. The time stamps are on the format YYMMDD (h)h:mm:ss, to be in line with the time stamps printed by the server and by InnoDB.
      
      Also added new Copyright notice (added ", 2008 Sun Microsystems, Inc.")
modified:
  storage/falcon/ha_falcon.cpp

=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp	2008-10-03 05:15:40 +0000
+++ b/storage/falcon/ha_falcon.cpp	2008-10-07 08:03:00 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006, 2007 MySQL AB
+/* Copyright (C) 2006, 2007 MySQL AB, 2008 Sun Microsystems, 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
@@ -19,6 +19,8 @@
 #define MYSQL_SERVER
 #endif
 
+#include <time.h>
+
 #include "mysql_priv.h"
 #include "falcon_probes.h"
 
@@ -173,6 +175,38 @@ bool checkExceptionSupport()
 	return false;
 }
 
+void getTimestamp(int length, char* buffer)
+{
+#ifdef __WIN__
+	SYSTEMTIME now;
+	GetLocalTime(&now);
+	snprintf(buffer, length, "%.2d%.2d%.2d %2d:%.2d:%.2d",
+			 (int)now.wYear % 100,
+			 (int)now.wMonth,
+			 (int)now.wDay,
+			 (int)now.wHour,
+			 (int)now.wMinute,
+			 (int)now.wSecond);
+#else
+	struct tm result;
+	time_t now;
+	time(&now);
+#ifdef HAVE_LOCALTIME_R
+	struct tm* time_ptr = localtime_r(&now, &result);
+#else
+	struct tm* time_ptr = localtime(&now);
+	result = *time_ptr;
+#endif
+	snprintf(buffer, length, "%.2d%.2d%.2d %2d:%.2d:%.2d",
+			 (int)result.tm_year % 100,
+			 (int)result.tm_mon + 1,
+			 (int)result.tm_mday,
+			 (int)result.tm_hour,
+			 (int)result.tm_min,
+			 (int)result.tm_sec);
+#endif
+}
+
 int StorageInterface::falcon_init(void *p)
 {
 	DBUG_ENTER("falcon_init");
@@ -2358,12 +2392,14 @@ void StorageInterface::logger(int mask, 
 {
 	if (mask & falcon_debug_mask)
 		{
-		printf("%s", text);
+		char time[256];
+		getTimestamp(sizeof(time), time);
+		printf("%s Falcon: %s", time, text);
 		fflush(stdout);
 
 		if (falcon_log_file)
 			{
-			fprintf(falcon_log_file, "%s", text);
+			fprintf(falcon_log_file, "%s Falcon: %s", time, text);
 			fflush(falcon_log_file);
 			}
 		}

Thread
bzr commit into mysql-6.0-falcon-team branch (lars-erik.bjork:2859) Bug#39647lars-erik.bjork7 Oct