~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message.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:
22
22
 
23
23
#include <drizzled/show.h>
24
24
#include <drizzled/session.h>
 
25
#include <drizzled/statement/create_schema.h>
25
26
#include <drizzled/db.h>
26
27
#include <drizzled/plugin/event_observer.h>
27
28
#include <drizzled/message.h>
28
29
 
29
30
#include "drizzled/message/table.pb.h"
30
31
#include "drizzled/message/schema.pb.h"
31
 
 
32
 
#include <string>
33
32
#include <uuid/uuid.h>
34
33
 
35
34
namespace drizzled {
36
35
namespace message {
37
36
 
38
 
static const std::string PROGRAM_ERROR("PROGRAM_ERROR");
39
 
 
40
 
// These are used to generate strings for types
41
 
static const std::string VARCHAR("VARCHAR");
42
 
static const std::string DOUBLE("DOUBLE");
43
 
static const std::string BLOB("BLOB");
44
 
static const std::string ENUM("ENUM");
45
 
static const std::string INTEGER("INTEGER");
46
 
static const std::string BIGINT("BIGINT");
47
 
static const std::string DECIMAL("DECIMAL");
48
 
static const std::string DATE("DATE");
49
 
static const std::string TIMESTAMP("TIMESTAMP");
50
 
static const std::string DATETIME("DATETIME");
51
 
static const std::string UUID("UUID");
52
 
 
53
 
static const std::string UNDEFINED("UNDEFINED");
54
 
static const std::string RESTRICT("RESTRICT");
55
 
static const std::string CASCADE("CASCADE");
56
 
static const std::string SET_NULL("SET NULL");
57
 
static const std::string NO_ACTION("NO ACTION");
58
 
static const std::string SET_DEFAULT("SET DEFAULT");
59
 
 
60
 
static const std::string YES("YES");
61
 
static const std::string NO("NO");
62
 
 
63
 
static const std::string UNKNOWN_INDEX("UNKNOWN_INDEX");
64
 
static const std::string BTREE("BTREE");
65
 
static const std::string RTREE("RTREE");
66
 
static const std::string HASH("HASH");
67
 
static const std::string FULLTEXT("FULLTEXT");
68
 
 
69
 
static const std::string MATCH_FULL("FULL");
70
 
static const std::string MATCH_PARTIAL("PARTIAL");
71
 
static const std::string MATCH_SIMPLE("SIMPLE");
72
 
 
73
37
void init(drizzled::message::Table &arg, const std::string &name_arg, const std::string &schema_arg, const std::string &engine_arg)
74
38
{
75
39
  arg.set_name(name_arg);
119
83
  arg.set_update_timestamp(time(NULL));
120
84
}
121
85
 
122
 
const std::string &type(drizzled::message::Table::Field::FieldType type)
123
 
{
124
 
  switch (type)
125
 
  {
126
 
  case message::Table::Field::VARCHAR:
127
 
    return VARCHAR;
128
 
  case message::Table::Field::DOUBLE:
129
 
    return DOUBLE;
130
 
  case message::Table::Field::BLOB:
131
 
    return BLOB;
132
 
  case message::Table::Field::ENUM:
133
 
    return ENUM;
134
 
  case message::Table::Field::INTEGER:
135
 
    return INTEGER;
136
 
  case message::Table::Field::BIGINT:
137
 
    return BIGINT;
138
 
  case message::Table::Field::DECIMAL:
139
 
    return DECIMAL;
140
 
  case message::Table::Field::DATE:
141
 
    return DATE;
142
 
  case message::Table::Field::TIMESTAMP:
143
 
    return TIMESTAMP;
144
 
  case message::Table::Field::DATETIME:
145
 
    return DATETIME;
146
 
  case message::Table::Field::UUID:
147
 
    return UUID;
148
 
  }
149
 
 
150
 
  assert(0);
151
 
  return PROGRAM_ERROR;
152
 
}
153
 
 
154
 
const std::string &type(drizzled::message::Table::ForeignKeyConstraint::ForeignKeyOption type)
155
 
{
156
 
  switch (type)
157
 
  {
158
 
  case message::Table::ForeignKeyConstraint::OPTION_RESTRICT:
159
 
    return RESTRICT;
160
 
  case message::Table::ForeignKeyConstraint::OPTION_CASCADE:
161
 
    return CASCADE;
162
 
  case message::Table::ForeignKeyConstraint::OPTION_SET_NULL:
163
 
    return SET_NULL;
164
 
  case message::Table::ForeignKeyConstraint::OPTION_UNDEF:
165
 
  case message::Table::ForeignKeyConstraint::OPTION_NO_ACTION:
166
 
    return NO_ACTION;
167
 
  case message::Table::ForeignKeyConstraint::OPTION_SET_DEFAULT:
168
 
    return SET_DEFAULT;
169
 
  }
170
 
 
171
 
  return NO_ACTION;
172
 
}
173
 
 
174
 
// This matches SQL standard of using YES/NO not the normal TRUE/FALSE
175
 
const std::string &type(bool type)
176
 
{
177
 
  return type ? YES : NO;
178
 
}
179
 
 
180
 
const std::string &type(drizzled::message::Table::Index::IndexType type)
181
 
{
182
 
  switch (type)
183
 
  {
184
 
  case message::Table::Index::UNKNOWN_INDEX:
185
 
    return UNKNOWN_INDEX;
186
 
  case message::Table::Index::BTREE:
187
 
    return BTREE;
188
 
  case message::Table::Index::RTREE:
189
 
    return RTREE;
190
 
  case message::Table::Index::HASH:
191
 
    return HASH;
192
 
  case message::Table::Index::FULLTEXT:
193
 
    return FULLTEXT;
194
 
  }
195
 
 
196
 
  assert(0);
197
 
  return PROGRAM_ERROR;
198
 
}
199
 
 
200
 
const std::string &type(drizzled::message::Table::ForeignKeyConstraint::ForeignKeyMatchOption type)
201
 
{
202
 
  switch (type)
203
 
  {
204
 
  case message::Table::ForeignKeyConstraint::MATCH_FULL:
205
 
    return MATCH_FULL;
206
 
  case message::Table::ForeignKeyConstraint::MATCH_PARTIAL:
207
 
    return MATCH_PARTIAL;
208
 
  case message::Table::ForeignKeyConstraint::MATCH_UNDEFINED:
209
 
  case message::Table::ForeignKeyConstraint::MATCH_SIMPLE:
210
 
    return MATCH_SIMPLE;
211
 
  }
212
 
 
213
 
  return MATCH_SIMPLE;
214
 
}
215
 
 
216
 
#if 0
217
 
std::ostream& operator<<(std::ostream& output, const message::Transaction &message)
218
 
219
 
    std::string buffer;
220
 
 
221
 
    google::protobuf::TextFormat::PrintToString(message, &buffer);
222
 
    output << buffer;
223
 
 
224
 
    return output;
225
 
}
226
 
 
227
 
std::ostream& operator<<(std::ostream& output, const message::Table &message)
228
 
229
 
  std::string buffer;
230
 
 
231
 
  google::protobuf::TextFormat::PrintToString(message, &buffer);
232
 
  output << buffer;
233
 
 
234
 
  return output;
235
 
}
236
 
#endif
237
 
 
238
 
 
239
86
} /* namespace message */
240
87
} /* namespace drizzled */