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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
0eb46e42
Commit
0eb46e42
authored
Dec 20, 2001
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix insert delated + query cache.
Fix pthread_mutex_trylock on HPUX (needed for query cache).
parent
b1291364
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
80 additions
and
9 deletions
+80
-9
include/my_pthread.h
include/my_pthread.h
+2
-0
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+5
-5
mysql-test/r/query_cache.result
mysql-test/r/query_cache.result
+31
-0
mysql-test/t/query_cache.test
mysql-test/t/query_cache.test
+20
-0
mysys/my_pthread.c
mysys/my_pthread.c
+14
-0
sql/repl_failsafe.cc
sql/repl_failsafe.cc
+6
-4
sql/sql_insert.cc
sql/sql_insert.cc
+2
-0
No files found.
include/my_pthread.h
View file @
0eb46e42
...
@@ -448,8 +448,10 @@ struct hostent *my_gethostbyname_r(const char *name,
...
@@ -448,8 +448,10 @@ struct hostent *my_gethostbyname_r(const char *name,
#if defined(HPUX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
#if defined(HPUX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
#define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c))
#define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c))
#define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a))
int
my_pthread_cond_timedwait
(
pthread_cond_t
*
cond
,
pthread_mutex_t
*
mutex
,
int
my_pthread_cond_timedwait
(
pthread_cond_t
*
cond
,
pthread_mutex_t
*
mutex
,
struct
timespec
*
abstime
);
struct
timespec
*
abstime
);
int
my_pthread_mutex_trylock
(
pthread_mutex_t
*
mutex
);
#endif
#endif
/* safe_mutex adds checking to mutex for easier debugging */
/* safe_mutex adds checking to mutex for easier debugging */
...
...
mysql-test/mysql-test-run.sh
View file @
0eb46e42
...
@@ -674,9 +674,9 @@ manager_term()
...
@@ -674,9 +674,9 @@ manager_term()
ident
=
$1
ident
=
$1
shift
shift
if
[
$USE_MANAGER
=
0
]
;
then
if
[
$USE_MANAGER
=
0
]
;
then
$MYSQLADMIN
--no-defaults
-uroot
--socket
=
$MYSQL_TMP_DIR
/
$ident
.sock
-O
\
$MYSQLADMIN
--no-defaults
-uroot
--socket
=
$MYSQL_TMP_DIR
/
$ident
.sock
-O
\
connect_timeout
=
5
-O
shutdown_timeout
=
20 shutdown
>
/dev/null 2>&1
connect_timeout
=
5
-O
shutdown_timeout
=
20 shutdown
>
/dev/null 2>&1
return
return
fi
fi
$MYSQL_MANAGER_CLIENT
$MANAGER_QUIET_OPT
--user
=
$MYSQL_MANAGER_USER
\
$MYSQL_MANAGER_CLIENT
$MANAGER_QUIET_OPT
--user
=
$MYSQL_MANAGER_USER
\
--password
=
$MYSQL_MANAGER_PW
--port
=
$MYSQL_MANAGER_PORT
<<
EOF
--password
=
$MYSQL_MANAGER_PW
--port
=
$MYSQL_MANAGER_PORT
<<
EOF
...
@@ -774,7 +774,7 @@ EOF
...
@@ -774,7 +774,7 @@ EOF
else
else
manager_launch master
$MYSQLD
$master_args
manager_launch master
$MYSQLD
$master_args
fi
fi
sleep_until_file_exists
$MASTER_MY
SOCK
$wait_for_master
sleep_until_file_exists
$MASTER_MY
PID
$wait_for_master
wait_for_master
=
$SLEEP_TIME_FOR_SECOND_MASTER
wait_for_master
=
$SLEEP_TIME_FOR_SECOND_MASTER
MASTER_RUNNING
=
1
MASTER_RUNNING
=
1
}
}
...
@@ -874,7 +874,7 @@ start_slave()
...
@@ -874,7 +874,7 @@ start_slave()
manager_launch
$slave_ident
$SLAVE_MYSQLD
$slave_args
manager_launch
$slave_ident
$SLAVE_MYSQLD
$slave_args
fi
fi
eval
"SLAVE
$1_RUNNING
=1"
eval
"SLAVE
$1_RUNNING
=1"
sleep_until_file_exists
$slave_
sock
$wait_for_slave
sleep_until_file_exists
$slave_
pid
$wait_for_slave
wait_for_slave
=
$SLEEP_TIME_FOR_SECOND_SLAVE
wait_for_slave
=
$SLEEP_TIME_FOR_SECOND_SLAVE
}
}
...
...
mysql-test/r/query_cache.result
View file @
0eb46e42
...
@@ -376,3 +376,34 @@ show status like "Qcache_queries_in_cache";
...
@@ -376,3 +376,34 @@ show status like "Qcache_queries_in_cache";
Variable_name Value
Variable_name Value
Qcache_queries_in_cache 2
Qcache_queries_in_cache 2
drop table t1;
drop table t1;
flush query cache;
reset query cache;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
select * from t1;
a
1
2
3
select * from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
insert delayed into t1 values (4);
select a from t1;
a
1
2
3
4
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
drop table t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
mysql-test/t/query_cache.test
View file @
0eb46e42
...
@@ -247,6 +247,7 @@ select * from foo.t1;
...
@@ -247,6 +247,7 @@ select * from foo.t1;
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_queries_in_cache"
;
drop
database
foo
;
drop
database
foo
;
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_queries_in_cache"
;
#
#
# Charset convertion (cp1251_koi8 always present)
# Charset convertion (cp1251_koi8 always present)
#
#
...
@@ -263,3 +264,22 @@ drop table t1;
...
@@ -263,3 +264,22 @@ drop table t1;
# machines :(
# machines :(
#show variables like "query_cache_size";
#show variables like "query_cache_size";
#show status like "Qcache_free_memory";
#show status like "Qcache_free_memory";
#
# Test insert delayed
#
flush
query
cache
;
reset
query
cache
;
create
table
t1
(
a
int
not
null
);
insert
into
t1
values
(
1
),(
2
),(
3
);
select
*
from
t1
;
select
*
from
t1
;
show
status
like
"Qcache_queries_in_cache"
;
insert
delayed
into
t1
values
(
4
);
--
sleep
5
# Wait for insert delayed to be executed.
select
a
from
t1
;
show
status
like
"Qcache_queries_in_cache"
;
drop
table
t1
;
show
status
like
"Qcache_queries_in_cache"
;
mysys/my_pthread.c
View file @
0eb46e42
...
@@ -471,6 +471,8 @@ struct hostent *my_gethostbyname_r(const char *name,
...
@@ -471,6 +471,8 @@ struct hostent *my_gethostbyname_r(const char *name,
this has to be added here.
this has to be added here.
*****************************************************************************/
*****************************************************************************/
#ifdef HPUX
int
my_pthread_cond_timedwait
(
pthread_cond_t
*
cond
,
pthread_mutex_t
*
mutex
,
int
my_pthread_cond_timedwait
(
pthread_cond_t
*
cond
,
pthread_mutex_t
*
mutex
,
struct
timespec
*
abstime
)
struct
timespec
*
abstime
)
{
{
...
@@ -483,6 +485,18 @@ int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
...
@@ -483,6 +485,18 @@ int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
}
}
int
my_pthread_mutex_trylock
(
pthread_mutex_t
*
mutex
)
{
int
error
=
pthread_mutex_trylock
(
mutex
);
if
(
error
==
1
)
/* Safety if the lib is fixed */
return
0
;
/* Mutex was locked */
if
(
error
==
-
1
)
/* Safety if the lib is fixed */
error
=
errno
;
return
error
;
}
#endif
/* Some help functions */
/* Some help functions */
int
pthread_no_free
(
void
*
not_used
__attribute__
((
unused
)))
int
pthread_no_free
(
void
*
not_used
__attribute__
((
unused
)))
...
...
sql/repl_failsafe.cc
View file @
0eb46e42
...
@@ -191,10 +191,12 @@ void init_slave_list()
...
@@ -191,10 +191,12 @@ void init_slave_list()
void
end_slave_list
()
void
end_slave_list
()
{
{
pthread_mutex_lock
(
&
LOCK_slave_list
);
/* No protection by a mutex needed as we are only called at shutdown */
hash_free
(
&
slave_list
);
if
(
hash_inited
(
&
slave_list
))
pthread_mutex_unlock
(
&
LOCK_slave_list
);
{
pthread_mutex_destroy
(
&
LOCK_slave_list
);
hash_free
(
&
slave_list
);
pthread_mutex_destroy
(
&
LOCK_slave_list
);
}
}
}
static
int
find_target_pos
(
LEX_MASTER_INFO
*
mi
,
IO_CACHE
*
log
,
char
*
errmsg
)
static
int
find_target_pos
(
LEX_MASTER_INFO
*
mi
,
IO_CACHE
*
log
,
char
*
errmsg
)
...
...
sql/sql_insert.cc
View file @
0eb46e42
...
@@ -1227,6 +1227,7 @@ bool delayed_insert::handle_inserts(void)
...
@@ -1227,6 +1227,7 @@ bool delayed_insert::handle_inserts(void)
sql_print_error
(
"%s"
,
thd
.
net
.
last_error
);
sql_print_error
(
"%s"
,
thd
.
net
.
last_error
);
goto
err
;
goto
err
;
}
}
query_cache
.
invalidate
(
table
);
if
(
thr_reschedule_write_lock
(
*
thd
.
lock
->
locks
))
if
(
thr_reschedule_write_lock
(
*
thd
.
lock
->
locks
))
{
{
/* This should never happen */
/* This should never happen */
...
@@ -1251,6 +1252,7 @@ bool delayed_insert::handle_inserts(void)
...
@@ -1251,6 +1252,7 @@ bool delayed_insert::handle_inserts(void)
sql_print_error
(
"%s"
,
thd
.
net
.
last_error
);
sql_print_error
(
"%s"
,
thd
.
net
.
last_error
);
goto
err
;
goto
err
;
}
}
query_cache
.
invalidate
(
table
);
pthread_mutex_lock
(
&
mutex
);
pthread_mutex_lock
(
&
mutex
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
...
...
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