Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
educg-net-25737-2462428
DB2024-HIT-2869
Commits
98b3d8ff
Commit
98b3d8ff
authored
9 months ago
by
lepsa
Browse files
Options
Download
Patches
Plain Diff
refact:删除一些没用到的代码
parent
c97dbc51
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/record/rm_file_handle.cpp
+0
-38
src/record/rm_file_handle.cpp
src/record/rm_file_handle.h
+0
-2
src/record/rm_file_handle.h
with
0 additions
and
40 deletions
+0
-40
src/record/rm_file_handle.cpp
+
0
−
38
View file @
98b3d8ff
...
...
@@ -35,44 +35,6 @@ std::unique_ptr<RmRecord> RmFileHandle::get_record(const Rid& rid, Context* cont
return
record
;
}
void
RmFileHandle
::
massive_insert
(
const
std
::
vector
<
std
::
unique_ptr
<
RmRecord
>>
*
records
,
std
::
vector
<
Rid
>
*
rids
,
Context
*
context
)
{
if
(
rids
!=
nullptr
)
{
assert
(
rids
->
size
()
==
0
);
}
int
record_size
=
file_hdr_
.
record_size
;
int
record_nums
=
file_hdr_
.
num_records_per_page
;
RmPageHandle
page_hdl
=
create_page_handle
();
for
(
size_t
i
=
0
;
i
<
records
->
size
();
i
++
)
{
int
slot_no
=
Bitmap
::
first_bit
(
false
,
page_hdl
.
bitmap
,
record_nums
);
// insert_entry对record加X锁
auto
rid
=
Rid
{.
page_no
=
page_hdl
.
page
->
get_page_id
().
page_no
,
.
slot_no
=
slot_no
};
// if(context != nullptr) {
// context->lock_mgr_->lock_exclusive_on_record(context->txn_, rid, fd_);
// }
//
if
(
rids
!=
nullptr
)
{
rids
->
push_back
(
rid
);
}
// 3. 将buf复制到空闲slot位置
char
*
slot_ptr
=
page_hdl
.
get_slot
(
slot_no
);
std
::
memcpy
(
slot_ptr
,
(
*
records
)[
i
]
->
data
,
record_size
);
Bitmap
::
set
(
page_hdl
.
bitmap
,
slot_no
);
// 当前page满了,取下一个page
if
(
++
page_hdl
.
page_hdr
->
num_records
==
record_nums
){
file_hdr_
.
first_free_page_no
=
page_hdl
.
page_hdr
->
next_free_page_no
;
buffer_pool_manager_
->
unpin_page
(
page_hdl
.
page
->
get_page_id
(),
true
);
// buffer_pool_manager_->flush_page(page_hdl.page->get_page_id());
page_hdl
=
create_page_handle
();
}
}
buffer_pool_manager_
->
unpin_page
(
page_hdl
.
page
->
get_page_id
(),
true
);
// flush all pages
// buffer_pool_manager_->flush_page(page_hdl.page->get_page_id());
}
/**
* @description: 在当前表中插入一条记录,不指定插入位置
* @param {char*} buf 要插入的记录的数据
...
...
This diff is collapsed.
Click to expand it.
src/record/rm_file_handle.h
+
0
−
2
View file @
98b3d8ff
...
...
@@ -77,8 +77,6 @@ class RmFileHandle {
std
::
unique_ptr
<
RmRecord
>
get_record
(
const
Rid
&
rid
,
Context
*
context
)
const
;
void
massive_insert
(
const
std
::
vector
<
std
::
unique_ptr
<
RmRecord
>>
*
records
,
std
::
vector
<
Rid
>
*
rids
,
Context
*
context
);
Rid
insert_record
(
char
*
buf
,
Context
*
context
,
bool
is_load
=
false
);
void
insert_record
(
const
Rid
&
rid
,
char
*
buf
,
Context
*
context
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets