From 8e97811153db92cbe5fb7c7774d5e2cee1b963c4 Mon Sep 17 00:00:00 2001 From: nicksxs Date: Sun, 17 May 2020 23:58:33 +0800 Subject: [PATCH] Site updated: 2020-05-17 23:58:31 --- 2014/12/23/my-new-post/index.html | 8 +- 2014/12/24/MFC 模态对话框/index.html | 14 +- 2014/12/30/Clone-Graph-Part-I/index.html | 12 +- 2015/01/04/Path-Sum/index.html | 12 +- 2015/01/14/Two-Sum/index.html | 14 +- .../index.html | 14 +- 2015/03/11/Number-Of-1-Bits/index.html | 16 +- 2015/03/11/Reverse-Bits/index.html | 14 +- 2015/03/13/Reverse-Integer/index.html | 14 +- 2015/04/14/Add-Two-Number/index.html | 16 +- 2015/04/15/Leetcode-No-3/index.html | 18 +- 2015/06/22/invert-binary-tree/index.html | 12 +- 2016/07/13/swoole-websocket-test/index.html | 8 +- 2016/08/14/34-Search-for-a-Range/index.html | 16 +- 2016/08/14/docker-mysql-cluster/index.html | 8 +- 2016/09/29/binary-watch/index.html | 12 +- .../minimum-size-subarray-sum-209/index.html | 12 +- 2016/10/12/summary-ranges-228/index.html | 12 +- .../index.html | 8 +- 2017/03/28/spark-little-tips/index.html | 8 +- 2017/04/25/rabbitmq-tips/index.html | 12 +- 2017/05/09/ambari-summary/index.html | 8 +- 2019/06/18/openresty/index.html | 8 +- .../23/AbstractQueuedSynchronizer/index.html | 8 +- 2019/12/07/JVM-G1-Part-1/index.html | 8 +- 2019/12/10/Redis-Part-1/index.html | 8 +- 2019/12/18/1Q84读后感/index.html | 8 +- .../聊聊Java中的单例模式/index.html | 8 +- 2019/12/26/redis数据结构介绍/index.html | 12 +- .../04/redis数据结构介绍二/index.html | 8 +- .../10/redis数据结构介绍三/index.html | 8 +- .../19/redis数据结构介绍四/index.html | 12 +- .../20/redis数据结构介绍五/index.html | 12 +- .../22/redis数据结构介绍六/index.html | 12 +- 2020/02/01/2019年终总结/index.html | 8 +- 2020/02/09/G1收集器概述/index.html | 8 +- 2020/02/16/Maven实用小技巧/index.html | 12 +- .../index.html | 8 +- 2020/03/01/寄生虫观后感/index.html | 8 +- .../index.html | 8 +- .../index.html | 8 +- .../index.html | 8 +- .../echo命令的一个小技巧/index.html | 8 +- 2020/04/05/Comparator使用小记/index.html | 8 +- 2020/04/12/redis系列介绍七/index.html | 12 +- 2020/04/18/redis系列介绍八/index.html | 12 +- 2020/04/26/聊聊-mysql-的-MVCC/index.html | 12 +- .../聊聊-mysql-的-MVCC-续篇/index.html | 12 +- .../index.html | 27 +- .../index.html | 749 ++++++++++++++++++ 404.html | 8 +- 404/index.html | 8 +- archives/2014/12/index.html | 10 +- archives/2014/index.html | 10 +- archives/2015/01/index.html | 10 +- archives/2015/03/index.html | 10 +- archives/2015/04/index.html | 10 +- archives/2015/06/index.html | 10 +- archives/2015/index.html | 10 +- archives/2016/07/index.html | 10 +- archives/2016/08/index.html | 10 +- archives/2016/09/index.html | 10 +- archives/2016/10/index.html | 10 +- archives/2016/11/index.html | 10 +- archives/2016/index.html | 10 +- archives/2017/03/index.html | 10 +- archives/2017/04/index.html | 10 +- archives/2017/05/index.html | 10 +- archives/2017/index.html | 10 +- archives/2019/06/index.html | 10 +- archives/2019/09/index.html | 10 +- archives/2019/12/index.html | 10 +- archives/2019/index.html | 10 +- archives/2020/01/index.html | 10 +- archives/2020/02/index.html | 10 +- archives/2020/03/index.html | 10 +- archives/2020/04/index.html | 10 +- archives/2020/05/index.html | 30 +- archives/2020/index.html | 52 +- archives/2020/page/2/index.html | 52 +- archives/2020/page/3/index.html | 576 ++++++++++++++ archives/index.html | 50 +- archives/page/2/index.html | 50 +- archives/page/3/index.html | 53 +- archives/page/4/index.html | 53 +- archives/page/5/index.html | 30 +- atom.xml | 84 +- baidu_verify_Gl8jtoDV4z.html | 8 +- baidusitemap.xml | 23 +- categories/C/Mysql/index.html | 8 +- categories/C/Redis/index.html | 8 +- categories/C/index.html | 8 +- categories/C/page/2/index.html | 8 +- categories/Java/Design-Patterns/index.html | 8 +- categories/Java/GC/index.html | 8 +- categories/Java/JVM/index.html | 8 +- categories/Java/Maven/index.html | 8 +- categories/Java/Singleton/index.html | 8 +- categories/Java/index.html | 209 +++-- categories/Java/集合/index.html | 8 +- categories/Linux/index.html | 8 +- categories/Linux/命令/echo/index.html | 8 +- categories/Linux/命令/index.html | 8 +- categories/Mysql/index.html | 8 +- categories/Mysql/数据结构/index.html | 8 +- categories/Mysql/源码/index.html | 8 +- categories/Redis/Distributed-Lock/index.html | 8 +- categories/Redis/index.html | 8 +- categories/Redis/数据结构/index.html | 8 +- categories/Redis/源码/index.html | 8 +- categories/data-analysis/index.html | 8 +- categories/docker/index.html | 180 +++-- categories/docker/介绍/index.html | 8 +- categories/docker/发行版本/index.html | 8 +- categories/index.html | 12 +- categories/leetcode/index.html | 8 +- categories/leetcode/page/2/index.html | 8 +- categories/nginx/index.html | 8 +- categories/php/index.html | 8 +- categories/分布式事务/index.html | 583 ++++++++++++++ .../三阶段提交/index.html | 583 ++++++++++++++ .../两阶段提交/index.html | 583 ++++++++++++++ categories/持续集成/index.html | 8 +- categories/生活/index.html | 8 +- .../生活/年终总结/2019/index.html | 8 +- categories/生活/年终总结/index.html | 8 +- categories/生活/影评/2020/index.html | 8 +- categories/生活/影评/index.html | 8 +- categories/读后感/index.html | 8 +- categories/读后感/村上春树/index.html | 8 +- css/main.css | 2 +- index.html | 276 +++---- leancloud.memo | 1 + leancloud_counter_security_urls.json | 2 +- lib/pace/README.html | 8 +- page/2/index.html | 265 ++++--- page/3/index.html | 226 +++--- page/4/index.html | 215 +++-- page/5/index.html | 114 ++- sitemap.xml | 25 +- tags/2019/index.html | 8 +- tags/2PC/index.html | 583 ++++++++++++++ tags/3PC/index.html | 583 ++++++++++++++ tags/Comparator/index.html | 8 +- tags/Design-Patterns/index.html | 8 +- tags/Distributed-Lock/index.html | 8 +- tags/Dockerfile/index.html | 8 +- tags/G1/index.html | 8 +- tags/GC/index.html | 8 +- tags/Garbage-First-Collector/index.html | 8 +- tags/Gogs/index.html | 8 +- tags/JVM/index.html | 8 +- tags/Maven/index.html | 8 +- tags/Redis/index.html | 8 +- tags/Singleton/index.html | 8 +- tags/Stream/index.html | 8 +- tags/Webhook/index.html | 8 +- tags/aqs/index.html | 8 +- tags/c/index.html | 8 +- tags/c/page/2/index.html | 8 +- tags/cgroup/index.html | 8 +- tags/cluster/index.html | 8 +- tags/docker/index.html | 8 +- tags/echo/index.html | 8 +- tags/gap-lock/index.html | 8 +- tags/hadoop/index.html | 8 +- tags/im/index.html | 8 +- tags/index.html | 12 +- tags/java/index.html | 8 +- tags/leetcode/index.html | 8 +- tags/leetcode/page/2/index.html | 8 +- tags/linux/index.html | 8 +- tags/mfc/index.html | 8 +- tags/mq/index.html | 8 +- tags/mvcc/index.html | 8 +- tags/mysql/index.html | 8 +- tags/namespace/index.html | 8 +- tags/next-key-lock/index.html | 8 +- tags/nginx/index.html | 8 +- tags/nullsfirst/index.html | 8 +- tags/openresty/index.html | 8 +- tags/php/index.html | 8 +- tags/python/index.html | 8 +- tags/read-view/index.html | 8 +- tags/sort/index.html | 8 +- tags/spark/index.html | 8 +- tags/swoole/index.html | 8 +- tags/uname/index.html | 8 +- tags/websocket/index.html | 8 +- tags/三阶段提交/index.html | 583 ++++++++++++++ tags/两阶段提交/index.html | 583 ++++++++++++++ tags/分布式事务/index.html | 583 ++++++++++++++ tags/分布式锁/index.html | 8 +- tags/单例/index.html | 8 +- tags/博客,文章/index.html | 8 +- tags/发行版/index.html | 8 +- tags/寄生虫/index.html | 8 +- tags/年终总结/index.html | 8 +- tags/幻读/index.html | 8 +- tags/影评/index.html | 8 +- tags/排序/index.html | 8 +- tags/数据结构/index.html | 8 +- tags/数据结构/page/2/index.html | 8 +- tags/源码/index.html | 8 +- tags/源码/page/2/index.html | 8 +- tags/生活/index.html | 8 +- tags/设计模式/index.html | 8 +- tags/读后感/index.html | 8 +- 208 files changed, 7896 insertions(+), 1706 deletions(-) create mode 100644 2020/05/17/聊聊我理解的分布式事务/index.html create mode 100644 archives/2020/page/3/index.html create mode 100644 categories/分布式事务/index.html create mode 100644 categories/分布式事务/三阶段提交/index.html create mode 100644 categories/分布式事务/两阶段提交/index.html create mode 100644 tags/2PC/index.html create mode 100644 tags/3PC/index.html create mode 100644 tags/三阶段提交/index.html create mode 100644 tags/两阶段提交/index.html create mode 100644 tags/分布式事务/index.html diff --git a/2014/12/23/my-new-post/index.html b/2014/12/23/my-new-post/index.html index 996a078234..789d33d3a6 100644 --- a/2014/12/23/my-new-post/index.html +++ b/2014/12/23/my-new-post/index.html @@ -421,20 +421,20 @@
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -459,7 +459,7 @@
diff --git a/2014/12/24/MFC 模态对话框/index.html b/2014/12/24/MFC 模态对话框/index.html index 2b6e9b0885..89fc4959be 100644 --- a/2014/12/24/MFC 模态对话框/index.html +++ b/2014/12/24/MFC 模态对话框/index.html @@ -294,13 +294,13 @@ @@ -455,20 +455,20 @@
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -493,7 +493,7 @@
diff --git a/2016/07/13/swoole-websocket-test/index.html b/2016/07/13/swoole-websocket-test/index.html index 90b461061e..0c5461e4e4 100644 --- a/2016/07/13/swoole-websocket-test/index.html +++ b/2016/07/13/swoole-websocket-test/index.html @@ -454,20 +454,20 @@ user3:
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -492,7 +492,7 @@ user3:
diff --git a/2016/08/14/34-Search-for-a-Range/index.html b/2016/08/14/34-Search-for-a-Range/index.html index d296cb49b0..ce7633f4d3 100644 --- a/2016/08/14/34-Search-for-a-Range/index.html +++ b/2016/08/14/34-Search-for-a-Range/index.html @@ -294,19 +294,19 @@ @@ -448,20 +448,20 @@
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -486,7 +486,7 @@
diff --git a/2016/08/14/docker-mysql-cluster/index.html b/2016/08/14/docker-mysql-cluster/index.html index b2d1ec459c..a2d8dad82e 100644 --- a/2016/08/14/docker-mysql-cluster/index.html +++ b/2016/08/14/docker-mysql-cluster/index.html @@ -446,20 +446,20 @@
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -484,7 +484,7 @@
diff --git a/2016/09/29/binary-watch/index.html b/2016/09/29/binary-watch/index.html index c452400f04..61e65238c8 100644 --- a/2016/09/29/binary-watch/index.html +++ b/2016/09/29/binary-watch/index.html @@ -305,7 +305,7 @@ @@ -456,20 +456,20 @@
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -494,7 +494,7 @@
diff --git a/2016/10/11/minimum-size-subarray-sum-209/index.html b/2016/10/11/minimum-size-subarray-sum-209/index.html index 31cd1b8fa1..3c748e9f95 100644 --- a/2016/10/11/minimum-size-subarray-sum-209/index.html +++ b/2016/10/11/minimum-size-subarray-sum-209/index.html @@ -295,7 +295,7 @@ @@ -446,20 +446,20 @@
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -484,7 +484,7 @@
diff --git a/2016/10/12/summary-ranges-228/index.html b/2016/10/12/summary-ranges-228/index.html index 63e627e6b1..6b593ca327 100644 --- a/2016/10/12/summary-ranges-228/index.html +++ b/2016/10/12/summary-ranges-228/index.html @@ -294,7 +294,7 @@ @@ -445,20 +445,20 @@
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -483,7 +483,7 @@
diff --git a/2016/11/10/php-abstract-class-and-interface/index.html b/2016/11/10/php-abstract-class-and-interface/index.html index 5ed227bb7c..0c8c83c85f 100644 --- a/2016/11/10/php-abstract-class-and-interface/index.html +++ b/2016/11/10/php-abstract-class-and-interface/index.html @@ -440,20 +440,20 @@
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -478,7 +478,7 @@
diff --git a/2017/03/28/spark-little-tips/index.html b/2017/03/28/spark-little-tips/index.html index 6bfcbb83f6..54c98346fd 100644 --- a/2017/03/28/spark-little-tips/index.html +++ b/2017/03/28/spark-little-tips/index.html @@ -429,20 +429,20 @@
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -467,7 +467,7 @@
diff --git a/2017/04/25/rabbitmq-tips/index.html b/2017/04/25/rabbitmq-tips/index.html index 28f0b8600a..80c65575a6 100644 --- a/2017/04/25/rabbitmq-tips/index.html +++ b/2017/04/25/rabbitmq-tips/index.html @@ -35,8 +35,8 @@ - + @@ -342,8 +342,8 @@ @@ -480,20 +483,20 @@
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -518,7 +521,7 @@
diff --git a/2020/05/17/聊聊我理解的分布式事务/index.html b/2020/05/17/聊聊我理解的分布式事务/index.html new file mode 100644 index 0000000000..3d6407642b --- /dev/null +++ b/2020/05/17/聊聊我理解的分布式事务/index.html @@ -0,0 +1,749 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 聊聊我理解的分布式事务 | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+ + + +

Nicksxs's Blog

+ +
+

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + + + + + + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+ + + + + +
+

+ 聊聊我理解的分布式事务 +

+ + +
+ + + + +
+ + +

前面说了mysql数据库的事务相关的,那事务是用来干嘛的,这里得补一下ACID,

+
+

ACID,是指数据库管理系统DBMS)在写入或更新资料的过程中,为保证事务(transaction)是正确可靠的,所必须具备的四个特性:原子性(atomicity,或称不可分割性)、一致性(consistency)、隔离性(isolation,又称独立性)、持久性(durability)。

+
+
    +
  • Atomicity(原子性):一个事务(transaction)中的所有操作,或者全部完成,或者全部不完成,不会结束在中间某个环节。事务在执行过程中发生错误,会被回滚(Rollback)到事务开始前的状态,就像这个事务从来没有执行过一样。即,事务不可分割、不可约简。[1]

    +
  • +
  • Consistency(一致性):在事务开始之前和事务结束以后,数据库的完整性没有被破坏。这表示写入的资料必须完全符合所有的预设约束触发器级联回滚等。[1]

    +
  • +
  • Isolation(隔离性):数据库允许多个并发事务同时对其数据进行读写和修改的能力,隔离性可以防止多个事务并发执行时由于交叉执行而导致数据的不一致。事务隔离分为不同级别,包括未提交读(Read uncommitted)、提交读(read committed)、可重复读(repeatable read)和串行化(Serializable)。[1]

    +
  • +
  • Durability(持久性):事务处理结束后,对数据的修改就是永久的,即便系统故障也不会丢失。[1]

    +
  • +
+

在mysql中,借助于MVCC,各种级别的锁,日志等特性来实现了事务的ACID,但是这个我们通常是对于一个数据库服务的定义,常见的情况下我们的数据库随着业务发展也会从单实例变成多实例,组成主从Master-Slave架构,这个时候其实会有一些问题随之出现,比如说主从同步延迟,假如在业务代码中做了读写分离,对于一些敏感度较低的数据其实问题不是很大,只要主从延迟不到特别夸张的地步一般都是可以忍受的,但是对于一些核心的业务数据,比如订单之类的,不能忍受数据不一致,下了单了,付了款了,一刷订单列表,发现这个订单还没支付,甚至订单都没在,这对于用户来讲是恨不能容忍的错误,那么这里就需要一些措施,要不就不读写分离,要不就在 redis 这类缓存下订单,或者支付后加个延时等,这些都是一些补偿措施,并且这也是一个不太切当的例子,比较合适的例子也可以用这个下单来说,一般在电商平台下单会有挺多要做的事情,比如像下面这个图

+

+

下单的是后要冻结核销优惠券,如果账户里有钱要冻结扣除账户里的钱,如果使用了J 豆也一样,可能还有 E 卡,忽略我借用的平台,因为目前一般后台服务化之后,可能每一项都是对应的一个后台服务,我们期望的执行过程是要不全成功,要不就全保持执行前状态,不能是部分扣减核销成功了,部分还不行,所以我们处理这种情况会引入一些通用的方案,第一种叫二阶段提交,

+
+

二阶段提交(英语:Two-phase Commit)是指在计算机网络以及数据库领域内,为了使基于分布式系统架构下的所有节点在进行事务提交时保持一致性而设计的一种算法。通常,二阶段提交也被称为是一种协议(Protocol)。在分布式系统中,每个节点虽然可以知晓自己的操作时成功或者失败,却无法知道其他节点的操作的成功或失败。当一个事务跨越多个节点时,为了保持事务的ACID特性,需要引入一个作为协调者的组件来统一掌控所有节点(称作参与者)的操作结果并最终指示这些节点是否要把操作结果进行真正的提交(比如将更新后的数据写入磁盘等等)。因此,二阶段提交的算法思路可以概括为: 参与者将操作成败通知协调者,再由协调者根据所有参与者的反馈情报决定各参与者是否要提交操作还是中止操作。

+
+

对于上面的例子,我们将整个过程分成两个阶段,首先是提交请求阶段,这个阶段大概需要做的是确定资源存在,锁定资源,可能还要做好失败后回滚的准备,如果这些都 ok 了那么就响应成功,这里其实用到了一个叫事务的协调者的角色,类似于裁判员,每个节点都反馈第一阶段成功后,开始执行第二阶段,也就是实际执行操作,这里也是需要所有节点都反馈成功后才是执行成功,要不就是失败回滚。其实常用的分布式事务的解决方案主要也是基于此方案的改进,比如后面介绍的三阶段提交,有三阶段提交就是因为二阶段提交比较尴尬的几个点,

+
    +
  • 第一是对于两阶段提交,其中默认只有协调者有超时时间,当一个参与者进入卡死状态时只能依赖协调者的超时来结束任务,这中间的时间参与者都是锁定着资源
  • +
  • 第二是协调者的单点问题,万一挂了,参与者就会在那傻等着
  • +
+

所以三阶段提交引入了各节点的超时机制和一个准备阶段,首先是一个can commit阶段,询问下各个节点有没有资源,能不能进行操作,这个阶段不阻塞,只是提前做个摸底,这个阶段其实人畜无害,但是能提高成功率,在这个阶段如果就有节点反馈是不接受的,那就不用执行下去了,也没有锁资源,然后第二阶段是 pre commit ,这个阶段做的事情跟原来的 第一阶段比较类似,然后是第三阶段do commit,其实三阶段提交我个人觉得只是加了个超时,和准备阶段,好像木有根本性的解决的两阶段提交的问题,后续可以再看看一些论文来思考讨论下。

+ +
+ + + + + + +
+
请我喝杯咖啡
+ + +
+ + + +
+ +
+ + + + +
+ + + + + + +
+ + +
+
+ +
+
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/404.html b/404.html index ba10a485eb..df6fc03562 100644 --- a/404.html +++ b/404.html @@ -320,20 +320,20 @@
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -358,7 +358,7 @@
diff --git a/404/index.html b/404/index.html index fc801403d5..1391317c53 100644 --- a/404/index.html +++ b/404/index.html @@ -307,20 +307,20 @@
- 49 + 50 posts
- 38 + 41 categories
- 63 + 68 tags
@@ -345,7 +345,7 @@
diff --git a/archives/2014/12/index.html b/archives/2014/12/index.html index 654847dca7..7553402df5 100644 --- a/archives/2014/12/index.html +++ b/archives/2014/12/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -350,20 +350,20 @@ @@ -388,7 +388,7 @@ diff --git a/archives/2014/index.html b/archives/2014/index.html index 41c3184d27..0fa1423ed8 100644 --- a/archives/2014/index.html +++ b/archives/2014/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -350,20 +350,20 @@ @@ -388,7 +388,7 @@ diff --git a/archives/2015/01/index.html b/archives/2015/01/index.html index d286eb4c49..adf368ab2e 100644 --- a/archives/2015/01/index.html +++ b/archives/2015/01/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -350,20 +350,20 @@ @@ -388,7 +388,7 @@ diff --git a/archives/2015/03/index.html b/archives/2015/03/index.html index d75bc2f408..6bd50c7b24 100644 --- a/archives/2015/03/index.html +++ b/archives/2015/03/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -350,20 +350,20 @@ @@ -388,7 +388,7 @@ diff --git a/archives/2015/04/index.html b/archives/2015/04/index.html index 35b412f5d9..461c1239da 100644 --- a/archives/2015/04/index.html +++ b/archives/2015/04/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -330,20 +330,20 @@ @@ -368,7 +368,7 @@ diff --git a/archives/2015/06/index.html b/archives/2015/06/index.html index 1842c5965c..68c06e82ee 100644 --- a/archives/2015/06/index.html +++ b/archives/2015/06/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/archives/2015/index.html b/archives/2015/index.html index e800188182..5df32fecd9 100644 --- a/archives/2015/index.html +++ b/archives/2015/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -470,20 +470,20 @@ @@ -508,7 +508,7 @@ diff --git a/archives/2016/07/index.html b/archives/2016/07/index.html index c9d8575438..37e47703f7 100644 --- a/archives/2016/07/index.html +++ b/archives/2016/07/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/archives/2016/08/index.html b/archives/2016/08/index.html index ef01e5829b..e6230407f6 100644 --- a/archives/2016/08/index.html +++ b/archives/2016/08/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -330,20 +330,20 @@ @@ -368,7 +368,7 @@ diff --git a/archives/2016/09/index.html b/archives/2016/09/index.html index 0305d1c150..b7289b6596 100644 --- a/archives/2016/09/index.html +++ b/archives/2016/09/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/archives/2016/10/index.html b/archives/2016/10/index.html index f14d2399f5..d151c60dfc 100644 --- a/archives/2016/10/index.html +++ b/archives/2016/10/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -330,20 +330,20 @@ @@ -368,7 +368,7 @@ diff --git a/archives/2016/11/index.html b/archives/2016/11/index.html index 5842883b9a..29c2dd1ee2 100644 --- a/archives/2016/11/index.html +++ b/archives/2016/11/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/archives/2016/index.html b/archives/2016/index.html index b41699fe6a..5a2f396c39 100644 --- a/archives/2016/index.html +++ b/archives/2016/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -430,20 +430,20 @@ @@ -468,7 +468,7 @@ diff --git a/archives/2017/03/index.html b/archives/2017/03/index.html index c950f1f5a9..797be067df 100644 --- a/archives/2017/03/index.html +++ b/archives/2017/03/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/archives/2017/04/index.html b/archives/2017/04/index.html index fc83d921db..c00aae7b39 100644 --- a/archives/2017/04/index.html +++ b/archives/2017/04/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/archives/2017/05/index.html b/archives/2017/05/index.html index e2d976a226..44d33b6372 100644 --- a/archives/2017/05/index.html +++ b/archives/2017/05/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/archives/2017/index.html b/archives/2017/index.html index 997f8f9740..55e073b6e2 100644 --- a/archives/2017/index.html +++ b/archives/2017/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -350,20 +350,20 @@ @@ -388,7 +388,7 @@ diff --git a/archives/2019/06/index.html b/archives/2019/06/index.html index dd06971480..b98e06f992 100644 --- a/archives/2019/06/index.html +++ b/archives/2019/06/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/archives/2019/09/index.html b/archives/2019/09/index.html index 05aa913e33..b996a9837e 100644 --- a/archives/2019/09/index.html +++ b/archives/2019/09/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/archives/2019/12/index.html b/archives/2019/12/index.html index dfca023431..3219489fab 100644 --- a/archives/2019/12/index.html +++ b/archives/2019/12/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -390,20 +390,20 @@ @@ -428,7 +428,7 @@ diff --git a/archives/2019/index.html b/archives/2019/index.html index b68cb82b03..0d8adc151c 100644 --- a/archives/2019/index.html +++ b/archives/2019/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -430,20 +430,20 @@ @@ -468,7 +468,7 @@ diff --git a/archives/2020/01/index.html b/archives/2020/01/index.html index dda17cb022..451b8017e9 100644 --- a/archives/2020/01/index.html +++ b/archives/2020/01/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -390,20 +390,20 @@ @@ -428,7 +428,7 @@ diff --git a/archives/2020/02/index.html b/archives/2020/02/index.html index 3f99fe26b6..a14960bafa 100644 --- a/archives/2020/02/index.html +++ b/archives/2020/02/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -370,20 +370,20 @@ @@ -408,7 +408,7 @@ diff --git a/archives/2020/03/index.html b/archives/2020/03/index.html index 0052cd60ae..e3fb019418 100644 --- a/archives/2020/03/index.html +++ b/archives/2020/03/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -390,20 +390,20 @@ @@ -428,7 +428,7 @@ diff --git a/archives/2020/04/index.html b/archives/2020/04/index.html index e4ec5c553c..8d3ccb06e3 100644 --- a/archives/2020/04/index.html +++ b/archives/2020/04/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -370,20 +370,20 @@ @@ -408,7 +408,7 @@ diff --git a/archives/2020/05/index.html b/archives/2020/05/index.html index f68c733080..c5c7cab567 100644 --- a/archives/2020/05/index.html +++ b/archives/2020/05/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -216,6 +216,26 @@ 2020
+ +
@@ -330,20 +350,20 @@ @@ -368,7 +388,7 @@ diff --git a/archives/2020/index.html b/archives/2020/index.html index 69d3cf6782..e899625eb5 100644 --- a/archives/2020/index.html +++ b/archives/2020/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -216,6 +216,26 @@ 2020
+ +
@@ -396,26 +416,6 @@
- -
@@ -425,7 +425,7 @@ @@ -493,20 +493,20 @@ @@ -531,7 +531,7 @@ diff --git a/archives/2020/page/2/index.html b/archives/2020/page/2/index.html index 48c8d70981..c5c44c6529 100644 --- a/archives/2020/page/2/index.html +++ b/archives/2020/page/2/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -216,6 +216,26 @@ 2020
+ +
@@ -396,26 +416,6 @@
- -
@@ -425,7 +425,7 @@ @@ -493,20 +493,20 @@ @@ -531,7 +531,7 @@ diff --git a/archives/2020/page/3/index.html b/archives/2020/page/3/index.html new file mode 100644 index 0000000000..69192bea3e --- /dev/null +++ b/archives/2020/page/3/index.html @@ -0,0 +1,576 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Archive | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+ + + +

