~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/cslib/CSSys.h

[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:
1
 
/* Copyright (c) 2010 PrimeBase Technologies GmbH, Germany
2
 
 *
3
 
 * PrimeBase Media Stream for MySQL
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License as published by
7
 
 * the Free Software Foundation; either version 2 of the License, or
8
 
 * (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
 
 *
19
 
 * Author: Barry Leslie
20
 
 *
21
 
 * 2010-02-05
22
 
 *
23
 
 * CORE SYSTEM:
24
 
 * Basic system specific file I/O classes.
25
 
 * The classes in this header are defined in CSSys_unix.cc and  CSSys_win.cc
26
 
 *
27
 
 */
28
 
 
29
 
#ifndef __CSSYSFILE_H__
30
 
#define __CSSYSFILE_H__
31
 
 
32
 
#ifdef OS_WINDOWS
33
 
#define INVALID_DIR_HANDLE (INVALID_HANDLE_VALUE)
34
 
#define INVALID_FILE_HANDLE (INVALID_HANDLE_VALUE)
35
 
#else
36
 
#include <dirent.h>
37
 
#define INVALID_DIR_HANDLE (NULL)
38
 
#define INVALID_FILE_HANDLE (-1)
39
 
#endif
40
 
 
41
 
#include "CSString.h"
42
 
#include "CSException.h"
43
 
#include "CSTime.h"
44
 
 
45
 
class CSSysDir {
46
 
public:
47
 
        CSSysDir(): 
48
 
                sd_path(NULL),
49
 
                sd_filter(NULL),
50
 
                sd_dir(INVALID_DIR_HANDLE){}
51
 
        
52
 
        ~CSSysDir();
53
 
        
54
 
        void open();
55
 
        void close();
56
 
        bool next();
57
 
 
58
 
        bool entryIsFile();
59
 
        const char *entryName();
60
 
        void getEntryPath(char *path, size_t size);
61
 
        
62
 
        CSString *sd_path;
63
 
        
64
 
private:
65
 
        CSStringBuffer *sd_filter;
66
 
#ifdef OS_WINDOWS
67
 
        WIN32_FIND_DATAA sd_entry;
68
 
        HANDLE sd_dir;
69
 
#else
70
 
        struct dirent sd_entry;
71
 
        DIR *sd_dir;
72
 
#endif
73
 
};
74
 
 
75
 
 
76
 
class CSSysFile {
77
 
public:
78
 
 
79
 
        static bool isDirNotFound(CSException *e);
80
 
        static bool isFileNotFound(CSException *e);
81
 
        static bool isDirExists(CSException *e);
82
 
 
83
 
CSSysFile(): sf_path(NULL), sf_fh(INVALID_FILE_HANDLE){}
84
 
 
85
 
        ~CSSysFile(){ sf_close();}
86
 
        
87
 
        bool fs_isOpen() { return ( sf_fh != INVALID_FILE_HANDLE);}
88
 
        
89
 
        void sf_open(const char *path, bool readonly, bool create);
90
 
        void sf_close();
91
 
        
92
 
        size_t sf_pread(void *data, size_t size, off64_t offset);
93
 
        void sf_pwrite(const void *data, size_t size, off64_t offset);
94
 
        
95
 
        off64_t sf_getEOF();
96
 
        void sf_setEOF(off64_t offset);
97
 
        
98
 
        void sf_sync();
99
 
        
100
 
        void sf_lock(bool shared);
101
 
        void sf_unlock();
102
 
        
103
 
private:
104
 
        CSString *sf_path;
105
 
#ifdef OS_WINDOWS
106
 
        HANDLE  sf_fh;
107
 
#else
108
 
        int             sf_fh;
109
 
#endif
110
 
        
111
 
};
112
 
 
113
 
class CSSys {
114
 
        public:
115
 
        static bool sys_exists(const char *path);
116
 
        static void sys_makeDir(const char *path);
117
 
        static void sys_removeDir(const char *path);
118
 
        static void sys_removeFile(const char *path);
119
 
        static void sys_rename(const char *old_path, const char *new_path);
120
 
        static void sys_stat(const char *path, bool *is_dir, off64_t *size, CSTime *mod_time);
121
 
        static bool sys_isLink(const char *path);
122
 
        static void sys_getcwd(char *path, size_t size);
123
 
        static void sys_setcwd(const char *path);
124
 
        static uint32_t sys_getpid();
125
 
        static bool sys_isAlive(uint32_t pid);
126
 
};
127
 
 
128
 
#endif