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
a9e31951
Commit
a9e31951
authored
May 22, 2001
by
tim@threads.polyesthetic.msg
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql-4.0
into threads.polyesthetic.msg:/usr/local/src/my/4
parents
8fc6d351
15c50abd
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
549 additions
and
282 deletions
+549
-282
Docs/manual.texi
Docs/manual.texi
+311
-263
innobase/dict/dict0dict.c
innobase/dict/dict0dict.c
+67
-0
innobase/dict/dict0mem.c
innobase/dict/dict0mem.c
+5
-0
innobase/include/dict0dict.h
innobase/include/dict0dict.h
+26
-0
innobase/include/dict0mem.h
innobase/include/dict0mem.h
+10
-0
innobase/include/os0file.h
innobase/include/os0file.h
+13
-5
innobase/include/sync0sync.h
innobase/include/sync0sync.h
+1
-0
innobase/include/univ.i
innobase/include/univ.i
+6
-0
innobase/os/os0file.c
innobase/os/os0file.c
+37
-7
innobase/srv/srv0start.c
innobase/srv/srv0start.c
+25
-4
innobase/sync/sync0sync.c
innobase/sync/sync0sync.c
+2
-0
mysys/getvar.c
mysys/getvar.c
+1
-1
sql/ha_innobase.cc
sql/ha_innobase.cc
+36
-2
sql/sql_parse.cc
sql/sql_parse.cc
+9
-0
No files found.
Docs/manual.texi
View file @
a9e31951
This diff is collapsed.
Click to expand it.
innobase/dict/dict0dict.c
View file @
a9e31951
...
...
@@ -235,6 +235,71 @@ dict_table_get_index_noninline(
return
(
dict_table_get_index
(
table
,
name
));
}
/************************************************************************
Initializes the autoinc counter. It is not an error to initialize already
initialized counter. */
void
dict_table_autoinc_initialize
(
/*==========================*/
dict_table_t
*
table
,
/* in: table */
ib_longlong
value
)
/* in: value which was assigned to a row */
{
mutex_enter
(
&
(
table
->
autoinc_mutex
));
table
->
autoinc_inited
=
TRUE
;
table
->
autoinc
=
value
;
mutex_exit
(
&
(
table
->
autoinc_mutex
));
}
/************************************************************************
Gets the next autoinc value, 0 if not yet initialized. */
ib_longlong
dict_table_autoinc_get
(
/*===================*/
/* out: value for a new row, or 0 */
dict_table_t
*
table
)
/* in: table */
{
ib_longlong
value
;
mutex_enter
(
&
(
table
->
autoinc_mutex
));
if
(
!
table
->
autoinc_inited
)
{
value
=
0
;
}
else
{
table
->
autoinc
=
table
->
autoinc
+
1
;
value
=
table
->
autoinc
;
}
mutex_exit
(
&
(
table
->
autoinc_mutex
));
return
(
value
);
}
/************************************************************************
Updates the autoinc counter if the value supplied is bigger than the
current value. If not inited, does nothing. */
void
dict_table_autoinc_update
(
/*======================*/
dict_table_t
*
table
,
/* in: table */
ib_longlong
value
)
/* in: value which was assigned to a row */
{
mutex_enter
(
&
(
table
->
autoinc_mutex
));
if
(
table
->
autoinc_inited
)
{
if
(
value
>
table
->
autoinc
)
{
table
->
autoinc
=
value
;
}
}
mutex_exit
(
&
(
table
->
autoinc_mutex
));
}
/************************************************************************
Looks for column n in an index. */
...
...
@@ -568,6 +633,8 @@ dict_table_remove_from_cache(
/* Remove table from LRU list of tables */
UT_LIST_REMOVE
(
table_LRU
,
dict_sys
->
table_LRU
,
table
);
mutex_free
(
&
(
table
->
autoinc_mutex
));
size
=
mem_heap_get_size
(
table
->
heap
);
ut_ad
(
dict_sys
->
size
>=
size
);
...
...
innobase/dict/dict0mem.c
View file @
a9e31951
...
...
@@ -71,6 +71,11 @@ dict_mem_table_create(
table
->
stat_modif_counter
=
0
;
mutex_create
(
&
(
table
->
autoinc_mutex
));
mutex_set_level
(
&
(
table
->
autoinc_mutex
),
SYNC_DICT_AUTOINC_MUTEX
);
table
->
autoinc_inited
=
FALSE
;
table
->
magic_n
=
DICT_TABLE_MAGIC_N
;
return
(
table
);
...
...
innobase/include/dict0dict.h
View file @
a9e31951
...
...
@@ -88,6 +88,32 @@ ulint
dict_col_get_clust_pos
(
/*===================*/
dict_col_t
*
col
);
/************************************************************************
Initializes the autoinc counter. It is not an error to initialize already
initialized counter. */
void
dict_table_autoinc_initialize
(
/*==========================*/
dict_table_t
*
table
,
/* in: table */
ib_longlong
value
);
/* in: value which was assigned to a row */
/************************************************************************
Gets the next autoinc value, 0 if not yet initialized. */
ib_longlong
dict_table_autoinc_get
(
/*===================*/
/* out: value for a new row, or 0 */
dict_table_t
*
table
);
/* in: table */
/************************************************************************
Updates the autoinc counter if the value supplied is bigger than the
current value. If not inited, does nothing. */
void
dict_table_autoinc_update
(
/*======================*/
dict_table_t
*
table
,
/* in: table */
ib_longlong
value
);
/* in: value which was assigned to a row */
/**************************************************************************
Adds a table object to the dictionary cache. */
...
...
innobase/include/dict0mem.h
View file @
a9e31951
...
...
@@ -302,6 +302,16 @@ struct dict_table_struct{
for MySQL SHOW TABLE STATUS; this counter
is not protected by any latch, because this
is only used for heuristics */
/*----------------------*/
mutex_t
autoinc_mutex
;
/* mutex protecting the autoincrement
counter */
ibool
autoinc_inited
;
/* TRUE if the autoinc counter has been
inited; MySQL gets the init value by executing
SELECT MAX(auto inc column) */
ib_longlong
autoinc
;
/* autoinc counter value already given to
a row */
ulint
magic_n
;
/* magic number */
};
#define DICT_TABLE_MAGIC_N 76333786
...
...
innobase/include/os0file.h
View file @
a9e31951
...
...
@@ -13,12 +13,10 @@ Created 10/21/1995 Heikki Tuuri
#ifdef __WIN__
#if (defined(__NT__) || defined(__WIN2000__))
/* We define always WIN_ASYNC_IO, and check at run-time whether
the OS actually supports it: Win 95 does not, NT does. */
#define WIN_ASYNC_IO
#endif
#define UNIV_NON_BUFFERED_IO
#else
...
...
@@ -100,7 +98,17 @@ log. */
requests in a batch, and only after that
wake the i/o-handler thread; this has
effect only in simulated aio */
#define OS_WIN31 1
#define OS_WIN95 2
#define OS_WINNT 3
/***************************************************************************
Gets the operating system version. Currently works only on Windows. */
ulint
os_get_os_version
(
void
);
/*===================*/
/* out: OS_WIN95, OS_WIN31, OS_WINNT (2000 == NT) */
/********************************************************************
Opens an existing file or creates a new. */
...
...
innobase/include/sync0sync.h
View file @
a9e31951
...
...
@@ -372,6 +372,7 @@ Memory pool mutex */
latching order checking */
#define SYNC_LEVEL_NONE 2000
/* default: level not defined */
#define SYNC_DICT 1000
#define SYNC_DICT_AUTOINC_MUTEX 999
#define SYNC_PURGE_IS_RUNNING 997
#define SYNC_DICT_HEADER 995
#define SYNC_IBUF_HEADER 914
...
...
innobase/include/univ.i
View file @
a9e31951
...
...
@@ -155,6 +155,12 @@ typedef unsigned long int ulint;
typedef
long
int
lint
;
#
ifdef
__WIN__
typedef
__int64
ib_longlong
;
#
else
typedef
longlong
ib_longlong
;
#
endif
/* The following type should be at least a 64-bit floating point number */
typedef
double
utfloat
;
...
...
innobase/os/os0file.c
View file @
a9e31951
...
...
@@ -103,6 +103,38 @@ os_aio_array_t* os_aio_sync_array = NULL;
ulint
os_aio_n_segments
=
ULINT_UNDEFINED
;
/***************************************************************************
Gets the operating system version. Currently works only on Windows. */
ulint
os_get_os_version
(
void
)
/*===================*/
/* out: OS_WIN95, OS_WIN31, OS_WINNT (2000 == NT) */
{
#ifdef __WIN__
OSVERSIONINFO
os_info
;
os_info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFO
);
ut_a
(
GetVersionEx
(
&
os_info
));
if
(
os_info
.
dwPlatformId
==
VER_PLATFORM_WIN32s
)
{
return
(
OS_WIN31
);
}
else
if
(
os_info
.
dwPlatformId
==
VER_PLATFORM_WIN32_WINDOWS
)
{
return
(
OS_WIN95
);
}
else
if
(
os_info
.
dwPlatformId
==
VER_PLATFORM_WIN32_NT
)
{
return
(
OS_WINNT
);
}
else
{
ut_error
;
return
(
0
);
}
#else
ut_error
;
return
(
0
);
#endif
}
/***************************************************************************
Retrieves the last error number if an error occurs in a file io function.
The number should be retrieved before any other OS calls (because they may
...
...
@@ -438,13 +470,13 @@ os_file_set_size(
byte
*
buf
;
try_again:
/* We use a very big
16 MB buffer in writing because Linux is
/* We use a very big
8 MB buffer in writing because Linux may be
extremely slow in fdatasync on 1 MB writes */
buf
=
ut_malloc
(
UNIV_PAGE_SIZE
*
1024
);
buf
=
ut_malloc
(
UNIV_PAGE_SIZE
*
512
);
/* Write buffer full of zeros */
for
(
i
=
0
;
i
<
UNIV_PAGE_SIZE
*
1024
;
i
++
)
{
for
(
i
=
0
;
i
<
UNIV_PAGE_SIZE
*
512
;
i
++
)
{
buf
[
i
]
=
'\0'
;
}
...
...
@@ -456,10 +488,10 @@ os_file_set_size(
UT_NOT_USED
(
size_high
);
#endif
while
(
offset
<
low
)
{
if
(
low
-
offset
<
UNIV_PAGE_SIZE
*
1024
)
{
if
(
low
-
offset
<
UNIV_PAGE_SIZE
*
512
)
{
n_bytes
=
low
-
offset
;
}
else
{
n_bytes
=
UNIV_PAGE_SIZE
*
1024
;
n_bytes
=
UNIV_PAGE_SIZE
*
512
;
}
ret
=
os_file_write
(
name
,
file
,
buf
,
offset
,
0
,
n_bytes
);
...
...
@@ -475,8 +507,6 @@ os_file_set_size(
ret
=
os_file_flush
(
file
);
fsync
(
file
);
if
(
ret
)
{
return
(
TRUE
);
}
...
...
innobase/srv/srv0start.c
View file @
a9e31951
...
...
@@ -549,11 +549,19 @@ innobase_start_or_create_for_mysql(void)
srv_n_file_io_threads
=
4
;
#endif
#ifdef WIN_ASYNC_IO
/* On NT always use aio */
os_aio_use_native_aio
=
TRUE
;
#endif
#ifdef __WIN__
if
(
os_get_os_version
()
==
OS_WIN95
||
os_get_os_version
()
==
OS_WIN31
)
{
/* On Win 95, 98, ME, and Win32 subsystem for Windows 3.1 use
simulated aio */
os_aio_use_native_aio
=
FALSE
;
srv_n_file_io_threads
=
4
;
}
else
{
/* On NT and Win 2000 always use aio */
os_aio_use_native_aio
=
TRUE
;
}
#endif
if
(
!
os_aio_use_native_aio
)
{
os_aio_init
(
4
*
SRV_N_PENDING_IOS_PER_THREAD
*
srv_n_file_io_threads
,
...
...
@@ -600,6 +608,19 @@ innobase_start_or_create_for_mysql(void)
return
(
DB_ERROR
);
}
sum_of_new_sizes
=
0
;
for
(
i
=
0
;
i
<
srv_n_data_files
;
i
++
)
{
sum_of_new_sizes
+=
srv_data_file_sizes
[
i
];
}
if
(
sum_of_new_sizes
<
640
)
{
fprintf
(
stderr
,
"InnoDB: Error: tablespace size must be at least 10 MB
\n
"
);
return
(
DB_ERROR
);
}
err
=
open_or_create_data_files
(
&
create_new_db
,
&
min_flushed_lsn
,
&
min_arch_log_no
,
&
max_flushed_lsn
,
&
max_arch_log_no
,
...
...
innobase/sync/sync0sync.c
View file @
a9e31951
...
...
@@ -1001,6 +1001,8 @@ sync_thread_add_level(
&&
!
sync_thread_levels_contain
(
array
,
SYNC_IBUF_MUTEX
)
&&
!
sync_thread_levels_contain
(
array
,
SYNC_IBUF_PESS_INSERT_MUTEX
));
}
else
if
(
level
==
SYNC_DICT_AUTOINC_MUTEX
)
{
ut_a
(
sync_thread_levels_g
(
array
,
SYNC_DICT_AUTOINC_MUTEX
));
}
else
if
(
level
==
SYNC_DICT_HEADER
)
{
ut_a
(
sync_thread_levels_g
(
array
,
SYNC_DICT_HEADER
));
}
else
if
(
level
==
SYNC_PURGE_IS_RUNNING
)
{
...
...
mysys/getvar.c
View file @
a9e31951
...
...
@@ -87,7 +87,7 @@ my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars)
DBUG_RETURN
(
1
);
}
num
=
atoll
(
end
);
endchar
=
strend
(
end
)[
-
1
];
num
=
strtoll
(
end
,
(
char
**
)
NULL
,
10
);
endchar
=
strend
(
end
)[
-
1
];
if
(
endchar
==
'k'
||
endchar
==
'K'
)
num
*=
1024
;
else
if
(
endchar
==
'm'
||
endchar
==
'M'
)
...
...
sql/ha_innobase.cc
View file @
a9e31951
...
...
@@ -1242,7 +1242,8 @@ ha_innobase::write_row(
{
row_prebuilt_t
*
prebuilt
=
(
row_prebuilt_t
*
)
innobase_prebuilt
;
int
error
;
longlong
auto_inc
;
DBUG_ENTER
(
"ha_innobase::write_row"
);
statistic_increment
(
ha_write_count
,
&
LOCK_status
);
...
...
@@ -1261,10 +1262,43 @@ ha_innobase::write_row(
make sure all columns are fetched in the select done by
update_auto_increment */
prebuilt
->
in_update_remember_pos
=
FALSE
;
/* Fetch the value the user possibly has set in the
autoincrement field */
auto_inc
=
table
->
next_number_field
->
val_int
();
if
(
auto_inc
!=
0
)
{
/* This call will calculate the max of the
current value and the value supplied by the user, if
the auto_inc counter is already initialized
for the table */
dict_table_autoinc_update
(
prebuilt
->
table
,
auto_inc
);
}
else
{
auto_inc
=
dict_table_autoinc_get
(
prebuilt
->
table
);
/* If auto_inc is now != 0 the autoinc counter
was already initialized for the table: we can give
the new value for MySQL to place in the field */
if
(
auto_inc
!=
0
)
{
user_thd
->
next_insert_id
=
auto_inc
;
}
}
prebuilt
->
in_update_remember_pos
=
FALSE
;
update_auto_increment
();
if
(
auto_inc
==
0
)
{
/* The autoinc counter for our table was not yet
initialized, initialize it now */
auto_inc
=
table
->
next_number_field
->
val_int
();
dict_table_autoinc_initialize
(
prebuilt
->
table
,
auto_inc
);
}
/* We have to set sql_stat_start to TRUE because
update_auto_increment has called a select, and
has reset that flag; row_insert_for_mysql has to
...
...
sql/sql_parse.cc
View file @
a9e31951
...
...
@@ -1864,6 +1864,15 @@ mysql_execute_command(void)
}
if
(
check_db_used
(
thd
,
tables
)
||
end_active_trans
(
thd
))
goto
error
;
for
(
TABLE_LIST
*
tmp
=
tables
;
tmp
;
tmp
=
tmp
->
next
)
{
if
(
!
(
tmp
->
lock_type
==
TL_READ_NO_INSERT
?
!
check_table_access
(
thd
,
SELECT_ACL
,
tmp
)
:
(
!
check_table_access
(
thd
,
INSERT_ACL
,
tmp
)
||
!
check_table_access
(
thd
,
UPDATE_ACL
,
tmp
)
||
!
check_table_access
(
thd
,
DELETE_ACL
,
tmp
))))
goto
error
;
}
thd
->
in_lock_tables
=
1
;
if
(
!
(
res
=
open_and_lock_tables
(
thd
,
tables
)))
{
...
...
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