Nicksxs's Blog

+ +
+

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + + + + + + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+ + OK! 50 posts in total. Keep on posting. +
+ + +
+ 2020 +
+ + + + +
+
+ + + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/archives/index.html b/archives/index.html index 17fb247713..a4332c0904 100644 --- a/archives/index.html +++ b/archives/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -216,6 +216,26 @@ 2020
+ +
@@ -396,26 +416,6 @@
- -
@@ -493,20 +493,20 @@ @@ -531,7 +531,7 @@ diff --git a/archives/page/2/index.html b/archives/page/2/index.html index 5a635c755f..dbbdb5d1e1 100644 --- a/archives/page/2/index.html +++ b/archives/page/2/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -216,6 +216,26 @@ 2020
+ +
@@ -396,26 +416,6 @@
- -
@@ -493,20 +493,20 @@ @@ -531,7 +531,7 @@ diff --git a/archives/page/3/index.html b/archives/page/3/index.html index 92007c9cf5..e5aee8832e 100644 --- a/archives/page/3/index.html +++ b/archives/page/3/index.html @@ -208,10 +208,33 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
+
+ 2020 +
+ +
2019
@@ -399,26 +422,6 @@ - -
@@ -496,20 +499,20 @@ @@ -534,7 +537,7 @@ diff --git a/archives/page/4/index.html b/archives/page/4/index.html index dad8631c8b..628a9251bf 100644 --- a/archives/page/4/index.html +++ b/archives/page/4/index.html @@ -208,10 +208,33 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
+
+ 2017 +
+ +
2016
@@ -399,26 +422,6 @@ - -
@@ -496,20 +499,20 @@ @@ -534,7 +537,7 @@ diff --git a/archives/page/5/index.html b/archives/page/5/index.html index 9c71c89c6b..e71fec1b51 100644 --- a/archives/page/5/index.html +++ b/archives/page/5/index.html @@ -208,7 +208,7 @@
- OK! 49 posts in total. Keep on posting. + OK! 50 posts in total. Keep on posting.
@@ -216,6 +216,26 @@ 2015
+ +
@@ -476,20 +496,20 @@ @@ -514,7 +534,7 @@ diff --git a/atom.xml b/atom.xml index c734543ba7..1d24d9da55 100644 --- a/atom.xml +++ b/atom.xml @@ -6,7 +6,7 @@ - 2020-05-10T14:23:36.231Z + 2020-05-17T15:57:30.000Z https://nicksxs.me/ @@ -16,12 +16,53 @@ Hexo + + 聊聊我理解的分布式事务 + + https://nicksxs.me/2020/05/17/%E8%81%8A%E8%81%8A%E6%88%91%E7%90%86%E8%A7%A3%E7%9A%84%E5%88%86%E5%B8%83%E5%BC%8F%E4%BA%8B%E5%8A%A1/ + 2020-05-17T15:56:01.000Z + 2020-05-17T15:57:30.000Z + + + + + + + + <p>前面说了mysql数据库的事务相关的,那事务是用来干嘛的,这里得补一下ACID,</p> +<blockquote> +<p><a href="https://zh.wikipedia.org/wiki/ACID" target="_blank" + + + + + + + + + + + + + + + + + + + + + + + + + 聊聊 mysql 的 MVCC 续续篇之锁分析 https://nicksxs.me/2020/05/10/%E8%81%8A%E8%81%8A-mysql-%E7%9A%84-MVCC-%E7%BB%AD%E7%BB%AD%E7%AF%87%E4%B9%8B%E5%8A%A0%E9%94%81%E5%88%86%E6%9E%90/ 2020-05-10T01:55:10.000Z - 2020-05-10T14:23:36.231Z + 2020-05-10T14:26:13.027Z @@ -730,45 +771,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - redis数据结构介绍二-第二部分 跳表 - - https://nicksxs.me/2020/01/04/redis%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%BB%8B%E7%BB%8D%E4%BA%8C/ - 2020-01-03T16:03:05.000Z - 2020-01-12T13:08:27.009Z - - - - - - - - <h2 id="跳表-skiplist"><a href="#跳表-skiplist" class="headerlink" title="跳表 skiplist"></a>跳表 - - - diff --git a/baidu_verify_Gl8jtoDV4z.html b/baidu_verify_Gl8jtoDV4z.html index 1bdd566684..e7a8f12339 100644 --- a/baidu_verify_Gl8jtoDV4z.html +++ b/baidu_verify_Gl8jtoDV4z.html @@ -309,20 +309,20 @@ @@ -347,7 +347,7 @@ diff --git a/baidusitemap.xml b/baidusitemap.xml index 9ed3fa349c..3566bfe051 100644 --- a/baidusitemap.xml +++ b/baidusitemap.xml @@ -1,6 +1,9 @@ + https://nicksxs.me/2020/05/17/%E8%81%8A%E8%81%8A%E6%88%91%E7%90%86%E8%A7%A3%E7%9A%84%E5%88%86%E5%B8%83%E5%BC%8F%E4%BA%8B%E5%8A%A1/ + 2020-05-17 + https://nicksxs.me/2020/05/10/%E8%81%8A%E8%81%8A-mysql-%E7%9A%84-MVCC-%E7%BB%AD%E7%BB%AD%E7%AF%87%E4%B9%8B%E5%8A%A0%E9%94%81%E5%88%86%E6%9E%90/ 2020-05-10 @@ -70,10 +73,10 @@ https://nicksxs.me/2019/12/26/redis%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%BB%8B%E7%BB%8D/ 2020-01-12 - https://nicksxs.me/2015/03/13/Reverse-Integer/ + https://nicksxs.me/2015/04/14/Add-Two-Number/ 2020-01-12 - https://nicksxs.me/2015/04/14/Add-Two-Number/ + https://nicksxs.me/2015/03/13/Reverse-Integer/ 2020-01-12 https://nicksxs.me/2014/12/24/MFC%20%E6%A8%A1%E6%80%81%E5%AF%B9%E8%AF%9D%E6%A1%86/ @@ -82,10 +85,10 @@ https://nicksxs.me/2016/08/14/docker-mysql-cluster/ 2020-01-12 - https://nicksxs.me/2017/05/09/ambari-summary/ + https://nicksxs.me/2019/06/18/openresty/ 2020-01-12 - https://nicksxs.me/2019/06/18/openresty/ + https://nicksxs.me/2017/05/09/ambari-summary/ 2020-01-12 https://nicksxs.me/2020/01/04/redis%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%BB%8B%E7%BB%8D%E4%BA%8C/ @@ -103,10 +106,10 @@ https://nicksxs.me/2020/01/10/redis%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%BB%8B%E7%BB%8D%E4%B8%89/ 2020-01-12 - https://nicksxs.me/2014/12/23/my-new-post/ + https://nicksxs.me/2017/03/28/spark-little-tips/ 2020-01-12 - https://nicksxs.me/2017/03/28/spark-little-tips/ + https://nicksxs.me/2014/12/23/my-new-post/ 2020-01-12 https://nicksxs.me/2014/12/30/Clone-Graph-Part-I/ @@ -115,10 +118,10 @@ https://nicksxs.me/2016/07/13/swoole-websocket-test/ 2020-01-12 - https://nicksxs.me/2015/06/22/invert-binary-tree/ + https://nicksxs.me/2016/10/12/summary-ranges-228/ 2020-01-12 - https://nicksxs.me/2016/10/12/summary-ranges-228/ + https://nicksxs.me/2015/06/22/invert-binary-tree/ 2020-01-12 https://nicksxs.me/2015/01/04/Path-Sum/ @@ -130,10 +133,10 @@ https://nicksxs.me/2015/03/11/Number-Of-1-Bits/ 2020-01-12 - https://nicksxs.me/2019/09/23/AbstractQueuedSynchronizer/ + https://nicksxs.me/2015/04/15/Leetcode-No-3/ 2020-01-12 - https://nicksxs.me/2015/04/15/Leetcode-No-3/ + https://nicksxs.me/2019/09/23/AbstractQueuedSynchronizer/ 2020-01-12 https://nicksxs.me/2015/01/16/pcre-intro-and-a-simple-package/ diff --git a/categories/C/Mysql/index.html b/categories/C/Mysql/index.html index 4cdd05df87..cca61d503c 100644 --- a/categories/C/Mysql/index.html +++ b/categories/C/Mysql/index.html @@ -350,20 +350,20 @@ @@ -388,7 +388,7 @@ diff --git a/categories/C/Redis/index.html b/categories/C/Redis/index.html index aa4d27e631..19e96f13ff 100644 --- a/categories/C/Redis/index.html +++ b/categories/C/Redis/index.html @@ -473,20 +473,20 @@ @@ -511,7 +511,7 @@ diff --git a/categories/C/index.html b/categories/C/index.html index cc239be7dd..cea82b011a 100644 --- a/categories/C/index.html +++ b/categories/C/index.html @@ -493,20 +493,20 @@ @@ -531,7 +531,7 @@ diff --git a/categories/C/page/2/index.html b/categories/C/page/2/index.html index 9a99865920..1c961c6b41 100644 --- a/categories/C/page/2/index.html +++ b/categories/C/page/2/index.html @@ -333,20 +333,20 @@ @@ -371,7 +371,7 @@ diff --git a/categories/Java/Design-Patterns/index.html b/categories/Java/Design-Patterns/index.html index 4f15742ae1..53c2e32ba0 100644 --- a/categories/Java/Design-Patterns/index.html +++ b/categories/Java/Design-Patterns/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/categories/Java/GC/index.html b/categories/Java/GC/index.html index 2ac951adbe..fcfed99805 100644 --- a/categories/Java/GC/index.html +++ b/categories/Java/GC/index.html @@ -333,20 +333,20 @@ @@ -371,7 +371,7 @@ diff --git a/categories/Java/JVM/index.html b/categories/Java/JVM/index.html index 1f620fdc0f..dd0aa4f58b 100644 --- a/categories/Java/JVM/index.html +++ b/categories/Java/JVM/index.html @@ -333,20 +333,20 @@ @@ -371,7 +371,7 @@ diff --git a/categories/Java/Maven/index.html b/categories/Java/Maven/index.html index 5852b1f952..5ecf65a9e6 100644 --- a/categories/Java/Maven/index.html +++ b/categories/Java/Maven/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/categories/Java/Singleton/index.html b/categories/Java/Singleton/index.html index 9a382c5844..e546ccb40f 100644 --- a/categories/Java/Singleton/index.html +++ b/categories/Java/Singleton/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/categories/Java/index.html b/categories/Java/index.html index c9f5fc1e71..4a5c67bed5 100644 --- a/categories/Java/index.html +++ b/categories/Java/index.html @@ -29,7 +29,7 @@ - + @@ -40,7 +40,7 @@ - + - Category: java | Nicksxs's Blog + Category: Java | Nicksxs's Blog - - - - - - -if (CONFIG.page.isPost) { - if (CONFIG.hostname !== location.hostname) return; - addCount(Counter); - } else if (document.querySelectorAll('.post-title-link').length >= 1) { - showTime(Counter); - } - } - - let api_server = app_id.slice(-9) !== '-MdYXbMMI' ? server_url : `https://${app_id.slice(0, 8).toLowerCase()}.api.lncldglobal.com`; - - if (api_server) { - fetchData(api_server); - } else { - fetch('https://app-router.leancloud.cn/2/route?appId=' + app_id) - .then(response => response.json()) - .then(({ api_server }) => { - fetchData('https://' + api_server); - }); - } - })(); - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Category: Docker | Nicksxs's Blog + Category: docker | Nicksxs's Blog + + + + + + +id.slice(0, 8).toLowerCase()}.api.lncldglobal.com`; + + if (api_server) { + fetchData(api_server); + } else { + fetch('https://app-router.leancloud.cn/2/route?appId=' + app_id) + .then(response => response.json()) + .then(({ api_server }) => { + fetchData('https://' + api_server); + }); + } + })(); + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Category: 分布式事务 | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+ + + +

