concurrent inserts into myisam file
Hi all, I have a problem using the MYISAM storage from an application.
I open a myisam file in READONLY mode.
I then call a dll from the active process opening the same file again but in I/O mode and I insert a record.
When I get back to the calling process, if I try to read with mode HA_READ_KEY_EXACT the record is noklt found even if it was inserted successfully.
The problem is in the fix of the mi_rkey.c file (obviously!) as follows:
...omissis ... from mi_rkey.c mysql v. 5.0.67
/*
Found a key, but it might not be usable. We cannot use rows that
are inserted by other threads after we got our table lock
("concurrent inserts"). The record may not even be present yet.
Keys are inserted into the index(es) before the record is
inserted into the data file. When we got our table lock, we
saved the current data_file_length. Concurrent inserts always go
to the end of the file. So we can test if the found key
references a new record.
*/
if (info->lastpos >= info->state->data_file_length)
{
/* The key references a concurrently inserted record. */
if (search_flag == HA_READ_KEY_EXACT &&
last_used_keyseg == keyinfo->seg + keyinfo->keysegs)
{
/* Simply ignore the key if it matches exactly. (Bug #29838) */
my_errno= HA_ERR_KEY_NOT_FOUND;
info->lastpos= HA_OFFSET_ERROR;
... follows ...
The mi_rkey() returns a HA_ERR_KEY_NOT_FOUND reply even if the record was actually found.
I understand the problem, but how can I fix this? I found out that if I close and reopen the file before the read everything is ok, but...
...is there a more elegant way to fix this annoying problem? Is there a call that refreshes the internal pointers or something like that?
Thank you in advance
D.
Edited 1 time(s). Last edit at 06/09/2010 01:21AM by Damiano C..
Subject
Views
Written By
Posted
concurrent inserts into myisam file
4017
June 05, 2010 02:51AM
1821
June 06, 2010 09:41PM
2066
June 09, 2010 01:00AM
1737
June 09, 2010 10:31AM
2023
June 12, 2010 01:42AM
1871
June 12, 2010 01:50AM
1932
June 12, 2010 11:10AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.