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
c01678bc
Commit
c01678bc
authored
May 19, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option --read-only (Thanks to Markus Benning)
parent
a46c0a7c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
9 deletions
+29
-9
myisam/myisamchk.c
myisam/myisamchk.c
+2
-1
sql/init.cc
sql/init.cc
+0
-2
sql/mysql_priv.h
sql/mysql_priv.h
+1
-2
sql/mysqld.cc
sql/mysqld.cc
+10
-4
sql/set_var.cc
sql/set_var.cc
+4
-0
sql/sql_parse.cc
sql/sql_parse.cc
+12
-0
No files found.
myisam/myisamchk.c
View file @
c01678bc
...
...
@@ -45,6 +45,7 @@ static const char *set_charset_name;
static
CHARSET_INFO
*
set_charset
;
static
long
opt_myisam_block_size
;
static
const
char
*
my_progname_short
;
static
int
stopwords_inited
=
0
;
static
const
char
*
type_names
[]
=
{
"?"
,
"char"
,
"binary"
,
"short"
,
"long"
,
"float"
,
...
...
@@ -861,7 +862,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
}
else
{
if
(
share
->
fulltext_index
)
if
(
share
->
fulltext_index
&&
!
stopwords_inited
++
)
ft_init_stopwords
();
if
(
!
(
param
->
testflag
&
T_READONLY
))
...
...
sql/init.cc
View file @
c01678bc
...
...
@@ -38,13 +38,11 @@ void unireg_init(ulong options)
init_my_atof
();
/* use our atof */
#endif
my_abort_hook
=
unireg_abort
;
/* Abort with close of databases */
f_fyllchar
=
' '
;
/* Input fill char */
VOID
(
strmov
(
reg_ext
,
".frm"
));
for
(
i
=
0
;
i
<
6
;
i
++
)
// YYMMDDHHMMSS
dayord
.
pos
[
i
]
=
i
;
specialflag
=
SPECIAL_SAME_DB_NAME
;
blob_newline
=
'^'
;
/* Convert newline in blobs to this */
/* Make a tab of powers of 10 */
for
(
i
=
0
,
nr
=
1.0
;
i
<
array_elements
(
log_10
)
;
i
++
)
{
/* It's used by filesort... */
...
...
sql/mysql_priv.h
View file @
c01678bc
...
...
@@ -627,7 +627,6 @@ extern char language[LIBLEN],reg_ext[FN_EXTLEN];
extern
char
glob_hostname
[
FN_REFLEN
],
mysql_home
[
FN_REFLEN
];
extern
char
pidfile_name
[
FN_REFLEN
],
time_zone
[
30
],
*
opt_init_file
;
extern
char
log_error_file
[
FN_REFLEN
];
extern
char
blob_newline
;
extern
double
log_10
[
32
];
extern
ulonglong
keybuff_size
;
extern
ulong
refresh_version
,
flush_version
,
thread_id
,
query_id
,
opened_tables
;
...
...
@@ -675,8 +674,8 @@ extern uint volatile thread_count, thread_running, global_read_lock;
extern
my_bool
opt_sql_bin_update
,
opt_safe_user_create
,
opt_no_mix_types
;
extern
my_bool
opt_safe_show_db
,
opt_local_infile
,
lower_case_table_names
;
extern
my_bool
opt_slave_compressed_protocol
,
use_temp_pool
;
extern
my_bool
opt_readonly
;
extern
my_bool
opt_enable_named_pipe
;
extern
char
f_fyllchar
;
extern
MYSQL_LOG
mysql_log
,
mysql_update_log
,
mysql_slow_log
,
mysql_bin_log
;
extern
FILE
*
bootstrap_file
;
...
...
sql/mysqld.cc
View file @
c01678bc
...
...
@@ -289,7 +289,7 @@ my_bool opt_enable_named_pipe= 0;
my_bool
opt_local_infile
,
opt_external_locking
,
opt_slave_compressed_protocol
;
uint
delay_key_write_options
=
(
uint
)
DELAY_KEY_WRITE_ON
;
static
bool
opt_do_pstack
=
0
;
static
my_
bool
opt_do_pstack
=
0
;
static
ulong
opt_specialflag
=
SPECIAL_ENGLISH
;
static
ulong
opt_myisam_block_size
;
...
...
@@ -306,6 +306,7 @@ my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
my_bool
lower_case_table_names
,
opt_old_rpl_compat
;
my_bool
opt_show_slave_auth_info
,
opt_sql_bin_update
=
0
;
my_bool
opt_log_slave_updates
=
0
,
opt_console
=
0
;
my_bool
opt_readonly
=
0
;
volatile
bool
mqh_used
=
0
;
FILE
*
bootstrap_file
=
0
;
...
...
@@ -376,7 +377,7 @@ const char *localhost=LOCAL_HOST;
const
char
*
delayed_user
=
"DELAYED"
;
uint
master_port
=
MYSQL_PORT
,
master_connect_retry
=
60
;
uint
report_port
=
MYSQL_PORT
;
bool
master_ssl
=
0
;
my_
bool
master_ssl
=
0
;
ulong
master_retry_count
=
0
;
ulong
bytes_sent
=
0L
,
bytes_received
=
0L
;
...
...
@@ -404,8 +405,7 @@ ulong slow_launch_threads = 0;
char
mysql_real_data_home
[
FN_REFLEN
],
language
[
LIBLEN
],
reg_ext
[
FN_EXTLEN
],
mysql_charsets_dir
[
FN_REFLEN
],
*
charsets_list
,
blob_newline
,
f_fyllchar
,
max_sort_char
,
*
mysqld_user
,
*
mysqld_chroot
,
*
opt_init_file
;
max_sort_char
,
*
mysqld_user
,
*
mysqld_chroot
,
*
opt_init_file
;
char
*
language_ptr
=
language
;
char
mysql_data_home_buff
[
2
],
*
mysql_data_home
=
mysql_real_data_home
;
#ifndef EMBEDDED_LIBRARY
...
...
@@ -3143,6 +3143,7 @@ enum options {
OPT_QUERY_CACHE_TYPE
,
OPT_RECORD_BUFFER
,
OPT_RECORD_RND_BUFFER
,
OPT_RELAY_LOG_SPACE_LIMIT
,
OPT_SLAVE_NET_TIMEOUT
,
OPT_SLAVE_COMPRESSED_PROTOCOL
,
OPT_SLOW_LAUNCH_TIME
,
OPT_READONLY
,
OPT_SORT_BUFFER
,
OPT_TABLE_CACHE
,
OPT_THREAD_CONCURRENCY
,
OPT_THREAD_CACHE_SIZE
,
OPT_TMP_TABLE_SIZE
,
OPT_THREAD_STACK
,
...
...
@@ -3927,6 +3928,11 @@ replicating a LOAD DATA INFILE command",
"Number of seconds to wait for more data from a master/slave connection before aborting the read."
,
(
gptr
*
)
&
slave_net_timeout
,
(
gptr
*
)
&
slave_net_timeout
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
SLAVE_NET_TIMEOUT
,
1
,
LONG_TIMEOUT
,
0
,
1
,
0
},
{
"read-only"
,
OPT_READONLY
,
"Make all tables readonly, with the expections for replications (slave) threads and users with the SUPER privilege"
,
(
gptr
*
)
&
opt_readonly
,
(
gptr
*
)
&
opt_readonly
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
1
,
0
,
1
,
0
},
{
"slow_launch_time"
,
OPT_SLOW_LAUNCH_TIME
,
"If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented."
,
(
gptr
*
)
&
slow_launch_time
,
(
gptr
*
)
&
slow_launch_time
,
0
,
GET_ULONG
,
...
...
sql/set_var.cc
View file @
c01678bc
...
...
@@ -204,6 +204,8 @@ sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol",
&
opt_slave_compressed_protocol
);
sys_var_long_ptr
sys_slave_net_timeout
(
"slave_net_timeout"
,
&
slave_net_timeout
);
sys_var_bool_ptr
sys_readonly
(
"read_only"
,
&
opt_readonly
);
sys_var_long_ptr
sys_slow_launch_time
(
"slow_launch_time"
,
&
slow_launch_time
);
sys_var_thd_ulong
sys_sort_buffer
(
"sort_buffer_size"
,
...
...
@@ -375,6 +377,7 @@ sys_var *sys_variables[]=
&
sys_slave_compressed_protocol
,
&
sys_slave_net_timeout
,
&
sys_slave_skip_counter
,
&
sys_readonly
,
&
sys_slow_launch_time
,
&
sys_sort_buffer
,
&
sys_sql_big_tables
,
...
...
@@ -522,6 +525,7 @@ struct show_var_st init_vars[]= {
#endif
/* HAVE_QUERY_CACHE */
{
sys_server_id
.
name
,
(
char
*
)
&
sys_server_id
,
SHOW_SYS
},
{
sys_slave_net_timeout
.
name
,(
char
*
)
&
sys_slave_net_timeout
,
SHOW_SYS
},
{
sys_readonly
.
name
,
(
char
*
)
&
sys_readonly
,
SHOW_SYS
},
{
"skip_external_locking"
,
(
char
*
)
&
my_disable_locking
,
SHOW_MY_BOOL
},
{
"skip_networking"
,
(
char
*
)
&
opt_disable_networking
,
SHOW_BOOL
},
{
"skip_show_database"
,
(
char
*
)
&
opt_skip_show_db
,
SHOW_BOOL
},
...
...
sql/sql_parse.cc
View file @
c01678bc
...
...
@@ -1330,6 +1330,18 @@ mysql_execute_command(void)
!
tables_ok
(
thd
,
tables
)))
DBUG_VOID_RETURN
;
/*
When option readonly is set deny operations which change tables.
Except for the replication thread and the 'super' users.
*/
if
(
opt_readonly
&&
!
(
thd
->
slave_thread
||
(
thd
->
master_access
&
SUPER_ACL
))
&&
(
uc_update_queries
[
lex
->
sql_command
]
>
0
))
{
send_error
(
&
thd
->
net
,
ER_CANT_UPDATE_WITH_READLOCK
);
DBUG_VOID_RETURN
;
}
statistic_increment
(
com_stat
[
lex
->
sql_command
],
&
LOCK_status
);
switch
(
lex
->
sql_command
)
{
case
SQLCOM_SELECT
:
...
...
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