Nicksxs's Blog

+ +
+

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + + + + + + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

分布式事务 + Category +

+
+ + +
+ 2020 +
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/categories/分布式事务/三阶段提交/index.html b/categories/分布式事务/三阶段提交/index.html new file mode 100644 index 0000000000..0dbe6addf2 --- /dev/null +++ b/categories/分布式事务/三阶段提交/index.html @@ -0,0 +1,583 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Category: 三阶段提交 | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+ + + +

Nicksxs's Blog

+ +
+

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + + + + + + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

三阶段提交 + Category +

+
+ + +
+ 2020 +
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/categories/分布式事务/两阶段提交/index.html b/categories/分布式事务/两阶段提交/index.html new file mode 100644 index 0000000000..aca3510ebd --- /dev/null +++ b/categories/分布式事务/两阶段提交/index.html @@ -0,0 +1,583 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Category: 两阶段提交 | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+ + + +

Nicksxs's Blog

+ +
+

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + + + + + + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

两阶段提交 + Category +

+
+ + +
+ 2020 +
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/categories/持续集成/index.html b/categories/持续集成/index.html index 18853bcb4f..e3575f0fba 100644 --- a/categories/持续集成/index.html +++ b/categories/持续集成/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/categories/生活/index.html b/categories/生活/index.html index 71a4520068..d013b9daa4 100644 --- a/categories/生活/index.html +++ b/categories/生活/index.html @@ -353,20 +353,20 @@ @@ -391,7 +391,7 @@ diff --git a/categories/生活/年终总结/2019/index.html b/categories/生活/年终总结/2019/index.html index d4d78040f3..6b7304a97a 100644 --- a/categories/生活/年终总结/2019/index.html +++ b/categories/生活/年终总结/2019/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/categories/生活/年终总结/index.html b/categories/生活/年终总结/index.html index 6fa26ce8c9..79303b9af7 100644 --- a/categories/生活/年终总结/index.html +++ b/categories/生活/年终总结/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/categories/生活/影评/2020/index.html b/categories/生活/影评/2020/index.html index efba16f044..4d42e4ca17 100644 --- a/categories/生活/影评/2020/index.html +++ b/categories/生活/影评/2020/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/categories/生活/影评/index.html b/categories/生活/影评/index.html index c54dc60916..e5dff0a57b 100644 --- a/categories/生活/影评/index.html +++ b/categories/生活/影评/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/categories/读后感/index.html b/categories/读后感/index.html index f1c07876b7..0529ba17d8 100644 --- a/categories/读后感/index.html +++ b/categories/读后感/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/categories/读后感/村上春树/index.html b/categories/读后感/村上春树/index.html index 5a3461e12b..f47a563620 100644 --- a/categories/读后感/村上春树/index.html +++ b/categories/读后感/村上春树/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/css/main.css b/css/main.css index 6c45bfa25e..720fe3f747 100644 --- a/css/main.css +++ b/css/main.css @@ -1262,7 +1262,7 @@ pre .javascript .function { } .links-of-author a::before, .links-of-author span.exturl::before { - background: #ff9505; + background: #f29e57; border-radius: 50%; content: ' '; display: inline-block; diff --git a/index.html b/index.html index 4776a99511..63f32a75cf 100644 --- a/index.html +++ b/index.html @@ -203,6 +203,130 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

前面说了mysql数据库的事务相关的,那事务是用来干嘛的,这里得补一下ACID,

+
+

ACID,是指数据库管理系统DBMS)在写入或更新资料的过程中,为保证事务(transaction)是正确可靠的,所必须具备的四个特性:原子性(atomicity,或称不可分割性)、一致性(consistency)、隔离性(isolation,又称独立性)、持久性(durability)。

+
+
    +
  • Atomicity(原子性):一个事务(transaction)中的所有操作,或者全部完成,或者全部不完成,不会结束在中间某个环节。事务在执行过程中发生错误,会被回滚(Rollback)到事务开始前的状态,就像这个事务从来没有执行过一样。即,事务不可分割、不可约简。[1]

    +
  • +
  • Consistency(一致性):在事务开始之前和事务结束以后,数据库的完整性没有被破坏。这表示写入的资料必须完全符合所有的预设约束触发器级联回滚等。[1]

    +
  • +
  • Isolation(隔离性):数据库允许多个并发事务同时对其数据进行读写和修改的能力,隔离性可以防止多个事务并发执行时由于交叉执行而导致数据的不一致。事务隔离分为不同级别,包括未提交读(Read uncommitted)、提交读(read committed)、可重复读(repeatable read)和串行化(Serializable)。[1]

    +
  • +
  • Durability(持久性):事务处理结束后,对数据的修改就是永久的,即便系统故障也不会丢失。[1]

    +
  • +
+

在mysql中,借助于MVCC,各种级别的锁,日志等特性来实现了事务的ACID,但是这个我们通常是对于一个数据库服务的定义,常见的情况下我们的数据库随着业务发展也会从单实例变成多实例,组成主从Master-Slave架构,这个时候其实会有一些问题随之出现,比如说主从同步延迟,假如在业务代码中做了读写分离,对于一些敏感度较低的数据其实问题不是很大,只要主从延迟不到特别夸张的地步一般都是可以忍受的,但是对于一些核心的业务数据,比如订单之类的,不能忍受数据不一致,下了单了,付了款了,一刷订单列表,发现这个订单还没支付,甚至订单都没在,这对于用户来讲是恨不能容忍的错误,那么这里就需要一些措施,要不就不读写分离,要不就在 redis 这类缓存下订单,或者支付后加个延时等,这些都是一些补偿措施,并且这也是一个不太切当的例子,比较合适的例子也可以用这个下单来说,一般在电商平台下单会有挺多要做的事情,比如像下面这个图

+

+

下单的是后要冻结核销优惠券,如果账户里有钱要冻结扣除账户里的钱,如果使用了J 豆也一样,可能还有 E 卡,忽略我借用的平台,因为目前一般后台服务化之后,可能每一项都是对应的一个后台服务,我们期望的执行过程是要不全成功,要不就全保持执行前状态,不能是部分扣减核销成功了,部分还不行,所以我们处理这种情况会引入一些通用的方案,第一种叫二阶段提交,

+
+

二阶段提交(英语:Two-phase Commit)是指在计算机网络以及数据库领域内,为了使基于分布式系统架构下的所有节点在进行事务提交时保持一致性而设计的一种算法。通常,二阶段提交也被称为是一种协议(Protocol)。在分布式系统中,每个节点虽然可以知晓自己的操作时成功或者失败,却无法知道其他节点的操作的成功或失败。当一个事务跨越多个节点时,为了保持事务的ACID特性,需要引入一个作为协调者的组件来统一掌控所有节点(称作参与者)的操作结果并最终指示这些节点是否要把操作结果进行真正的提交(比如将更新后的数据写入磁盘等等)。因此,二阶段提交的算法思路可以概括为: 参与者将操作成败通知协调者,再由协调者根据所有参与者的反馈情报决定各参与者是否要提交操作还是中止操作。

+
+

对于上面的例子,我们将整个过程分成两个阶段,首先是提交请求阶段,这个阶段大概需要做的是确定资源存在,锁定资源,可能还要做好失败后回滚的准备,如果这些都 ok 了那么就响应成功,这里其实用到了一个叫事务的协调者的角色,类似于裁判员,每个节点都反馈第一阶段成功后,开始执行第二阶段,也就是实际执行操作,这里也是需要所有节点都反馈成功后才是执行成功,要不就是失败回滚。其实常用的分布式事务的解决方案主要也是基于此方案的改进,比如后面介绍的三阶段提交,有三阶段提交就是因为二阶段提交比较尴尬的几个点,

+
    +
  • 第一是对于两阶段提交,其中默认只有协调者有超时时间,当一个参与者进入卡死状态时只能依赖协调者的超时来结束任务,这中间的时间参与者都是锁定着资源
  • +
  • 第二是协调者的单点问题,万一挂了,参与者就会在那傻等着
  • +
+

所以三阶段提交引入了各节点的超时机制和一个准备阶段,首先是一个can commit阶段,询问下各个节点有没有资源,能不能进行操作,这个阶段不阻塞,只是提前做个摸底,这个阶段其实人畜无害,但是能提高成功率,在这个阶段如果就有节点反馈是不接受的,那就不用执行下去了,也没有锁资源,然后第二阶段是 pre commit ,这个阶段做的事情跟原来的 第一阶段比较类似,然后是第三阶段do commit,其实三阶段提交我个人觉得只是加了个超时,和准备阶段,好像木有根本性的解决的两阶段提交的问题,后续可以再看看一些论文来思考讨论下。

+ + +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -229,7 +353,7 @@ - +
@@ -1272,146 +1396,6 @@ - - - -
- - - - - -
-

- - -

- - -
- - - - -
- - -

因为最近想搭一个phabricator用来做看板和任务管理,一开始了解这个是Easy大大有在微博推荐过,后来苏洋也在群里和博客里说到了,看上去还不错的样子,因为主角是docker所以就不介绍太多,后面有机会写一下。

-

docker最开始是之前在某位大佬的博客看到的,看上去有点神奇,感觉是一种轻量级的虚拟机,但是能做的事情好像差不多,那时候是在Ubuntu系统的vps里起一个Ubuntu的docker,然后在里面装个nginx,配置端口映射就可以访问了,后来也草草写过一篇使用docker搭建mysql集群,但是最近看了下好像是因为装docker的大佬做了一些别名还是什么操作,导致里面用的操作都不具有普遍性,而且主要是把搭的过程写了下,属于囫囵吞枣,没理解docker是干啥的,为啥用docker,就是操作了下,这几天借着搭phabricator的过程,把一些原来不理解,或者原来理解错误的地方重新理一下。

