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
8c24ad9e
Commit
8c24ad9e
authored
Feb 27, 2008
by
sunny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/innodb+: Merge revisions 2315:2322 from branches/zip
parent
70684a3d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
108 additions
and
20 deletions
+108
-20
handler/i_s.cc
handler/i_s.cc
+11
-0
ibuf/ibuf0ibuf.c
ibuf/ibuf0ibuf.c
+12
-2
include/db0err.h
include/db0err.h
+8
-8
include/ibuf0ibuf.h
include/ibuf0ibuf.h
+2
-2
page/page0zip.c
page/page0zip.c
+75
-8
No files found.
handler/i_s.cc
View file @
8c24ad9e
...
@@ -1033,6 +1033,14 @@ static ST_FIELD_INFO i_s_zip_fields_info[] =
...
@@ -1033,6 +1033,14 @@ static ST_FIELD_INFO i_s_zip_fields_info[] =
STRUCT_FLD
(
old_name
,
"Currently in Use"
),
STRUCT_FLD
(
old_name
,
"Currently in Use"
),
STRUCT_FLD
(
open_method
,
SKIP_OPEN_TABLE
)},
STRUCT_FLD
(
open_method
,
SKIP_OPEN_TABLE
)},
{
STRUCT_FLD
(
field_name
,
"free"
),
STRUCT_FLD
(
field_length
,
21
),
STRUCT_FLD
(
field_type
,
MYSQL_TYPE_LONG
),
STRUCT_FLD
(
value
,
0
),
STRUCT_FLD
(
field_flags
,
0
),
STRUCT_FLD
(
old_name
,
"Currently Available"
),
STRUCT_FLD
(
open_method
,
SKIP_OPEN_TABLE
)},
END_OF_ST_FIELD_INFO
END_OF_ST_FIELD_INFO
};
};
...
@@ -1096,6 +1104,9 @@ i_s_zip_fill_low(
...
@@ -1096,6 +1104,9 @@ i_s_zip_fill_low(
table
->
field
[
4
]
->
store
(
0
);
table
->
field
[
4
]
->
store
(
0
);
}
}
table
->
field
[
5
]
->
store
(
buf_buddy_used
[
x
]);
table
->
field
[
5
]
->
store
(
buf_buddy_used
[
x
]);
table
->
field
[
6
]
->
store
(
UNIV_LIKELY
(
x
<
BUF_BUDDY_SIZES
)
?
UT_LIST_GET_LEN
(
buf_pool
->
zip_free
[
x
])
:
0
);
if
(
schema_table_store_record
(
thd
,
table
))
{
if
(
schema_table_store_record
(
thd
,
table
))
{
status
=
1
;
status
=
1
;
...
...
ibuf/ibuf0ibuf.c
View file @
8c24ad9e
...
@@ -955,8 +955,8 @@ UNIV_INTERN
...
@@ -955,8 +955,8 @@ UNIV_INTERN
void
void
ibuf_update_free_bits_zip
(
ibuf_update_free_bits_zip
(
/*======================*/
/*======================*/
const
buf_block_t
*
block
,
/* in
: index page */
buf_block_t
*
block
,
/* in/out
: index page */
mtr_t
*
mtr
)
/* in/out: mtr */
mtr_t
*
mtr
)
/* in/out: mtr */
{
{
page_t
*
bitmap_page
;
page_t
*
bitmap_page
;
ulint
space
;
ulint
space
;
...
@@ -974,6 +974,16 @@ ibuf_update_free_bits_zip(
...
@@ -974,6 +974,16 @@ ibuf_update_free_bits_zip(
bitmap_page
=
ibuf_bitmap_get_map_page
(
space
,
page_no
,
zip_size
,
mtr
);
bitmap_page
=
ibuf_bitmap_get_map_page
(
space
,
page_no
,
zip_size
,
mtr
);
after
=
ibuf_index_page_calc_free_zip
(
zip_size
,
block
);
after
=
ibuf_index_page_calc_free_zip
(
zip_size
,
block
);
if
(
after
==
0
)
{
/* We move the page to the front of the buffer pool LRU list:
the purpose of this is to prevent those pages to which we
cannot make inserts using the insert buffer from slipping
out of the buffer pool */
buf_page_make_young
(
&
block
->
page
);
}
ibuf_bitmap_page_set_bits
(
bitmap_page
,
page_no
,
zip_size
,
ibuf_bitmap_page_set_bits
(
bitmap_page
,
page_no
,
zip_size
,
IBUF_BITMAP_FREE
,
after
,
mtr
);
IBUF_BITMAP_FREE
,
after
,
mtr
);
}
}
...
...
include/db0err.h
View file @
8c24ad9e
...
@@ -25,7 +25,7 @@ enum db_err {
...
@@ -25,7 +25,7 @@ enum db_err {
DB_MISSING_HISTORY
,
/* required history data has been
DB_MISSING_HISTORY
,
/* required history data has been
deleted due to lack of space in
deleted due to lack of space in
rollback segment */
rollback segment */
DB_CLUSTER_NOT_FOUND
,
DB_CLUSTER_NOT_FOUND
=
30
,
DB_TABLE_NOT_FOUND
,
DB_TABLE_NOT_FOUND
,
DB_MUST_GET_MORE_FILE_SPACE
,
/* the database has to be stopped
DB_MUST_GET_MORE_FILE_SPACE
,
/* the database has to be stopped
and restarted with more file space */
and restarted with more file space */
...
@@ -67,23 +67,23 @@ enum db_err {
...
@@ -67,23 +67,23 @@ enum db_err {
preconfigured undo slots, this can
preconfigured undo slots, this can
only happen when there are too many
only happen when there are too many
concurrent transactions */
concurrent transactions */
DB_PRIMARY_KEY_IS_NULL
,
/* a column in the PRIMARY KEY
was found to be NULL */
DB_TABLE_ZIP_NO_IBD
,
/* trying to create a compressed
table in the system tablespace */
DB_UNSUPPORTED
,
/* when InnoDB sees any artefact or
DB_UNSUPPORTED
,
/* when InnoDB sees any artefact or
a feature that it can't recoginize or
a feature that it can't recoginize or
work with e.g., FT indexes created by
work with e.g., FT indexes created by
a later version of the engine. */
a later version of the engine. */
DB_PRIMARY_KEY_IS_NULL
,
/* a column in the PRIMARY KEY
was found to be NULL */
DB_TABLE_ZIP_NO_IBD
,
/* trying to create a compressed
table in the system tablespace */
/* The following are partial failure codes */
/* The following are partial failure codes */
DB_FAIL
,
DB_FAIL
=
1000
,
DB_OVERFLOW
,
DB_OVERFLOW
,
DB_UNDERFLOW
,
DB_UNDERFLOW
,
DB_STRONG_FAIL
,
DB_STRONG_FAIL
,
DB_ZIP_OVERFLOW
,
DB_ZIP_OVERFLOW
,
DB_RECORD_NOT_FOUND
,
DB_RECORD_NOT_FOUND
=
1500
,
DB_END_OF_INDEX
DB_END_OF_INDEX
};
};
...
...
include/ibuf0ibuf.h
View file @
8c24ad9e
...
@@ -110,8 +110,8 @@ UNIV_INTERN
...
@@ -110,8 +110,8 @@ UNIV_INTERN
void
void
ibuf_update_free_bits_zip
(
ibuf_update_free_bits_zip
(
/*======================*/
/*======================*/
const
buf_block_t
*
block
,
/* in
: index page */
buf_block_t
*
block
,
/* in/out
: index page */
mtr_t
*
mtr
);
/* in/out: mtr */
mtr_t
*
mtr
);
/* in/out: mtr */
/**************************************************************************
/**************************************************************************
Updates the free bits for the two pages to reflect the present state. Does
Updates the free bits for the two pages to reflect the present state. Does
this in the mtr given, which means that the latching order rules virtually
this in the mtr given, which means that the latching order rules virtually
...
...
page/page0zip.c
View file @
8c24ad9e
...
@@ -658,10 +658,19 @@ page_zip_set_alloc(
...
@@ -658,10 +658,19 @@ page_zip_set_alloc(
strm
->
opaque
=
heap
;
strm
->
opaque
=
heap
;
}
}
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
#if 0 || defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
# define PAGE_ZIP_COMPRESS_DBG
#endif
#ifdef PAGE_ZIP_COMPRESS_DBG
/* Set this variable in a debugger to enable
/* Set this variable in a debugger to enable
excessive logging in page_zip_compress(). */
excessive logging in page_zip_compress(). */
UNIV_INTERN
ibool
page_zip_compress_dbg
;
UNIV_INTERN
ibool
page_zip_compress_dbg
;
/* Set this variable in a debugger to enable
binary logging of the data passed to deflate().
When this variable is nonzero, it will act
as a log file name generator. */
UNIV_INTERN
unsigned
page_zip_compress_log
;
/**************************************************************************
/**************************************************************************
Wrapper for deflate(). Log the operation if page_zip_compress_dbg is set. */
Wrapper for deflate(). Log the operation if page_zip_compress_dbg is set. */
...
@@ -669,6 +678,7 @@ static
...
@@ -669,6 +678,7 @@ static
ibool
ibool
page_zip_compress_deflate
(
page_zip_compress_deflate
(
/*======================*/
/*======================*/
FILE
*
logfile
,
/* in: log file, or NULL */
z_streamp
strm
,
/* in/out: compressed stream for deflate() */
z_streamp
strm
,
/* in/out: compressed stream for deflate() */
int
flush
)
/* in: deflate() flushing method */
int
flush
)
/* in: deflate() flushing method */
{
{
...
@@ -676,6 +686,9 @@ page_zip_compress_deflate(
...
@@ -676,6 +686,9 @@ page_zip_compress_deflate(
if
(
UNIV_UNLIKELY
(
page_zip_compress_dbg
))
{
if
(
UNIV_UNLIKELY
(
page_zip_compress_dbg
))
{
ut_print_buf
(
stderr
,
strm
->
next_in
,
strm
->
avail_in
);
ut_print_buf
(
stderr
,
strm
->
next_in
,
strm
->
avail_in
);
}
}
if
(
UNIV_LIKELY_NULL
(
logfile
))
{
fwrite
(
strm
->
next_in
,
1
,
strm
->
avail_in
,
logfile
);
}
status
=
deflate
(
strm
,
flush
);
status
=
deflate
(
strm
,
flush
);
if
(
UNIV_UNLIKELY
(
page_zip_compress_dbg
))
{
if
(
UNIV_UNLIKELY
(
page_zip_compress_dbg
))
{
fprintf
(
stderr
,
" -> %d
\n
"
,
status
);
fprintf
(
stderr
,
" -> %d
\n
"
,
status
);
...
@@ -685,8 +698,13 @@ page_zip_compress_deflate(
...
@@ -685,8 +698,13 @@ page_zip_compress_deflate(
/* Redefine deflate(). */
/* Redefine deflate(). */
# undef deflate
# undef deflate
# define deflate page_zip_compress_deflate
# define deflate(strm, flush) page_zip_compress_deflate(logfile, strm, flush)
#endif
/* UNIV_DEBUG || UNIV_ZIP_DEBUG */
# define FILE_LOGFILE FILE* logfile,
# define LOGFILE logfile,
#else
/* PAGE_ZIP_COMPRESS_DBG */
# define FILE_LOGFILE
# define LOGFILE
#endif
/* PAGE_ZIP_COMPRESS_DBG */
/**************************************************************************
/**************************************************************************
Compress the records of a node pointer page. */
Compress the records of a node pointer page. */
...
@@ -695,6 +713,7 @@ int
...
@@ -695,6 +713,7 @@ int
page_zip_compress_node_ptrs
(
page_zip_compress_node_ptrs
(
/*========================*/
/*========================*/
/* out: Z_OK, or a zlib error code */
/* out: Z_OK, or a zlib error code */
FILE_LOGFILE
z_stream
*
c_stream
,
/* in/out: compressed page stream */
z_stream
*
c_stream
,
/* in/out: compressed page stream */
const
rec_t
**
recs
,
/* in: dense page directory
const
rec_t
**
recs
,
/* in: dense page directory
sorted by address */
sorted by address */
...
@@ -759,6 +778,7 @@ int
...
@@ -759,6 +778,7 @@ int
page_zip_compress_sec
(
page_zip_compress_sec
(
/*==================*/
/*==================*/
/* out: Z_OK, or a zlib error code */
/* out: Z_OK, or a zlib error code */
FILE_LOGFILE
z_stream
*
c_stream
,
/* in/out: compressed page stream */
z_stream
*
c_stream
,
/* in/out: compressed page stream */
const
rec_t
**
recs
,
/* in: dense page directory
const
rec_t
**
recs
,
/* in: dense page directory
sorted by address */
sorted by address */
...
@@ -803,6 +823,7 @@ int
...
@@ -803,6 +823,7 @@ int
page_zip_compress_clust_ext
(
page_zip_compress_clust_ext
(
/*========================*/
/*========================*/
/* out: Z_OK, or a zlib error code */
/* out: Z_OK, or a zlib error code */
FILE_LOGFILE
z_stream
*
c_stream
,
/* in/out: compressed page stream */
z_stream
*
c_stream
,
/* in/out: compressed page stream */
const
rec_t
*
rec
,
/* in: record */
const
rec_t
*
rec
,
/* in: record */
const
ulint
*
offsets
,
/* in: rec_get_offsets(rec) */
const
ulint
*
offsets
,
/* in: rec_get_offsets(rec) */
...
@@ -929,6 +950,7 @@ int
...
@@ -929,6 +950,7 @@ int
page_zip_compress_clust
(
page_zip_compress_clust
(
/*====================*/
/*====================*/
/* out: Z_OK, or a zlib error code */
/* out: Z_OK, or a zlib error code */
FILE_LOGFILE
z_stream
*
c_stream
,
/* in/out: compressed page stream */
z_stream
*
c_stream
,
/* in/out: compressed page stream */
const
rec_t
**
recs
,
/* in: dense page directory
const
rec_t
**
recs
,
/* in: dense page directory
sorted by address */
sorted by address */
...
@@ -986,6 +1008,7 @@ page_zip_compress_clust(
...
@@ -986,6 +1008,7 @@ page_zip_compress_clust(
ut_ad
(
dict_index_is_clust
(
index
));
ut_ad
(
dict_index_is_clust
(
index
));
err
=
page_zip_compress_clust_ext
(
err
=
page_zip_compress_clust_ext
(
LOGFILE
c_stream
,
rec
,
offsets
,
trx_id_col
,
c_stream
,
rec
,
offsets
,
trx_id_col
,
deleted
,
storage
,
&
externs
,
n_blobs
);
deleted
,
storage
,
&
externs
,
n_blobs
);
...
@@ -1081,6 +1104,9 @@ page_zip_compress(
...
@@ -1081,6 +1104,9 @@ page_zip_compress(
ulint
*
offsets
=
NULL
;
ulint
*
offsets
=
NULL
;
ulint
n_blobs
=
0
;
ulint
n_blobs
=
0
;
byte
*
storage
;
/* storage of uncompressed columns */
byte
*
storage
;
/* storage of uncompressed columns */
#ifdef PAGE_ZIP_COMPRESS_DBG
FILE
*
logfile
=
NULL
;
#endif
ut_a
(
page_is_comp
(
page
));
ut_a
(
page_is_comp
(
page
));
ut_a
(
fil_page_get_type
(
page
)
==
FIL_PAGE_INDEX
);
ut_a
(
fil_page_get_type
(
page
)
==
FIL_PAGE_INDEX
);
...
@@ -1113,18 +1139,41 @@ page_zip_compress(
...
@@ -1113,18 +1139,41 @@ page_zip_compress(
/* The dense directory excludes the infimum and supremum records. */
/* The dense directory excludes the infimum and supremum records. */
n_dense
=
page_dir_get_n_heap
(
page
)
-
PAGE_HEAP_NO_USER_LOW
;
n_dense
=
page_dir_get_n_heap
(
page
)
-
PAGE_HEAP_NO_USER_LOW
;
#if
defined UNIV_DEBUG || defined UNIV_ZIP_DEBU
G
#if
def PAGE_ZIP_COMPRESS_DB
G
if
(
UNIV_UNLIKELY
(
page_zip_compress_dbg
))
{
if
(
UNIV_UNLIKELY
(
page_zip_compress_dbg
))
{
fprintf
(
stderr
,
"compress %p %p %lu %lu %lu
\n
"
,
fprintf
(
stderr
,
"compress %p %p %lu %lu %lu
\n
"
,
(
void
*
)
page_zip
,
(
void
*
)
page
,
(
void
*
)
page_zip
,
(
void
*
)
page
,
page_is_leaf
(
page
),
page_is_leaf
(
page
),
n_fields
,
n_dense
);
n_fields
,
n_dense
);
}
}
#endif
/* UNIV_DEBUG || UNIV_ZIP_DEBUG */
if
(
UNIV_UNLIKELY
(
page_zip_compress_log
))
{
/* Create a log file for every compression attempt. */
char
logfilename
[
9
];
ut_snprintf
(
logfilename
,
sizeof
logfilename
,
"%08x"
,
page_zip_compress_log
++
);
logfile
=
fopen
(
logfilename
,
"wb"
);
if
(
logfile
)
{
/* Write the uncompressed page to the log. */
fwrite
(
page
,
1
,
UNIV_PAGE_SIZE
,
logfile
);
/* Record the compressed size as zero.
This will be overwritten at successful exit. */
putc
(
0
,
logfile
);
putc
(
0
,
logfile
);
putc
(
0
,
logfile
);
putc
(
0
,
logfile
);
}
}
#endif
/* PAGE_ZIP_COMPRESS_DBG */
page_zip_compress_count
[
page_zip
->
ssize
]
++
;
page_zip_compress_count
[
page_zip
->
ssize
]
++
;
if
(
UNIV_UNLIKELY
(
n_dense
*
PAGE_ZIP_DIR_SLOT_SIZE
if
(
UNIV_UNLIKELY
(
n_dense
*
PAGE_ZIP_DIR_SLOT_SIZE
>=
page_zip_get_size
(
page_zip
)))
{
>=
page_zip_get_size
(
page_zip
)))
{
#ifdef PAGE_ZIP_COMPRESS_DBG
if
(
logfile
)
{
fclose
(
logfile
);
}
#endif
/* PAGE_ZIP_COMPRESS_DBG */
return
(
FALSE
);
return
(
FALSE
);
}
}
...
@@ -1208,20 +1257,23 @@ page_zip_compress(
...
@@ -1208,20 +1257,23 @@ page_zip_compress(
if
(
UNIV_UNLIKELY
(
!
n_dense
))
{
if
(
UNIV_UNLIKELY
(
!
n_dense
))
{
}
else
if
(
!
page_is_leaf
(
page
))
{
}
else
if
(
!
page_is_leaf
(
page
))
{
/* This is a node pointer page. */
/* This is a node pointer page. */
err
=
page_zip_compress_node_ptrs
(
&
c_stream
,
recs
,
n_dense
,
err
=
page_zip_compress_node_ptrs
(
LOGFILE
&
c_stream
,
recs
,
n_dense
,
index
,
storage
,
heap
);
index
,
storage
,
heap
);
if
(
UNIV_UNLIKELY
(
err
!=
Z_OK
))
{
if
(
UNIV_UNLIKELY
(
err
!=
Z_OK
))
{
goto
zlib_error
;
goto
zlib_error
;
}
}
}
else
if
(
UNIV_LIKELY
(
trx_id_col
==
ULINT_UNDEFINED
))
{
}
else
if
(
UNIV_LIKELY
(
trx_id_col
==
ULINT_UNDEFINED
))
{
/* This is a leaf page in a secondary index. */
/* This is a leaf page in a secondary index. */
err
=
page_zip_compress_sec
(
&
c_stream
,
recs
,
n_dense
);
err
=
page_zip_compress_sec
(
LOGFILE
&
c_stream
,
recs
,
n_dense
);
if
(
UNIV_UNLIKELY
(
err
!=
Z_OK
))
{
if
(
UNIV_UNLIKELY
(
err
!=
Z_OK
))
{
goto
zlib_error
;
goto
zlib_error
;
}
}
}
else
{
}
else
{
/* This is a leaf page in a clustered index. */
/* This is a leaf page in a clustered index. */
err
=
page_zip_compress_clust
(
&
c_stream
,
recs
,
n_dense
,
err
=
page_zip_compress_clust
(
LOGFILE
&
c_stream
,
recs
,
n_dense
,
index
,
&
n_blobs
,
trx_id_col
,
index
,
&
n_blobs
,
trx_id_col
,
buf_end
-
PAGE_ZIP_DIR_SLOT_SIZE
buf_end
-
PAGE_ZIP_DIR_SLOT_SIZE
*
page_get_n_recs
(
page
),
*
page_get_n_recs
(
page
),
...
@@ -1248,6 +1300,11 @@ page_zip_compress(
...
@@ -1248,6 +1300,11 @@ page_zip_compress(
zlib_error:
zlib_error:
deflateEnd
(
&
c_stream
);
deflateEnd
(
&
c_stream
);
mem_heap_free
(
heap
);
mem_heap_free
(
heap
);
#ifdef PAGE_ZIP_COMPRESS_DBG
if
(
logfile
)
{
fclose
(
logfile
);
}
#endif
/* PAGE_ZIP_COMPRESS_DBG */
return
(
FALSE
);
return
(
FALSE
);
}
}
...
@@ -1295,6 +1352,16 @@ page_zip_compress(
...
@@ -1295,6 +1352,16 @@ page_zip_compress(
UNIV_MEM_ASSERT_RW
(
page_zip
->
data
,
page_zip_get_size
(
page_zip
));
UNIV_MEM_ASSERT_RW
(
page_zip
->
data
,
page_zip_get_size
(
page_zip
));
#ifdef PAGE_ZIP_COMPRESS_DBG
if
(
logfile
)
{
/* Record the compressed size of the block. */
byte
sz
[
4
];
mach_write_to_4
(
sz
,
c_stream
.
total_out
);
fseek
(
logfile
,
UNIV_PAGE_SIZE
,
SEEK_SET
);
fwrite
(
sz
,
1
,
sizeof
sz
,
logfile
);
fclose
(
logfile
);
}
#endif
/* PAGE_ZIP_COMPRESS_DBG */
return
(
TRUE
);
return
(
TRUE
);
}
}
...
...
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