[MDEV-377] Name support for dynamic columns Created: 2012-07-02  Updated: 2013-01-14  Resolved: 2013-01-14

Status: Closed
Project: MariaDB Server
Component/s: None
Fix Version/s: 10.0.1

Type: Task Priority: Critical
Reporter: Oleksandr Byelkin Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-431 Cassandra storage engine Closed
is part of MDEV-506 Cassandra dynamic columns access Closed
Relates
relates to MDEV-122 Data mapping between HBase and SQL Closed
relates to MDEV-458 DNAMES: Server crashes on using an un... Closed
relates to MDEV-459 DNAMES: column_list returns an empty ... Closed
relates to MDEV-460 DNAMES: main.dyncol test produces mis... Closed
relates to MDEV-461 DNAMES: column names do not work with... Closed
relates to MDEV-488 DNAMES: Assertion `column_name->lengt... Closed
relates to MDEV-489 DNAMES: Assertion `offset < 0x1f' fai... Closed
relates to MDEV-490 DNAMES: Server crashes in Item_dyncol... Closed
relates to MDEV-491 DNAMES: Server crashes in Item_func_d... Closed
relates to MDEV-558 DNAMES: Adding a column with a too lo... Closed
relates to MDEV-560 Cassandra: DynCols: Server crashes in... Closed
relates to MDEV-561 Cassandra: DynCols: debugger aborting... Closed
relates to MDEV-565 Cassandra: DynCols: Server crashes in... Closed

 Description   

Dynamic columns should be referred by names (now only numeric references supported).

Numeric (current) format of dynamic columns string is:

fixed part
1 byte flags (now stores <offset size> - 1 in first 2 bits)
2 bytes column counter
fixed size column headers sorted by column number, each entry contains of:
2 bytes column number
1-4 bytes combined offset from beginning of the data segment + 3 bit type
data of above columns size of data and length depend on type

For columns with names proposed following format. I think in this format numeric references could be written as strings.

fixed part
1 byte flags (now stores <offset size> - 1 in first 2 bits, and 1 bit to set this new format)
2 bytes column counter
2 bytes size of stored names pool
fixed size column headers sorted by names, each consists of
1 byte length of the name
2 bytes offset of name
1-4 bytes combined offset from beginning of the data segment + 3 bit type
names stored one after another
data of above columns size of data and length depend on type

there was other ideas which I think is not so good:

  1. store names just in header part (then it looses its array properties and binary search)
  2. store both headers numbers and names (I doubts that both way of references could be used simultaneously). (We have agreed this is not possible, because name↔number mapping must be the same for every record in the table, and there is no way we could efficiently maintain this mapping. For example, HBase does not provide any fast way to get a full list of column names).

Limitations:

  • each name not more then 255 symbols
  • sum of all names length cant be more then 65535

New format used if

  • at least one of dynamic column references has non integer type.
    or
  • dynamic column string on which operation performed has new format

New low level interface functions:

Parameters of creating/changing functions:

DYNAMIC_COLUMN *str the dynamic column.
uchar *column_keys array of uint or LEX_STRING keys depends on names
DYNAMIC_COLUMN_VALUE *values array of values
uint column_count number of above arrays
my_bool names TRUE if names are character strings

enum enum_dyncol_func_result
dynamic_column_create_many_fmt(DYNAMIC_COLUMN *str,
                               uint column_count,
                               uchar *column_keys,
                               DYNAMIC_COLUMN_VALUE *values,
                               my_bool names);
enum enum_dyncol_func_result
dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str,
                               uint add_column_count,
                               void *column_keys,
                               DYNAMIC_COLUMN_VALUE *values,
                               my_bool string_keys);

Check existence of column (not null) (2 functions, one is addition to old
function, other is universal)

enum enum_dyncol_func_result
dynamic_column_exists_str(DYNAMIC_COLUMN *str, LEX_STRING *name);
enum enum_dyncol_func_result
dynamic_column_exists_fmt(DYNAMIC_COLUMN *str, void *key, my_bool string_keys);

Get list of of columns (works for both formats):

enum enum_dyncol_func_result
dynamic_column_list_str(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_lexstr);

Get column value (2 functions, one is addition to old
function, other is universal)

enum enum_dyncol_func_result
dynamic_column_get_str(DYNAMIC_COLUMN *str, LEX_STRING *name,
                           DYNAMIC_COLUMN_VALUE *store_it_here);
enum enum_dyncol_func_result
dynamic_column_get_fmt(DYNAMIC_COLUMN *str, void *key,
                           DYNAMIC_COLUMN_VALUE *store_it_here,
                           my_bool names)

Check the string format:

my_bool dynamic_column_has_names(DYNAMIC_COLUMN *str);


Generated at Thu Feb 08 06:28:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.