-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrow_cache_for_mysql.5.1.48_2011_05_11.diff
2459 lines (2358 loc) · 91.9 KB
/
row_cache_for_mysql.5.1.48_2011_05_11.diff
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
Index: storage/innodb_plugin/Makefile.in
===================================================================
--- storage/innodb_plugin/Makefile.in (revision 118)
+++ storage/innodb_plugin/Makefile.in (revision 125)
@@ -162,7 +162,11 @@
libinnobase_a-ut0list.$(OBJEXT) libinnobase_a-ut0mem.$(OBJEXT) \
libinnobase_a-ut0rbt.$(OBJEXT) libinnobase_a-ut0rnd.$(OBJEXT) \
libinnobase_a-ut0ut.$(OBJEXT) libinnobase_a-ut0vec.$(OBJEXT) \
- libinnobase_a-ut0wqueue.$(OBJEXT)
+ libinnobase_a-ut0wqueue.$(OBJEXT) \
+ libinnobase_a-row0cache.$(OBJEXT) \
+ libinnobase_a-row0cache0hash.$(OBJEXT) \
+ libinnobase_a-row0cache0lru.$(OBJEXT) \
+ libinnobase_a-row0cache0mempool.$(OBJEXT)
libinnobase_a_OBJECTS = $(am_libinnobase_a_OBJECTS)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@@ -237,7 +241,11 @@
ha_innodb_plugin_la-ut0dbg.lo ha_innodb_plugin_la-ut0list.lo \
ha_innodb_plugin_la-ut0mem.lo ha_innodb_plugin_la-ut0rbt.lo \
ha_innodb_plugin_la-ut0rnd.lo ha_innodb_plugin_la-ut0ut.lo \
- ha_innodb_plugin_la-ut0vec.lo ha_innodb_plugin_la-ut0wqueue.lo
+ ha_innodb_plugin_la-ut0vec.lo ha_innodb_plugin_la-ut0wqueue.lo \
+ ha_innodb_plugin_la-row0cache.lo \
+ ha_innodb_plugin_la-row0cache0hash.lo \
+ ha_innodb_plugin_la-row0cache0lru.lo \
+ ha_innodb_plugin_la-row0cache0mempool.lo
am_ha_innodb_plugin_la_OBJECTS = $(am__objects_1)
ha_innodb_plugin_la_OBJECTS = $(am_ha_innodb_plugin_la_OBJECTS)
ha_innodb_plugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
@@ -516,14 +524,10 @@
plugin_blackhole_static_target = @plugin_blackhole_static_target@
plugin_csv_shared_target = @plugin_csv_shared_target@
plugin_csv_static_target = @plugin_csv_static_target@
-plugin_daemon_example_shared_target = @plugin_daemon_example_shared_target@
-plugin_daemon_example_static_target = @plugin_daemon_example_static_target@
plugin_example_shared_target = @plugin_example_shared_target@
plugin_example_static_target = @plugin_example_static_target@
plugin_federated_shared_target = @plugin_federated_shared_target@
plugin_federated_static_target = @plugin_federated_static_target@
-plugin_ftexample_shared_target = @plugin_ftexample_shared_target@
-plugin_ftexample_static_target = @plugin_ftexample_static_target@
plugin_heap_shared_target = @plugin_heap_shared_target@
plugin_heap_static_target = @plugin_heap_static_target@
plugin_ibmdb2i_shared_target = @plugin_ibmdb2i_shared_target@
@@ -565,7 +569,6 @@
target_os = @target_os@
target_vendor = @target_vendor@
tools_dirs = @tools_dirs@
-top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
uname_prog = @uname_prog@
@@ -782,6 +785,10 @@
include/ut0vec.h \
include/ut0vec.ic \
include/ut0wqueue.h \
+ include/row0cache.h \
+ include/row0cache0hash.h \
+ include/row0cache0lru.h \
+ include/row0cache0mempool.h \
mem/mem0dbg.c
EXTRA_LIBRARIES = libinnobase.a
@@ -879,7 +886,11 @@
ut/ut0rnd.c \
ut/ut0ut.c \
ut/ut0vec.c \
- ut/ut0wqueue.c
+ ut/ut0wqueue.c \
+ cache/row0cache.c \
+ cache/row0cache0hash.c \
+ cache/row0cache0lru.c \
+ cache/row0cache0mempool.c
libinnobase_a_CXXFLAGS = $(AM_CFLAGS)
libinnobase_a_CFLAGS = $(AM_CFLAGS)
@@ -1025,6 +1036,10 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ha_innodb_plugin_la-read0read.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ha_innodb_plugin_la-rem0cmp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ha_innodb_plugin_la-rem0rec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ha_innodb_plugin_la-row0cache.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ha_innodb_plugin_la-row0cache0hash.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ha_innodb_plugin_la-row0cache0lru.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ha_innodb_plugin_la-row0cache0mempool.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ha_innodb_plugin_la-row0ext.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ha_innodb_plugin_la-row0ins.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ha_innodb_plugin_la-row0merge.Plo@am__quote@
@@ -1118,6 +1133,10 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinnobase_a-read0read.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinnobase_a-rem0cmp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinnobase_a-rem0rec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinnobase_a-row0cache.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinnobase_a-row0cache0hash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinnobase_a-row0cache0lru.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinnobase_a-row0cache0mempool.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinnobase_a-row0ext.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinnobase_a-row0ins.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinnobase_a-row0merge.Po@am__quote@
@@ -2423,6 +2442,62 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -c -o libinnobase_a-ut0wqueue.obj `if test -f 'ut/ut0wqueue.c'; then $(CYGPATH_W) 'ut/ut0wqueue.c'; else $(CYGPATH_W) '$(srcdir)/ut/ut0wqueue.c'; fi`
+libinnobase_a-row0cache.o: cache/row0cache.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -MT libinnobase_a-row0cache.o -MD -MP -MF $(DEPDIR)/libinnobase_a-row0cache.Tpo -c -o libinnobase_a-row0cache.o `test -f 'cache/row0cache.c' || echo '$(srcdir)/'`cache/row0cache.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libinnobase_a-row0cache.Tpo $(DEPDIR)/libinnobase_a-row0cache.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache/row0cache.c' object='libinnobase_a-row0cache.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -c -o libinnobase_a-row0cache.o `test -f 'cache/row0cache.c' || echo '$(srcdir)/'`cache/row0cache.c
+
+libinnobase_a-row0cache.obj: cache/row0cache.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -MT libinnobase_a-row0cache.obj -MD -MP -MF $(DEPDIR)/libinnobase_a-row0cache.Tpo -c -o libinnobase_a-row0cache.obj `if test -f 'cache/row0cache.c'; then $(CYGPATH_W) 'cache/row0cache.c'; else $(CYGPATH_W) '$(srcdir)/cache/row0cache.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libinnobase_a-row0cache.Tpo $(DEPDIR)/libinnobase_a-row0cache.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache/row0cache.c' object='libinnobase_a-row0cache.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -c -o libinnobase_a-row0cache.obj `if test -f 'cache/row0cache.c'; then $(CYGPATH_W) 'cache/row0cache.c'; else $(CYGPATH_W) '$(srcdir)/cache/row0cache.c'; fi`
+
+libinnobase_a-row0cache0hash.o: cache/row0cache0hash.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -MT libinnobase_a-row0cache0hash.o -MD -MP -MF $(DEPDIR)/libinnobase_a-row0cache0hash.Tpo -c -o libinnobase_a-row0cache0hash.o `test -f 'cache/row0cache0hash.c' || echo '$(srcdir)/'`cache/row0cache0hash.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libinnobase_a-row0cache0hash.Tpo $(DEPDIR)/libinnobase_a-row0cache0hash.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache/row0cache0hash.c' object='libinnobase_a-row0cache0hash.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -c -o libinnobase_a-row0cache0hash.o `test -f 'cache/row0cache0hash.c' || echo '$(srcdir)/'`cache/row0cache0hash.c
+
+libinnobase_a-row0cache0hash.obj: cache/row0cache0hash.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -MT libinnobase_a-row0cache0hash.obj -MD -MP -MF $(DEPDIR)/libinnobase_a-row0cache0hash.Tpo -c -o libinnobase_a-row0cache0hash.obj `if test -f 'cache/row0cache0hash.c'; then $(CYGPATH_W) 'cache/row0cache0hash.c'; else $(CYGPATH_W) '$(srcdir)/cache/row0cache0hash.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libinnobase_a-row0cache0hash.Tpo $(DEPDIR)/libinnobase_a-row0cache0hash.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache/row0cache0hash.c' object='libinnobase_a-row0cache0hash.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -c -o libinnobase_a-row0cache0hash.obj `if test -f 'cache/row0cache0hash.c'; then $(CYGPATH_W) 'cache/row0cache0hash.c'; else $(CYGPATH_W) '$(srcdir)/cache/row0cache0hash.c'; fi`
+
+libinnobase_a-row0cache0lru.o: cache/row0cache0lru.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -MT libinnobase_a-row0cache0lru.o -MD -MP -MF $(DEPDIR)/libinnobase_a-row0cache0lru.Tpo -c -o libinnobase_a-row0cache0lru.o `test -f 'cache/row0cache0lru.c' || echo '$(srcdir)/'`cache/row0cache0lru.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libinnobase_a-row0cache0lru.Tpo $(DEPDIR)/libinnobase_a-row0cache0lru.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache/row0cache0lru.c' object='libinnobase_a-row0cache0lru.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -c -o libinnobase_a-row0cache0lru.o `test -f 'cache/row0cache0lru.c' || echo '$(srcdir)/'`cache/row0cache0lru.c
+
+libinnobase_a-row0cache0lru.obj: cache/row0cache0lru.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -MT libinnobase_a-row0cache0lru.obj -MD -MP -MF $(DEPDIR)/libinnobase_a-row0cache0lru.Tpo -c -o libinnobase_a-row0cache0lru.obj `if test -f 'cache/row0cache0lru.c'; then $(CYGPATH_W) 'cache/row0cache0lru.c'; else $(CYGPATH_W) '$(srcdir)/cache/row0cache0lru.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libinnobase_a-row0cache0lru.Tpo $(DEPDIR)/libinnobase_a-row0cache0lru.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache/row0cache0lru.c' object='libinnobase_a-row0cache0lru.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -c -o libinnobase_a-row0cache0lru.obj `if test -f 'cache/row0cache0lru.c'; then $(CYGPATH_W) 'cache/row0cache0lru.c'; else $(CYGPATH_W) '$(srcdir)/cache/row0cache0lru.c'; fi`
+
+libinnobase_a-row0cache0mempool.o: cache/row0cache0mempool.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -MT libinnobase_a-row0cache0mempool.o -MD -MP -MF $(DEPDIR)/libinnobase_a-row0cache0mempool.Tpo -c -o libinnobase_a-row0cache0mempool.o `test -f 'cache/row0cache0mempool.c' || echo '$(srcdir)/'`cache/row0cache0mempool.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libinnobase_a-row0cache0mempool.Tpo $(DEPDIR)/libinnobase_a-row0cache0mempool.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache/row0cache0mempool.c' object='libinnobase_a-row0cache0mempool.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -c -o libinnobase_a-row0cache0mempool.o `test -f 'cache/row0cache0mempool.c' || echo '$(srcdir)/'`cache/row0cache0mempool.c
+
+libinnobase_a-row0cache0mempool.obj: cache/row0cache0mempool.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -MT libinnobase_a-row0cache0mempool.obj -MD -MP -MF $(DEPDIR)/libinnobase_a-row0cache0mempool.Tpo -c -o libinnobase_a-row0cache0mempool.obj `if test -f 'cache/row0cache0mempool.c'; then $(CYGPATH_W) 'cache/row0cache0mempool.c'; else $(CYGPATH_W) '$(srcdir)/cache/row0cache0mempool.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libinnobase_a-row0cache0mempool.Tpo $(DEPDIR)/libinnobase_a-row0cache0mempool.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache/row0cache0mempool.c' object='libinnobase_a-row0cache0mempool.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinnobase_a_CFLAGS) $(CFLAGS) -c -o libinnobase_a-row0cache0mempool.obj `if test -f 'cache/row0cache0mempool.c'; then $(CYGPATH_W) 'cache/row0cache0mempool.c'; else $(CYGPATH_W) '$(srcdir)/cache/row0cache0mempool.c'; fi`
+
ha_innodb_plugin_la-btr0btr.lo: btr/btr0btr.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ha_innodb_plugin_la_CFLAGS) $(CFLAGS) -MT ha_innodb_plugin_la-btr0btr.lo -MD -MP -MF $(DEPDIR)/ha_innodb_plugin_la-btr0btr.Tpo -c -o ha_innodb_plugin_la-btr0btr.lo `test -f 'btr/btr0btr.c' || echo '$(srcdir)/'`btr/btr0btr.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ha_innodb_plugin_la-btr0btr.Tpo $(DEPDIR)/ha_innodb_plugin_la-btr0btr.Plo
@@ -3046,6 +3121,34 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ha_innodb_plugin_la_CFLAGS) $(CFLAGS) -c -o ha_innodb_plugin_la-ut0wqueue.lo `test -f 'ut/ut0wqueue.c' || echo '$(srcdir)/'`ut/ut0wqueue.c
+ha_innodb_plugin_la-row0cache.lo: cache/row0cache.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ha_innodb_plugin_la_CFLAGS) $(CFLAGS) -MT ha_innodb_plugin_la-row0cache.lo -MD -MP -MF $(DEPDIR)/ha_innodb_plugin_la-row0cache.Tpo -c -o ha_innodb_plugin_la-row0cache.lo `test -f 'cache/row0cache.c' || echo '$(srcdir)/'`cache/row0cache.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ha_innodb_plugin_la-row0cache.Tpo $(DEPDIR)/ha_innodb_plugin_la-row0cache.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache/row0cache.c' object='ha_innodb_plugin_la-row0cache.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ha_innodb_plugin_la_CFLAGS) $(CFLAGS) -c -o ha_innodb_plugin_la-row0cache.lo `test -f 'cache/row0cache.c' || echo '$(srcdir)/'`cache/row0cache.c
+
+ha_innodb_plugin_la-row0cache0hash.lo: cache/row0cache0hash.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ha_innodb_plugin_la_CFLAGS) $(CFLAGS) -MT ha_innodb_plugin_la-row0cache0hash.lo -MD -MP -MF $(DEPDIR)/ha_innodb_plugin_la-row0cache0hash.Tpo -c -o ha_innodb_plugin_la-row0cache0hash.lo `test -f 'cache/row0cache0hash.c' || echo '$(srcdir)/'`cache/row0cache0hash.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ha_innodb_plugin_la-row0cache0hash.Tpo $(DEPDIR)/ha_innodb_plugin_la-row0cache0hash.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache/row0cache0hash.c' object='ha_innodb_plugin_la-row0cache0hash.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ha_innodb_plugin_la_CFLAGS) $(CFLAGS) -c -o ha_innodb_plugin_la-row0cache0hash.lo `test -f 'cache/row0cache0hash.c' || echo '$(srcdir)/'`cache/row0cache0hash.c
+
+ha_innodb_plugin_la-row0cache0lru.lo: cache/row0cache0lru.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ha_innodb_plugin_la_CFLAGS) $(CFLAGS) -MT ha_innodb_plugin_la-row0cache0lru.lo -MD -MP -MF $(DEPDIR)/ha_innodb_plugin_la-row0cache0lru.Tpo -c -o ha_innodb_plugin_la-row0cache0lru.lo `test -f 'cache/row0cache0lru.c' || echo '$(srcdir)/'`cache/row0cache0lru.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ha_innodb_plugin_la-row0cache0lru.Tpo $(DEPDIR)/ha_innodb_plugin_la-row0cache0lru.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache/row0cache0lru.c' object='ha_innodb_plugin_la-row0cache0lru.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ha_innodb_plugin_la_CFLAGS) $(CFLAGS) -c -o ha_innodb_plugin_la-row0cache0lru.lo `test -f 'cache/row0cache0lru.c' || echo '$(srcdir)/'`cache/row0cache0lru.c
+
+ha_innodb_plugin_la-row0cache0mempool.lo: cache/row0cache0mempool.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ha_innodb_plugin_la_CFLAGS) $(CFLAGS) -MT ha_innodb_plugin_la-row0cache0mempool.lo -MD -MP -MF $(DEPDIR)/ha_innodb_plugin_la-row0cache0mempool.Tpo -c -o ha_innodb_plugin_la-row0cache0mempool.lo `test -f 'cache/row0cache0mempool.c' || echo '$(srcdir)/'`cache/row0cache0mempool.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ha_innodb_plugin_la-row0cache0mempool.Tpo $(DEPDIR)/ha_innodb_plugin_la-row0cache0mempool.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache/row0cache0mempool.c' object='ha_innodb_plugin_la-row0cache0mempool.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ha_innodb_plugin_la_CFLAGS) $(CFLAGS) -c -o ha_innodb_plugin_la-row0cache0mempool.lo `test -f 'cache/row0cache0mempool.c' || echo '$(srcdir)/'`cache/row0cache0mempool.c
+
.cc.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
Index: storage/innodb_plugin/mtr/mtr0mtr.c
===================================================================
--- storage/innodb_plugin/mtr/mtr0mtr.c (revision 118)
+++ storage/innodb_plugin/mtr/mtr0mtr.c (revision 125)
@@ -208,6 +208,12 @@
ut_d(mtr->state = MTR_COMMITTED);
dyn_array_free(&(mtr->memo));
dyn_array_free(&(mtr->log));
+
+
+ if(mtr->row_cache_value_queue_base.count>0){
+ //release row cache value
+ release_row_cache_value_in_mtr(mtr);
+ }
}
#ifndef UNIV_HOTBACKUP
Index: storage/innodb_plugin/cache/row0cache0lru.c
===================================================================
--- storage/innodb_plugin/cache/row0cache0lru.c (revision 0)
+++ storage/innodb_plugin/cache/row0cache0lru.c (revision 125)
@@ -0,0 +1,132 @@
+/********************************************************************
+created: 2011/03/23
+created: 23:3:2011 15:15
+filename: D:\Work\Project\VisualStudio\TAoBao-MySQL-Trunk\5.1.48\storage\innodb_plugin\plugin\row0cache0lru.c
+file path: D:\Work\Project\VisualStudio\TAoBao-MySQL-Trunk\5.1.48\storage\innodb_plugin\plugin
+file base: row0cache0lru
+file ext: c
+author: [email protected]
+
+purpose:
+*********************************************************************/
+#include "row0cache0lru.h"
+#include "row0cache0hash.h"
+#include "row0cache0mempool.h"
+#include "ut0rbt.h"
+#include "ut0lst.h"
+
+#define ROW_CACHE_FREE_DISANCE 100
+
+typedef UT_LIST_BASE_NODE_T(row_cache_value_t) ROW_CACHE_VALUE_LRU_BASE;
+
+static ROW_CACHE_VALUE_LRU_BASE *innodb_row_cache_lru;
+
+static row_cache_lru_stat_t _row_cache_lru_stat;
+
+UNIV_INTERN row_cache_lru_stat_t* row_cache_lru_stat = &_row_cache_lru_stat;
+
+
+void init_innodb_row_cache_lru(){
+ if (innodb_row_cache_mutex_num > 0){
+ ulint i;
+ innodb_row_cache_lru = (ROW_CACHE_VALUE_LRU_BASE*) ut_malloc(innodb_row_cache_mutex_num * sizeof(ROW_CACHE_VALUE_LRU_BASE));
+ for (i = 0 ; i < innodb_row_cache_mutex_num ; i++)
+ {
+ UT_LIST_INIT(*(innodb_row_cache_lru+i));
+ }
+ }
+ memset(row_cache_lru_stat , 0 , sizeof(row_cache_lru_stat_t));
+}
+
+void deinit_innodb_row_cache_lru(){
+ if (innodb_row_cache_mutex_num > 0){
+ ulint i;
+ for (i = 0 ; i < innodb_row_cache_mutex_num ; i++)
+ {
+ row_cache_value_t* value;
+ ROW_CACHE_VALUE_LRU_BASE* free_lru = innodb_row_cache_lru + i;
+ row_cache_enter_mutex_by_no(i);
+ for (value = UT_LIST_GET_LAST(*free_lru);
+ value!=NULL;){
+ row_cache_value_t* free_value;
+ ulint fold;
+ free_value = value;
+ fold = free_value->fold;
+ value=UT_LIST_GET_PREV(list,value);
+ UT_LIST_REMOVE(list,*free_lru,free_value);
+ delete_row_cache_value(free_value);
+ ca_free(free_value->buf , fold);
+ ca_free(free_value , fold);
+ }
+ row_cache_exit_mutex_by_no(i);
+ }
+ ut_free(innodb_row_cache_lru);
+ }
+}
+
+
+static ROW_CACHE_VALUE_LRU_BASE* get_current_lru_base(const ulint fold){
+ return innodb_row_cache_lru + row_cache_get_mutex_no(fold);
+}
+
+void add_row_cache_value_to_lru( row_cache_value_t* value ) {
+ UT_LIST_ADD_FIRST(list,*get_current_lru_base(value->fold),value);
+ row_cache_lru_stat->n_add++;
+}
+
+void make_row_cache_value_first_from_lru( row_cache_value_t* value )
+{
+ ROW_CACHE_VALUE_LRU_BASE* lru_base = get_current_lru_base(value->fold);
+ UT_LIST_REMOVE(list,*lru_base,value);
+ UT_LIST_ADD_FIRST(list,*lru_base,value);
+ row_cache_lru_stat->n_make_first++;
+}
+
+ulint free_from_lru(const ulint size , const ulint used_fold)
+{
+ ulint iteration_size = 0;
+ int free_distance = 0;
+ ulint free_size = 0;
+ row_cache_value_t* value;
+ ROW_CACHE_VALUE_LRU_BASE* lru_base = get_current_lru_base(used_fold);
+ for (value = UT_LIST_GET_LAST(*lru_base);
+ free_distance < ROW_CACHE_FREE_DISANCE && value!=NULL;)
+ {
+ row_cache_value_t* free_value;
+ free_value = value;
+ value=UT_LIST_GET_PREV(list,value);
+ iteration_size += free_value->buf_size;
+ if(free_value->ref_num==0 && free_value->fold!=used_fold){
+ //the value can't be used or can't be locked by the upper function
+ UT_LIST_REMOVE(list,*lru_base,free_value);
+ row_cache_lru_stat->n_evict++;
+ free_size+=free_value->buf_size;
+ delete_row_cache_value(free_value);
+ ca_free(free_value->buf , used_fold);
+ ca_free(free_value , used_fold);
+ }
+ if(iteration_size > size){
+ //when may free enough mem and calc free distance
+ free_distance++;
+ }
+ }
+ return free_size;
+}
+
+void remove_row_cache_value_from_lru( row_cache_value_t* value )
+{
+ UT_LIST_REMOVE(list,*get_current_lru_base(value->fold),value);
+ row_cache_lru_stat->n_evict++;
+}
+
+ulint get_row_cache_lru_count()
+{
+ ulint i;
+ ulint ret = 0;
+ for (i = 0 ; i < innodb_row_cache_mutex_num ; i++)
+ {
+ ret += UT_LIST_GET_LEN(*(innodb_row_cache_lru+i));
+ }
+ return ret;
+}
+
Index: storage/innodb_plugin/cache/row0cache0hash.c
===================================================================
--- storage/innodb_plugin/cache/row0cache0hash.c (revision 0)
+++ storage/innodb_plugin/cache/row0cache0hash.c (revision 125)
@@ -0,0 +1,185 @@
+/********************************************************************
+created: 2011/03/24
+created: 24:3:2011 8:49
+filename: D:\Work\Project\VisualStudio\TAoBao-MySQL-Trunk\5.1.48\storage\innodb_plugin\plugin\row0cache0hash.c
+file path: D:\Work\Project\VisualStudio\TAoBao-MySQL-Trunk\5.1.48\storage\innodb_plugin\plugin
+file base: row0cache0hash
+file ext: c
+author: [email protected]
+
+purpose:
+*********************************************************************/
+
+#include "row0cache0hash.h"
+#include "ha0ha.h"
+#include "hash0hash.h"
+#include "rem0rec.h"
+#include "rem0cmp.h"
+#include "ut0byte.h"
+
+
+
+UNIV_INTERN unsigned long innodb_row_cache_cell_num = 10000L;
+
+UNIV_INTERN unsigned int innodb_row_cache_mutex_num_shift = 6;
+
+UNIV_INTERN ulint innodb_row_cache_mutex_num = 0;
+
+static row_cache_t _innodb_row_cache;
+
+UNIV_INTERN row_cache_t* innodb_row_cache = &_innodb_row_cache;
+
+int init_row_cache_hash(my_bool innodb_row_cache_on)
+{
+ memset(innodb_row_cache, 0 , sizeof(row_cache_t));
+ if (innodb_row_cache_on)
+ {
+ innodb_row_cache_mutex_num = (1<<innodb_row_cache_mutex_num_shift);
+ innodb_row_cache->row_cache = ha_create(innodb_row_cache_cell_num,innodb_row_cache_mutex_num,0);
+
+ }else{
+ innodb_row_cache->row_cache = NULL;
+ }
+ return 0;
+}
+
+static void free_hash_table_mutex(hash_table_t* table){
+ //mutex was freed by sync_close();
+ /* ulint i;
+ for (i = 0; i < table->n_mutexes; i++) {
+ mutex_free(table->mutexes + i);
+ }*/
+ mem_free(table->mutexes);
+ table->mutexes = NULL;
+ table->n_mutexes = 0;
+}
+
+void deinit_row_cache_hash(my_bool innodb_row_cache_on){
+ if (innodb_row_cache_on)
+ {
+ ha_clear(innodb_row_cache->row_cache);
+ free_hash_table_mutex(innodb_row_cache->row_cache);
+ hash_table_free(innodb_row_cache->row_cache);
+ }
+}
+
+row_cache_value_t* search_row_cache_value(const dtuple_t* tuple, const dict_index_t* index, const ulint fold)
+{
+ ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ ulint* offsets = offsets_;
+ mem_heap_t* heap = NULL;
+ row_cache_chain_t* chain = NULL;
+ HASH_SEARCH(
+ /* hash_chain->"next" */
+ next,
+ /* the hash table */
+ innodb_row_cache->row_cache,
+ /* fold */
+ fold,
+ /* the type of the next variable */
+ row_cache_chain_t*,
+ /* auxiliary variable */
+ chain,
+ /* assertion on every traversed item */
+ ,
+ /* this determines if we have found the lock */
+ (chain->value!=NULL && ut_dulint_cmp(chain->value->tree_id , index->id)==0 &&
+ cmp_dtuple_rec(tuple,chain->value->rec,rec_get_offsets(chain->value->rec, index, offsets, ULINT_UNDEFINED, &heap)) == 0));
+ if (chain == NULL) {
+ return(NULL);
+ }
+ /* else */
+ return(chain->value);
+}
+
+
+row_cache_value_t* search_row_cache_value_with_rec( const rec_t* rec, const ulint* rec_offsets, dict_index_t* index, const ulint fold )
+{
+ ulint offsets_[REC_OFFS_NORMAL_SIZE];
+ ulint* offsets = offsets_;
+ mem_heap_t* heap = NULL;
+ row_cache_chain_t* chain = NULL;
+ HASH_SEARCH(
+ /* hash_chain->"next" */
+ next,
+ /* the hash table */
+ innodb_row_cache->row_cache,
+ /* fold */
+ fold,
+ /* the type of the next variable */
+ row_cache_chain_t*,
+ /* auxiliary variable */
+ chain,
+ /* assertion on every traversed item */
+ ,
+ /* this determines if we have found the lock */
+ (chain->value!=NULL && ut_dulint_cmp(chain->value->tree_id , index->id)==0 &&
+ cmp_rec_rec(rec,chain->value->rec,rec_offsets,rec_get_offsets(chain->value->rec, index, offsets, ULINT_UNDEFINED, &heap),index)==0));
+ if (chain == NULL) {
+ return(NULL);
+ }
+ /* else */
+ return(chain->value);
+
+}
+
+
+
+
+row_cache_value_t* insert_row_cache_value(const ulint fold , row_cache_value_t* value){
+ HASH_INSERT(
+ /* the type used in the hash chain */
+ row_cache_chain_t,
+ /* hash_chain->"next" */
+ next,
+ /* the hash table */
+ innodb_row_cache->row_cache,
+ /* fold */
+ fold,
+ /* add this data to the hash */
+ &value->chain);
+ return value;
+}
+
+
+void delete_row_cache_value(row_cache_value_t* value){
+ HASH_DELETE(
+ row_cache_chain_t,
+ next,
+ innodb_row_cache->row_cache,
+ value->fold,
+ (&value->chain));
+}
+
+void row_cache_enter_mutex_by_no(const ulint no){
+ mutex_enter(hash_get_nth_mutex(innodb_row_cache->row_cache, no));
+}
+
+void row_cache_exit_mutex_by_no(const ulint no){
+ mutex_exit(hash_get_nth_mutex(innodb_row_cache->row_cache, no));
+}
+
+void row_cache_enter_mutex( const ulint fold )
+{
+ hash_mutex_enter(innodb_row_cache->row_cache , fold);
+}
+
+ulint row_cache_enter_mutex_nowait( const ulint fold )
+{
+ //hash_mutex_enter(innodb_row_cache->row_cache , fold);
+ mutex_enter_nowait(hash_get_mutex(innodb_row_cache->row_cache, fold));
+}
+
+void row_cache_exit_mutex( const ulint fold )
+{
+ hash_mutex_exit(innodb_row_cache->row_cache , fold);
+}
+
+int row_cache_own_mutex(const ulint fold1 , const ulint fold2){
+ return hash_get_mutex_no(innodb_row_cache->row_cache , fold1) == hash_get_mutex_no(innodb_row_cache->row_cache , fold2);
+}
+
+ulint row_cache_get_mutex_no( const ulint fold )
+{
+ return hash_get_mutex_no(innodb_row_cache->row_cache , fold);
+}
Index: storage/innodb_plugin/cache/row0cache0mempool.c
===================================================================
--- storage/innodb_plugin/cache/row0cache0mempool.c (revision 0)
+++ storage/innodb_plugin/cache/row0cache0mempool.c (revision 125)
@@ -0,0 +1,88 @@
+/********************************************************************
+ created: 2011/03/23
+ created: 23:3:2011 15:15
+ filename: D:\Work\Project\VisualStudio\TAoBao-MySQL-Trunk\5.1.48\storage\innodb_plugin\plugin\row0cache0mempool.c
+ file path: D:\Work\Project\VisualStudio\TAoBao-MySQL-Trunk\5.1.48\storage\innodb_plugin\plugin
+ file base: row0cache0mempool
+ file ext: c
+ author: [email protected]
+
+ purpose:
+*********************************************************************/
+#include "row0cache0mempool.h"
+#include "mem0mem.h"
+#include "sync0sync.h"
+#include "row0cache0lru.h"
+#include "mem0pool.h"
+
+UNIV_INTERN long long innodb_row_cache_mem_pool_size = 1024 * 1024L; //default is 1M
+
+static mem_pool_t** row_cache_mem_pool = NULL;
+
+void init_row_cache_mem_pool(my_bool innodb_row_cache_on)
+{
+ if(!innodb_row_cache_on){
+ innodb_row_cache_mem_pool_size = 1;
+ }
+ if (sizeof(ulint) == 4) {
+ if (innodb_row_cache_mem_pool_size > UINT_MAX32) {
+ fprintf(stderr,
+ "[Error]innodb_row_cache_mem_pool_size can't be over 4GB"
+ " on 32-bit systems");
+ }
+ }
+ if (innodb_row_cache_mutex_num > 0){
+ ulint i;
+ row_cache_mem_pool = (mem_pool_t**) ut_malloc(innodb_row_cache_mutex_num * sizeof(mem_pool_t*));
+ for (i = 0 ; i < innodb_row_cache_mutex_num ; i++)
+ {
+ row_cache_mem_pool[i] = mem_pool_create(innodb_row_cache_mem_pool_size/innodb_row_cache_mutex_num);
+ }
+ }
+}
+
+void deinit_row_cache_mem_pool(){
+ if (innodb_row_cache_mutex_num > 0){
+ ulint i;
+ for (i = 0 ; i < innodb_row_cache_mutex_num ; i++){
+ mem_pool_free(row_cache_mem_pool[i]);
+ }
+ ut_free(row_cache_mem_pool);
+ }
+}
+
+static mem_pool_t* get_current_mem_pool(const ulint fold){
+ return row_cache_mem_pool[row_cache_get_mutex_no(fold)];
+}
+
+void* ca_malloc_low(ulint n , const ulint used_fold)
+{
+ mem_pool_t* mem_pool = get_current_mem_pool(used_fold);
+ void* ret=mem_area_alloc_out(&n,mem_pool);
+ if(ret==NULL){
+ free_from_lru(n,used_fold);
+ ret=mem_area_alloc_out(&n,mem_pool);
+ }
+ return ret;
+}
+
+void ca_free_low( void* ptr , const ulint used_fold)
+{
+ mem_area_free_out(ptr,get_current_mem_pool(used_fold));
+}
+
+ulint row_cache_mem_pool_used()
+{
+ if(row_cache_mem_pool){
+ ulint i;
+ ulint ret = 0;
+ for (i = 0 ; i < innodb_row_cache_mutex_num ; i++)
+ {
+ ret += mem_pool_get_reserved(row_cache_mem_pool[i]);
+ }
+ return ret;
+ }
+ return 0;
+}
+
+
Index: storage/innodb_plugin/cache/row0cache.c
===================================================================
--- storage/innodb_plugin/cache/row0cache.c (revision 0)
+++ storage/innodb_plugin/cache/row0cache.c (revision 125)
@@ -0,0 +1,347 @@
+/********************************************************************
+created: 2011/03/17
+created: 17:3:2011 16:51
+filename: D:\Work\Project\VisualStudio\TAoBao-MySQL-Trunk\5.1.48\storage\innodb_plugin\plugin\row0cache.c
+file path: D:\Work\Project\VisualStudio\TAoBao-MySQL-Trunk\5.1.48\storage\innodb_plugin\plugin
+file base: row0cache
+file ext: c
+author: [email protected]
+
+purpose: for row cache
+*********************************************************************/
+
+#include "row0cache.h"
+#include "row0cache0mempool.h"
+#include "row0cache0hash.h"
+#include "mtr0mtr.h"
+#include "rem0rec.h"
+#include "row0cache0lru.h"
+#include "trx0types.h"
+#include "page0page.h"
+#include "log0recv.h"
+#include "read0read.h"
+#include "rem0cmp.h"
+
+UNIV_INTERN my_bool innodb_row_cache_on = FALSE;
+
+static row_cache_stat_t _row_cache_stat;
+
+UNIV_INTERN row_cache_stat_t* row_cache_stat = &_row_cache_stat;
+
+
+void init_row_cache()
+{
+ DBUG_ENTER("init_row_cache");
+ memset(row_cache_stat , 0 , sizeof(row_cache_stat_t));
+ init_row_cache_hash(innodb_row_cache_on);
+ init_innodb_row_cache_lru();
+ init_row_cache_mem_pool(innodb_row_cache_on);
+ //init_row_cache_lock_pool(1000);//TODO
+ DBUG_VOID_RETURN;
+}
+
+void deinit_row_cache()
+{
+ DBUG_ENTER("deinit_row_cache");
+ deinit_innodb_row_cache_lru();
+ deinit_row_cache_hash(innodb_row_cache_on);
+ deinit_row_cache_mem_pool();
+ //TODO deinit
+ DBUG_VOID_RETURN;
+}
+
+static row_cache_value_t* create_row_cache_value(const rec_t* rec ,const ulint* offsets, ulint fold,const dict_index_t* index, ibool is_sec_index)
+{
+ ulint buf_size;
+ row_cache_value_t* value = (row_cache_value_t*) ca_malloc(sizeof(row_cache_value_t) , fold);
+ if(value == NULL){
+ //not enough mem
+ fprintf(stderr,"[Warnning] malloc row_cache_value_t failded in create_row_cache_value !");
+ return NULL;
+ }
+ memset(value , 0 , sizeof(row_cache_value_t));
+ buf_size=rec_offs_extra_size(offsets)+rec_offs_data_size(offsets);
+ if(is_sec_index){
+ buf_size+=sizeof(trx_id_t);
+ }
+ value->buf = (rec_t*) ca_malloc(buf_size , fold);
+ if(value->buf==NULL){
+ //not enough mem
+ fprintf(stderr,"[Warnning] malloc rec copy buf failded in create_row_cache_value !");
+ ca_free(value , fold);
+ return NULL;
+ }
+ memset(value->buf,0,buf_size);
+ value->fold = fold;
+ value->tree_id=index->id;
+ value->rec = rec_copy(value->buf , rec , offsets);
+ if(is_sec_index){
+ trx_id_t* trx_id_in_rec=(trx_id_t*) (value->buf + buf_size - sizeof(trx_id_t));
+ *trx_id_in_rec = page_get_max_trx_id(page_align(rec));
+ }
+ value->buf_size=buf_size;
+ value->is_removed=0;
+ value->ref_num=0;
+ value->chain.value = value;
+ return value;
+}
+
+static int update_row_cache_value(row_cache_value_t* value, const rec_t* rec ,const ulint* offsets, ulint fold,const dict_index_t* index,ibool is_sec_index){
+ ulint buf_size;
+ ca_free(value->buf , fold);
+ buf_size=rec_offs_extra_size(offsets)+rec_offs_data_size(offsets);
+ if(is_sec_index){
+ buf_size+=sizeof(trx_id_t);
+ }
+ value->buf = (rec_t*) ca_malloc(buf_size , fold);
+ if(value->buf==NULL){
+ //not enough mem
+ fprintf(stderr,"[Warnning] malloc rec copy buf failded in create_row_cache_value !");
+ return NOT_ENOUGH_MEM;
+ }
+ value->fold = fold;
+ value->tree_id=index->id;
+ value->rec = rec_copy(value->buf , rec , offsets);
+ if(is_sec_index){
+ trx_id_t* trx_id_in_rec=(trx_id_t*) (value->buf + buf_size - sizeof(trx_id_t));
+ *trx_id_in_rec = page_get_max_trx_id(page_align(rec));
+ }
+ value->buf_size=buf_size;
+ value->is_removed=0;
+ value->ref_num=0;
+ return 0;
+}
+
+void put_rec_to_row_cache(const dtuple_t* tuple,
+ const rec_t* rec, /*!< in: physical record */
+ const ulint* offsets, /*!< in: array returned by rec_get_offsets() */
+ const dict_index_t* index,
+ ibool is_sec_index)
+{
+ row_cache_value_t* value;
+ ulint fold;
+ if (!innodb_row_cache_on)
+ {
+ return;
+ }
+ fold = calc_fold_by_rec(rec, offsets, dict_index_get_n_unique(index), index->id);
+ row_cache_enter_mutex(fold);
+ value = search_row_cache_value(tuple, index, fold);
+ if(value == NULL){
+ value = create_row_cache_value(rec, offsets, fold,index,is_sec_index);
+ if(value!=NULL){
+ insert_row_cache_value(fold,value);
+ add_row_cache_value_to_lru(value);
+ }
+ }else{
+ if(value->is_removed == 1 && value->ref_num == 0){
+ //can be overwrite
+ if(update_row_cache_value(value,rec,offsets,fold,index,is_sec_index) == NOT_ENOUGH_MEM){
+ delete_row_cache_value(value);
+ remove_row_cache_value_from_lru(value);
+ ca_free(value , fold); //value->buf already free in update_row_cache_value()
+ }else{
+ make_row_cache_value_first_from_lru(value);
+ }
+ }
+ }
+ row_cache_exit_mutex(fold);
+}
+
+static int add_row_cache_value_to_mtr(mtr_t* mtr , row_cache_value_t* value){
+ row_cache_value_queue_t* row_cache_value_queue;
+ row_cache_value_queue=(row_cache_value_queue_t*)ca_malloc(sizeof(row_cache_value_queue_t) , value->fold);
+ if(NULL==row_cache_value_queue){
+ fprintf(stderr,"[Warnning] malloc row_cache_value_queue_t failded in add_row_cache_value_to_mtr!");
+ return NOT_ENOUGH_MEM;
+ }
+ memset(row_cache_value_queue , 0 ,sizeof(row_cache_value_queue_t));
+ row_cache_value_queue->value = value;
+ UT_LIST_ADD_LAST(list,mtr->row_cache_value_queue_base,row_cache_value_queue);
+ return 0;
+}
+
+void release_row_cache_value_in_mtr( mtr_t* mtr )
+{
+ row_cache_value_queue_t* row_cache_value_queue;
+ if (!innodb_row_cache_on)
+ {
+ return;
+ }
+ while(mtr->row_cache_value_queue_base.count!=0){
+ ulint fold;
+ row_cache_value_queue = mtr->row_cache_value_queue_base.end;
+ //release Reference
+ fold = row_cache_value_queue->value->fold;
+ row_cache_enter_mutex(fold);
+ row_cache_value_queue->value->ref_num--;
+ row_cache_exit_mutex(fold);
+ UT_LIST_REMOVE(list,mtr->row_cache_value_queue_base,row_cache_value_queue);
+ ca_free(row_cache_value_queue , fold) ;
+ }
+}
+
+static void free_row_cache_value(row_cache_value_t* value){
+ ulint fold = value->fold;
+ ca_free(value->buf , fold);
+ ca_free(value , fold);
+}
+
+rec_t* get_from_row_cache_low(const ulint fold, const dtuple_t* tuple, const dict_index_t* index ,mtr_t* mtr)
+{
+ row_cache_value_t* value;
+ if (!innodb_row_cache_on)
+ {
+ return NULL;
+ }
+ row_cache_stat->n_get++;
+ row_cache_enter_mutex(fold);
+ value = search_row_cache_value(tuple, index, fold);
+ if(value!=NULL){
+ if(value->is_removed == 1 && value->ref_num == 0){
+ //can be free
+ delete_row_cache_value(value);
+ remove_row_cache_value_from_lru(value);
+ free_row_cache_value(value);
+ value=NULL;
+ }else if(value->is_removed == 0){
+ //can be read
+ if(add_row_cache_value_to_mtr(mtr,value)==0){
+ make_row_cache_value_first_from_lru(value);
+ value->ref_num++;
+ }else{
+ //not have enough mem
+ value=NULL;
+ }
+
+ }else{
+ // is removed can't be read
+ value=NULL;
+ }
+ }
+ row_cache_exit_mutex(fold);
+ if(value != NULL){
+ row_cache_stat->geted++;
+ return value->rec;
+ }
+ return NULL;
+}
+
+void remove_from_row_cache_low(const ulint fold,const rec_t* rec, const ulint* offsets, const dtuple_t* tuple, dict_index_t* index)
+{
+ row_cache_value_t* value = NULL;
+ if (!innodb_row_cache_on)
+ {
+ return;
+ }
+ row_cache_enter_mutex(fold);
+ if(rec && offsets){
+ value = search_row_cache_value_with_rec(rec,offsets,index,fold);
+ }else if(tuple){
+ value = search_row_cache_value(tuple, index, fold);
+ }
+ if(value != NULL){
+ if(value->ref_num == 0){
+ //can be free
+ delete_row_cache_value(value);
+ remove_row_cache_value_from_lru(value);
+ free_row_cache_value(value);
+ value=NULL;
+ }else{
+ //using just set is_removed = 1
+ value->is_removed = 1;
+ }
+ }
+ row_cache_exit_mutex(fold);
+}
+
+ulint calc_fold_by_rec(const rec_t* rec, /*!< in: the physical record */
+ const ulint* offsets, /*!< in: array returned by rec_get_offsets() */
+ ulint n_fields, /*!< in: number of complete fields to fold */
+ dulint tree_id )
+{
+ return rec_fold(rec,offsets,n_fields,0,tree_id);
+}
+
+ulint lock_sec_rec_in_row_cache_cons_read_sees( const rec_t* rec, const ulint* offsets, const read_view_t* view )
+{
+ trx_id_t* max_trx_id;
+ if (recv_recovery_is_on()) {
+
+ return(FALSE);
+ }
+
+ max_trx_id =(trx_id_t*) (rec+ rec_offs_data_size(offsets));
+ ut_ad(!ut_dulint_is_zero(*max_trx_id));
+
+ return(ut_dulint_cmp( *max_trx_id, view->up_limit_id) < 0);
+}
+
+void row_cache_refresh_stats()
+{
+ row_cache_stat->last_printout_time = time(NULL);
+ row_cache_stat->old_geted = row_cache_stat->geted;
+ row_cache_stat->old_n_get = row_cache_stat->n_get;
+ row_cache_lru_stat->old_n_add = row_cache_lru_stat->n_add;
+ row_cache_lru_stat->old_n_evict = row_cache_lru_stat->n_evict;
+ row_cache_lru_stat->old_n_make_first = row_cache_lru_stat->n_make_first;
+}
+
+void print_row_cache_stats( FILE* file )
+{
+ time_t current_time;
+ double time_elapsed;
+ ulint n_gets_diff = 0;
+ ulint mem_pool_used = row_cache_mem_pool_used();
+
+ fputs("----------------------\n"
+ "ROW CACHE\n"
+ "----------------------\n", file);
+ fprintf(file,
+ "Total memory allocated " ULINTPF
+ "; used " ULINTPF " (" ULINTPF " / 1000)"
+ "; Total LRU count " ULINTPF"\n",
+ (ulong) innodb_row_cache_mem_pool_size,
+ (ulong) mem_pool_used,
+ (ulong) (1000 * mem_pool_used / innodb_row_cache_mem_pool_size),
+ (ulong) get_row_cache_lru_count());
+
+ current_time = time(NULL);
+ time_elapsed = 0.001 + difftime(current_time,
+ row_cache_stat->last_printout_time);
+
+ fprintf(file,
+ "Row total add " ULINTPF " , %.2f add/s \n"
+ "Row total make first " ULINTPF " , %.2f mf/s \n"
+ "Row total evict " ULINTPF " , %.2f evict/s \n"
+ "Row read from cache " ULINTPF ", %.2f read/s \n"
+ "Row get from cache " ULINTPF ", %.2f get/s \n" ,
+ (ulong) row_cache_lru_stat->n_add ,
+ (row_cache_lru_stat->n_add-row_cache_lru_stat->old_n_add)/time_elapsed ,
+ (ulong) row_cache_lru_stat->n_make_first ,
+ (row_cache_lru_stat->n_make_first-row_cache_lru_stat->old_n_make_first)/time_elapsed ,
+ (ulong) row_cache_lru_stat->n_evict ,
+ (row_cache_lru_stat->n_evict-row_cache_lru_stat->old_n_evict)/time_elapsed ,
+ (ulong) row_cache_stat->n_get ,
+ (row_cache_stat->n_get-row_cache_stat->old_n_get)/time_elapsed ,
+ (ulong) row_cache_stat->geted ,
+ (row_cache_stat->geted-row_cache_stat->old_geted)/time_elapsed
+ );
+
+ n_gets_diff = row_cache_stat->n_get - row_cache_stat->old_n_get;
+
+ if (n_gets_diff)
+ {
+ fprintf(file,
+ "Row cache hit rate %lu / 1000 \n",
+ (ulong ) (1000 * (row_cache_stat->geted - row_cache_stat->old_geted)) / n_gets_diff
+ );
+ }
+ else
+ {
+ fputs("No row cache gets since the last printout\n",
+ file);
+ }
+
+ row_cache_refresh_stats();
+}
Index: storage/innodb_plugin/srv/srv0srv.c
===================================================================
--- storage/innodb_plugin/srv/srv0srv.c (revision 118)
+++ storage/innodb_plugin/srv/srv0srv.c (revision 125)
@@ -85,6 +85,9 @@
#include "ha_prototypes.h"
#include "trx0i_s.h"
#include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
+#include "row0cache.h" /* for row cache*/
+#include "row0cache0lru.h"
+#include "row0cache0mempool.h"
/* This is set to TRUE if the MySQL user has set it in MySQL; currently
affects only FOREIGN KEY definition parsing */