Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f74f363a
Commit
f74f363a
authored
Oct 10, 2007
by
davi@moksha.com.br
Browse files
Options
Browse Files
Download
Plain Diff
Merge moksha.com.br:/Users/davi/mysql/bugs/21587-5.0
into moksha.com.br:/Users/davi/mysql/bugs/21587-5.1
parents
ac83b312
305ebc1e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
12 deletions
+40
-12
sql/sql_handler.cc
sql/sql_handler.cc
+40
-12
No files found.
sql/sql_handler.cc
View file @
f74f363a
...
@@ -65,11 +65,6 @@
...
@@ -65,11 +65,6 @@
static
enum
enum_ha_read_modes
rkey_to_rnext
[]
=
static
enum
enum_ha_read_modes
rkey_to_rnext
[]
=
{
RNEXT_SAME
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
,
RPREV
};
{
RNEXT_SAME
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
,
RPREV
};
#define HANDLER_TABLES_HACK(thd) { \
TABLE *tmp=thd->open_tables; \
thd->open_tables=thd->handler_tables; \
thd->handler_tables=tmp; }
static
int
mysql_ha_flush_table
(
THD
*
thd
,
TABLE
**
table_ptr
,
uint
mode_flags
);
static
int
mysql_ha_flush_table
(
THD
*
thd
,
TABLE
**
table_ptr
,
uint
mode_flags
);
...
@@ -187,6 +182,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
...
@@ -187,6 +182,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
char
*
db
,
*
name
,
*
alias
;
char
*
db
,
*
name
,
*
alias
;
uint
dblen
,
namelen
,
aliaslen
,
counter
;
uint
dblen
,
namelen
,
aliaslen
,
counter
;
int
error
;
int
error
;
TABLE
*
backup_open_tables
,
*
backup_handler_tables
;
DBUG_ENTER
(
"mysql_ha_open"
);
DBUG_ENTER
(
"mysql_ha_open"
);
DBUG_PRINT
(
"enter"
,(
"'%s'.'%s' as '%s' reopen: %d"
,
DBUG_PRINT
(
"enter"
,(
"'%s'.'%s' as '%s' reopen: %d"
,
tables
->
db
,
tables
->
table_name
,
tables
->
alias
,
tables
->
db
,
tables
->
table_name
,
tables
->
alias
,
...
@@ -215,17 +211,29 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
...
@@ -215,17 +211,29 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
}
}
}
}
/* save open_ and handler_ tables state */
backup_open_tables
=
thd
->
open_tables
;
backup_handler_tables
=
thd
->
handler_tables
;
/* no pre-opened tables */
thd
->
open_tables
=
NULL
;
/* to avoid flushes */
thd
->
handler_tables
=
NULL
;
/*
/*
open_tables() will set 'tables->table' if successful.
open_tables() will set 'tables->table' if successful.
It must be NULL for a real open when calling open_tables().
It must be NULL for a real open when calling open_tables().
*/
*/
DBUG_ASSERT
(
!
tables
->
table
);
DBUG_ASSERT
(
!
tables
->
table
);
HANDLER_TABLES_HACK
(
thd
);
/* for now HANDLER can be used only for real TABLES */
/* for now HANDLER can be used only for real TABLES */
tables
->
required_type
=
FRMTYPE_TABLE
;
tables
->
required_type
=
FRMTYPE_TABLE
;
error
=
open_tables
(
thd
,
&
tables
,
&
counter
,
0
);
error
=
open_tables
(
thd
,
&
tables
,
&
counter
,
0
);
HANDLER_TABLES_HACK
(
thd
);
/* restore the state and merge the opened table into handler_tables list */
thd
->
handler_tables
=
thd
->
open_tables
?
thd
->
open_tables
->
next
=
backup_handler_tables
,
thd
->
open_tables
:
backup_handler_tables
;
thd
->
open_tables
=
backup_open_tables
;
if
(
error
)
if
(
error
)
goto
err
;
goto
err
;
...
@@ -351,7 +359,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
...
@@ -351,7 +359,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
ha_rows
select_limit_cnt
,
ha_rows
offset_limit_cnt
)
ha_rows
select_limit_cnt
,
ha_rows
offset_limit_cnt
)
{
{
TABLE_LIST
*
hash_tables
;
TABLE_LIST
*
hash_tables
;
TABLE
*
table
;
TABLE
*
table
,
*
backup_open_tables
,
*
backup_handler_tables
;
MYSQL_LOCK
*
lock
;
MYSQL_LOCK
*
lock
;
List
<
Item
>
list
;
List
<
Item
>
list
;
Protocol
*
protocol
=
thd
->
protocol
;
Protocol
*
protocol
=
thd
->
protocol
;
...
@@ -361,7 +369,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
...
@@ -361,7 +369,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
uint
num_rows
;
uint
num_rows
;
uchar
*
key
;
uchar
*
key
;
uint
key_len
;
uint
key_len
;
bool
n
ot_used
;
bool
n
eed_reopen
;
DBUG_ENTER
(
"mysql_ha_read"
);
DBUG_ENTER
(
"mysql_ha_read"
);
DBUG_PRINT
(
"enter"
,(
"'%s'.'%s' as '%s'"
,
DBUG_PRINT
(
"enter"
,(
"'%s'.'%s' as '%s'"
,
tables
->
db
,
tables
->
table_name
,
tables
->
alias
));
tables
->
db
,
tables
->
table_name
,
tables
->
alias
));
...
@@ -375,6 +383,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
...
@@ -375,6 +383,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
List_iterator
<
Item
>
it
(
list
);
List_iterator
<
Item
>
it
(
list
);
it
++
;
it
++
;
retry:
if
((
hash_tables
=
(
TABLE_LIST
*
)
hash_search
(
&
thd
->
handler_tables_hash
,
if
((
hash_tables
=
(
TABLE_LIST
*
)
hash_search
(
&
thd
->
handler_tables_hash
,
(
uchar
*
)
tables
->
alias
,
(
uchar
*
)
tables
->
alias
,
strlen
(
tables
->
alias
)
+
1
)))
strlen
(
tables
->
alias
)
+
1
)))
...
@@ -428,9 +437,28 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
...
@@ -428,9 +437,28 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
}
}
tables
->
table
=
table
;
tables
->
table
=
table
;
HANDLER_TABLES_HACK
(
thd
);
/* save open_ and handler_ tables state */
lock
=
mysql_lock_tables
(
thd
,
&
tables
->
table
,
1
,
0
,
&
not_used
);
backup_open_tables
=
thd
->
open_tables
;
HANDLER_TABLES_HACK
(
thd
);
backup_handler_tables
=
thd
->
handler_tables
;
/* no pre-opened tables */
thd
->
open_tables
=
NULL
;
/* to avoid flushes */
thd
->
handler_tables
=
NULL
;
lock
=
mysql_lock_tables
(
thd
,
&
tables
->
table
,
1
,
MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN
,
&
need_reopen
);
/* restore previous context */
thd
->
handler_tables
=
backup_handler_tables
;
thd
->
open_tables
=
backup_open_tables
;
if
(
need_reopen
)
{
mysql_ha_close_table
(
thd
,
tables
);
hash_tables
->
table
=
NULL
;
goto
retry
;
}
if
(
!
lock
)
if
(
!
lock
)
goto
err0
;
// mysql_lock_tables() printed error message already
goto
err0
;
// mysql_lock_tables() printed error message already
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment