CurveBS IO Processing Flow
1. A CopySet, as the basic unit of a consistent replication group, contains Consensus Module and Log Module. 2. The State Machine corresponds to the chunk in the CurveBS, and it applies the operations NEBDClient, it just proxy requests and has limited retries, which ensuring that NEBDClient needs no change. To upgrade curve-client, you only need to restart the NEBDServer, which affects services in BRaft node.3. The BRaft node persists the log entry locally and replicates it to the followers so that the followers can also persist the log entry. BRaft Log Format: EntryHeader + Entry.0 码力 | 13 页 | 2.03 MB | 5 月前3Curve文件系统元数据管理
→ hashtable(inode id) fsedge → hashtable (parent inode + name) 全内存 chunk → hashtable(chunk id) log + dump record 差 否 chunk 链式多副本 overwirte有数据不一致风险 chubaofs(cfs) 有元数据服务器 inode → b tree(key ino) dentry 内部结点不保存数据,只有叶子结点保存数据。 https://github.com/begeekmyfriend/bplustree,(MIT),实现了落 盘 BST O(log(n)) O(n) c++ stl 模板© XXX Page 4 of 24 skip list O(log(n)) O(n) level db,https://github.com/google/leveldb/blob/master/db/skip uint64_t fsId; // uint32_t btime; /* birth / create time */ uint32_t ctime; /* status change time */ uint32_t mtime; /* modify time */ uint32_t atime; /* access time */ uint32_t0 码力 | 24 页 | 204.67 KB | 5 月前3Curve核心组件之chunkserver
写请求: 1. Client发送写请求给Leader ChunkServer 2. 请求封装,提交给Raft node 3. 本地持久化entry的同时发送给其他peer 4. 本地持久化log entry成功,并且有一个peer也落 盘成功,则commit 5. Commit后apply,此时把写请求写到chunkChunkServer核心模块-CopysetNode 坏盘(CS1对应的盘)后的迁移流程 3的副本CS1 offline, 生成change peer from CS1 to CS2的operator给这三个copyset ④ MDS通过RPC在CS2上创建copyset1,2,3这三个copyset ⑤ 假定三个copyset的leader都是CS3,在CS3的下一次心跳的 response中,下发第三步生成的三个operator ⑥ CS3收到change peer from CS1 的copyset最多,生成change peer from CS2 to CS1的operator给 部分copyset,比如copyset1,2,3 ⑤ MDS通过RPC在CS1上创建copyset1,2,3这些copyset ⑥ 假定三个copyset的leader都是CS3,在CS3的下一次心跳的 response中,下发第四步生成的三个operator ⑦ CS3收到change peer from0 码力 | 29 页 | 1.61 MB | 5 月前3Raft在Curve存储中的工程实践
add_peer(const PeerId& peer, Closure* done); void remove_peer(const PeerId& peer, Closure* done); void change_peers(const Configuration& new_peers, Closure* done); StateMachine void on_apply(::raft::Iterator& ChunkServer。 2. ChunkServer 收到请求,将请求封装成一个 log entry,提交给 raft。 3. raft模块在本地持久化 entry 的同时发送 entry 给其 他副本(ChunkServer)。 4. 本地持久化 log entry 成功,且另一个副本也写入 log entry 成功则 commit。 5. commit 后执行 apply,apply 03 raft在Curve中的应用 05 Q&A 04 Curve对raft的优化Curve对RAFT的优化 优化点一:轻量级快照 问题背景: raft的快照需要定期打快照,用来清理log。对于Curve块存储场景,系统状态就是Chunk当前的数据。 如果把所有chunk 拷贝一遍打快照,会出现两个问题: 1. 每次快照,空间上要多出1倍,空间浪费严重。 2. Curve块存储快照间隔默认300 码力 | 29 页 | 2.20 MB | 5 月前3Open Flags 调研
fi->fh. There are also some flags (direct_io, keep_cache) which the filesystem may set in fi, to change the way the file is opened. See fuse_file_info structure infor more details. If ret = inodeManager_->UpdateInode(inode); if (ret != CURVEFS_ERROR::OK) { LOG(ERROR) << "inodeManager update inode fail, ret = " << ret << ", inodeid = " 0 码力 | 23 页 | 524.47 KB | 5 月前3Curve文件系统元数据持久化方案设计
© XXX Page 1 of 12 元数据持久化© XXX Page 2 of 12 前言 Raft Log Raft Snapshot 持久化文件 key_value_pairs 其他说明 实现 1、inode、entry 的编码 2、KVStore Q&A 单靠 redis 的 AOF 机制能否保证数据不丢失? redis 的高可用、高可扩方案? redis + muliraft 前言 根据之前讨论的结果,元数据节点的架构如下图所示,这里涉及到两部分需要持久化/编码的内容: Raft Log:记录 operator log Raft Snapshot:将内存中的数据结构以特定格式 dump 到文件进行持久化© XXX Page 3 of 12 Raft Log +------+------------+-----+----------------+---------+----------+ feedAppendOnlyFile(cmd, ...) server.aof_buf = sdscatlen(server.aof_buf, ...) // op log buffer aofRewriteBufferAppend(...) /************************************************/0 码力 | 12 页 | 384.47 KB | 5 月前3CurveFS S3本地缓存盘方案
= 1024*4; LOG(INFO) << "whs start write."; for(int i = 0; i < 100000; i++) { char str[5]; sprintf(str, " %d" , i); Write(str, buf, length); } LOG(INFO) << "whs write."; 如上,写10万个4k文件,最终耗时5秒左右,如下: hzwuhongsong@pubbeta1-nostest2:/mnt$ sudo cat /data/log/curve/libcurve-cb6f5cfd.log.INFO.20210825-171813.1930722 | grep whs | egrep "start|end" I 2021-08-25T17:18:130 码力 | 9 页 | 150.46 KB | 5 月前3Curve元数据节点高可用
= leaderElection->CampaginLeader() || false == leaderElection->LeaderKeyExist()) { LOG(INFO) << leaderElectionOp.leaderUniqueName << " campaign for leader agin"; } le Key()) errCode := GetErrCode(EtcdGet, err) if errCode != C.OK { log.Printf("Observe can not get leader key: %v, startTime:" + " %v, spent: %v", election return C.ObserverLeaderInternal } else if len(resp.Kvs) == 0 { log.Printf("Observe find leader key%v not exist", election.Key()) return0 码力 | 30 页 | 2.42 MB | 5 月前3curvefs client删除文件和目录功能设计
ret = dentryManager_->GetDentry(parent, name, &dentry); if (ret != CURVEFS_ERROR::OK) { LOG(ERROR) << "dentryManager_ GetDentry fail, ret = " << ret << ", parent = " << parent ret = dentryManager_->DeleteDentry(parent, name); if (ret != CURVEFS_ERROR::OK) { LOG(ERROR) << "dentryManager_ DeleteDentry fail, ret = " << ret << ", parent = " << parent ret = inodeManager_->DeleteInode(dentry.inodeid()); if (ret != CURVEFS_ERROR::OK) { LOG(ERROR) << "inodeManager_ DeleteInode fail, ret = " << ret << ", parent = " << parent0 码力 | 15 页 | 325.42 KB | 5 月前3MySQL 兼容性可以做到什么程度
• SQL 指令兼容:show binary logs… • MySQL DUMP 协议 • 保证分布式事务完整性与顺序 • 同一连接串 已验证工具或系统 • MySQL Slave(change master) • DTS • Canal/CloudCanal • Maxwell • Debezium • Streamsets • mysql-binlog-connector-java 已有系统迁移怎么办? 下游Demo for ReplicationPolarDB-X Replication 特性详情 提供与 MySQL 主备复制的能力 产品体验 • 支持 MySQL Change Master 指令 • 原生作为 MySQL 备库的能力 • 支持 PolarDB-X 之间数据同步 • 支持 DDL 同步 • 支持事务复制、行级复制 已验证工具或系统 • MySQL/MariaDB0 码力 | 18 页 | 3.02 MB | 5 月前3
共 12 条
- 1
- 2