~ubuntu-branches/ubuntu/wily/mysql-5.6/wily

« back to all changes in this revision

Viewing changes to plugin/innodb_memcached/innodb_memcache/src/innodb_api.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2015-04-16 20:07:10 UTC
  • mto: (1.3.9 vivid-proposed)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: package-import@ubuntu.com-20150416200710-pcrsa022082zj46k
Tags: upstream-5.6.24
ImportĀ upstreamĀ versionĀ 5.6.24

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***********************************************************************
2
2
 
3
 
Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 
3
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it
6
6
under the terms of the GNU General Public License as published by the
170
170
                        return(err);
171
171
                }
172
172
 
 
173
                /* If MDL is enabled, we need to create mysql handler. */
 
174
                if (engine) {
 
175
                        /* Create a "Fake" THD if binlog is enabled */
 
176
                        /* For flush_all which request IB_LOCK_TABLE_X
 
177
                        lock, we need to add MDL lock. It's because we need
 
178
                        to block DMLs from sql layer. */
 
179
                        if (conn_data && (engine->enable_binlog
 
180
                                          || engine->enable_mdl
 
181
                                          || lock_mode == IB_LOCK_TABLE_X)) {
 
182
                                if (!conn_data->thd) {
 
183
                                        conn_data->thd = handler_create_thd(
 
184
                                                engine->enable_binlog);
 
185
 
 
186
                                        if (!conn_data->thd) {
 
187
                                                innodb_cb_cursor_close(*crsr);
 
188
                                                *crsr = NULL;
 
189
                                                return(DB_ERROR);
 
190
                                        }
 
191
                                }
 
192
 
 
193
                                if (!conn_data->mysql_tbl) {
 
194
                                        int lock_type =
 
195
                                                (lock_mode == IB_LOCK_TABLE_X?
 
196
                                                        HDL_FLUSH : HDL_WRITE);
 
197
                                        conn_data->mysql_tbl =
 
198
                                                handler_open_table(
 
199
                                                        conn_data->thd,
 
200
                                                        dbname,
 
201
                                                        name,
 
202
                                                        lock_type);
 
203
                                }
 
204
                        }
 
205
                }
 
206
 
173
207
                err = innodb_cb_cursor_lock(engine, *crsr, lock_mode);
174
208
 
175
209
                if (err != DB_SUCCESS) {
208
242
                                err = innodb_cb_cursor_lock(engine, *idx_crsr,
209
243
                                                      lock_mode);
210
244
                        }
211
 
 
212
 
                        /* Create a "Fake" THD if binlog is enabled */
213
 
                        if (conn_data && (engine->enable_binlog
214
 
                                          || engine->enable_mdl)) {
215
 
                                if (!conn_data->thd) {
216
 
                                        conn_data->thd = handler_create_thd(
217
 
                                                engine->enable_binlog);
218
 
 
219
 
                                        if (!conn_data->thd) {
220
 
                                                innodb_cb_cursor_close(*crsr);
221
 
                                                *crsr = NULL;
222
 
                                                return(DB_ERROR);
223
 
                                        }
224
 
                                }
225
 
 
226
 
                                if (!conn_data->mysql_tbl) {
227
 
                                        conn_data->mysql_tbl =
228
 
                                                handler_open_table(
229
 
                                                        conn_data->thd,
230
 
                                                        dbname,
231
 
                                                        name, HDL_WRITE);
232
 
                                }
233
 
                        }
234
245
                }
 
246
 
235
247
        } else {
236
248
                ib_cb_cursor_new_trx(*crsr, ib_trx);
237
249
 
1488
1500
                        column_used = 0;
1489
1501
                }
1490
1502
 
 
1503
                /* For int column, we don't support append command. */
 
1504
                if (append && !result->extra_col_value[column_used].is_str) {
 
1505
                        return DB_UNSUPPORTED;
 
1506
                }
 
1507
 
1491
1508
                before_len = result->extra_col_value[column_used].value_len;
1492
1509
                before_val = result->extra_col_value[column_used].value_str;
1493
1510
        } else {
 
1511
                /* For int column, we don't support append command. */
 
1512
                if (append && !result->col_value[MCI_COL_VALUE].is_str) {
 
1513
                        return DB_UNSUPPORTED;
 
1514
                }
 
1515
 
1494
1516
                before_len = result->col_value[MCI_COL_VALUE].value_len;
1495
1517
                before_val = result->col_value[MCI_COL_VALUE].value_str;
1496
1518
                column_used = UPDATE_ALL_VAL_COL;
1610
1632
                } else {
1611
1633
                        /* cursor_data->mysql_tbl can't be created.
1612
1634
                        So safe to return here */
1613
 
                        return(DB_RECORD_NOT_FOUND);
 
1635
                        return(ENGINE_KEY_ENOENT);
1614
1636
                }
1615
1637
        }
1616
1638