Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support wal covered writing #92

Merged
merged 2 commits into from
Sep 24, 2020
Merged

Conversation

bai-charisu
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

What is changed and how it works?

What's Changed:

How it Works:

Side effects(Breaking backward compatibility? Performance regression?):

Check List

  • Relevant documentation/comments is changed or added
  • I acknowledge that all my contributions will be made under the project's license

@bai-charisu bai-charisu force-pushed the master branch 8 times, most recently from edebdd3 to a2273ab Compare September 18, 2020 08:25
@bai-charisu bai-charisu reopened this Sep 18, 2020
@bai-charisu bai-charisu force-pushed the master branch 5 times, most recently from 4be12d7 to d3228ef Compare September 18, 2020 14:28
@bai-charisu bai-charisu reopened this Sep 18, 2020
@bai-charisu bai-charisu force-pushed the master branch 3 times, most recently from 66964ff to 3fe5496 Compare September 21, 2020 07:38
@bai-charisu bai-charisu reopened this Sep 21, 2020
@@ -0,0 +1,17 @@

- name: prepare chunkserver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥在这里有一个单独的deploy_chunkserver.yml? 之前不是直接放在deploy_curve.yml里的?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

自己写的临时程序忘删了,已删掉

- name: copy files to tempory directory
become: false
copy: src={{ local_file_path }} dest={{ tmp_dir }} mode={{ file_mode }}
- name: mv file
shell: sudo cp -rf {{ tmp_dir }}/* {{ remote_dir_name }}
when: copy_file_res.failed
when: copy_file_res.failedss
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

笔误?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

echo " -chunkfilepool_dir=/data/chunkserver{id}/chunkfilepool/"
echo " -chunkfilepool_metapath==/data/chunkserver{id}/chunkfilepool.meta"
echo " deploy all wal pool : ./chunkserver_ctl.sh deploy-wal-pool all"
echo " deploy one wal pool : ./chunkserver_ctl.sh deploy-wal-pool {\$chunkserverId}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有deploy all chunkfile pool 和 deploy one chunkfilepool吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前没有场景需要提供单独的格式化chunfile pool的命令

@@ -46,6 +46,7 @@ class ChunkClosure : public braft::Closure {
~ChunkClosure() = default;

void Run() override;
butil::Timer timer;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加在下面成员变量中

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是用来计算metric的,不再需要,已去掉

walfilepool.meta_path=./0/walfilepool.meta
walfilepool.segment_size=8388608
walfilepool.metapage_size=4096
walfilepool.meta_file_size=4096
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta_file_size 和 metapage_size 有啥区别

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta_file_size是记录元数据文件的大小,元数据文件是格式化之后存放pool的目录,file_size,meta_size这些元数据的。
metapage_size是头部的meta page的大小,也是内存对齐的单位

@@ -35,6 +35,9 @@
#include "src/chunkserver/clone_manager.h"
#include "src/chunkserver/clone_task.h"

static bvar::LatencyRecorder g_oprequest_writechunk_latency(
Copy link
Contributor

@ilixiaocui ilixiaocui Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

临时的metric先去掉吧,后面统一添加,需要有开关

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return _from_pool;
}
private:
friend class butil::RefCountedThreadSafe<CurveSegment>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不对齐

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


#include "src/common/string_util.h"
#include "src/fs/ext4_filesystem_impl.h"
#include "src/fs/wrap_posix.h"

#define MIN_KERNEL_VERSION KERNEL_VERSION(3, 15, 0)
static bvar::LatencyRecorder g_fs_write_latency(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

临时的metric先去掉吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@bai-charisu bai-charisu force-pushed the master branch 4 times, most recently from 9b3fec6 to 53b124e Compare September 23, 2020 07:43
src/chunkserver/raftlog/curve_segment_log_storage.cpp Outdated Show resolved Hide resolved
src/chunkserver/raftlog/curve_segment_log_storage.cpp Outdated Show resolved Hide resolved
src/chunkserver/raftlog/define.h Outdated Show resolved Hide resolved
src/chunkserver/raftlog/curve_segment.cpp Outdated Show resolved Hide resolved
src/chunkserver/raftlog/curve_segment.cpp Show resolved Hide resolved
src/chunkserver/raftlog/curve_segment.h Outdated Show resolved Hide resolved
src/chunkserver/raftlog/curve_segment.cpp Outdated Show resolved Hide resolved
src/chunkserver/raftlog/curve_segment.cpp Outdated Show resolved Hide resolved
@bai-charisu bai-charisu force-pushed the master branch 2 times, most recently from 288d697 to 3ae488e Compare September 24, 2020 06:41
do {
if (dynamic_cast<BraftSegment *>(_open_segment.get()) != nullptr) {
LOG(INFO) << "Loaded a braft open segment, close it directly";
scoped_refptr<Segment> prev_open_segment;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为啥要使用scoped_refptr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

braft::segment是用scoped_refptr管理的,把析构函数定义成了私有的,只有scope ptr能够访问

if (first_index == last_index + 1) {
return -1;
}
if (index < first_index || index > last_index + 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥不是index > last_index?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是为了把index=last_index+1单独处理,不打日志。replicator复制日志的时候会逐渐增加index去get_entry,直到即将发送的entry数量超过最大值或者get_entry返回失败。所以index=last_index+1是每次循环结束的条件,不用打日志。

<< " first_log_index: " << first_index
<< " last_log_index: " << last_index;
return -1;
} else if (index == last_index + 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么这个要放在这里单独判断

@xu-chaojie xu-chaojie merged commit 5d648c9 into opencurve:master Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants