383
384
// Release latches in case bulk insert takes a long time
384
plugin::StorageEngine::releaseTemporaryLatches(session);
385
plugin::TransactionalStorageEngine::releaseTemporaryLatches(session);
386
387
error=write_record(session, table ,&info);
413
414
transactional_table= table->cursor->has_transactions();
415
416
changed= (info.copied || info.deleted || info.updated);
416
if ((changed && error <= 0) || session->transaction.stmt.modified_non_trans_table)
417
if ((changed && error <= 0) || session->transaction.stmt.hasModifiedNonTransData())
418
if (session->transaction.stmt.modified_non_trans_table)
419
session->transaction.all.modified_non_trans_table= true;
419
if (session->transaction.stmt.hasModifiedNonTransData())
420
session->transaction.all.markModifiedNonTransData();
421
assert(transactional_table || !changed || session->transaction.stmt.modified_non_trans_table);
422
assert(transactional_table || !changed || session->transaction.stmt.hasModifiedNonTransData());
424
425
session->set_proc_info("end");
696
697
then both on update triggers will work instead. Similarly both on
697
698
delete triggers will be invoked if we will delete conflicting records.
699
Sets session->transaction.stmt.modified_non_trans_table to true if table which is updated didn't have
700
Sets session->transaction.stmt.modified_non_trans_data to true if table which is updated didn't have
1255
1256
// Release latches in case bulk insert takes a long time
1256
plugin::StorageEngine::releaseTemporaryLatches(session);
1257
plugin::TransactionalStorageEngine::releaseTemporaryLatches(session);
1258
1259
error= write_record(session, table, &info);
1326
1327
We must invalidate the table in the query cache before binlog writing
1327
1328
and ha_autocommit_or_rollback.
1329
if (session->transaction.stmt.modified_non_trans_table)
1330
session->transaction.all.modified_non_trans_table= true;
1330
if (session->transaction.stmt.hasModifiedNonTransData())
1331
session->transaction.all.markModifiedNonTransData();
1332
1333
assert(trans_table || !changed ||
1333
session->transaction.stmt.modified_non_trans_table);
1334
session->transaction.stmt.hasModifiedNonTransData());
1335
1336
table->cursor->ha_release_auto_increment();
1392
1393
changed= (info.copied || info.deleted || info.updated);
1393
1394
transactional_table= table->cursor->has_transactions();
1394
1395
assert(transactional_table || !changed ||
1395
session->transaction.stmt.modified_non_trans_table);
1396
session->transaction.stmt.hasModifiedNonTransData());
1396
1397
table->cursor->ha_release_auto_increment();
1454
1455
static Table *create_table_from_items(Session *session, HA_CREATE_INFO *create_info,
1455
1456
TableList *create_table,
1456
message::Table *table_proto,
1457
message::Table &table_proto,
1457
1458
AlterInfo *alter_info,
1458
1459
List<Item> *items,
1459
1460
bool is_if_not_exists,
1469
1470
Field *tmp_field;
1472
bool lex_identified_temp_table= (table_proto->type() == message::Table::TEMPORARY);
1473
bool lex_identified_temp_table= (table_proto.type() == message::Table::TEMPORARY);
1474
if (!(lex_identified_temp_table) &&
1475
if (not (lex_identified_temp_table) &&
1475
1476
create_table->table->db_stat)
1477
1478
/* Table already exists and was open at openTablesLock() stage. */
1495
1496
tmp_table.s->db_create_options=0;
1496
1497
tmp_table.s->blob_ptr_size= portable_sizeof_char_ptr;
1497
tmp_table.s->db_low_byte_first=
1498
test(create_info->db_type == myisam_engine ||
1499
create_info->db_type == heap_engine);
1499
if (not table_proto.engine().name().compare("MyISAM"))
1500
tmp_table.s->db_low_byte_first= true;
1501
else if (not table_proto.engine().name().compare("MEMORY"))
1502
tmp_table.s->db_low_byte_first= true;
1500
1504
tmp_table.null_row= false;
1501
1505
tmp_table.maybe_null= false;
1561
if (!(lex_identified_temp_table))
1565
if (not lex_identified_temp_table)
1563
1567
pthread_mutex_lock(&LOCK_open); /* CREATE TABLE... has found that the table already exists for insert and is adapting to use it */
1564
1568
if (session->reopen_name_locked_table(create_table, false))
1574
if (!(table= session->openTable(create_table, (bool*) 0,
1575
DRIZZLE_OPEN_TEMPORARY_ONLY)) &&
1576
!create_info->table_existed)
1578
if (not (table= session->openTable(create_table, (bool*) 0,
1579
DRIZZLE_OPEN_TEMPORARY_ONLY)) &&
1580
not create_info->table_existed)
1579
1583
This shouldn't happen as creation of temporary table should make
1611
1615
select_create::prepare(List<Item> &values, Select_Lex_Unit *u)
1613
bool lex_identified_temp_table= (table_proto->type() == message::Table::TEMPORARY);
1617
bool lex_identified_temp_table= (table_proto.type() == message::Table::TEMPORARY);
1615
1619
DRIZZLE_LOCK *extra_lock= NULL;
1617
For row-based replication, the CREATE-SELECT statement is written
1618
in two pieces: the first one contain the CREATE TABLE statement
1619
necessary to create the table and the second part contain the rows
1620
that should go into the table.
1622
For non-temporary tables, the start of the CREATE-SELECT
1623
implicitly commits the previous transaction, and all events
1624
forming the statement will be stored the transaction cache. At end
1625
of the statement, the entire statement is committed as a
1626
transaction, and all events are written to the binary log.
1628
On the master, the table is locked for the duration of the
1629
statement, but since the CREATE part is replicated as a simple
1630
statement, there is no way to lock the table for accesses on the
1631
slave. Hence, we have to hold on to the CREATE part of the
1632
statement until the statement has finished.
1621
For replication, the CREATE-SELECT statement is written
1622
in two pieces: the first transaction messsage contains
1623
the CREATE TABLE statement as a CreateTableStatement message
1624
necessary to create the table.
1626
The second transaction message contains all the InsertStatement
1627
and associated InsertRecords that should go into the table.
1638
Start a statement transaction before the create if we are using
1639
row-based replication for the statement. If we are creating a
1640
temporary table, we need to start a statement transaction.
1643
1632
if (!(table= create_table_from_items(session, create_info, create_table,
1645
1634
alter_info, &values,