-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2162 lines (1505 loc) · 101 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 3.8.0">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
<link rel="mask-icon" href="/images/logo.svg" color="#222">
<meta name="google-site-verification" content="wE7ISC42t3QOT-S-gdbdy_XsP3NB23Xi3alKNWXd0dA">
<meta name="baidu-site-verification" content="keFN8E7jd3">
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Operator Mono:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
<script id="hexo-configurations">
var NexT = window.NexT || {};
var CONFIG = {
hostname: new URL('https://blog.lovezhy.cc').hostname,
root: '/',
scheme: 'Muse',
version: '7.7.1',
exturl: false,
sidebar: {"position":"right","display":"always","padding":18,"offset":12,"onmobile":false},
copycode: {"enable":true,"show_result":true,"style":null},
back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
bookmark: {"enable":false,"color":"#222","save":"auto"},
fancybox: false,
mediumzoom: false,
lazyload: false,
pangu: false,
comments: {"style":"tabs","active":"disqus","storage":true,"lazyload":false,"nav":null},
algolia: {
appID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
},
localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
path: 'search.xml',
motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}
};
</script>
<meta name="description" content="敌视现实">
<meta property="og:type" content="website">
<meta property="og:title" content="LoveZhy">
<meta property="og:url" content="https://blog.lovezhy.cc/index.html">
<meta property="og:site_name" content="LoveZhy">
<meta property="og:description" content="敌视现实">
<meta property="og:locale" content="zh-cn">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="LoveZhy">
<meta name="twitter:description" content="敌视现实">
<link rel="canonical" href="https://blog.lovezhy.cc/">
<script id="page-configurations">
// https://hexo.io/docs/variables.html
CONFIG.page = {
sidebar: "",
isHome: true,
isPost: false
};
</script>
<title>LoveZhy</title>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-125642214-1"></script>
<script>
if (CONFIG.hostname === location.hostname) {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-125642214-1');
}
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?c1f963571cb3d8a4a5dc82346dc65842";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<noscript>
<style>
.use-motion .brand,
.use-motion .menu-item,
.sidebar-inner,
.use-motion .post-block,
.use-motion .pagination,
.use-motion .comments,
.use-motion .post-header,
.use-motion .post-body,
.use-motion .collection-header { opacity: initial; }
.use-motion .site-title,
.use-motion .site-subtitle {
opacity: initial;
top: initial;
}
.use-motion .logo-line-before i { left: initial; }
.use-motion .logo-line-after i { right: initial; }
</style>
</noscript>
<link rel="alternate" href="/atom.xml" title="LoveZhy" type="application/atom+xml">
</head>
<body itemscope itemtype="http://schema.org/WebPage">
<div class="container use-motion">
<div class="headband"></div>
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-container">
<div class="site-meta">
<div>
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">LoveZhy</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
</div>
<div class="site-nav-toggle">
<div class="toggle" aria-label="Toggle navigation bar">
<span class="toggle-line toggle-line-first"></span>
<span class="toggle-line toggle-line-middle"></span>
<span class="toggle-line toggle-line-last"></span>
</div>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section"><i class="fa fa-fw fa-home"></i>Home</a>
</li>
<li class="menu-item menu-item-about">
<a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>About</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>Tags</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>Categories</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>Archives</a>
</li>
<li class="menu-item menu-item-sitemap">
<a href="/sitemap.xml" rel="section"><i class="fa fa-fw fa-sitemap"></i>Sitemap</a>
</li>
</ul>
</nav>
</div>
</header>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
<span>0%</span>
</div>
<main class="main">
<div class="main-inner">
<div class="content-wrap">
<div class="content">
<div class="posts-expand">
<article itemscope="" itemtype="http://schema.org/Article" class="post-block home" lang="zh-cn">
<link itemprop="mainEntityOfPage" href="https://blog.lovezhy.cc/2021/02/02/Async的循环依赖/">
<span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="zhy">
<meta itemprop="description" content="敌视现实">
</span>
<span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="LoveZhy">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/02/02/Async的循环依赖/" class="post-title-link" itemprop="url">Async的循环依赖</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2021-02-02 00:00:00 / Modified: 19:48:50" itemprop="dateCreated datePublished" datetime="2021-02-02T00:00:00+08:00">2021-02-02</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
<a href="/categories/Spring/" itemprop="url" rel="index">
<span itemprop="name">Spring</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>用了Spring这么多年,以为我对循环依赖的问题已经了如指掌,但是现实还是给我了一巴掌。</p>
<p>最近线上服务报了错误:</p>
<blockquote>
<p>Bean with name xx has been injected into other beans [ x ] in its raw version as part of a circular reference, </p>
<p>but has eventually been wrapped. This means that said other beans do not use the final version of the bean. </p>
<p>This is often the result of over-eager type matching - consider using ‘getBeanNamesOfType’ with the ‘allowEagerInit’ flag turned off, for example.</p>
</blockquote>
<p>Exception是BeanCurrentlyInCreationException,看起来是个循环依赖的问题,但是日志的报错是我从来没见过的。</p>
<h2 id="正常的循环依赖"><a href="#正常的循环依赖" class="headerlink" title="正常的循环依赖"></a>正常的循环依赖</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Service</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">A</span> </span>{</span><br><span class="line"> <span class="keyword">private</span> B b;</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="title">A</span><span class="params">(B b)</span> </span>{</span><br><span class="line"> <span class="keyword">this</span>.b = b;</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="meta">@Service</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">B</span> </span>{</span><br><span class="line"> <span class="keyword">private</span> A a;</span><br><span class="line"></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="title">B</span><span class="params">(A a)</span> </span>{</span><br><span class="line"> <span class="keyword">this</span>.a = a;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>如上,我们创建了两个Service,并且通过构造函数的方式注入。</p>
<p>启动时,Spring会报错:</p>
<blockquote>
<p>Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘a’: Requested bean is currently in creation: Is there an unresolvable circular reference?</p>
</blockquote>
<p>并且还会贴心的会你画个图:</p>
<blockquote>
<p>The dependencies of some of the beans in the application context form a cycle:</p>
<p>┌─────┐<br>| a defined in file [A.class]<br>↑ ↓<br>| b defined in file [B.class]<br>└─────┘</p>
</blockquote>
<p>这种也是我理解中的循环依赖问题,解决方案也是比较简单,我们换成set方法注入,或者成员变量注入就行。</p>
<h2 id="复现上文的异常"><a href="#复现上文的异常" class="headerlink" title="复现上文的异常"></a>复现上文的异常</h2><p>上文的异常,我一开始以为是AOP导致的问题,于是在A上加了个Aop的方法,发现Aop能够很好的解决这种循环依赖。</p>
<p>解决方案是三级缓存:</p>
<p>参考文章: <a href="https://segmentfault.com/a/1190000039134606" target="_blank" rel="noopener">https://segmentfault.com/a/1190000039134606</a></p>
<p>那我就疑惑了,到底是什么情况导致的呢?</p>
<p>后来搜到了文章:<a href="https://segmentfault.com/a/1190000018835760" target="_blank" rel="noopener">https://segmentfault.com/a/1190000018835760</a></p>
<p>发现@Async可以复现,于是我修改了代码:</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Service</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">A</span> </span>{</span><br><span class="line"> <span class="keyword">private</span> B b;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setB</span><span class="params">(B b)</span> </span>{</span><br><span class="line"> <span class="keyword">this</span>.b = b;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Async</span></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">doAsync</span><span class="params">()</span> </span>{</span><br><span class="line"> System.out.println(<span class="string">"hello"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="meta">@Service</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">B</span> </span>{</span><br><span class="line"> <span class="keyword">private</span> A a;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setA</span><span class="params">(A a)</span> </span>{</span><br><span class="line"> <span class="keyword">this</span>.a = a;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>发现确实可以复现了,这就暴露出我的知识盲区了,难道@Async不是通过Aop去解决的吗?</p>
<p>为什么@Aspect注解切的方法,不会报循环依赖,但是@Async的方法会呢?</p>
<p>带着疑惑,我又尝试了@Transectional会不会导致循环依赖问题,发现并不会。</p>
<p>所以,为啥@Async如此特殊呢?</p>
<h2 id="对比"><a href="#对比" class="headerlink" title="对比"></a>对比</h2><p>于是我得对比,@Async和@Transectional在实现上的区别</p>
<p>为此,我们把A的方法声明称这样:</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Service</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">A</span> </span>{</span><br><span class="line"> <span class="keyword">private</span> B b;</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Autowired</span></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setB</span><span class="params">(B b)</span> </span>{</span><br><span class="line"> <span class="keyword">this</span>.b = b;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Transactional</span></span><br><span class="line"> <span class="meta">@Async</span></span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">doAsync</span><span class="params">()</span> </span>{</span><br><span class="line"> System.out.println(<span class="string">"hello"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>同时配上一个手写的Aspect:</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Aspect</span></span><br><span class="line"><span class="meta">@Component</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">AspectA</span> </span>{</span><br><span class="line"></span><br><span class="line"> <span class="meta">@Before</span>(<span class="string">"execution(public A.doAsync())"</span>)</span><br><span class="line"> <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">beforeA</span><span class="params">()</span> </span>{</span><br><span class="line"> System.out.println(<span class="string">"beforeA 执行"</span>);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>在DefaultAdvisorChainFactory的getInterceptorsAndDynamicInterceptionAdvice方法中</p>
<p>我们可以查到这个方法所有的Advisor。</p>
<p><img src="http://log.lovezhy.cc/hVSBxt.png" alt=""></p>
<p>可以看到一共有三个</p>
<ol>
<li>ExposeInvocationInterceptor:先不管,和我们的业务无关</li>
<li>BeanFactoryTransactionAttributeSourceAdvisor:就是我们@Transactional的相关Aop</li>
<li>AspectA:自定义的Aop</li>
</ol>
<p>可以发现,并没有@Async相关的Aop代码。</p>
<p>而通过对DefaultAdvisorChainFactory的调用链,可以分析到,这里的执行,对原来类的Aop织入,其实在</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">doCreateBean#</span><br><span class="line">addSingletonFactory(beanName, () -> getEarlyBeanReference(beanName, mbd, bean));</span><br></pre></td></tr></table></figure>
<p>的逻辑中已经生成</p>
<p>所以也就导致</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">if</span> (earlySingletonExposure) {</span><br><span class="line"> Object earlySingletonReference = getSingleton(beanName, <span class="keyword">false</span>);</span><br><span class="line"> <span class="keyword">if</span> (earlySingletonReference != <span class="keyword">null</span>) {</span><br><span class="line"> <span class="comment">//这里拿到的exposedObject和Bean其实是一样的,不会抛出异常。</span></span><br><span class="line"> <span class="keyword">if</span> (exposedObject == bean) {</span><br><span class="line"> exposedObject = earlySingletonReference;</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">else</span> <span class="keyword">if</span> (!<span class="keyword">this</span>.allowRawInjectionDespiteWrapping && hasDependentBean(beanName)) {</span><br><span class="line"> String[] dependentBeans = getDependentBeans(beanName);</span><br><span class="line"> Set<String> actualDependentBeans = <span class="keyword">new</span> LinkedHashSet<>(dependentBeans.length);</span><br><span class="line"> <span class="keyword">for</span> (String dependentBean : dependentBeans) {</span><br><span class="line"> <span class="keyword">if</span> (!removeSingletonIfCreatedForTypeCheckOnly(dependentBean)) {</span><br><span class="line"> actualDependentBeans.add(dependentBean);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">if</span> (!actualDependentBeans.isEmpty()) {</span><br><span class="line"> <span class="keyword">throw</span> <span class="keyword">new</span> BeanCurrentlyInCreationException(beanName,</span><br><span class="line"> <span class="string">"Bean with name '"</span> + beanName + <span class="string">"' has been injected into other beans ["</span> +</span><br><span class="line"> StringUtils.collectionToCommaDelimitedString(actualDependentBeans) +</span><br><span class="line"> <span class="string">"] in its raw version as part of a circular reference, but has eventually been "</span> +</span><br><span class="line"> <span class="string">"wrapped. This means that said other beans do not use the final version of the "</span> +</span><br><span class="line"> <span class="string">"bean. This is often the result of over-eager type matching - consider using "</span> +</span><br><span class="line"> <span class="string">"'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example."</span>);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>那为什么加了@Async就会不一样呢?</p>
<p>通过上文,我们知道了@Async的逻辑和传统的Aop逻辑不太一样。</p>
<p>@Async是通过AsyncAnnotationBeanPostProcessor去织入自己的逻辑。</p>
<p>这个BeanPostProcessor在<code>applyBeanPostProcessorsAfterInitialization</code>方法中被调用</p>
<p>导致生成的是一个新的代理Bean,和原来的Bean就会不一样,也就是走到了抛出异常的逻辑。</p>
<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p>还是不能想当然,Aop是一个广泛的概念,但是在Spring中,其实还是冗余了不同的实现。</p>
<p>并不是所有加了Annotation的实现,都是一样的。</p>
<p>有可能是Aspect的实现,也有可能是类似BeanPostProcessor的实现。</p>
<p>需要看源码具体原因具体分析。</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope="" itemtype="http://schema.org/Article" class="post-block home" lang="zh-cn">
<link itemprop="mainEntityOfPage" href="https://blog.lovezhy.cc/2020/10/11/论文翻译-偏向锁/">
<span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="zhy">
<meta itemprop="description" content="敌视现实">
</span>
<span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="LoveZhy">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2020/10/11/论文翻译-偏向锁/" class="post-title-link" itemprop="url">论文翻译-偏向锁</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2020-10-11 00:00:00" itemprop="dateCreated datePublished" datetime="2020-10-11T00:00:00+08:00">2020-10-11</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2020-10-12 16:42:08" itemprop="dateModified" datetime="2020-10-12T16:42:08+08:00">2020-10-12</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
<a href="/categories/论文翻译/" itemprop="url" rel="index">
<span itemprop="name">论文翻译</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>论文名字:<strong>Eliminating Synchronization-Related Atomic Operations with Biased Locking and Bulk Rebiasing</strong></p>
<!--noindex-->
<div class="post-button">
<a class="btn" href="/2020/10/11/论文翻译-偏向锁/#more" rel="contents">
Read more »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope="" itemtype="http://schema.org/Article" class="post-block home" lang="zh-cn">
<link itemprop="mainEntityOfPage" href="https://blog.lovezhy.cc/2020/09/05/论文翻译-CMS/">
<span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="zhy">
<meta itemprop="description" content="敌视现实">
</span>
<span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="LoveZhy">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2020/09/05/论文翻译-CMS/" class="post-title-link" itemprop="url">论文翻译-CMS</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2020-09-05 00:00:00 / Modified: 23:25:19" itemprop="dateCreated datePublished" datetime="2020-09-05T00:00:00+08:00">2020-09-05</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
<a href="/categories/论文翻译/" itemprop="url" rel="index">
<span itemprop="name">论文翻译</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p><strong>A Generational Mostly-concurrent Garbage Collector</strong><br>(题目不知道咋翻,算了),论文发布在2000年</p>
<p>注:本文讲的不完全是CMS垃圾收集器,其实讲的是并发垃圾收集器的思路。</p>
<p>而Java中的并发垃圾收集器包含CMS和G1。</p>
<!--noindex-->
<div class="post-button">
<a class="btn" href="/2020/09/05/论文翻译-CMS/#more" rel="contents">
Read more »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope="" itemtype="http://schema.org/Article" class="post-block home" lang="zh-cn">
<link itemprop="mainEntityOfPage" href="https://blog.lovezhy.cc/2020/08/30/从Mpsc到RingBuffer(三)- Disruptor/">
<span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="zhy">
<meta itemprop="description" content="敌视现实">
</span>
<span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="LoveZhy">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2020/08/30/从Mpsc到RingBuffer(三)- Disruptor/" class="post-title-link" itemprop="url">从Mpsc到RingBuffer(三)- Disruptor</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2020-08-30 00:00:00" itemprop="dateCreated datePublished" datetime="2020-08-30T00:00:00+08:00">2020-08-30</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2020-09-05 23:24:35" itemprop="dateModified" datetime="2020-09-05T23:24:35+08:00">2020-09-05</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
<a href="/categories/RingBuffer/" itemprop="url" rel="index">
<span itemprop="name">RingBuffer</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="一-前言"><a href="#一-前言" class="headerlink" title="一. 前言"></a>一. 前言</h1><p>Disruptor几乎是每个Java开发绕不过去的坎,其实我想学习这个框架很久了,之前打开看了几次,但是有点复杂就放弃了。</p>
<p>这一次看到了Mpsc,心里在构思多生产者多消费者的队列怎么怎么做,自然就想到了RingBuffer。</p>
<p>有了上文的基础,下面我们就Disruptor来看看多生产者多消费者是怎么实现的。</p>
<p>注意:这个文章并不是特别的分析Disruptor是怎么实现高性能的,诸如网上说的那些伪共享之类,</p>
<p>就是带大家看看源码实现。</p>
<!--noindex-->
<div class="post-button">
<a class="btn" href="/2020/08/30/从Mpsc到RingBuffer(三)- Disruptor/#more" rel="contents">
Read more »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope="" itemtype="http://schema.org/Article" class="post-block home" lang="zh-cn">
<link itemprop="mainEntityOfPage" href="https://blog.lovezhy.cc/2020/08/27/从Mpsc到RingBuffer(二)- RingBuffer/">
<span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="zhy">
<meta itemprop="description" content="敌视现实">
</span>
<span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="LoveZhy">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2020/08/27/从Mpsc到RingBuffer(二)- RingBuffer/" class="post-title-link" itemprop="url">从Mpsc到RingBuffer(二)- RingBuffer</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2020-08-27 00:00:00" itemprop="dateCreated datePublished" datetime="2020-08-27T00:00:00+08:00">2020-08-27</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2020-08-30 00:50:34" itemprop="dateModified" datetime="2020-08-30T00:50:34+08:00">2020-08-30</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
<a href="/categories/RingBuffer/" itemprop="url" rel="index">
<span itemprop="name">RingBuffer</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>前面我们聊完了Mpsc,在提一下,Mpsc主要是针对的单消费者多生产者的情况。</p>
<p>对于消费者而言,因为只有一个消费者,所以不需要任何同步。</p>
<p>对于生产者而言,为了防止多线程下会出现问题,所以使用CAS操作。</p>
<p>但是上一篇文章中Mpsc使用的是链表的结构,不加以控制容易OOM。</p>
<p>为了避免这个问题,我们可以使用数组来作为底层存储。</p>
<p>原理其实和这边文章的RingBuffer讲的类似。</p>
<p>这里的RingBuffer其实就是Disruptor的实现,不过我单独抽成了一个文章来讲Disruptor的源码。</p>
<p>这里就划一些示意图,解释RingBuffer的原理。</p>
<!--noindex-->
<div class="post-button">
<a class="btn" href="/2020/08/27/从Mpsc到RingBuffer(二)- RingBuffer/#more" rel="contents">
Read more »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope="" itemtype="http://schema.org/Article" class="post-block home" lang="zh-cn">
<link itemprop="mainEntityOfPage" href="https://blog.lovezhy.cc/2020/08/26/从Mpsc到RingBuffer(一)- Mpsc/">
<span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="zhy">
<meta itemprop="description" content="敌视现实">
</span>
<span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="LoveZhy">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2020/08/26/从Mpsc到RingBuffer(一)- Mpsc/" class="post-title-link" itemprop="url">从Mpsc到RingBuffer(一)- Mpsc</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2020-08-26 00:00:00" itemprop="dateCreated datePublished" datetime="2020-08-26T00:00:00+08:00">2020-08-26</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2020-08-30 00:50:13" itemprop="dateModified" datetime="2020-08-30T00:50:13+08:00">2020-08-30</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
<a href="/categories/RingBuffer/" itemprop="url" rel="index">
<span itemprop="name">RingBuffer</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>其实一开始没有接触过这个,但是看Netty源码的时候,发现Netty的对象池使用了MpscQueue,感觉还挺有意思的。</p>
<p>MpscQueue主要针对的是单消费者,多生产者的情况,实现上是LockFree的,这里的Lock Free,一般都是指用了CAS解决并发问题。</p>
<!--noindex-->
<div class="post-button">
<a class="btn" href="/2020/08/26/从Mpsc到RingBuffer(一)- Mpsc/#more" rel="contents">
Read more »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope="" itemtype="http://schema.org/Article" class="post-block home" lang="zh-cn">
<link itemprop="mainEntityOfPage" href="https://blog.lovezhy.cc/2020/08/19/LevelDB源码解析(七)- Compact与Version/">
<span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="zhy">
<meta itemprop="description" content="敌视现实">
</span>
<span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="LoveZhy">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2020/08/19/LevelDB源码解析(七)- Compact与Version/" class="post-title-link" itemprop="url">LevelDB源码解析(七)- Compact与Version</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2020-08-19 00:00:00" itemprop="dateCreated datePublished" datetime="2020-08-19T00:00:00+08:00">2020-08-19</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2020-08-18 15:44:52" itemprop="dateModified" datetime="2020-08-18T15:44:52+08:00">2020-08-18</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
<a href="/categories/LevelDB/" itemprop="url" rel="index">
<span itemprop="name">LevelDB</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>20200818补充</p>
<ol>
<li><a href="https://zhuanlan.zhihu.com/p/112574579" target="_blank" rel="noopener">LSM Tree的Leveling 和 Tiering Compaction</a> 文章讲了LSM的多种Compact策略,写的很好</li>
</ol>
<h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>这一节讲述最复杂的Version以及Compact的部分</p>
<!--noindex-->
<div class="post-button">
<a class="btn" href="/2020/08/19/LevelDB源码解析(七)- Compact与Version/#more" rel="contents">
Read more »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope="" itemtype="http://schema.org/Article" class="post-block home" lang="zh-cn">
<link itemprop="mainEntityOfPage" href="https://blog.lovezhy.cc/2020/08/18/LevelDB源码解析(六)- WAL和Log文件/">
<span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="zhy">
<meta itemprop="description" content="敌视现实">
</span>
<span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="LoveZhy">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2020/08/18/LevelDB源码解析(六)- WAL和Log文件/" class="post-title-link" itemprop="url">LevelDB源码解析(六)- WAL和Log文件</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2020-08-18 00:00:00" itemprop="dateCreated datePublished" datetime="2020-08-18T00:00:00+08:00">2020-08-18</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2020-08-15 18:55:53" itemprop="dateModified" datetime="2020-08-15T18:55:53+08:00">2020-08-15</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
<a href="/categories/LevelDB/" itemprop="url" rel="index">
<span itemprop="name">LevelDB</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>数据库中基本都有WAL功能,LevelDB也不例外,不过这里的WAL功能实现比较简单</p>
<!--noindex-->
<div class="post-button">
<a class="btn" href="/2020/08/18/LevelDB源码解析(六)- WAL和Log文件/#more" rel="contents">
Read more »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope="" itemtype="http://schema.org/Article" class="post-block home" lang="zh-cn">
<link itemprop="mainEntityOfPage" href="https://blog.lovezhy.cc/2020/08/17/LevelDB源码解析(五)- CURRENT和Manifest/">
<span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="zhy">
<meta itemprop="description" content="敌视现实">
</span>
<span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="LoveZhy">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2020/08/17/LevelDB源码解析(五)- CURRENT和Manifest/" class="post-title-link" itemprop="url">LevelDB源码解析(五)- CURRENT和Manifest</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2020-08-17 00:00:00" itemprop="dateCreated datePublished" datetime="2020-08-17T00:00:00+08:00">2020-08-17</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2020-08-15 19:01:43" itemprop="dateModified" datetime="2020-08-15T19:01:43+08:00">2020-08-15</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
<a href="/categories/LevelDB/" itemprop="url" rel="index">
<span itemprop="name">LevelDB</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>Manifest文件,简单的看就是当前VersionEdit的持久化信息,其中包含了:</p>
<ol>
<li>Comparator:全局的比较方法</li>
<li>LogNumber:下一个MemTable的WAL日志文件的FileNumber</li>
<li>PreviousLogNumber:已经被废弃,之前版本有用到</li>
<li>NextFileNumber:下一个File的数字</li>
<li>LastSequence:最新的Seq</li>
<li>Compact_Pointer:在Compact一章中统一讲。</li>
<li>Deteted_Files:相对于上一个Version,删除的文件</li>
<li>New_Files:相对于上一个Version,新增的文件</li>
</ol>