MySQL source analysis--csv storage engine

Source: Internet
Author: User

Always want to analyze the source of MySQL, at the beginning do not know where to start, first from the CSV file storage start it, this is relatively simple. I am using the mysql5.7.16 version of the source code.

CSV source files in the MySQL source mysql-5.7.16\storage\csv folder, which in addition to a make file, the remaining four files is the CSV storage read code.

The transparent_file.h/cc file is simple and defines only one Transparent_file class to read data from the specified file into the cache.

classtransparent_file{file filedes; Uchar*buff;/*in-memory window to the file or mmaped area*/  /*Current window sizes*/my_off_t Lower_bound;//file offset start positionmy_off_t Upper_bound;//file offset End position  UINTBuff_size;//the length of the cache file Public: Transparent_file (); ~Transparent_file (); voidInit_buff (File filedes_arg);//reading data from a file into the in-memory cacheUchar *ptr ();//returns the memory cache pointermy_off_t start ();  my_off_t end (); Charget_value (my_off_t offset); my_off_t Read_next ();//read the next paragraph};

The 1.transparent_file constructor, based on the size of the buff_size and the characters, requests a specified length of space, just the application, without initializing the data in the file.

The purpose of the 2.init_buff function is to load the file contents into the cache from the specified file.

3.read_next the contents of the next buff_size length from the file into the cache and overrides the values of Lower_bound and Upper_bound.

4.get_value reads data from a file with a specified location length of buff_size and puts it in the cache.

Not to be continued ...

MySQL source analysis--csv storage engine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.