~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.cc

  • Committer: Brian Aker
  • Date: 2008-10-20 03:40:03 UTC
  • mto: (492.3.21 drizzle-clean-code)
  • mto: This revision was merged to the branch mainline in revision 530.
  • Revision ID: brian@tangent.org-20081020034003-t2dcnl0ayr2ymm8k
THD -> Session rename

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
 
64
64
 
65
65
 
66
 
static plugin_ref ha_default_plugin(THD *thd)
 
66
static plugin_ref ha_default_plugin(Session *thd)
67
67
{
68
68
  if (thd->variables.table_plugin)
69
69
    return thd->variables.table_plugin;
80
80
  @return
81
81
    pointer to handlerton
82
82
*/
83
 
handlerton *ha_default_handlerton(THD *thd)
 
83
handlerton *ha_default_handlerton(Session *thd)
84
84
{
85
85
  plugin_ref plugin= ha_default_plugin(thd);
86
86
  assert(plugin);
99
99
  @return
100
100
    pointer to storage engine plugin handle
101
101
*/
102
 
plugin_ref ha_resolve_by_name(THD *thd, const LEX_STRING *name)
 
102
plugin_ref ha_resolve_by_name(Session *thd, const LEX_STRING *name)
103
103
{
104
104
  const LEX_STRING *table_alias;
105
105
  plugin_ref plugin;
141
141
}
142
142
 
143
143
 
144
 
plugin_ref ha_lock_engine(THD *thd, handlerton *hton)
 
144
plugin_ref ha_lock_engine(Session *thd, handlerton *hton)
145
145
{
146
146
  if (hton)
147
147
  {
153
153
}
154
154
 
155
155
 
156
 
handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type)
 
156
handlerton *ha_resolve_by_legacy_type(Session *thd, enum legacy_db_type db_type)
157
157
{
158
158
  plugin_ref plugin;
159
159
  switch (db_type) {
173
173
/**
174
174
  Use other database handler if databasehandler is not compiled in.
175
175
*/
176
 
handlerton *ha_checktype(THD *thd, enum legacy_db_type database_type,
 
176
handlerton *ha_checktype(Session *thd, enum legacy_db_type database_type,
177
177
                          bool no_substitute, bool report_error)
178
178
{
179
179
  handlerton *hton= ha_resolve_by_legacy_type(thd, database_type);
444
444
  return(error);
445
445
}
446
446
 
447
 
static bool dropdb_handlerton(THD *unused1 __attribute__((unused)),
 
447
static bool dropdb_handlerton(Session *unused1 __attribute__((unused)),
448
448
                              plugin_ref plugin,
449
449
                              void *path)
450
450
{
461
461
}
462
462
 
463
463
 
464
 
static bool closecon_handlerton(THD *thd, plugin_ref plugin,
 
464
static bool closecon_handlerton(Session *thd, plugin_ref plugin,
465
465
                                void *unused __attribute__((unused)))
466
466
{
467
467
  handlerton *hton= plugin_data(plugin, handlerton *);
480
480
  @note
481
481
    don't bother to rollback here, it's done already
482
482
*/
483
 
void ha_close_connection(THD* thd)
 
483
void ha_close_connection(Session* thd)
484
484
{
485
485
  plugin_foreach(thd, closecon_handlerton, DRIZZLE_STORAGE_ENGINE_PLUGIN, 0);
486
486
}
588
588
 
589
589
  The server stores its transaction-related data in
590
590
  thd->transaction. This structure has two members of type
591
 
  THD_TRANS. These members correspond to the statement and
 
591
  Session_TRANS. These members correspond to the statement and
592
592
  normal transactions respectively:
593
593
 
594
594
  - thd->transaction.stmt contains a list of engines
791
791
    times per transaction.
792
792
 
793
793
*/
794
 
void trans_register_ha(THD *thd, bool all, handlerton *ht_arg)
 
794
void trans_register_ha(Session *thd, bool all, handlerton *ht_arg)
795
795
{
796
 
  THD_TRANS *trans;
 
796
  Session_TRANS *trans;
797
797
  Ha_trx_info *ha_info;
798
798
 
799
799
  if (all)
824
824
  @retval
825
825
    1   error, transaction was rolled back
826
826
*/
827
 
int ha_prepare(THD *thd)
 
827
int ha_prepare(Session *thd)
828
828
{
829
829
  int error=0, all=1;
830
 
  THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
 
830
  Session_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
831
831
  Ha_trx_info *ha_info= trans->ha_list;
832
832
  if (ha_info)
833
833
  {
873
873
 
874
874
static
875
875
bool
876
 
ha_check_and_coalesce_trx_read_only(THD *thd, Ha_trx_info *ha_list,
 
876
ha_check_and_coalesce_trx_read_only(Session *thd, Ha_trx_info *ha_list,
877
877
                                    bool all)
878
878
{
879
879
  /* The number of storage engines that have actual changes. */
927
927
    stored functions or triggers. So we simply do nothing now.
928
928
    TODO: This should be fixed in later ( >= 5.1) releases.
929
929
*/
930
 
int ha_commit_trans(THD *thd, bool all)
 
930
int ha_commit_trans(Session *thd, bool all)
931
931
{
932
932
  int error= 0, cookie= 0;
933
933
  /*
934
934
    'all' means that this is either an explicit commit issued by
935
935
    user, or an implicit commit issued by a DDL.
936
936
  */
937
 
  THD_TRANS *trans= all ? &thd->transaction.all : &thd->transaction.stmt;
 
937
  Session_TRANS *trans= all ? &thd->transaction.all : &thd->transaction.stmt;
938
938
  bool is_real_trans= all || thd->transaction.all.ha_list == 0;
939
939
  Ha_trx_info *ha_info= trans->ha_list;
940
940
  my_xid xid= thd->transaction.xid_state.xid.get_my_xid();
1017
1017
  @note
1018
1018
  This function does not care about global read lock. A caller should.
1019
1019
*/
1020
 
int ha_commit_one_phase(THD *thd, bool all)
 
1020
int ha_commit_one_phase(Session *thd, bool all)
1021
1021
{
1022
1022
  int error=0;
1023
 
  THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
 
1023
  Session_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
1024
1024
  bool is_real_trans=all || thd->transaction.all.ha_list == 0;
1025
1025
  Ha_trx_info *ha_info= trans->ha_list, *ha_info_next;
1026
1026
  if (ha_info)
1052
1052
}
1053
1053
 
1054
1054
 
1055
 
int ha_rollback_trans(THD *thd, bool all)
 
1055
int ha_rollback_trans(Session *thd, bool all)
1056
1056
{
1057
1057
  int error=0;
1058
 
  THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
 
1058
  Session_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
1059
1059
  Ha_trx_info *ha_info= trans->ha_list, *ha_info_next;
1060
1060
  bool is_real_trans=all || thd->transaction.all.ha_list == 0;
1061
1061
 
1104
1104
    message in the error log, so we don't send it.
1105
1105
  */
1106
1106
  if (is_real_trans && thd->transaction.all.modified_non_trans_table &&
1107
 
      !thd->slave_thread && thd->killed != THD::KILL_CONNECTION)
 
1107
      !thd->slave_thread && thd->killed != Session::KILL_CONNECTION)
1108
1108
    push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1109
1109
                 ER_WARNING_NOT_COMPLETE_ROLLBACK,
1110
1110
                 ER(ER_WARNING_NOT_COMPLETE_ROLLBACK));
1122
1122
    the user has used LOCK TABLES then that mechanism does not know to do the
1123
1123
    commit.
1124
1124
*/
1125
 
int ha_autocommit_or_rollback(THD *thd, int error)
 
1125
int ha_autocommit_or_rollback(Session *thd, int error)
1126
1126
{
1127
1127
  if (thd->transaction.stmt.ha_list)
1128
1128
  {
1149
1149
  int result;
1150
1150
};
1151
1151
 
1152
 
static bool xacommit_handlerton(THD *unused1 __attribute__((unused)),
 
1152
static bool xacommit_handlerton(Session *unused1 __attribute__((unused)),
1153
1153
                                plugin_ref plugin,
1154
1154
                                void *arg)
1155
1155
{
1162
1162
  return false;
1163
1163
}
1164
1164
 
1165
 
static bool xarollback_handlerton(THD *unused1 __attribute__((unused)),
 
1165
static bool xarollback_handlerton(Session *unused1 __attribute__((unused)),
1166
1166
                                  plugin_ref plugin,
1167
1167
                                  void *arg)
1168
1168
{
1212
1212
  bool dry_run;
1213
1213
};
1214
1214
 
1215
 
static bool xarecover_handlerton(THD *unused __attribute__((unused)),
 
1215
static bool xarecover_handlerton(Session *unused __attribute__((unused)),
1216
1216
                                 plugin_ref plugin,
1217
1217
                                 void *arg)
1218
1218
{
1334
1334
    so mysql_xa_recover does not filter XID's to ensure uniqueness.
1335
1335
    It can be easily fixed later, if necessary.
1336
1336
*/
1337
 
bool mysql_xa_recover(THD *thd)
 
1337
bool mysql_xa_recover(Session *thd)
1338
1338
{
1339
1339
  List<Item> field_list;
1340
1340
  Protocol *protocol= thd->protocol;
1392
1392
  @return
1393
1393
    always 0
1394
1394
*/
1395
 
static bool release_temporary_latches(THD *thd, plugin_ref plugin,
 
1395
static bool release_temporary_latches(Session *thd, plugin_ref plugin,
1396
1396
                                      void *unused __attribute__((unused)))
1397
1397
{
1398
1398
  handlerton *hton= plugin_data(plugin, handlerton *);
1404
1404
}
1405
1405
 
1406
1406
 
1407
 
int ha_release_temporary_latches(THD *thd)
 
1407
int ha_release_temporary_latches(Session *thd)
1408
1408
{
1409
1409
  plugin_foreach(thd, release_temporary_latches, DRIZZLE_STORAGE_ENGINE_PLUGIN, 
1410
1410
                 NULL);
1412
1412
  return 0;
1413
1413
}
1414
1414
 
1415
 
int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv)
 
1415
int ha_rollback_to_savepoint(Session *thd, SAVEPOINT *sv)
1416
1416
{
1417
1417
  int error=0;
1418
 
  THD_TRANS *trans= &thd->transaction.all;
 
1418
  Session_TRANS *trans= &thd->transaction.all;
1419
1419
  Ha_trx_info *ha_info, *ha_info_next;
1420
1420
 
1421
1421
  trans->no_2pc=0;
1466
1466
  section "4.33.4 SQL-statements and transaction states",
1467
1467
  SAVEPOINT is *not* transaction-initiating SQL-statement
1468
1468
*/
1469
 
int ha_savepoint(THD *thd, SAVEPOINT *sv)
 
1469
int ha_savepoint(Session *thd, SAVEPOINT *sv)
1470
1470
{
1471
1471
  int error=0;
1472
 
  THD_TRANS *trans= &thd->transaction.all;
 
1472
  Session_TRANS *trans= &thd->transaction.all;
1473
1473
  Ha_trx_info *ha_info= trans->ha_list;
1474
1474
  for (; ha_info; ha_info= ha_info->next())
1475
1475
  {
1497
1497
  return(error);
1498
1498
}
1499
1499
 
1500
 
int ha_release_savepoint(THD *thd, SAVEPOINT *sv)
 
1500
int ha_release_savepoint(Session *thd, SAVEPOINT *sv)
1501
1501
{
1502
1502
  int error=0;
1503
1503
  Ha_trx_info *ha_info= sv->ha_list;
1521
1521
}
1522
1522
 
1523
1523
 
1524
 
static bool snapshot_handlerton(THD *thd, plugin_ref plugin, void *arg)
 
1524
static bool snapshot_handlerton(Session *thd, plugin_ref plugin, void *arg)
1525
1525
{
1526
1526
  handlerton *hton= plugin_data(plugin, handlerton *);
1527
1527
  if (hton->state == SHOW_OPTION_YES &&
1533
1533
  return false;
1534
1534
}
1535
1535
 
1536
 
int ha_start_consistent_snapshot(THD *thd)
 
1536
int ha_start_consistent_snapshot(Session *thd)
1537
1537
{
1538
1538
  bool warn= true;
1539
1539
 
1551
1551
}
1552
1552
 
1553
1553
 
1554
 
static bool flush_handlerton(THD *thd __attribute__((unused)),
 
1554
static bool flush_handlerton(Session *thd __attribute__((unused)),
1555
1555
                             plugin_ref plugin,
1556
1556
                             void *arg __attribute__((unused)))
1557
1557
{
1611
1611
  virtual bool handle_error(uint32_t sql_errno,
1612
1612
                            const char *message,
1613
1613
                            DRIZZLE_ERROR::enum_warning_level level,
1614
 
                            THD *thd);
 
1614
                            Session *thd);
1615
1615
  char buff[DRIZZLE_ERRMSG_SIZE];
1616
1616
};
1617
1617
 
1621
1621
handle_error(uint32_t sql_errno  __attribute__((unused)),
1622
1622
             const char *message,
1623
1623
             DRIZZLE_ERROR::enum_warning_level level __attribute__((unused)),
1624
 
             THD *thd __attribute__((unused)))
 
1624
             Session *thd __attribute__((unused)))
1625
1625
{
1626
1626
  /* Grab the error message */
1627
1627
  strmake(buff, message, sizeof(buff)-1);
1633
1633
  This should return ENOENT if the file doesn't exists.
1634
1634
  The .frm file will be deleted only if we return 0 or ENOENT
1635
1635
*/
1636
 
int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
 
1636
int ha_delete_table(Session *thd, handlerton *table_type, const char *path,
1637
1637
                    const char *db, const char *alias, bool generate_warning)
1638
1638
{
1639
1639
  handler *file;
1717
1717
  status_var_increment(table->in_use->status_var.*offset);
1718
1718
}
1719
1719
 
1720
 
void **handler::ha_data(THD *thd) const
 
1720
void **handler::ha_data(Session *thd) const
1721
1721
{
1722
1722
  return thd_ha_data(thd, ht);
1723
1723
}
1724
1724
 
1725
 
THD *handler::ha_thd(void) const
 
1725
Session *handler::ha_thd(void) const
1726
1726
{
1727
1727
  assert(!table || !table->in_use || table->in_use == current_thd);
1728
1728
  return (table && table->in_use) ? table->in_use : current_thd;
1857
1857
void handler::adjust_next_insert_id_after_explicit_value(uint64_t nr)
1858
1858
{
1859
1859
  /*
1860
 
    If we have set THD::next_insert_id previously and plan to insert an
 
1860
    If we have set Session::next_insert_id previously and plan to insert an
1861
1861
    explicitely-specified value larger than this, we need to increase
1862
 
    THD::next_insert_id to be greater than the explicit value.
 
1862
    Session::next_insert_id to be greater than the explicit value.
1863
1863
  */
1864
1864
  if ((next_insert_id > 0) && (nr >= next_insert_id))
1865
1865
    set_next_insert_id(compute_next_insert_id(nr, &table->in_use->variables));
1980
1980
{
1981
1981
  uint64_t nr, nb_reserved_values;
1982
1982
  bool append= false;
1983
 
  THD *thd= table->in_use;
 
1983
  Session *thd= table->in_use;
1984
1984
  struct system_variables *variables= &thd->variables;
1985
1985
 
1986
1986
  /*
2078
2078
    /*
2079
2079
      first test if the query was aborted due to strict mode constraints
2080
2080
    */
2081
 
    if (thd->killed == THD::KILL_BAD_DATA)
 
2081
    if (thd->killed == Session::KILL_BAD_DATA)
2082
2082
      return(HA_ERR_AUTOINC_ERANGE);
2083
2083
 
2084
2084
    /*
2637
2637
  @retval
2638
2638
    HA_ADMIN_NOT_IMPLEMENTED
2639
2639
*/
2640
 
int handler::ha_check(THD *thd, HA_CHECK_OPT *check_opt)
 
2640
int handler::ha_check(Session *thd, HA_CHECK_OPT *check_opt)
2641
2641
{
2642
2642
  int error;
2643
2643
 
2697
2697
  @sa handler::repair()
2698
2698
*/
2699
2699
 
2700
 
int handler::ha_repair(THD* thd, HA_CHECK_OPT* check_opt)
 
2700
int handler::ha_repair(Session* thd, HA_CHECK_OPT* check_opt)
2701
2701
{
2702
2702
  int result;
2703
2703
 
2762
2762
*/
2763
2763
 
2764
2764
int
2765
 
handler::ha_optimize(THD* thd, HA_CHECK_OPT* check_opt)
 
2765
handler::ha_optimize(Session* thd, HA_CHECK_OPT* check_opt)
2766
2766
{
2767
2767
  mark_trx_read_write();
2768
2768
 
2777
2777
*/
2778
2778
 
2779
2779
int
2780
 
handler::ha_analyze(THD* thd, HA_CHECK_OPT* check_opt)
 
2780
handler::ha_analyze(Session* thd, HA_CHECK_OPT* check_opt)
2781
2781
{
2782
2782
  mark_trx_read_write();
2783
2783
 
2792
2792
*/
2793
2793
 
2794
2794
bool
2795
 
handler::ha_check_and_repair(THD *thd)
 
2795
handler::ha_check_and_repair(Session *thd)
2796
2796
{
2797
2797
  mark_trx_read_write();
2798
2798
 
2946
2946
  starts to commit every now and then automatically.
2947
2947
  This hint can be safely ignored.
2948
2948
*/
2949
 
int ha_enable_transaction(THD *thd, bool on)
 
2949
int ha_enable_transaction(Session *thd, bool on)
2950
2950
{
2951
2951
  int error=0;
2952
2952
 
3027
3027
  @retval
3028
3028
   1  error
3029
3029
*/
3030
 
int ha_create_table(THD *thd, const char *path,
 
3030
int ha_create_table(Session *thd, const char *path,
3031
3031
                    const char *db, const char *table_name,
3032
3032
                    HA_CREATE_INFO *create_info,
3033
3033
                    bool update_create_info)
3074
3074
  @retval
3075
3075
   > 0  Error, table existed but could not be created
3076
3076
*/
3077
 
int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
 
3077
int ha_create_table_from_engine(Session* thd, const char *db, const char *name)
3078
3078
{
3079
3079
  int error;
3080
3080
  unsigned char *frmblob;
3239
3239
  size_t *frmlen;
3240
3240
};
3241
3241
 
3242
 
static bool discover_handlerton(THD *thd, plugin_ref plugin,
 
3242
static bool discover_handlerton(Session *thd, plugin_ref plugin,
3243
3243
                                void *arg)
3244
3244
{
3245
3245
  st_discover_args *vargs= (st_discover_args *)arg;
3253
3253
  return false;
3254
3254
}
3255
3255
 
3256
 
int ha_discover(THD *thd, const char *db, const char *name,
 
3256
int ha_discover(Session *thd, const char *db, const char *name,
3257
3257
                unsigned char **frmblob, size_t *frmlen)
3258
3258
{
3259
3259
  int error= -1; // Table does not exist in any handler
3302
3302
  int err;
3303
3303
};
3304
3304
 
3305
 
static bool table_exists_in_engine_handlerton(THD *thd, plugin_ref plugin,
 
3305
static bool table_exists_in_engine_handlerton(Session *thd, plugin_ref plugin,
3306
3306
                                              void *arg)
3307
3307
{
3308
3308
  st_table_exists_in_engine_args *vargs= (st_table_exists_in_engine_args *)arg;
3320
3320
  return false;
3321
3321
}
3322
3322
 
3323
 
int ha_table_exists_in_engine(THD* thd, const char* db, const char* name)
 
3323
int ha_table_exists_in_engine(Session* thd, const char* db, const char* name)
3324
3324
{
3325
3325
  st_table_exists_in_engine_args args= {db, name, HA_ERR_NO_SUCH_TABLE};
3326
3326
  plugin_foreach(thd, table_exists_in_engine_handlerton,
3405
3405
  range_seq_t seq_it;
3406
3406
  ha_rows rows, total_rows= 0;
3407
3407
  uint32_t n_ranges=0;
3408
 
  THD *thd= current_thd;
 
3408
  Session *thd= current_thd;
3409
3409
  
3410
3410
  /* Default MRR implementation doesn't need buffer */
3411
3411
  *bufsz= 0;
3679
3679
  rowids_buf_end= rowids_buf_last;
3680
3680
 
3681
3681
  /* Create a separate handler object to do rndpos() calls. */
3682
 
  THD *thd= current_thd;
 
3682
  Session *thd= current_thd;
3683
3683
  if (!(new_h2= h->clone(thd->mem_root)) || 
3684
3684
      new_h2->ha_external_lock(thd, F_RDLCK))
3685
3685
  {
3974
3974
{
3975
3975
  COST_VECT dsmrr_cost;
3976
3976
  bool res;
3977
 
  THD *thd= current_thd;
 
3977
  Session *thd= current_thd;
3978
3978
  if ((thd->variables.optimizer_use_mrr == 2) || 
3979
3979
      (*flags & HA_MRR_INDEX_ONLY) || (*flags & HA_MRR_SORTED) ||
3980
3980
      (keyno == table->s->primary_key && 
4352
4352
  @retval
4353
4353
    pointer             pointer to TYPELIB structure
4354
4354
*/
4355
 
static bool exts_handlerton(THD *unused __attribute__((unused)),
 
4355
static bool exts_handlerton(Session *unused __attribute__((unused)),
4356
4356
                            plugin_ref plugin,
4357
4357
                            void *arg)
4358
4358
{
4411
4411
}
4412
4412
 
4413
4413
 
4414
 
static bool stat_print(THD *thd, const char *type, uint32_t type_len,
 
4414
static bool stat_print(Session *thd, const char *type, uint32_t type_len,
4415
4415
                       const char *file, uint32_t file_len,
4416
4416
                       const char *status, uint32_t status_len)
4417
4417
{
4425
4425
  return false;
4426
4426
}
4427
4427
 
4428
 
bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat)
 
4428
bool ha_show_status(Session *thd, handlerton *db_type, enum ha_stat_type stat)
4429
4429
{
4430
4430
  List<Item> field_list;
4431
4431
  Protocol *protocol= thd->protocol;
4460
4460
  - table is not mysql.event
4461
4461
*/
4462
4462
 
4463
 
static bool check_table_binlog_row_based(THD *thd, Table *table)
 
4463
static bool check_table_binlog_row_based(Session *thd, Table *table)
4464
4464
{
4465
4465
  if (table->s->cached_row_logging_check == -1)
4466
4466
  {
4485
4485
 
4486
4486
   This function will generate and write table maps for all tables
4487
4487
   that are locked by the thread 'thd'.  Either manually locked
4488
 
   (stored in THD::locked_tables) and automatically locked (stored
4489
 
   in THD::lock) are considered.
 
4488
   (stored in Session::locked_tables) and automatically locked (stored
 
4489
   in Session::lock) are considered.
4490
4490
 
4491
 
   @param thd     Pointer to THD structure
 
4491
   @param thd     Pointer to Session structure
4492
4492
 
4493
4493
   @retval 0   All OK
4494
4494
   @retval 1   Failed to write all table maps
4495
4495
 
4496
4496
   @sa
4497
 
       THD::lock
4498
 
       THD::locked_tables
 
4497
       Session::lock
 
4498
       Session::locked_tables
4499
4499
*/
4500
4500
 
4501
 
static int write_locked_table_maps(THD *thd)
 
4501
static int write_locked_table_maps(Session *thd)
4502
4502
{
4503
4503
  if (thd->get_binlog_table_maps() == 0)
4504
4504
  {
4537
4537
}
4538
4538
 
4539
4539
 
4540
 
typedef bool Log_func(THD*, Table*, bool, const unsigned char*, const unsigned char*);
 
4540
typedef bool Log_func(Session*, Table*, bool, const unsigned char*, const unsigned char*);
4541
4541
 
4542
4542
static int binlog_log_row(Table* table,
4543
4543
                          const unsigned char *before_record,
4547
4547
  if (table->no_replicate)
4548
4548
    return 0;
4549
4549
  bool error= 0;
4550
 
  THD *const thd= table->in_use;
 
4550
  Session *const thd= table->in_use;
4551
4551
 
4552
4552
  if (check_table_binlog_row_based(thd, table))
4553
4553
  {
4565
4565
  return error ? HA_ERR_RBR_LOGGING_FAILED : 0;
4566
4566
}
4567
4567
 
4568
 
int handler::ha_external_lock(THD *thd, int lock_type)
 
4568
int handler::ha_external_lock(Session *thd, int lock_type)
4569
4569
{
4570
4570
  /*
4571
4571
    Whether this is lock or unlock, this should be true, and is to verify that