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
6dfab3f3
Commit
6dfab3f3
authored
Mar 01, 2006
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/zip: Move some private functions from page0zip.ic and page0zip.h
to page0zip.c.
parent
ad003b81
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
177 deletions
+116
-177
include/page0zip.h
include/page0zip.h
+0
-61
include/page0zip.ic
include/page0zip.ic
+0
-116
page/page0zip.c
page/page0zip.c
+116
-0
No files found.
include/page0zip.h
View file @
6dfab3f3
...
...
@@ -84,67 +84,6 @@ page_zip_validate(
__attribute__
((
nonnull
));
#endif
/* UNIV_DEBUG || UNIV_ZIP_DEBUG */
/*****************************************************************
Gets the size of the compressed page trailer (the dense page directory),
including deleted records (the free list). */
UNIV_INLINE
ulint
page_zip_dir_size
(
/*==============*/
/* out: length of dense page
directory, in bytes */
const
page_zip_des_t
*
page_zip
)
/* in: compressed page */
__attribute__
((
pure
));
/*****************************************************************
Gets the size of the compressed page trailer (the dense page directory),
only including user records (excluding the free list). */
UNIV_INLINE
ulint
page_zip_dir_user_size
(
/*===================*/
/* out: length of dense page
directory, in bytes */
const
page_zip_des_t
*
page_zip
)
/* in: compressed page */
__attribute__
((
pure
));
/*****************************************************************
Find the slot of the given non-free record in the dense page directory. */
UNIV_INLINE
byte
*
page_zip_dir_find
(
/*==============*/
/* out: dense directory slot,
or NULL if record not found */
page_zip_des_t
*
page_zip
,
/* in: compressed page */
ulint
offset
)
/* in: offset of user record */
__attribute__
((
pure
));
/*****************************************************************
Find the slot of the given free record in the dense page directory. */
UNIV_INLINE
byte
*
page_zip_dir_find_free
(
/*===================*/
/* out: dense directory slot,
or NULL if record not found */
page_zip_des_t
*
page_zip
,
/* in: compressed page */
ulint
offset
)
/* in: offset of user record */
__attribute__
((
pure
));
/*****************************************************************
Read a given slot in the dense page directory. */
UNIV_INLINE
ulint
page_zip_dir_get
(
/*=============*/
/* out: record offset
on the uncompressed page,
possibly ORed with
PAGE_ZIP_DIR_SLOT_DEL or
PAGE_ZIP_DIR_SLOT_OWNED */
const
page_zip_des_t
*
page_zip
,
/* in: compressed page */
ulint
slot
)
/* in: slot
(0=first user record) */
__attribute__
((
pure
));
/**************************************************************************
Ensure that enough space is available in the modification log.
If not, try to compress the page. */
...
...
include/page0zip.ic
View file @
6dfab3f3
...
...
@@ -140,122 +140,6 @@ page_zip_simple_validate(
}
#endif /* UNIV_DEBUG */
/*****************************************************************
Gets the size of the compressed page trailer (the dense page directory),
including deleted records (the free list). */
UNIV_INLINE
ulint
page_zip_dir_size(
/*==============*/
/* out: length of dense page
directory, in bytes */
const page_zip_des_t* page_zip) /* in: compressed page */
{
/* Exclude the page infimum and supremum from the record count. */
ulint size = PAGE_ZIP_DIR_SLOT_SIZE
* (page_dir_get_n_heap((page_t*) page_zip->data) - 2);
ut_ad(page_zip->m_end + size < page_zip->size);
return(size);
}
/*****************************************************************
Gets the size of the compressed page trailer (the dense page directory),
only including user records (excluding the free list). */
UNIV_INLINE
ulint
page_zip_dir_user_size(
/*===================*/
/* out: length of dense page
directory comprising existing
records, in bytes */
const page_zip_des_t* page_zip) /* in: compressed page */
{
ulint size = PAGE_ZIP_DIR_SLOT_SIZE
* page_get_n_recs((page_t*) page_zip->data);
ut_ad(size < page_zip_dir_size(page_zip));
return(size);
}
/*****************************************************************
Find the slot of the given non-free record in the dense page directory. */
UNIV_INLINE
byte*
page_zip_dir_find(
/*==============*/
/* out: dense directory slot,
or NULL if record not found */
page_zip_des_t* page_zip, /* in: compressed page */
ulint offset) /* in: offset of user record */
{
byte* slot;
byte* end;
ut_ad(page_zip_simple_validate(page_zip));
end = page_zip->data + page_zip->size - PAGE_ZIP_DIR_SLOT_SIZE;
slot = end - page_zip_dir_user_size(page_zip);
for (; slot < end; slot += PAGE_ZIP_DIR_SLOT_SIZE) {
if ((mach_read_from_2(slot) & PAGE_ZIP_DIR_SLOT_MASK)
== offset) {
return(slot);
}
}
return(NULL);
}
/*****************************************************************
Find the slot of the given free record in the dense page directory. */
UNIV_INLINE
byte*
page_zip_dir_find_free(
/*===================*/
/* out: dense directory slot,
or NULL if record not found */
page_zip_des_t* page_zip, /* in: compressed page */
ulint offset) /* in: offset of user record */
{
byte* slot;
byte* end;
ut_ad(page_zip_simple_validate(page_zip));
slot = end = page_zip->data + page_zip->size;
slot -= page_zip_dir_size(page_zip);
end -= PAGE_ZIP_DIR_SLOT_SIZE + page_zip_dir_user_size(page_zip);
for (; slot < end; slot += PAGE_ZIP_DIR_SLOT_SIZE) {
if ((mach_read_from_2(slot) & PAGE_ZIP_DIR_SLOT_MASK)
== offset) {
return(slot);
}
}
return(NULL);
}
/*****************************************************************
Read a given slot in the dense page directory. */
UNIV_INLINE
ulint
page_zip_dir_get(
/*=============*/
/* out: record offset
on the uncompressed page,
possibly ORed with
PAGE_ZIP_DIR_SLOT_DEL or
PAGE_ZIP_DIR_SLOT_OWNED */
const page_zip_des_t* page_zip, /* in: compressed page */
ulint slot) /* in: slot
(0=first user record) */
{
ut_ad(page_zip_simple_validate(page_zip));
ut_ad(slot < page_zip_dir_size(page_zip) / PAGE_ZIP_DIR_SLOT_SIZE);
return(mach_read_from_2(page_zip->data + page_zip->size
- PAGE_ZIP_DIR_SLOT_SIZE * (slot + 1)));
}
/**************************************************************************
Ensure that enough space is available in the modification log.
If not, try to compress the page. */
...
...
page/page0zip.c
View file @
6dfab3f3
...
...
@@ -43,6 +43,122 @@ static const byte supremum_extra_data[] = {
0x65
,
0x6d
,
0x75
,
0x6d
/* "supremum" */
};
/*****************************************************************
Gets the size of the compressed page trailer (the dense page directory),
including deleted records (the free list). */
UNIV_INLINE
ulint
page_zip_dir_size
(
/*==============*/
/* out: length of dense page
directory, in bytes */
const
page_zip_des_t
*
page_zip
)
/* in: compressed page */
{
/* Exclude the page infimum and supremum from the record count. */
ulint
size
=
PAGE_ZIP_DIR_SLOT_SIZE
*
(
page_dir_get_n_heap
((
page_t
*
)
page_zip
->
data
)
-
2
);
ut_ad
(
page_zip
->
m_end
+
size
<
page_zip
->
size
);
return
(
size
);
}
/*****************************************************************
Gets the size of the compressed page trailer (the dense page directory),
only including user records (excluding the free list). */
UNIV_INLINE
ulint
page_zip_dir_user_size
(
/*===================*/
/* out: length of dense page
directory comprising existing
records, in bytes */
const
page_zip_des_t
*
page_zip
)
/* in: compressed page */
{
ulint
size
=
PAGE_ZIP_DIR_SLOT_SIZE
*
page_get_n_recs
((
page_t
*
)
page_zip
->
data
);
ut_ad
(
size
<
page_zip_dir_size
(
page_zip
));
return
(
size
);
}
/*****************************************************************
Find the slot of the given non-free record in the dense page directory. */
UNIV_INLINE
byte
*
page_zip_dir_find
(
/*==============*/
/* out: dense directory slot,
or NULL if record not found */
page_zip_des_t
*
page_zip
,
/* in: compressed page */
ulint
offset
)
/* in: offset of user record */
{
byte
*
slot
;
byte
*
end
;
ut_ad
(
page_zip_simple_validate
(
page_zip
));
end
=
page_zip
->
data
+
page_zip
->
size
-
PAGE_ZIP_DIR_SLOT_SIZE
;
slot
=
end
-
page_zip_dir_user_size
(
page_zip
);
for
(;
slot
<
end
;
slot
+=
PAGE_ZIP_DIR_SLOT_SIZE
)
{
if
((
mach_read_from_2
(
slot
)
&
PAGE_ZIP_DIR_SLOT_MASK
)
==
offset
)
{
return
(
slot
);
}
}
return
(
NULL
);
}
/*****************************************************************
Find the slot of the given free record in the dense page directory. */
UNIV_INLINE
byte
*
page_zip_dir_find_free
(
/*===================*/
/* out: dense directory slot,
or NULL if record not found */
page_zip_des_t
*
page_zip
,
/* in: compressed page */
ulint
offset
)
/* in: offset of user record */
{
byte
*
slot
;
byte
*
end
;
ut_ad
(
page_zip_simple_validate
(
page_zip
));
slot
=
end
=
page_zip
->
data
+
page_zip
->
size
;
slot
-=
page_zip_dir_size
(
page_zip
);
end
-=
PAGE_ZIP_DIR_SLOT_SIZE
+
page_zip_dir_user_size
(
page_zip
);
for
(;
slot
<
end
;
slot
+=
PAGE_ZIP_DIR_SLOT_SIZE
)
{
if
((
mach_read_from_2
(
slot
)
&
PAGE_ZIP_DIR_SLOT_MASK
)
==
offset
)
{
return
(
slot
);
}
}
return
(
NULL
);
}
/*****************************************************************
Read a given slot in the dense page directory. */
UNIV_INLINE
ulint
page_zip_dir_get
(
/*=============*/
/* out: record offset
on the uncompressed page,
possibly ORed with
PAGE_ZIP_DIR_SLOT_DEL or
PAGE_ZIP_DIR_SLOT_OWNED */
const
page_zip_des_t
*
page_zip
,
/* in: compressed page */
ulint
slot
)
/* in: slot
(0=first user record) */
{
ut_ad
(
page_zip_simple_validate
(
page_zip
));
ut_ad
(
slot
<
page_zip_dir_size
(
page_zip
)
/
PAGE_ZIP_DIR_SLOT_SIZE
);
return
(
mach_read_from_2
(
page_zip
->
data
+
page_zip
->
size
-
PAGE_ZIP_DIR_SLOT_SIZE
*
(
slot
+
1
)));
}
/**************************************************************************
Encode the length of a fixed-length column. */
static
...
...
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