428
427
pthread_mutex_unlock(&filesystem_mutex);
430
void FilesystemCursor::critical_section_enter()
432
if (sql_command_type == SQLCOM_ALTER_TABLE ||
433
sql_command_type == SQLCOM_UPDATE ||
434
sql_command_type == SQLCOM_DELETE ||
435
sql_command_type == SQLCOM_INSERT ||
436
sql_command_type == SQLCOM_INSERT_SELECT ||
437
sql_command_type == SQLCOM_REPLACE ||
438
sql_command_type == SQLCOM_REPLACE_SELECT)
439
share->filesystem_lock.scan_update_begin();
441
share->filesystem_lock.scan_begin();
443
thread_locked = true;
446
void FilesystemCursor::critical_section_exit()
448
if (sql_command_type == SQLCOM_ALTER_TABLE ||
449
sql_command_type == SQLCOM_UPDATE ||
450
sql_command_type == SQLCOM_DELETE ||
451
sql_command_type == SQLCOM_INSERT ||
452
sql_command_type == SQLCOM_INSERT_SELECT ||
453
sql_command_type == SQLCOM_REPLACE ||
454
sql_command_type == SQLCOM_REPLACE_SELECT)
455
share->filesystem_lock.scan_update_end();
457
share->filesystem_lock.scan_end();
459
thread_locked = false;
431
462
FilesystemCursor::FilesystemCursor(drizzled::plugin::StorageEngine &engine_arg, TableShare &table_arg)
432
: Cursor(engine_arg, table_arg)
463
: Cursor(engine_arg, table_arg),
434
466
file_buff= new TransparentFile();
654
691
int FilesystemCursor::doEndTableScan()
693
sql_command_type = session_sql_command(table->getSession());
656
695
if (share->format.isTagFormat())
698
critical_section_exit();
659
702
if (slots.size() == 0)
705
critical_section_exit();
663
710
sort(slots.begin(), slots.end());
764
814
if (share->format.isTagFormat())
817
sql_command_type = session_sql_command(table->getSession());
819
critical_section_enter();
767
821
int err_write= 0;
768
822
int err_close= 0;
770
824
string output_line;
771
825
recordToString(output_line);
773
pthread_mutex_lock(&share->mutex);
774
827
int fd= ::open(share->format.getFileName().c_str(), O_WRONLY | O_APPEND);
777
pthread_mutex_unlock(&share->mutex);
830
critical_section_exit();
845
898
return FormatInfo::validateOption(key, state);
848
THR_LOCK_DATA **FilesystemCursor::store_lock(Session *,
850
thr_lock_type lock_type)
852
if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK)
853
lock.type= lock_type;
858
901
int FilesystemEngine::doCreateTable(Session &,
860
903
const drizzled::TableIdentifier &identifier,