tag:blogger.com,1999:blog-43161103511513772952023-11-15T05:14:12.430-08:00sleebing's blogsleepinghttp://www.blogger.com/profile/16062467746631766116noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-4316110351151377295.post-35371340330818309952011-06-13T00:49:00.000-07:002011-06-13T00:57:54.412-07:00Notes on Innodb codeI am recently reading the code of Innodb. A lot of things are new for me. So it is a good idea to write down what I can understand from the code. Many basic knowledges of database management systems can be learned from below two books. So I am reading the books with the code together.<br />
"<a class="title" href="http://www.amazon.com/Database-Systems-Complete-Book-2nd/dp/0131873253/ref=sr_1_1?ie=UTF8&qid=1307950354&sr=8-1">Database Systems: The Complete Book (2nd Edition)</a> "<span class="ptBrand"></span><br />
<a class="title" href="http://www.amazon.com/Transaction-Processing-Concepts-Techniques-Management/dp/1558601902/ref=sr_1_1?ie=UTF8&qid=1307950283&sr=8-1">"Transaction Processing: Concepts and Techniques"</a><br />
<br />
The key functions of Innodb include:<br />
- Transaction Management<br />
- Lock Management<br />
- MVCC <br />
- Data Format<br />
- Buffer Pool <br />
- I/O Control<br />
- Thread Controlsleepinghttp://www.blogger.com/profile/16062467746631766116noreply@blogger.com0tag:blogger.com,1999:blog-4316110351151377295.post-48933864597261670762010-12-08T19:16:00.000-08:002011-06-13T01:05:00.570-07:00Install BT4-rc2 on KVM+Virtio<div style="font-family: "Courier New",Courier,monospace;">Recently, I tried to migrate my virtual machines KVM. I tried to install BT4-rc2 on KVM as soon as I got it. I first set the disk type IDE, but I found it was very slow to install BT4-rc2 in the virtual disk. So I changed the virtual disk's type to virtio. I finally could run it after a few hours struggle.</div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">Here is a brief summary.</div><div style="font-family: "Courier New",Courier,monospace;">* Boot from BT4-rc2.iso.</div><div style="font-family: "Courier New",Courier,monospace;">* Compile and load virtio modules.</div><div style="font-family: "Courier New",Courier,monospace;">* Install BT4-rc2.</div><div style="font-family: "Courier New",Courier,monospace;">* Make new initrd file</div><div style="font-family: "Courier New",Courier,monospace;">* Copy virtio modules and initrd file to the target disk.</div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">** Compile and load virtio modules </div><div style="font-family: "Courier New",Courier,monospace;"> virtio modules are not included in BT4-rc2's kernel. So the installation program could not find the virtio disk /dev/vda. For supporting virtio disk, I compiled and loaded virtio modules.<br />
<span style="font-size: x-small;">> cd /usr/src/linux</span></div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"> --- Config Virtio Modules ---<br />
<span style="font-size: x-small;">> make menuconfig</span><br />
Mark all virtio modules, they are in<br />
->Virtualization (Basic Modules of Virtio)<br />
->Device Drivers->Block Drivers (Virtio Disk Driver)<br />
->Device Drivers->Net Drivers (Virtio Net Driver)</div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"> --- Compile Basic Virtio Modules ---</div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > make SUBDIRS=drivers/virtio modules</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > mkdir drivers/net/virtio</span></div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"> --- Compile Virtio Net Module ---</div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > mkdir drivers/net/virtio</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > cat drivers/net/Makefile|grep virt> drivers/net/virtio/Makefile</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > cp drivers/net/virtio_net.c drivers/net/virtio</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > make SUBDIRS=drivers/net/virtio modules</span></div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"> --- Compile Virtio Block Module ---</div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > mkdir dirvers/block/virtio</span></div><div style="font-family: "Courier New",Courier,monospace;"></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > cat drivers/block/Makefile |grep virt> drivers/block/virtio/Makefile</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > cp drivers/block/virtio_blk.c drivers/net/virtio</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > make SUBDIRS=drivers/block/virtio modules</span></div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;"> --- Copy and Load Modules ---</div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> <span style="font-family: "Courier New",Courier,monospace; font-size: x-small;">> mkdir /lib/modules/2.6.35.8/kernel/drivers/virtio</span></span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > </span><span style="font-size: x-small;">cp drivers/virtio/*.ko /lib/modules/2.6.35.8/kernel/drivers/virtio</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > </span><span style="font-family: "Courier New",Courier,monospace; font-size: x-small;">cp drivers/net/virtio/*.ko /lib/modules/2.6.35.8/kernel/drivers/net</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > </span><span style="font-family: "Courier New",Courier,monospace; font-size: x-small;">cp drivers/block/virtio/*.ko /lib/modules/2.6.35.8/kernel/drivers/block</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > depmod -ae</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > modprobe virtio_blk</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Courier New",Courier,monospace; font-size: x-small;"> > modprobe virtio_pci</span></div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">** Make new initrd file</div><div style="font-family: "Courier New",Courier,monospace;"> <span style="font-size: x-small;">> mkinitramfs -o /tmp/initrd.img-2.6.35.8</span></div><div style="font-family: "Courier New",Courier,monospace;"><br />
</div><div style="font-family: "Courier New",Courier,monospace;">** Copy to target</div><div style="font-family: "Courier New",Courier,monospace;"> Copy virtio modules and initrd file to target disk after BT4-rc2 has been installed.</div><div style="font-family: "Courier New",Courier,monospace;"> <span style="font-size: x-small;">> mount /dev/vda1 /mnt</span></div><div style="font-family: "Courier New",Courier,monospace;"> Replace vda1 by the partition in which BT4-rc2 is installed.</div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > mv /mnt/boot/</span><span style="font-size: x-small;">initrd.img-2.6.35.8 /mnt/boot/initrd.img-2.6.35.8.bak</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > cp /tmp/</span><span style="font-size: x-small;">initrd.img-2.6.35.8 /mnt/boot/</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> <span style="font-family: "Courier New",Courier,monospace; font-size: x-small;">> mkdir /mnt/lib/modules/2.6.35.8/kernel/drivers/virtio</span></span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace; font-size: x-small;"> > cd /usr/src/linux </span></span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > </span><span style="font-size: x-small;">cp drivers/virtio/*.ko /mnt/lib/modules/2.6.35.8/kernel/drivers/virtio</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > </span><span style="font-family: "Courier New",Courier,monospace; font-size: x-small;">cp drivers/net/virtio/*.ko /mnt/lib/modules/2.6.35.8/kernel/drivers/net</span></div><div style="font-family: "Courier New",Courier,monospace;"><span style="font-size: x-small;"> > </span><span style="font-family: "Courier New",Courier,monospace; font-size: x-small;">cp drivers/block/virtio/*.ko /mnt/lib/modules/2.6.35.8/kernel/drivers/block</span><br />
<span style="font-family: "Courier New",Courier,monospace; font-size: x-small;"> > cp </span><span style="font-family: "Courier New",Courier,monospace; font-size: x-small;">/lib/modules/2.6.35.8/modules.* </span><span style="font-family: "Courier New",Courier,monospace; font-size: x-small;">/mnt/lib/modules/2.6.35.8/</span></div>sleepinghttp://www.blogger.com/profile/16062467746631766116noreply@blogger.com0