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
775b1c06
Commit
775b1c06
authored
May 26, 2006
by
osku
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add max_row_size to dict_table_t.
parent
ff38fefd
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
0 deletions
+70
-0
data/data0type.c
data/data0type.c
+33
-0
dict/dict0dict.c
dict/dict0dict.c
+19
-0
dict/dict0mem.c
dict/dict0mem.c
+2
-0
include/data0type.h
include/data0type.h
+10
-0
include/dict0mem.h
include/dict0mem.h
+6
-0
No files found.
data/data0type.c
View file @
775b1c06
...
...
@@ -293,3 +293,36 @@ dtype_print(
fprintf
(
stderr
,
" len %lu prec %lu"
,
(
ulong
)
len
,
(
ulong
)
type
->
prec
);
}
/***************************************************************************
Returns the maximum size of a data type. Note: types in system tables may be
incomplete and return incorrect information. */
UNIV_INLINE
ulint
dtype_get_max_size
(
/*===============*/
/* out: maximum size (ULINT_MAX for
unbounded types) */
const
dtype_t
*
type
)
/* in: type */
{
switch
(
type
->
mtype
)
{
case
DATA_SYS
:
case
DATA_CHAR
:
case
DATA_FIXBINARY
:
case
DATA_INT
:
case
DATA_FLOAT
:
case
DATA_DOUBLE
:
case
DATA_MYSQL
:
case
DATA_VARCHAR
:
case
DATA_BINARY
:
case
DATA_DECIMAL
:
case
DATA_VARMYSQL
:
return
(
type
->
len
);
case
DATA_BLOB
:
return
(
ULINT_MAX
);
default:
ut_error
;
}
return
(
ULINT_MAX
);
}
dict/dict0dict.c
View file @
775b1c06
...
...
@@ -861,6 +861,7 @@ dict_table_add_to_cache(
ulint
fold
;
ulint
id_fold
;
ulint
i
;
ulint
row_len
;
ut_ad
(
table
);
#ifdef UNIV_SYNC_DEBUG
...
...
@@ -908,6 +909,24 @@ dict_table_add_to_cache(
#error "DATA_N_SYS_COLS != 4"
#endif
row_len
=
0
;
for
(
i
=
0
;
i
<
table
->
n_def
;
i
++
)
{
ulint
col_len
=
dtype_get_max_size
(
dict_col_get_type
(
dict_table_get_nth_col
(
table
,
i
)));
/* If we have a single unbounded field, or several gigantic
fields, mark the maximum row size as ULINT_MAX. */
if
(
ut_max
(
col_len
,
row_len
)
>=
(
ULINT_MAX
/
2
))
{
row_len
=
ULINT_MAX
;
break
;
}
row_len
+=
col_len
;
}
table
->
max_row_size
=
row_len
;
/* Look for a table with the same name: error if such exists */
{
dict_table_t
*
table2
;
...
...
dict/dict0mem.c
View file @
775b1c06
...
...
@@ -82,6 +82,8 @@ dict_mem_table_create(
table
->
stat_modified_counter
=
0
;
table
->
max_row_size
=
0
;
mutex_create
(
&
table
->
autoinc_mutex
,
SYNC_DICT_AUTOINC_MUTEX
);
table
->
autoinc_inited
=
FALSE
;
...
...
include/data0type.h
View file @
775b1c06
...
...
@@ -330,6 +330,16 @@ dtype_get_min_size(
/* out: minimum size */
const
dtype_t
*
type
);
/* in: type */
/***************************************************************************
Returns the maximum size of a data type. Note: types in system tables may be
incomplete and return incorrect information. */
UNIV_INLINE
ulint
dtype_get_max_size
(
/*===============*/
/* out: maximum size (ULINT_MAX for
unbounded types) */
const
dtype_t
*
type
);
/* in: type */
/***************************************************************************
Returns a stored SQL NULL size for a type. For fixed length types it is
the fixed length of the type, otherwise 0. */
UNIV_INLINE
...
...
include/dict0mem.h
View file @
775b1c06
...
...
@@ -341,6 +341,12 @@ struct dict_table_struct{
had an IX lock on */
UT_LIST_BASE_NODE_T
(
lock_t
)
locks
;
/* list of locks on the table */
ulint
max_row_size
;
/* maximum size of a single row in the
table, not guaranteed to be especially
accurate. it's ULINT_MAX if there are
unbounded variable-width fields. initialized
in dict_table_add_to_cache. */
/*----------------------*/
ibool
does_not_fit_in_memory
;
/* this field is used to specify in simulations
...
...
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