~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/null_client.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:
21
21
#define DRIZZLED_PLUGIN_NULL_CLIENT_H
22
22
 
23
23
#include <drizzled/plugin/client.h>
24
 
#include<boost/tokenizer.hpp>
25
 
#include <vector>
26
 
#include <queue>
27
 
#include <string>
28
24
 
29
25
namespace drizzled
30
26
{
36
32
 */
37
33
class NullClient: public Client
38
34
{
39
 
  typedef std::vector<char> Bytes;
40
 
  typedef std::queue <Bytes> Queue;
41
 
  Queue to_execute;
42
 
  bool is_dead;
43
 
  Bytes packet_buffer;
44
 
 
45
35
public:
46
 
 
47
 
  NullClient() :
48
 
    is_dead(false)
49
 
  {
50
 
  }
51
 
 
52
36
  virtual int getFileDescriptor(void) { return -1; }
53
37
  virtual bool isConnected(void) { return true; }
54
38
  virtual bool isReading(void) { return false; }
56
40
  virtual bool flush(void) { return false; }
57
41
  virtual void close(void) {}
58
42
  virtual bool authenticate(void) { return true; }
59
 
 
60
 
  virtual bool readCommand(char **packet, uint32_t *packet_length)
61
 
  {
62
 
    while(not to_execute.empty())
63
 
    {
64
 
      Queue::value_type next= to_execute.front();
65
 
      packet_buffer.resize(next.size());
66
 
      memcpy(&packet_buffer[0], &next[0], next.size());
67
 
 
68
 
      *packet= &packet_buffer[0];
69
 
 
70
 
      *packet_length= next.size();
71
 
 
72
 
      to_execute.pop();
73
 
 
74
 
      return true;
75
 
    }
76
 
 
77
 
    if (not is_dead)
78
 
    {
79
 
      packet_buffer.resize(1);
80
 
      *packet_length= 1;
81
 
      *packet= &packet_buffer[0];
82
 
      is_dead= true;
83
 
 
84
 
      return true;
85
 
    }
86
 
 
87
 
    *packet_length= 0;
88
 
    return false;
89
 
  }
90
 
 
 
43
  virtual bool readCommand(char**, uint32_t*) { return false; }
91
44
  virtual void sendOK(void) {}
92
45
  virtual void sendEOF(void) {}
93
46
  virtual void sendError(uint32_t, const char*) {}
103
56
  virtual bool store(const char*) { return false; }
104
57
  virtual bool store(const char*, size_t) { return false; }
105
58
  virtual bool store(const std::string &) { return false; }
106
 
  virtual bool haveMoreData(void) { return false;}
 
59
  virtual bool haveMoreData(void) { return false; }
107
60
  virtual bool haveError(void) { return false; }
108
61
  virtual bool wasAborted(void) { return false; }
109
 
 
110
 
  void pushSQL(const std::string &arg)
111
 
  {
112
 
    Bytes byte;
113
 
    typedef boost::tokenizer<boost::escaped_list_separator<char> > Tokenizer;
114
 
    Tokenizer tok(arg, boost::escaped_list_separator<char>("\\", ";", "\""));
115
 
 
116
 
    for (Tokenizer::iterator iter= tok.begin(); iter != tok.end(); ++iter)
117
 
    {
118
 
      byte.resize((*iter).size() +1); // +1 for the COM_QUERY
119
 
      byte[0]= COM_QUERY;
120
 
      memcpy(&byte[1], (*iter).c_str(), (*iter).size());
121
 
      to_execute.push(byte);
122
 
    }
123
 
  }
124
62
};
125
63
 
126
64
} /* namespace plugin */