~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/cslib/CSLog.cc

[patch 109/129] Merge patch for revision 1921 from InnoDB SVN:
revno: 1921
revision-id: svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6160
parent: svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6159
committer: vasil
timestamp: Wed 2009-11-11 13:33:49 +0000
message:
  branches/zip: Merge r6152:6159 from branches/5.1:
  
  (r6158 was skipped as an equivallent change has already been merged from MySQL)
  
    ------------------------------------------------------------------------
    r6154 | calvin | 2009-11-11 02:51:17 +0200 (Wed, 11 Nov 2009) | 17 lines
    Changed paths:
       M /branches/5.1/include/os0file.h
       M /branches/5.1/os/os0file.c
    
    branches/5.1: fix bug#3139: Mysql crashes: 'windows error 995'
    after several selects on a large DB
    
    During stress environment, Windows AIO may fail with error code
    ERROR_OPERATION_ABORTED. InnoDB does not handle the error, rather
    crashes. The cause of the error is unknown, but likely due to
    faulty hardware or driver.
    
    This patch introduces a new error code OS_FILE_OPERATION_ABORTED,
    which maps to Windows ERROR_OPERATION_ABORTED (995). When the error
    is detected during AIO, the InnoDB will issue a synchronous retry
    (read/write).
    
    This patch has been extensively tested by MySQL support.
    
    Approved by: Marko
    rb://196
    ------------------------------------------------------------------------
    r6158 | vasil | 2009-11-11 14:52:14 +0200 (Wed, 11 Nov 2009) | 37 lines
    Changed paths:
       M /branches/5.1/handler/ha_innodb.cc
       M /branches/5.1/handler/ha_innodb.h
    
    branches/5.1:
    
    Merge a change from MySQL:
    (this has been reviewed by Calvin and Marko, and Calvin says Luis has
    incorporated Marko's suggestions)
    
      ------------------------------------------------------------
      revno: 3092.5.1
      committer: Luis Soares <luis.soares@sun.com>
      branch nick: mysql-5.1-bugteam
      timestamp: Thu 2009-09-24 15:52:52 +0100
      message:
        BUG#42829: binlogging enabled for all schemas regardless of
        binlog-db-db / binlog-ignore-db
              
        InnoDB will return an error if statement based replication is used
        along with transaction isolation level READ-COMMITTED (or weaker),
        even if the statement in question is filtered out according to the
        binlog-do-db rules set. In this case, an error should not be printed.
              
        This patch addresses this issue by extending the existing check in
        external_lock to take into account the filter rules before deciding to
        print an error. Furthermore, it also changes decide_logging_format to
        take into consideration whether the statement is filtered out from 
        binlog before decision is made.
      added:
        mysql-test/suite/binlog/r/binlog_stm_do_db.result
        mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt
        mysql-test/suite/binlog/t/binlog_stm_do_db.test
      modified:
        sql/sql_base.cc
        sql/sql_class.cc
        storage/innobase/handler/ha_innodb.cc
        storage/innobase/handler/ha_innodb.h
        storage/innodb_plugin/handler/ha_innodb.cc
        storage/innodb_plugin/handler/ha_innodb.h
    
    ------------------------------------------------------------------------
modified:
  include/os0file.h              2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fos0file.h
  os/os0file.c                   2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fos%2Fos0file.c
diff:
=== modified file 'include/os0file.h'

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
#include <string.h>
31
31
#include <time.h>
32
 
#include <stdarg.h>
33
 
#include <stdio.h>
34
 
#include <stdlib.h>
35
32
 
36
33
#include "CSLog.h"
37
34
#include "CSMemory.h"
39
36
#include "CSStrUtil.h"
40
37
#include "CSThread.h"
41
38
#include "CSGlobal.h"
42
 
 
43
 
 
44
 
//#ifdef DEBUG
45
 
//#define DEFAULT_LOG_BUFFER_SIZE                       10
46
 
//#else
47
 
#define DEFAULT_LOG_BUFFER_SIZE                 2000
48
 
//#endif
49
 
 
50
39
/*
51
40
 * The global logging object.
52
41
 */
171
160
        unlock();
172
161
}
173
162
 
174
 
void CSLog::log_va(CSThread *self, int level, const char *func, const char *file, int line, const char *fmt, va_list ap)
175
 
{
176
 
        char buffer[DEFAULT_LOG_BUFFER_SIZE];
177
 
        char *log_string = NULL;
178
 
 
179
 
        lock();
180
 
 
181
 
#if !defined(va_copy) || defined(OS_SOLARIS)
182
 
        int len;
183
 
 
184
 
        len = vsnprintf(buffer, DEFAULT_LOG_BUFFER_SIZE-1, fmt, ap);
185
 
        if (len > DEFAULT_LOG_BUFFER_SIZE-1)
186
 
                len = DEFAULT_LOG_BUFFER_SIZE-1;
187
 
        buffer[len] = 0;
188
 
        log_string = buffer;
189
 
#else
190
 
        /* Use the buffer, unless it is too small */
191
 
        va_list ap2;
192
 
 
193
 
        va_copy(ap2, ap);
194
 
        if (vsnprintf(buffer, DEFAULT_LOG_BUFFER_SIZE, fmt, ap) >= DEFAULT_LOG_BUFFER_SIZE) {
195
 
                if (vasprintf(&log_string, fmt, ap2) == -1)
196
 
                        log_string = NULL;
197
 
        }
198
 
        else
199
 
                log_string = buffer;
200
 
#endif
201
 
 
202
 
        if (log_string) {
203
 
                log(self, func, file, line, level, log_string);
204
 
 
205
 
                if (log_string != buffer)
206
 
                        free(log_string);
207
 
        }
208
 
 
209
 
        unlock();
210
 
}
211
 
 
212
 
void CSLog::logf(CSThread *self, int level, const char *fmt, ...)
213
 
{
214
 
        va_list ap;
215
 
 
216
 
        va_start(ap, fmt);
217
 
        log_va(self, level, NULL, NULL, 0, fmt, ap);
218
 
        va_end(ap);
219
 
}
220
 
 
221
 
void CSLog::logf(CSThread *self, int level, const char *func, const char *file, int line, const char *fmt, ...)
222
 
{
223
 
        va_list ap;
224
 
 
225
 
        va_start(ap, fmt);
226
 
        log_va(self, level, func, file, line, fmt, ap);
227
 
        va_end(ap);
228
 
}
 
163
 
229
164