<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PlanetMysql.ru - информация о СУБД MySQL &#187; protobuf</title>
	<atom:link href="http://planetmysql.ru/category/protobuf/feed/" rel="self" type="application/rss+xml" />
	<link>http://planetmysql.ru</link>
	<description>Блог о самой популярной СУБД MySQL</description>
	<lastBuildDate>Fri, 25 May 2012 06:11:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>SHOW CREATE TABLE using table protobuf message</title>
		<link>http://www.flamingspork.com/blog/2010/08/20/show-create-table-using-table-protobuf-message/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=show-create-table-using-table-protobuf-message</link>
		<comments>http://www.flamingspork.com/blog/2010/08/20/show-create-table-using-table-protobuf-message/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 03:37:45 +0000</pubDate>
		<dc:creator>Stewart Smith</dc:creator>
				<category><![CDATA[Drizzle]]></category>
		<category><![CDATA[protobuf]]></category>
		<category><![CDATA[SHOW CREATE TABLE]]></category>

		<guid isPermaLink="false">http://www.flamingspork.com/blog/?p=2121</guid>
		<description><![CDATA[&#8230; and really testing the replication code path for CREATE TABLE.
So, for a very long time now, Drizzle has been using a protobuf based structure to describe the structure of tables. The idea was to be able to have engines rather painlessly generate this structure themselves (which several now do). A secondary idea was to use this structure itself for CREATE TABLE (in progress, and embedded_innodb does in fact does only use the table message for its CREATE TABLE codepath). The third idea was to just put the table protobuf message into the replication stream instead of the CREATE TABLE statement (i.e. a SQL string). This means that you could (easily) write a replicator to a DBMS with different SQL syntax, or to a system that doesn&#8217;t speak SQL at all.
The final step, to reduce duplicated code functionality, would be to have the code that does SHOW CREATE TABLE to use a common bit of code for turning a table protobuf message back into a SQL string.
We now have that.
Just now, my branch to replace the old SHOW CREATE TABLE code (that was using TableShare and friends) with the statement_transform code (that we also use in converting a replication log to SQL commands) hit trunk.
Yay.




		
			Share this on Facebook
		
		
			Tweet This!
		
		
			Share this on del.icio.us
		
		
			Digg this!
		
		
			Post on Google Buzz
		


]]></description>
			<content:encoded><![CDATA[<p>&#8230; and <strong>really</strong> testing the replication code path for CREATE TABLE.</p>
<p>So, for a very long time now, <a href="http://drizzle.org">Drizzle</a> has been using a <a href="http://code.google.com/p/protobuf/">protobuf</a> based structure to describe the structure of tables. The idea was to be able to have engines rather painlessly generate this structure themselves (which several now do). A secondary idea was to use this structure itself for CREATE TABLE (in progress, and embedded_innodb does in fact does only use the table message for its CREATE TABLE codepath). The third idea was to just put the table protobuf message into the replication stream instead of the CREATE TABLE statement (i.e. a SQL string). This means that you could (easily) write a replicator to a DBMS with different SQL syntax, or to a system that doesn&#8217;t speak SQL at all.</p>
<p>The final step, to reduce duplicated code functionality, would be to have the code that does SHOW CREATE TABLE to use a common bit of code for turning a table protobuf message back into a SQL string.</p>
<p>We now have that.</p>
<p>Just now, my branch to replace the old SHOW CREATE TABLE code (that was using TableShare and friends) with the statement_transform code (that we also use in converting a replication log to SQL commands) hit trunk.</p>
<p>Yay.</p>


<div>
<ul>
		<li>
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.flamingspork.com/blog/2010/08/20/show-create-table-using-table-protobuf-message/&amp;t=SHOW+CREATE+TABLE+using+table+protobuf+message" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li>
			<a href="http://twitter.com/home?status=SHOW+CREATE+TABLE+using+table+protobuf+message+-+http://b2l.me/ajk8k3&amp;source=shareaholic" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li>
			<a href="http://delicious.com/post?url=http://www.flamingspork.com/blog/2010/08/20/show-create-table-using-table-protobuf-message/&amp;title=SHOW+CREATE+TABLE+using+table+protobuf+message" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li>
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.flamingspork.com/blog/2010/08/20/show-create-table-using-table-protobuf-message/&amp;title=SHOW+CREATE+TABLE+using+table+protobuf+message" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li>
			<a href="http://www.google.com/buzz/post?url=http://www.flamingspork.com/blog/2010/08/20/show-create-table-using-table-protobuf-message/&amp;imageurl=" rel="nofollow" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
</ul>
<div></div>
</div><br/>PlanetMySQL Voting:
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=25615&vote=1&apivote=1">Vote UP</a> /
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=25615&vote=-1&apivote=1">Vote DOWN</a>]]></content:encoded>
			<wfw:commentRss>http://planetmysql.ru/2010/08/20/show-create-table-using-table-protobuf-message/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing A Storage Engine for Drizzle, Part 2: CREATE TABLE</title>
		<link>http://www.flamingspork.com/blog/2010/03/12/writing-a-storage-engine-for-drizzle-part-2-create-table/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=writing-a-storage-engine-for-drizzle-part-2-create-table</link>
		<comments>http://www.flamingspork.com/blog/2010/03/12/writing-a-storage-engine-for-drizzle-part-2-create-table/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 14:27:34 +0000</pubDate>
		<dc:creator>Stewart Smith</dc:creator>
				<category><![CDATA[Drizzle]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[protobuf]]></category>

		<guid isPermaLink="false">http://www.flamingspork.com/blog/?p=1813</guid>
		<description><![CDATA[The DDL code paths for Drizzle are increasingly different from MySQL. For example, the embedded_innodb StorageEngine CREATE TABLE code path is completely different than what it would have to be for MySQL. This is because of a number of reasons, the primary one being that Drizzle uses a protobuf message to describe the table format instead of several data structures and a FRM file.
We are pretty close to having the table protobuf message format being final (there&#8217;s a few bits left to clean up, but expect them done Real Soon Now (TM)). You can see the definition (which is pretty simple to follow) in drizzled/message/table.proto. Also check out my series of blog posts on the table message (more posts coming, I promise!).
Drizzle allows either your StorageEngine or the Drizzle kernel to take care of storage of table metadata. You tell the Drizzle kernel that your engine will take care of metadata itself by specifying HTON_HAS_DATA_DICTIONARY to the StorageEngine constructor. If you don&#8217;t specify HTON_HAS_DATA_DICTIONARY, the Drizzle kernel stores the serialized Table protobuf message in a &#8220;table_name.dfe&#8221; file in a directory named after the database. If you have specified that you have a data dictionary, you&#8217;ll also have to implement some other methods in your StorageEngine. We&#8217;ll cover these in a later post.
If you ever dealt with creating a table in MySQL, you may recognize this method:
virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0;
This is not how we do things in Drizzle. We now have this function in StorageEngine that you have to implement:
int doCreateTable(Session* session, const char *path,
                  Table&#38; table_obj,
                  drizzled::message::Table&#38; table_message)
The existence of the Table parameter is largely historic and at some point will go away. In the Embedded InnoDB engine, we don&#8217;t use the Table parameter at all. Shortly we&#8217;ll also get rid of the path parameter, instead having the table schema in the Table message and helper functions to construct path names.
Methods name &#8220;doFoo&#8221; (such as doCreateTable) mean that there is a method named foo() (such as createTable()) in the base class. It does some base work (such as making sure the table_message is filled out and handling any errors) while the &#8220;real&#8221; work is done by your StorageEngine in the doCreateTable() method.
The Embedded InnoDB engine goes through the table message and constructs a data structure for the Embedded InnoDB library to create a table. The ARCHIVE storage engine is much simpler, and it pretty much just creates the header of the ARZ file, mostly ignoring the format of the table. The best bet is to look at the code from one of these engines, depending on what type of engine you&#8217;re working on. This code, along with the table message definition should be more than enough]]></description>
			<content:encoded><![CDATA[<p>The DDL code paths for Drizzle are increasingly different from MySQL. For example, the embedded_innodb StorageEngine CREATE TABLE code path is completely different than what it would have to be for MySQL. This is because of a number of reasons, the primary one being that Drizzle uses a protobuf message to describe the table format instead of several data structures and a FRM file.</p>
<p>We are pretty close to having the table protobuf message format being final (there&#8217;s a few bits left to clean up, but expect them done Real Soon Now (TM)). You can see the definition (which is pretty simple to follow) in <a href="http://bazaar.launchpad.net/~drizzle-developers/drizzle/development/annotate/head%3A/drizzled/message/table.proto">drizzled/message/table.proto</a>. Also check out my <a href="http://www.flamingspork.com/blog/2009/12/12/the-table-protobuf-message-format/">series of blog posts on the table message</a> (more posts coming, I promise!).</p>
<p>Drizzle allows either your StorageEngine or the Drizzle kernel to take care of storage of table metadata. You tell the Drizzle kernel that your engine will take care of metadata itself by specifying HTON_HAS_DATA_DICTIONARY to the StorageEngine constructor. If you don&#8217;t specify HTON_HAS_DATA_DICTIONARY, the Drizzle kernel stores the serialized Table protobuf message in a &#8220;table_name.dfe&#8221; file in a directory named after the database. If you have specified that you have a data dictionary, you&#8217;ll also have to implement some other methods in your StorageEngine. We&#8217;ll cover these in a later post.</p>
<p>If you ever dealt with creating a table in MySQL, you may recognize this method:</p>
<pre>virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0;</pre>
<p>This is not how we do things in Drizzle. We now have this function in StorageEngine that you have to implement:</p>
<pre>int doCreateTable(Session* session, const char *path,
                  Table&amp; table_obj,
                  drizzled::message::Table&amp; table_message)</pre>
<p>The existence of the Table parameter is largely historic and at some point will go away. In the Embedded InnoDB engine, we don&#8217;t use the Table parameter at all. Shortly we&#8217;ll also get rid of the path parameter, instead having the table schema in the Table message and helper functions to construct path names.</p>
<p>Methods name &#8220;doFoo&#8221; (such as doCreateTable) mean that there is a method named foo() (such as createTable()) in the base class. It does some base work (such as making sure the table_message is filled out and handling any errors) while the &#8220;real&#8221; work is done by your StorageEngine in the doCreateTable() method.</p>
<p>The Embedded InnoDB engine goes through the table message and constructs a data structure for the Embedded InnoDB library to create a table. The ARCHIVE storage engine is much simpler, and it pretty much just creates the header of the ARZ file, mostly ignoring the format of the table. The best bet is to look at the code from one of these engines, depending on what type of engine you&#8217;re working on. This code, along with the table message definition should be more than enough</p><br/>PlanetMySQL Voting:
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=23867&vote=1&apivote=1">Vote UP</a> /
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=23867&vote=-1&apivote=1">Vote DOWN</a>]]></content:encoded>
			<wfw:commentRss>http://planetmysql.ru/2010/03/11/writing-a-storage-engine-for-drizzle-part-2-create-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

