摘要: 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) 编辑
摘要: 在mac机上, 为iPhone版本编译产品. 运行./configure报错如下: configure:22793: error: cannot run test program while cross compiling See `config.log' for more details 原因: 阅读全文
posted @ 2016-04-15 12:07 brayden 阅读(439) 评论(0) 推荐(0) 编辑
摘要: #define max(a, b) ((a) > (b) ? (a) : (b)) static char* reverse(char *str) { char *l, *r, c; for (l = str, r = str + strlen(str) - 1; l < r; l++, r--) { c = *l; *l = *r; ... 阅读全文
posted @ 2016-04-01 11:45 brayden 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 假设有一个字符串数组,每一个字符都是一个数字(1-9),找到其中的最大递增数,递增数是指相邻的数位从小到大排列的数字,如:28953456323,递增数有:289,3456,23,那么最大的递增数为3456。 阅读全文
posted @ 2016-03-31 23:32 brayden 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 链表检测环 链表是否交叉 两个链表第一个公共节点 阅读全文
posted @ 2016-03-31 00:03 brayden 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 对一个文件做修改, 通常认为 直接 open-seek-write-write-close 不是原子的. 1. write 本身 不一定是原子的: https://blogs.msdn.microsoft.com/adioltean/2005/12/28/how-to-do-atomic-write 阅读全文
posted @ 2016-03-28 17:40 brayden 阅读(661) 评论(0) 推荐(0) 编辑
摘要: 输入“I am a student”输出“student a am I” 阅读全文
posted @ 2016-03-24 17:32 brayden 阅读(341) 评论(0) 推荐(0) 编辑
摘要: txn/txn.c, __txn_prepare(), 对比 __txn_commit(). 基本只差了 写一个 commit log rec; 释放写锁; 释放内存数据结构等. td->status = TXN_PREPARED; __txn_abort(), 对 已经TXN_PREPARED 的 阅读全文
posted @ 2016-03-23 14:46 brayden 阅读(136) 评论(0) 推荐(0) 编辑