摘要: 为什么要lockfree 按我的理解, lockfree就是不去 调用操作系统给定的锁机制. 1. 会有system call, and system call is expensive; 比如pthread在linux里调用了futex. 2. 会失去控制, 接下来发生什么看操作系统心情了. 怎么 阅读全文
posted @ 2016-08-17 16:27 brayden 阅读(462) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/promise6522/archive/2012/05/09/2493542.html 阅读全文
posted @ 2016-08-17 16:20 brayden 阅读(149) 评论(0) 推荐(0) 编辑
摘要: dirty reader怎样 不被writor block住? 如数据库支持dirty read, 则 所有打开的dbhandle都配置 DB_READ_UNCOMMITTED; 在线程拿到 write锁并做完处理后(比如splite one page), 降为 was_write锁. WWRITE 阅读全文
posted @ 2016-08-17 13:16 brayden 阅读(551) 评论(0) 推荐(0) 编辑
摘要: priority based lru in src/mp/mp_fget.c, __memp_fget(), 初始化 一个page buffer时, 设置其 priority: in src/mp/mp_fget.c, __memp_fput(), 对一个page buffer做put, 使其ref 阅读全文
posted @ 2016-08-17 13:15 brayden 阅读(429) 评论(0) 推荐(0) 编辑
摘要: __memp_alloc() 注: MPOOL_ALLOC_SEARCH_DYN 没有 出现在 bdb document上, 也没出现在 除了mp_alloc外的代码里. 先删了 以便代码清楚. 按 mpool初始化代码来看, 一个hash bucket上 假定为 2.5个buffer. 查找有 三 阅读全文
posted @ 2016-08-17 13:15 brayden 阅读(741) 评论(0) 推荐(0) 编辑
摘要: repmgr_method.c, __repmgr_start_int()repmgr_method.c, __repmgr_start_msg_threads()repmgr_msg.c, __repmgr_msg_thread()message_loop() while ((ret = __re 阅读全文
posted @ 2016-08-17 13:14 brayden 阅读(186) 评论(0) 推荐(0) 编辑
摘要: repmgr_method.c, __repmgr_start_int() 初始2个elect线程. repmgr_elect.c, __repmgr_init_election() __repmgr_elect_thread() __repmgr_elect_main() lease, prefe 阅读全文
posted @ 2016-08-17 13:13 brayden 阅读(156) 评论(0) 推荐(0) 编辑
摘要: repmgr/repmgr_net.c, __repmgr_send(): 做send_broadcast, 然后根据policy 对DB_REP_PERMANENT的处理 __repmgr_send_broadcast(): 对每个site, send_connection(). MASTER 发 阅读全文
posted @ 2016-08-17 13:13 brayden 阅读(526) 评论(0) 推荐(0) 编辑
摘要: 代码: wiredtiger-2.8.0/src/os_posix/os_mtx_rw.c rw锁结构 要加锁, 先领号. 即 (读lock.users, lock.users++), 原子操作. 当领的号 与 当前 服务的 lock.writers 同, 则申请 w锁成功; 与当前 服务的 loc 阅读全文
posted @ 2016-08-17 13:12 brayden 阅读(142) 评论(0) 推荐(0) 编辑
摘要: http://www.drdobbs.com/lock-free-data-structures-with-hazard-po/184401890 memory deallocation lock-free session.h support/hazard.c __wt_hazard_set() / 阅读全文
posted @ 2016-08-17 13:12 brayden 阅读(316) 评论(0) 推荐(0) 编辑