maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #05011
Re: [Commits] Rev 3480: Post review changes in the interface part 1.
Hi, Sanja!
few preliminary comments:
On Dec 19, sanja@xxxxxxxxxxxx wrote:
> At file:///home/bell/maria/bzr/work-maria-10.0-cassandra/
> ------------------------------------------------------------
> revno: 3480
> revision-id: sanja@xxxxxxxxxxxx-20121219200839-oyxvfz7im9p7wqpw
> parent: sanja@xxxxxxxxxxxxxxxx-20121119121604-5h5tu0zn11em0sb3
> committer: sanja@xxxxxxxxxxxx
> branch nick: work-maria-10.0-cassandra
> timestamp: Wed 2012-12-19 22:08:39 +0200
> message:
> Post review changes in the interface part 1.
> === modified file 'mysys/ma_dyncol.c'
> --- a/mysys/ma_dyncol.c 2012-09-28 12:27:16 +0000
> +++ b/mysys/ma_dyncol.c 2012-12-19 20:08:39 +0000
> @@ -26,6 +26,39 @@
> SUCH DAMAGE.
> */
>
> +/*
> + Numeric format:
> + ===============
> + * Fixed header part
> + 1 byte flags:
> + 0,1 bits - <offset size> - 1
> + 2-7 bits - 0
> + 2 bytes column counter
> + * Columns directory sorted by column number, each entry contains of:
> + 2 bytes column number
> + <offset size> bytes (1-4) combined offset from beginning of
> + the data segment + 3 bit type
> + * Data of above columns size of data and length depend on type
> +
> + Columns with names:
> + ===================
> + * Fixed header part
> + 1 byte flags:
> + 0,1 bits - <offset size> - 2
> + 2 bit - 1 (mens format with names)
s/mens/means/g
> + 3,4 bits - 01 (mens <names offset size> - 1, now 2 is only supported size)
eh. I would simply assume that if the bit 2 is 1, this also means
offset-2. Like, you have "old format" as above, and "new format" with
names, support for recursion (4 bits per type, offset-2), etc.
you only have 6 bits here, let's use them sparingly and keep things
simple.
> + 5-7 bits - 0
> + 2 bytes column counter
> + * Variable header part
> + <names offset size> (2) bytes size of stored names pool
> + * Column directory sorted by names, each consists of
> + <names offset size> (2) bytes offset of name
> + <offset size> bytes (1-4)bytes combined offset from beginning of
> + the data segment + 4 bit type
> + * Names stored one after another
> + * Data of above columns size of data and length depend on type
> +*/
> +
> #include "mysys_priv.h"
> #include <m_string.h>
> #include <ma_dyncol.h>
> === modified file 'storage/cassandra/ha_cassandra.cc'
> --- a/storage/cassandra/ha_cassandra.cc 2012-11-19 12:16:04 +0000
> +++ b/storage/cassandra/ha_cassandra.cc 2012-12-19 20:08:39 +0000
> @@ -893,9 +893,37 @@ public:
> /**
> Converting dynamic columns types to/from casandra types
> */
> +
> +
> +/**
> + Check and initialize (if it is needed) string MEM_ROOT
> +*/
> +static void alloc_strings_memroot(MEM_ROOT *mem_root)
> +{
> + if (mem_root->block_size == 0)
write
if (alloc_root_inited(mem_root))
> + {
> + /*
> + The mem_root used to allocate UUID (of length 36 + \0) so make
> + appropriate allocated size
> + */
> + init_alloc_root(mem_root,
> + (36 + 1 + ALIGN_SIZE(sizeof(USED_MEM))) * 10 +
> + ALLOC_ROOT_MIN_BLOCK_SIZE,
> + (36 + 1 + ALIGN_SIZE(sizeof(USED_MEM))) * 10 +
> + ALLOC_ROOT_MIN_BLOCK_SIZE);
> + }
> +}
> +
> +static void free_strings_memroot(MEM_ROOT *mem_root)
> +{
> + if (mem_root->block_size != 0)
and here
> + free_root(mem_root, MYF(0));
> +}
> +
> @@ -1730,6 +1759,7 @@ int ha_cassandra::read_cassandra_columns
> int res= 0;
> ulong total_name_len= 0;
>
> + strings_root.block_size= 0; // indicates uninitialized MEM_ROOT
Use
clear_alloc_root(&strings_root);
> /*
> cassandra_to_mariadb() calls will use field->store(...) methods, which
> require that the column is in the table->write_set
Regards,
Sergei