-

之前写的 mysql 集群,一主二备,这种架构在很多小型应用里都是这么配置的,而且一般是直接在三台 vps 里启动三个 mysql 实例,但是如果换成 docker 会有什么好处呢,其实就是方便部署,比如其中一台备库挂了,我要加一台,或者说备库的 qps 太高了,需要再加一个,如果要在 vps 上搭建的话,首先要买一台机器,等初始化,然后在上面修改源,更新,装 mysql ,然后配置主从,可能还要处理防火墙等等,如果把这些打包成一个 docker 镜像,并且放在自己的 docker registry,那就直接run 一下就可以了;还有比如在公司要给一个新同学整一套开发测试环境,以 Java 开发为例,要装 git,maven,jdk,配置 maven settings 和各种 rc,整合在一个镜像里的话,就会很方便了;再比如微服务的水平扩展。

-

但是为啥 docker 会有这种优势,听起来好像虚拟机也可以干这个事,但是虚拟机动辄上 G,而且需要 VMware,virtual box 等支持,不适合在Linux服务器环境使用,而且占用资源也会非常大。说得这么好,那么 docker 是啥呢

-

docker 主要使用 Linux 中已经存在的两种技术的一个整合升级,一个是 namespace,一个是cgroups,相比于虚拟机需要完整虚拟出一个操作系统运行基础,docker 基于宿主机内核,通过 namespace 和 cgroups 分隔进程,理念就是提供一个隔离的最小化运行依赖,这样子相对于虚拟机就有了巨大的便利性,具体的 namespace 和 cgroups 就先不展开讲,可以参考耗子叔的文章

-

安装

那么我们先安装下 docker,参考官方的教程,安装,我的系统是 ubuntu 的,就贴了 ubuntu 的链接,用其他系统的可以找到对应的系统文档安装,安装完了的话看看 docker 的信息

-
1
sudo docker info
- -

输出以下信息

-

简单运行

然后再来运行个 hello world 呗,

-
1
sudo docker run hello-world
- -

输出了这些

-

看看这个运行命令是怎么用的,一般都会看到这样子的,sudo docker run -it ubuntu bash, 前面的 docker run 反正就是运行一个容器的意思,-it是啥呢,还有这个什么 ubuntu bash,来看看docker run`的命令帮助信息

-
1
-i, --interactive                    Keep STDIN open even if not attached
- -

就是要有输入,我们运行的时候能输入

-
1
-t, --tty                            Allocate a pseudo-TTY
- -

要有个虚拟终端,

-
1
2
3
Usage:	docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Run a command in a new container
- -

镜像

上面说的-it 就是这里的 options,后面那个 ubuntu 就是 image 辣,image 是啥呢

-

Docker 把应用程序及其依赖,打包在 image 文件里面,可以把它理解成为类似于虚拟机的镜像或者运行一个进程的代码,跑起来了的叫docker 容器或者进程,比如我们将要运行的docker run -it ubuntu bash的ubuntu 就是个 ubuntu 容器的镜像,将这个镜像运行起来后,我们可以进入容器像使用 ubuntu 一样使用它,来看下我们的镜像,使用sudo docker image ls就能列出我们宿主机上的 docker 镜像了

-

-

一个 ubuntu 镜像才 64MB,非常小巧,然后是后面的bash,我通过交互式启动了一个 ubuntu 容器,然后在这个启动的容器里运行了 bash 命令,这样就可以在容器里玩一下了

-

在容器里看下进程,

-

只有刚才运行容器的 bash 进程和我刚执行的 ps,这里有个可以注意下的,bash 这个进程的 pid 是 1,其实这里就用到了 linux 中的PID Namespace,容器会隔离出一个 pid 的名字空间,这里面的进程跟外部的 pid 命名独立

-

查看宿主机上的容器

1
sudo docker ps -a
- -

-

如何进入一个正在运行中的 docker 容器

这个应该是比较常用的,因为比如是一个微服务容器,有时候就像看下运行状态,日志啥的

-
1
sudo docker exec -it [containerID] bash
- -

-

查看日志

1
sudo docker logs [containerID]
- -

我在运行容器的终端里胡乱输入点啥,然后通过上面的命令就可以看到啦

-

-

- - -
- - - - - - -
-
-
-
- - - - @@ -1521,7 +1505,7 @@ diff --git a/leancloud.memo b/leancloud.memo index 507979435b..40ee006dd4 100644 --- a/leancloud.memo +++ b/leancloud.memo @@ -47,4 +47,5 @@ {"title":"redis系列介绍八-淘汰策略","url":"/2020/04/18/redis系列介绍八/"}, {"title":"聊聊 mysql 的 MVCC","url":"/2020/04/26/聊聊-mysql-的-MVCC/"}, {"title":"聊聊 mysql 的 MVCC 续篇","url":"/2020/05/02/聊聊-mysql-的-MVCC-续篇/"}, +{"title":"聊聊 mysql 的 MVCC 续续篇之锁分析","url":"/2020/05/10/聊聊-mysql-的-MVCC-续续篇之加锁分析/"}, ] \ No newline at end of file diff --git a/leancloud_counter_security_urls.json b/leancloud_counter_security_urls.json index aa1f57ccfb..d38d98cff3 100644 --- a/leancloud_counter_security_urls.json +++ b/leancloud_counter_security_urls.json @@ -1 +1 @@ -[{"title":"34_Search_for_a_Range","url":"/2016/08/14/34-Search-for-a-Range/"},{"title":"村上春树《1Q84》读后感","url":"/2019/12/18/1Q84读后感/"},{"title":"AbstractQueuedSynchronizer","url":"/2019/09/23/AbstractQueuedSynchronizer/"},{"title":"add-two-number","url":"/2015/04/14/Add-Two-Number/"},{"title":"Clone Graph Part I","url":"/2014/12/30/Clone-Graph-Part-I/"},{"title":"2019年终总结","url":"/2020/02/01/2019年终总结/"},{"title":"Comparator使用小记","url":"/2020/04/05/Comparator使用小记/"},{"title":"MFC 模态对话框","url":"/2014/12/24/MFC 模态对话框/"},{"title":"G1收集器概述","url":"/2020/02/09/G1收集器概述/"},{"title":"Number of 1 Bits","url":"/2015/03/11/Number-Of-1-Bits/"},{"title":"Path Sum","url":"/2015/01/04/Path-Sum/"},{"title":"Maven实用小技巧","url":"/2020/02/16/Maven实用小技巧/"},{"title":"Reverse Bits","url":"/2015/03/11/Reverse-Bits/"},{"title":"Redis_分布式锁","url":"/2019/12/10/Redis-Part-1/"},{"title":"two sum","url":"/2015/01/14/Two-Sum/"},{"title":"Reverse Integer","url":"/2015/03/13/Reverse-Integer/"},{"title":"ambari-summary","url":"/2017/05/09/ambari-summary/"},{"title":"binary-watch","url":"/2016/09/29/binary-watch/"},{"title":"docker-mysql-cluster","url":"/2016/08/14/docker-mysql-cluster/"},{"title":"docker比一般多一点的初学者介绍","url":"/2020/03/08/docker比一般多一点的初学者介绍/"},{"title":"docker比一般多一点的初学者介绍三","url":"/2020/03/21/docker比一般多一点的初学者介绍三/"},{"title":"docker比一般多一点的初学者介绍二","url":"/2020/03/15/docker比一般多一点的初学者介绍二/"},{"title":"minimum-size-subarray-sum-209","url":"/2016/10/11/minimum-size-subarray-sum-209/"},{"title":"gogs使用webhook部署react单页应用","url":"/2020/02/22/gogs使用webhook部署react单页应用/"},{"title":"invert-binary-tree","url":"/2015/06/22/invert-binary-tree/"},{"title":"openresty","url":"/2019/06/18/openresty/"},{"title":"C++ 指针使用中的一个小问题","url":"/2014/12/23/my-new-post/"},{"title":"docker使用中发现的echo命令的一个小技巧及其他","url":"/2020/03/29/echo命令的一个小技巧/"},{"title":"php-abstract-class-and-interface","url":"/2016/11/10/php-abstract-class-and-interface/"},{"title":"pcre-intro-and-a-simple-package","url":"/2015/01/16/pcre-intro-and-a-simple-package/"},{"title":"redis数据结构介绍三-第三部分 整数集合","url":"/2020/01/10/redis数据结构介绍三/"},{"title":"rabbitmq-tips","url":"/2017/04/25/rabbitmq-tips/"},{"title":"redis数据结构介绍二-第二部分 跳表","url":"/2020/01/04/redis数据结构介绍二/"},{"title":"redis数据结构介绍五-第五部分 对象","url":"/2020/01/20/redis数据结构介绍五/"},{"title":"spark-little-tips","url":"/2017/03/28/spark-little-tips/"},{"title":"redis数据结构介绍四-第四部分 压缩表","url":"/2020/01/19/redis数据结构介绍四/"},{"title":"summary-ranges-228","url":"/2016/10/12/summary-ranges-228/"},{"title":"swoole-websocket-test","url":"/2016/07/13/swoole-websocket-test/"},{"title":"聊聊 mysql 的 MVCC 续篇","url":"/2020/05/02/聊聊-mysql-的-MVCC-续篇/"},{"title":"聊聊 mysql 的 MVCC 续续篇之锁分析","url":"/2020/05/10/聊聊-mysql-的-MVCC-续续篇之加锁分析/"},{"title":"寄生虫观后感","url":"/2020/03/01/寄生虫观后感/"},{"title":"聊聊Java中的单例模式","url":"/2019/12/21/聊聊Java中的单例模式/"},{"title":"聊聊 mysql 的 MVCC","url":"/2020/04/26/聊聊-mysql-的-MVCC/"},{"title":"leetcode no.3","url":"/2015/04/15/Leetcode-No-3/"},{"title":"redis数据结构介绍-第一部分 SDS,链表,字典","url":"/2019/12/26/redis数据结构介绍/"},{"title":"redis数据结构介绍六 快表","url":"/2020/01/22/redis数据结构介绍六/"},{"title":"redis系列介绍七-过期策略","url":"/2020/04/12/redis系列介绍七/"},{"title":"JVM源码分析之G1垃圾收集器分析一","url":"/2019/12/07/JVM-G1-Part-1/"},{"title":"redis系列介绍八-淘汰策略","url":"/2020/04/18/redis系列介绍八/"}] \ No newline at end of file +[{"title":"AbstractQueuedSynchronizer","url":"/2019/09/23/AbstractQueuedSynchronizer/"},{"title":"Clone Graph Part I","url":"/2014/12/30/Clone-Graph-Part-I/"},{"title":"34_Search_for_a_Range","url":"/2016/08/14/34-Search-for-a-Range/"},{"title":"村上春树《1Q84》读后感","url":"/2019/12/18/1Q84读后感/"},{"title":"add-two-number","url":"/2015/04/14/Add-Two-Number/"},{"title":"MFC 模态对话框","url":"/2014/12/24/MFC 模态对话框/"},{"title":"leetcode no.3","url":"/2015/04/15/Leetcode-No-3/"},{"title":"G1收集器概述","url":"/2020/02/09/G1收集器概述/"},{"title":"Number of 1 Bits","url":"/2015/03/11/Number-Of-1-Bits/"},{"title":"2019年终总结","url":"/2020/02/01/2019年终总结/"},{"title":"Comparator使用小记","url":"/2020/04/05/Comparator使用小记/"},{"title":"Reverse Bits","url":"/2015/03/11/Reverse-Bits/"},{"title":"Redis_分布式锁","url":"/2019/12/10/Redis-Part-1/"},{"title":"Reverse Integer","url":"/2015/03/13/Reverse-Integer/"},{"title":"ambari-summary","url":"/2017/05/09/ambari-summary/"},{"title":"two sum","url":"/2015/01/14/Two-Sum/"},{"title":"Path Sum","url":"/2015/01/04/Path-Sum/"},{"title":"Maven实用小技巧","url":"/2020/02/16/Maven实用小技巧/"},{"title":"docker-mysql-cluster","url":"/2016/08/14/docker-mysql-cluster/"},{"title":"binary-watch","url":"/2016/09/29/binary-watch/"},{"title":"minimum-size-subarray-sum-209","url":"/2016/10/11/minimum-size-subarray-sum-209/"},{"title":"invert-binary-tree","url":"/2015/06/22/invert-binary-tree/"},{"title":"docker比一般多一点的初学者介绍","url":"/2020/03/08/docker比一般多一点的初学者介绍/"},{"title":"gogs使用webhook部署react单页应用","url":"/2020/02/22/gogs使用webhook部署react单页应用/"},{"title":"openresty","url":"/2019/06/18/openresty/"},{"title":"docker比一般多一点的初学者介绍三","url":"/2020/03/21/docker比一般多一点的初学者介绍三/"},{"title":"C++ 指针使用中的一个小问题","url":"/2014/12/23/my-new-post/"},{"title":"rabbitmq-tips","url":"/2017/04/25/rabbitmq-tips/"},{"title":"docker比一般多一点的初学者介绍二","url":"/2020/03/15/docker比一般多一点的初学者介绍二/"},{"title":"pcre-intro-and-a-simple-package","url":"/2015/01/16/pcre-intro-and-a-simple-package/"},{"title":"php-abstract-class-and-interface","url":"/2016/11/10/php-abstract-class-and-interface/"},{"title":"redis数据结构介绍二-第二部分 跳表","url":"/2020/01/04/redis数据结构介绍二/"},{"title":"redis数据结构介绍三-第三部分 整数集合","url":"/2020/01/10/redis数据结构介绍三/"},{"title":"redis数据结构介绍五-第五部分 对象","url":"/2020/01/20/redis数据结构介绍五/"},{"title":"spark-little-tips","url":"/2017/03/28/spark-little-tips/"},{"title":"redis数据结构介绍四-第四部分 压缩表","url":"/2020/01/19/redis数据结构介绍四/"},{"title":"docker使用中发现的echo命令的一个小技巧及其他","url":"/2020/03/29/echo命令的一个小技巧/"},{"title":"summary-ranges-228","url":"/2016/10/12/summary-ranges-228/"},{"title":"swoole-websocket-test","url":"/2016/07/13/swoole-websocket-test/"},{"title":"聊聊 mysql 的 MVCC 续篇","url":"/2020/05/02/聊聊-mysql-的-MVCC-续篇/"},{"title":"聊聊Java中的单例模式","url":"/2019/12/21/聊聊Java中的单例模式/"},{"title":"聊聊 mysql 的 MVCC 续续篇之锁分析","url":"/2020/05/10/聊聊-mysql-的-MVCC-续续篇之加锁分析/"},{"title":"聊聊我理解的分布式事务","url":"/2020/05/17/聊聊我理解的分布式事务/"},{"title":"寄生虫观后感","url":"/2020/03/01/寄生虫观后感/"},{"title":"聊聊 mysql 的 MVCC","url":"/2020/04/26/聊聊-mysql-的-MVCC/"},{"title":"redis数据结构介绍-第一部分 SDS,链表,字典","url":"/2019/12/26/redis数据结构介绍/"},{"title":"redis数据结构介绍六 快表","url":"/2020/01/22/redis数据结构介绍六/"},{"title":"redis系列介绍七-过期策略","url":"/2020/04/12/redis系列介绍七/"},{"title":"JVM源码分析之G1垃圾收集器分析一","url":"/2019/12/07/JVM-G1-Part-1/"},{"title":"redis系列介绍八-淘汰策略","url":"/2020/04/18/redis系列介绍八/"}] \ No newline at end of file diff --git a/lib/pace/README.html b/lib/pace/README.html index c3924160fe..c7d9032dca 100644 --- a/lib/pace/README.html +++ b/lib/pace/README.html @@ -351,20 +351,20 @@ @@ -389,7 +389,7 @@ diff --git a/page/2/index.html b/page/2/index.html index 20e3503441..d4b9d9edab 100644 --- a/page/2/index.html +++ b/page/2/index.html @@ -203,6 +203,146 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

因为最近想搭一个phabricator用来做看板和任务管理,一开始了解这个是Easy大大有在微博推荐过,后来苏洋也在群里和博客里说到了,看上去还不错的样子,因为主角是docker所以就不介绍太多,后面有机会写一下。

+

docker最开始是之前在某位大佬的博客看到的,看上去有点神奇,感觉是一种轻量级的虚拟机,但是能做的事情好像差不多,那时候是在Ubuntu系统的vps里起一个Ubuntu的docker,然后在里面装个nginx,配置端口映射就可以访问了,后来也草草写过一篇使用docker搭建mysql集群,但是最近看了下好像是因为装docker的大佬做了一些别名还是什么操作,导致里面用的操作都不具有普遍性,而且主要是把搭的过程写了下,属于囫囵吞枣,没理解docker是干啥的,为啥用docker,就是操作了下,这几天借着搭phabricator的过程,把一些原来不理解,或者原来理解错误的地方重新理一下。

+

之前写的 mysql 集群,一主二备,这种架构在很多小型应用里都是这么配置的,而且一般是直接在三台 vps 里启动三个 mysql 实例,但是如果换成 docker 会有什么好处呢,其实就是方便部署,比如其中一台备库挂了,我要加一台,或者说备库的 qps 太高了,需要再加一个,如果要在 vps 上搭建的话,首先要买一台机器,等初始化,然后在上面修改源,更新,装 mysql ,然后配置主从,可能还要处理防火墙等等,如果把这些打包成一个 docker 镜像,并且放在自己的 docker registry,那就直接run 一下就可以了;还有比如在公司要给一个新同学整一套开发测试环境,以 Java 开发为例,要装 git,maven,jdk,配置 maven settings 和各种 rc,整合在一个镜像里的话,就会很方便了;再比如微服务的水平扩展。

+

但是为啥 docker 会有这种优势,听起来好像虚拟机也可以干这个事,但是虚拟机动辄上 G,而且需要 VMware,virtual box 等支持,不适合在Linux服务器环境使用,而且占用资源也会非常大。说得这么好,那么 docker 是啥呢

+

docker 主要使用 Linux 中已经存在的两种技术的一个整合升级,一个是 namespace,一个是cgroups,相比于虚拟机需要完整虚拟出一个操作系统运行基础,docker 基于宿主机内核,通过 namespace 和 cgroups 分隔进程,理念就是提供一个隔离的最小化运行依赖,这样子相对于虚拟机就有了巨大的便利性,具体的 namespace 和 cgroups 就先不展开讲,可以参考耗子叔的文章

+

安装

那么我们先安装下 docker,参考官方的教程,安装,我的系统是 ubuntu 的,就贴了 ubuntu 的链接,用其他系统的可以找到对应的系统文档安装,安装完了的话看看 docker 的信息

+
1
sudo docker info
+ +

输出以下信息

+

简单运行

然后再来运行个 hello world 呗,

+
1
sudo docker run hello-world
+ +

输出了这些

+

看看这个运行命令是怎么用的,一般都会看到这样子的,sudo docker run -it ubuntu bash, 前面的 docker run 反正就是运行一个容器的意思,-it是啥呢,还有这个什么 ubuntu bash,来看看docker run`的命令帮助信息

+
1
-i, --interactive                    Keep STDIN open even if not attached
+ +

就是要有输入,我们运行的时候能输入

+
1
-t, --tty                            Allocate a pseudo-TTY
+ +

要有个虚拟终端,

+
1
2
3
Usage:	docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Run a command in a new container
+ +

镜像

上面说的-it 就是这里的 options,后面那个 ubuntu 就是 image 辣,image 是啥呢

+

Docker 把应用程序及其依赖,打包在 image 文件里面,可以把它理解成为类似于虚拟机的镜像或者运行一个进程的代码,跑起来了的叫docker 容器或者进程,比如我们将要运行的docker run -it ubuntu bash的ubuntu 就是个 ubuntu 容器的镜像,将这个镜像运行起来后,我们可以进入容器像使用 ubuntu 一样使用它,来看下我们的镜像,使用sudo docker image ls就能列出我们宿主机上的 docker 镜像了

+

+

一个 ubuntu 镜像才 64MB,非常小巧,然后是后面的bash,我通过交互式启动了一个 ubuntu 容器,然后在这个启动的容器里运行了 bash 命令,这样就可以在容器里玩一下了

+

在容器里看下进程,

+

只有刚才运行容器的 bash 进程和我刚执行的 ps,这里有个可以注意下的,bash 这个进程的 pid 是 1,其实这里就用到了 linux 中的PID Namespace,容器会隔离出一个 pid 的名字空间,这里面的进程跟外部的 pid 命名独立

+

查看宿主机上的容器

1
sudo docker ps -a
+ +

+

如何进入一个正在运行中的 docker 容器

这个应该是比较常用的,因为比如是一个微服务容器,有时候就像看下运行状态,日志啥的

+
1
sudo docker exec -it [containerID] bash
+ +

+

查看日志

1
sudo docker logs [containerID]
+ +

我在运行容器的终端里胡乱输入点啥,然后通过上面的命令就可以看到啦

+

+

+ + +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -1252,123 +1392,6 @@ - - - -
- - - - - -
-

- - -

- - -
- - - - -
- - -

跳表 skiplist

跳表是个在我们日常的代码中不太常用到的数据结构,相对来讲就没有像数组,链表,字典,散列,树等结构那么熟悉,所以就从头开始分析下,首先是链表,跳表跟链表都有个表字(太硬扯了我🤦‍♀️),注意这是个有序链表

如上图,在这个链表里如果我要找到 23,是不是我需要从3,5,9开始一直往后找直到找到 23,也就是说时间复杂度是 O(N),N 的一次幂复杂度,那么我们来看看第二个

这个结构跟原先有点不一样,它给链表中偶数位的节点又加了一个指针把它们链接起来,这样子当我们要寻找 23 的时候就可以从原来的一个个往下找变成跳着找,先找到 5,然后是 10,接着是 19,然后是 28,这时候发现 28 比 23 大了,那我在退回到 19,然后从下一层原来的链表往前找,

这里毛估估是不是前面的节点我就少找了一半,有那么点二分法的意思。
前面的其实是跳表的引子,真正的跳表其实不是这样,因为上面的其实有个比较大的问题,就是插入一个元素后需要调整每个元素的指针,在 redis 中的跳表其实是做了个随机层数的优化,因为沿着前面的例子,其实当数据量很大的时候,是不是层数越多,其查询效率越高,但是随着层数变多,要保持这种严格的层数规则其实也会增大处理复杂度,所以 redis 插入每个元素的时候都是使用随机的方式,看一眼代码

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* ZSETs use a specialized version of Skiplists */
typedef struct zskiplistNode {
sds ele;
double score;
struct zskiplistNode *backward;
struct zskiplistLevel {
struct zskiplistNode *forward;
unsigned long span;
} level[];
} zskiplistNode;

typedef struct zskiplist {
struct zskiplistNode *header, *tail;
unsigned long length;
int level;
} zskiplist;

typedef struct zset {
dict *dict;
zskiplist *zsl;
} zset;
-

忘了说了,redis 是把 skiplist 跳表用在 zset 里,zset 是个有序的集合,可以看到 zskiplist 就是个跳表的结构,里面用 header 保存跳表的表头,tail 保存表尾,还有长度和最大层级,具体的跳表节点元素使用 zskiplistNode 表示,里面包含了 sds 类型的元素值,double 类型的分值,用来排序,一个 backward 后向指针和一个 zskiplistLevel 数组,每个 level 包含了一个前向指针,和一个 span,span 表示的是跳表前向指针的跨度,这里再补充一点,前面说了为了灵活这个跳表的新增修改,redis 使用了随机层高的方式插入新节点,但是如果所有节点都随机到很高的层级或者所有都很低的话,跳表的效率优势就会减小,所以 redis 使用了个小技巧,贴下代码

-
1
2
3
4
5
6
7
#define ZSKIPLIST_P 0.25      /* Skiplist P = 1/4 */
int zslRandomLevel(void) {
int level = 1;
while ((random()&0xFFFF) < (ZSKIPLIST_P * 0xFFFF))
level += 1;
return (level<ZSKIPLIST_MAXLEVEL) ? level : ZSKIPLIST_MAXLEVEL;
}
-

当随机值跟0xFFFF进行与操作小于ZSKIPLIST_P * 0xFFFF时才会增大 level 的值,因此保持了一个相对递减的概率
可以简单分析下,当 random() 的值小于 0xFFFF 的 1/4,才会 level + 1,就意味着当有 1 - 1/4也就是3/4的概率是直接跳出,所以一层的概率是3/4,也就是 1-P,二层的概率是 P*(1-P),三层的概率是 P² * (1-P) 依次递推。

