78
78
static int read_meta_file(int meta_file, ha_rows *rows);
79
79
static int write_meta_file(int meta_file, ha_rows rows, bool dirty);
81
void tina_get_status(void* param, int concurrent_insert);
82
void tina_update_status(void* param);
83
bool tina_check_status(void* param);
85
81
/* Stuff for shares */
86
82
pthread_mutex_t tina_mutex;
782
Three functions below are needed to enable concurrent insert functionality
783
for CSV engine. For more details see mysys/thr_lock.c
786
void tina_get_status(void* param, int)
788
ha_tina *tina= (ha_tina*) param;
792
void tina_update_status(void* param)
794
ha_tina *tina= (ha_tina*) param;
795
tina->update_status();
798
/* this should exist and return 0 for concurrent insert to work */
799
bool tina_check_status(void *)
805
Save the state of the table
811
This function is used to retrieve the file length. During the lock
812
phase of concurrent insert. For more details see comment to
813
ha_tina::update_status below.
816
void ha_tina::get_status()
818
local_saved_data_file_length= share->saved_data_file_length;
823
Correct the state of the table. Called by unlock routines
824
before the write lock is released.
830
When we employ concurrent insert lock, we save current length of the file
831
during the lock phase. We do not read further saved value, as we don't
832
want to interfere with undergoing concurrent insert. Writers update file
833
length info during unlock with update_status().
836
For log tables concurrent insert works different. The reason is that
837
log tables are always opened and locked. And as they do not unlock
838
tables, the file length after writes should be updated in a different
842
void ha_tina::update_status()
844
/* correct local_saved_data_file_length for writers */
845
share->saved_data_file_length= local_saved_data_file_length;
850
778
Open a database file. Keep in mind that tables are caches, so
851
779
this will not be called for every request. Any sort of positions
852
780
that need to be reset should be kept in the ::extra() call.
871
799
so that they could save/update local_saved_data_file_length value
872
800
during locking. This is needed to enable concurrent inserts.
874
thr_lock_data_init(&share->lock, &lock, (void*) this);
802
thr_lock_data_init(&share->lock, &lock);
875
803
ref_length=sizeof(off_t);
877
share->lock.get_status= tina_get_status;
878
share->lock.update_status= tina_update_status;
879
share->lock.check_status= tina_check_status;