- - -
- - - - - - -
-
-
-
- - - - @@ -1478,7 +1501,7 @@ diff --git a/page/3/index.html b/page/3/index.html index 21c40f6898..7b6fe7ca34 100644 --- a/page/3/index.html +++ b/page/3/index.html @@ -203,6 +203,123 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

跳表 skiplist

跳表是个在我们日常的代码中不太常用到的数据结构,相对来讲就没有像数组,链表,字典,散列,树等结构那么熟悉,所以就从头开始分析下,首先是链表,跳表跟链表都有个表字(太硬扯了我🤦‍♀️),注意这是个有序链表

如上图,在这个链表里如果我要找到 23,是不是我需要从3,5,9开始一直往后找直到找到 23,也就是说时间复杂度是 O(N),N 的一次幂复杂度,那么我们来看看第二个

这个结构跟原先有点不一样,它给链表中偶数位的节点又加了一个指针把它们链接起来,这样子当我们要寻找 23 的时候就可以从原来的一个个往下找变成跳着找,先找到 5,然后是 10,接着是 19,然后是 28,这时候发现 28 比 23 大了,那我在退回到 19,然后从下一层原来的链表往前找,

这里毛估估是不是前面的节点我就少找了一半,有那么点二分法的意思。
前面的其实是跳表的引子,真正的跳表其实不是这样,因为上面的其实有个比较大的问题,就是插入一个元素后需要调整每个元素的指针,在 redis 中的跳表其实是做了个随机层数的优化,因为沿着前面的例子,其实当数据量很大的时候,是不是层数越多,其查询效率越高,但是随着层数变多,要保持这种严格的层数规则其实也会增大处理复杂度,所以 redis 插入每个元素的时候都是使用随机的方式,看一眼代码

+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* ZSETs use a specialized version of Skiplists */
typedef struct zskiplistNode {
sds ele;
double score;
struct zskiplistNode *backward;
struct zskiplistLevel {
struct zskiplistNode *forward;
unsigned long span;
} level[];
} zskiplistNode;

typedef struct zskiplist {
struct zskiplistNode *header, *tail;
unsigned long length;
int level;
} zskiplist;

typedef struct zset {
dict *dict;
zskiplist *zsl;
} zset;
+

忘了说了,redis 是把 skiplist 跳表用在 zset 里,zset 是个有序的集合,可以看到 zskiplist 就是个跳表的结构,里面用 header 保存跳表的表头,tail 保存表尾,还有长度和最大层级,具体的跳表节点元素使用 zskiplistNode 表示,里面包含了 sds 类型的元素值,double 类型的分值,用来排序,一个 backward 后向指针和一个 zskiplistLevel 数组,每个 level 包含了一个前向指针,和一个 span,span 表示的是跳表前向指针的跨度,这里再补充一点,前面说了为了灵活这个跳表的新增修改,redis 使用了随机层高的方式插入新节点,但是如果所有节点都随机到很高的层级或者所有都很低的话,跳表的效率优势就会减小,所以 redis 使用了个小技巧,贴下代码

+
1
2
3
4
5
6
7
#define ZSKIPLIST_P 0.25      /* Skiplist P = 1/4 */
int zslRandomLevel(void) {
int level = 1;
while ((random()&0xFFFF) < (ZSKIPLIST_P * 0xFFFF))
level += 1;
return (level<ZSKIPLIST_MAXLEVEL) ? level : ZSKIPLIST_MAXLEVEL;
}
+

当随机值跟0xFFFF进行与操作小于ZSKIPLIST_P * 0xFFFF时才会增大 level 的值,因此保持了一个相对递减的概率
可以简单分析下,当 random() 的值小于 0xFFFF 的 1/4,才会 level + 1,就意味着当有 1 - 1/4也就是3/4的概率是直接跳出,所以一层的概率是3/4,也就是 1-P,二层的概率是 P*(1-P),三层的概率是 P² * (1-P) 依次递推。

+ + +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -1233,107 +1350,6 @@ - - - -
- - - - - -
-

- - -

- - -
- - - - -
- - -

spark 的一些粗浅使用经验

工作中学习使用了一下Spark做数据分析,主要是用spark的python接口,首先是pyspark.SparkContext(appName=xxx),这是初始化一个Spark应用实例或者说会话,不能重复,
返回的实例句柄就可以调用textFile(path)读取文本文件,这里的文本文件可以是HDFS上的文本文件,也可以普通文本文件,但是需要在Spark的所有集群上都存在,否则会
读取失败,parallelize则可以将python生成的集合数据读取后转换成rdd(A Resilient Distributed Dataset (RDD),一种spark下的基本抽象数据集),基于这个RDD就可以做
数据的流式计算,例如map reduce,在Spark中可以非常方便地实现

-

简单的mapreduce word count示例

1
2
3
4
textFile = sc.parallelize([(1,1), (2,1), (3,1), (4,1), (5,1),(1,1), (2,1), (3,1), (4,1), (5,1)])
data = textFile.reduceByKey(lambda x, y: x + y).collect()
for _ in data:
print(_)
- - -

结果

1
2
3
4
5
(3, 2)
(1, 2)
(4, 2)
(2, 2)
(5, 2)
- - -
- - - - - - -
-
-
-
- - - - @@ -1443,7 +1459,7 @@ diff --git a/page/4/index.html b/page/4/index.html index 42f28e3a14..1f97649189 100644 --- a/page/4/index.html +++ b/page/4/index.html @@ -203,6 +203,107 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

spark 的一些粗浅使用经验

工作中学习使用了一下Spark做数据分析,主要是用spark的python接口,首先是pyspark.SparkContext(appName=xxx),这是初始化一个Spark应用实例或者说会话,不能重复,
返回的实例句柄就可以调用textFile(path)读取文本文件,这里的文本文件可以是HDFS上的文本文件,也可以普通文本文件,但是需要在Spark的所有集群上都存在,否则会
读取失败,parallelize则可以将python生成的集合数据读取后转换成rdd(A Resilient Distributed Dataset (RDD),一种spark下的基本抽象数据集),基于这个RDD就可以做
数据的流式计算,例如map reduce,在Spark中可以非常方便地实现

+

简单的mapreduce word count示例

1
2
3
4
textFile = sc.parallelize([(1,1), (2,1), (3,1), (4,1), (5,1),(1,1), (2,1), (3,1), (4,1), (5,1)])
data = textFile.reduceByKey(lambda x, y: x + y).collect()
for _ in data:
print(_)
+ + +

结果

1
2
3
4
5
(3, 2)
(1, 2)
(4, 2)
(2, 2)
(5, 2)
+ + +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -1140,112 +1241,6 @@ - - - -
- - - - - -
-

- - -

- - -
- - - - -
- - -

problem

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.

-

Input:(2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8

-

分析(不用英文装逼了)
这个代码是抄来的,链接原作是这位大大。

- -
- - Read more » - -
- - - -
- - - - - - -
-
-
-
- - - - @@ -1355,7 +1350,7 @@ diff --git a/page/5/index.html b/page/5/index.html index 928efe2156..a308209bfa 100644 --- a/page/5/index.html +++ b/page/5/index.html @@ -203,6 +203,112 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

problem

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.

+

Input:(2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8

+

分析(不用英文装逼了)
这个代码是抄来的,链接原作是这位大大。

+ +
+ + Read more » + +
+ + + +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -1200,20 +1306,20 @@ @@ -1238,7 +1344,7 @@ diff --git a/sitemap.xml b/sitemap.xml index 0c46d4492f..4ac0c377b2 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -1,10 +1,17 @@ + + https://nicksxs.me/2020/05/17/%E8%81%8A%E8%81%8A%E6%88%91%E7%90%86%E8%A7%A3%E7%9A%84%E5%88%86%E5%B8%83%E5%BC%8F%E4%BA%8B%E5%8A%A1/ + + 2020-05-17T15:57:30.000Z + + + https://nicksxs.me/2020/05/10/%E8%81%8A%E8%81%8A-mysql-%E7%9A%84-MVCC-%E7%BB%AD%E7%BB%AD%E7%AF%87%E4%B9%8B%E5%8A%A0%E9%94%81%E5%88%86%E6%9E%90/ - 2020-05-10T14:23:36.231Z + 2020-05-10T14:26:13.027Z @@ -177,14 +184,14 @@ - https://nicksxs.me/2016/09/29/binary-watch/ + https://nicksxs.me/2016/11/10/php-abstract-class-and-interface/ 2020-01-12T13:08:27.014Z - https://nicksxs.me/2016/11/10/php-abstract-class-and-interface/ + https://nicksxs.me/2016/09/29/binary-watch/ 2020-01-12T13:08:27.014Z @@ -275,14 +282,14 @@ - https://nicksxs.me/2014/12/23/my-new-post/ + https://nicksxs.me/2017/03/28/spark-little-tips/ 2020-01-12T13:08:26.998Z - https://nicksxs.me/2017/03/28/spark-little-tips/ + https://nicksxs.me/2014/12/23/my-new-post/ 2020-01-12T13:08:26.998Z @@ -303,14 +310,14 @@ - https://nicksxs.me/2016/10/12/summary-ranges-228/ + https://nicksxs.me/2015/06/22/invert-binary-tree/ 2020-01-12T13:08:26.994Z - https://nicksxs.me/2015/06/22/invert-binary-tree/ + https://nicksxs.me/2016/10/12/summary-ranges-228/ 2020-01-12T13:08:26.994Z @@ -338,14 +345,14 @@ - https://nicksxs.me/2019/09/23/AbstractQueuedSynchronizer/ + https://nicksxs.me/2015/04/15/Leetcode-No-3/ 2020-01-12T13:08:26.991Z - https://nicksxs.me/2015/04/15/Leetcode-No-3/ + https://nicksxs.me/2019/09/23/AbstractQueuedSynchronizer/ 2020-01-12T13:08:26.991Z diff --git a/tags/2019/index.html b/tags/2019/index.html index c7cc923bb2..e9816a6b91 100644 --- a/tags/2019/index.html +++ b/tags/2019/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/2PC/index.html b/tags/2PC/index.html new file mode 100644 index 0000000000..046fb14904 --- /dev/null +++ b/tags/2PC/index.html @@ -0,0 +1,583 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tag: 2PC | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+ + + +

Nicksxs's Blog

+ +
+

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + + + + + + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

2PC + Tag +

+
+ + +
+ 2020 +
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/3PC/index.html b/tags/3PC/index.html new file mode 100644 index 0000000000..8b376a2360 --- /dev/null +++ b/tags/3PC/index.html @@ -0,0 +1,583 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tag: 3PC | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+ + + +

Nicksxs's Blog

+ +
+

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + + + + + + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

3PC + Tag +

+
+ + +
+ 2020 +
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/Comparator/index.html b/tags/Comparator/index.html index 31227bd6ba..413140084e 100644 --- a/tags/Comparator/index.html +++ b/tags/Comparator/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/Design-Patterns/index.html b/tags/Design-Patterns/index.html index 6d621346c0..65b8f75ab8 100644 --- a/tags/Design-Patterns/index.html +++ b/tags/Design-Patterns/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/Distributed-Lock/index.html b/tags/Distributed-Lock/index.html index b47a4bd9d2..44b275ed81 100644 --- a/tags/Distributed-Lock/index.html +++ b/tags/Distributed-Lock/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/Dockerfile/index.html b/tags/Dockerfile/index.html index 06dc113de8..7555ba2e08 100644 --- a/tags/Dockerfile/index.html +++ b/tags/Dockerfile/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/G1/index.html b/tags/G1/index.html index e03343ad5e..e7c86ef8e3 100644 --- a/tags/G1/index.html +++ b/tags/G1/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/GC/index.html b/tags/GC/index.html index 8d2c08b4e7..8dce0c6fe6 100644 --- a/tags/GC/index.html +++ b/tags/GC/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/Garbage-First-Collector/index.html b/tags/Garbage-First-Collector/index.html index 643bfc0086..16596807b6 100644 --- a/tags/Garbage-First-Collector/index.html +++ b/tags/Garbage-First-Collector/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/Gogs/index.html b/tags/Gogs/index.html index 658e155d51..3a87133426 100644 --- a/tags/Gogs/index.html +++ b/tags/Gogs/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/JVM/index.html b/tags/JVM/index.html index 2407f27eb4..1ab6870759 100644 --- a/tags/JVM/index.html +++ b/tags/JVM/index.html @@ -333,20 +333,20 @@ @@ -371,7 +371,7 @@ diff --git a/tags/Maven/index.html b/tags/Maven/index.html index 1ef01909b7..8c402552a5 100644 --- a/tags/Maven/index.html +++ b/tags/Maven/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/Redis/index.html b/tags/Redis/index.html index 7b7f694e11..1dd238fe82 100644 --- a/tags/Redis/index.html +++ b/tags/Redis/index.html @@ -453,20 +453,20 @@ @@ -491,7 +491,7 @@ diff --git a/tags/Singleton/index.html b/tags/Singleton/index.html index 03b292c974..284e217b0b 100644 --- a/tags/Singleton/index.html +++ b/tags/Singleton/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/Stream/index.html b/tags/Stream/index.html index 6667c2a9ca..56180bdb06 100644 --- a/tags/Stream/index.html +++ b/tags/Stream/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/Webhook/index.html b/tags/Webhook/index.html index 3bf45895b4..40a731af5e 100644 --- a/tags/Webhook/index.html +++ b/tags/Webhook/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/aqs/index.html b/tags/aqs/index.html index fc66980b68..253217fc1f 100644 --- a/tags/aqs/index.html +++ b/tags/aqs/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/c/index.html b/tags/c/index.html index 1e8abb6090..bf927df25f 100644 --- a/tags/c/index.html +++ b/tags/c/index.html @@ -496,20 +496,20 @@ @@ -534,7 +534,7 @@ diff --git a/tags/c/page/2/index.html b/tags/c/page/2/index.html index efd209566a..06bdd4c22f 100644 --- a/tags/c/page/2/index.html +++ b/tags/c/page/2/index.html @@ -376,20 +376,20 @@ @@ -414,7 +414,7 @@ diff --git a/tags/cgroup/index.html b/tags/cgroup/index.html index 511537b531..ddde25d22b 100644 --- a/tags/cgroup/index.html +++ b/tags/cgroup/index.html @@ -330,20 +330,20 @@ @@ -368,7 +368,7 @@ diff --git a/tags/cluster/index.html b/tags/cluster/index.html index e12294be56..00b5def701 100644 --- a/tags/cluster/index.html +++ b/tags/cluster/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/docker/index.html b/tags/docker/index.html index fb2ba96ef3..95687efbf3 100644 --- a/tags/docker/index.html +++ b/tags/docker/index.html @@ -370,20 +370,20 @@ @@ -408,7 +408,7 @@ diff --git a/tags/echo/index.html b/tags/echo/index.html index f18145c3a2..e9b91cc857 100644 --- a/tags/echo/index.html +++ b/tags/echo/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/gap-lock/index.html b/tags/gap-lock/index.html index a9db8ce066..01de388204 100644 --- a/tags/gap-lock/index.html +++ b/tags/gap-lock/index.html @@ -330,20 +330,20 @@ @@ -368,7 +368,7 @@ diff --git a/tags/hadoop/index.html b/tags/hadoop/index.html index 81f95d6758..1a9fe42100 100644 --- a/tags/hadoop/index.html +++ b/tags/hadoop/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/im/index.html b/tags/im/index.html index be81d8f31c..335ad39328 100644 --- a/tags/im/index.html +++ b/tags/im/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/index.html b/tags/index.html index 2aef99d777..5523f9ff0e 100644 --- a/tags/index.html +++ b/tags/index.html @@ -228,10 +228,10 @@
@@ -317,20 +317,20 @@ @@ -355,7 +355,7 @@ diff --git a/tags/java/index.html b/tags/java/index.html index b920c74f43..a84e0c868f 100644 --- a/tags/java/index.html +++ b/tags/java/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/leetcode/index.html b/tags/leetcode/index.html index 67a2a227ad..3c33a81565 100644 --- a/tags/leetcode/index.html +++ b/tags/leetcode/index.html @@ -496,20 +496,20 @@ @@ -534,7 +534,7 @@ diff --git a/tags/leetcode/page/2/index.html b/tags/leetcode/page/2/index.html index 879ca8152c..06380b14a2 100644 --- a/tags/leetcode/page/2/index.html +++ b/tags/leetcode/page/2/index.html @@ -356,20 +356,20 @@ @@ -394,7 +394,7 @@ diff --git a/tags/linux/index.html b/tags/linux/index.html index 2de1dce8a9..ba42bbfa56 100644 --- a/tags/linux/index.html +++ b/tags/linux/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/mfc/index.html b/tags/mfc/index.html index b7c2a2f722..863fb7dcf7 100644 --- a/tags/mfc/index.html +++ b/tags/mfc/index.html @@ -333,20 +333,20 @@ @@ -371,7 +371,7 @@ diff --git a/tags/mq/index.html b/tags/mq/index.html index 9e3507c328..b28bd0805a 100644 --- a/tags/mq/index.html +++ b/tags/mq/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/mvcc/index.html b/tags/mvcc/index.html index 1e45406969..860792b465 100644 --- a/tags/mvcc/index.html +++ b/tags/mvcc/index.html @@ -350,20 +350,20 @@ @@ -388,7 +388,7 @@ diff --git a/tags/mysql/index.html b/tags/mysql/index.html index f052597e60..a5965018a8 100644 --- a/tags/mysql/index.html +++ b/tags/mysql/index.html @@ -373,20 +373,20 @@ @@ -411,7 +411,7 @@ diff --git a/tags/namespace/index.html b/tags/namespace/index.html index 828f7afdff..2dd7c4d230 100644 --- a/tags/namespace/index.html +++ b/tags/namespace/index.html @@ -350,20 +350,20 @@ @@ -388,7 +388,7 @@ diff --git a/tags/next-key-lock/index.html b/tags/next-key-lock/index.html index df5a445ab0..e796ad2c7e 100644 --- a/tags/next-key-lock/index.html +++ b/tags/next-key-lock/index.html @@ -330,20 +330,20 @@ @@ -368,7 +368,7 @@ diff --git a/tags/nginx/index.html b/tags/nginx/index.html index f529097a28..533a0a12de 100644 --- a/tags/nginx/index.html +++ b/tags/nginx/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/nullsfirst/index.html b/tags/nullsfirst/index.html index c6861ef2a1..b78b91e463 100644 --- a/tags/nullsfirst/index.html +++ b/tags/nullsfirst/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/openresty/index.html b/tags/openresty/index.html index 344b291ba6..85f307159d 100644 --- a/tags/openresty/index.html +++ b/tags/openresty/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/php/index.html b/tags/php/index.html index f49596672f..f3aefff95e 100644 --- a/tags/php/index.html +++ b/tags/php/index.html @@ -333,20 +333,20 @@ @@ -371,7 +371,7 @@ diff --git a/tags/python/index.html b/tags/python/index.html index 4a21f7a3c6..087a174066 100644 --- a/tags/python/index.html +++ b/tags/python/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/read-view/index.html b/tags/read-view/index.html index 96be1df8f2..865a3f0a3d 100644 --- a/tags/read-view/index.html +++ b/tags/read-view/index.html @@ -350,20 +350,20 @@ @@ -388,7 +388,7 @@ diff --git a/tags/sort/index.html b/tags/sort/index.html index 6abd7ce2c5..878bb1ed77 100644 --- a/tags/sort/index.html +++ b/tags/sort/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/spark/index.html b/tags/spark/index.html index 45aadfb963..1efa94122f 100644 --- a/tags/spark/index.html +++ b/tags/spark/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/swoole/index.html b/tags/swoole/index.html index bb01470df5..5ee3673972 100644 --- a/tags/swoole/index.html +++ b/tags/swoole/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/uname/index.html b/tags/uname/index.html index b95d86d683..c3729c7b74 100644 --- a/tags/uname/index.html +++ b/tags/uname/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/websocket/index.html b/tags/websocket/index.html index 240279cbb3..8ade99cb9e 100644 --- a/tags/websocket/index.html +++ b/tags/websocket/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/三阶段提交/index.html b/tags/三阶段提交/index.html new file mode 100644 index 0000000000..765680f718 --- /dev/null +++ b/tags/三阶段提交/index.html @@ -0,0 +1,583 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tag: 三阶段提交 | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+ + + +

Nicksxs's Blog

+ +
+

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + + + + + + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

三阶段提交 + Tag +

+
+ + +
+ 2020 +
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/两阶段提交/index.html b/tags/两阶段提交/index.html new file mode 100644 index 0000000000..cb4d45b4bb --- /dev/null +++ b/tags/两阶段提交/index.html @@ -0,0 +1,583 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tag: 两阶段提交 | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+ + + +

Nicksxs's Blog

+ +
+

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + + + + + + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

两阶段提交 + Tag +

+
+ + +
+ 2020 +
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/分布式事务/index.html b/tags/分布式事务/index.html new file mode 100644 index 0000000000..566d1701f1 --- /dev/null +++ b/tags/分布式事务/index.html @@ -0,0 +1,583 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tag: 分布式事务 | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+ + + +

Nicksxs's Blog

+ +
+

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + + + + + + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

分布式事务 + Tag +

+
+ + +
+ 2020 +
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/分布式锁/index.html b/tags/分布式锁/index.html index 4da00d184c..5de6f16994 100644 --- a/tags/分布式锁/index.html +++ b/tags/分布式锁/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/单例/index.html b/tags/单例/index.html index 6f52798934..a2e2727400 100644 --- a/tags/单例/index.html +++ b/tags/单例/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/博客,文章/index.html b/tags/博客,文章/index.html index b03fe2388a..481f8984a8 100644 --- a/tags/博客,文章/index.html +++ b/tags/博客,文章/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/发行版/index.html b/tags/发行版/index.html index deac1d9830..7dba7310f1 100644 --- a/tags/发行版/index.html +++ b/tags/发行版/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/寄生虫/index.html b/tags/寄生虫/index.html index 285e36d167..9a7e9651a0 100644 --- a/tags/寄生虫/index.html +++ b/tags/寄生虫/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/年终总结/index.html b/tags/年终总结/index.html index 0c223418dc..0742eca471 100644 --- a/tags/年终总结/index.html +++ b/tags/年终总结/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/幻读/index.html b/tags/幻读/index.html index 6783dbb4ac..6012323f84 100644 --- a/tags/幻读/index.html +++ b/tags/幻读/index.html @@ -330,20 +330,20 @@ @@ -368,7 +368,7 @@ diff --git a/tags/影评/index.html b/tags/影评/index.html index 5c5b8764b5..059a462e17 100644 --- a/tags/影评/index.html +++ b/tags/影评/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/排序/index.html b/tags/排序/index.html index 275db28dfc..169ac333b8 100644 --- a/tags/排序/index.html +++ b/tags/排序/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/数据结构/index.html b/tags/数据结构/index.html index 2b221d5f75..dcb687d89b 100644 --- a/tags/数据结构/index.html +++ b/tags/数据结构/index.html @@ -493,20 +493,20 @@ @@ -531,7 +531,7 @@ diff --git a/tags/数据结构/page/2/index.html b/tags/数据结构/page/2/index.html index 2b700b2cae..20c0481ba7 100644 --- a/tags/数据结构/page/2/index.html +++ b/tags/数据结构/page/2/index.html @@ -313,20 +313,20 @@ @@ -351,7 +351,7 @@ diff --git a/tags/源码/index.html b/tags/源码/index.html index 4d1f29871f..0a7d934e46 100644 --- a/tags/源码/index.html +++ b/tags/源码/index.html @@ -493,20 +493,20 @@ @@ -531,7 +531,7 @@ diff --git a/tags/源码/page/2/index.html b/tags/源码/page/2/index.html index 00c7f7dee4..d78d0aa371 100644 --- a/tags/源码/page/2/index.html +++ b/tags/源码/page/2/index.html @@ -313,20 +313,20 @@ @@ -351,7 +351,7 @@ diff --git a/tags/生活/index.html b/tags/生活/index.html index cefa48d416..c34fc973c6 100644 --- a/tags/生活/index.html +++ b/tags/生活/index.html @@ -330,20 +330,20 @@ @@ -368,7 +368,7 @@ diff --git a/tags/设计模式/index.html b/tags/设计模式/index.html index 0038078b9d..182a7c0411 100644 --- a/tags/设计模式/index.html +++ b/tags/设计模式/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@ diff --git a/tags/读后感/index.html b/tags/读后感/index.html index e16be37b82..6cec14957b 100644 --- a/tags/读后感/index.html +++ b/tags/读后感/index.html @@ -310,20 +310,20 @@ @@ -348,7 +348,7 @@