0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
HqlHelpText.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
28 #include <Common/Compat.h>
29 #include "HqlHelpText.h"
30 
31 #include <Common/StringExt.h>
32 
33 #include <iostream>
34 #include <string>
35 #include <unordered_map>
36 
37 using namespace Hypertable;
38 using namespace std;
39 
40 namespace {
41 
42  const char *help_text_contents[] = {
43  "",
44  "USE ................ Sets the current namespace",
45  "COMPACT ............ Schedules manual compaction",
46  "CREATE NAMESPACE ... Creates a new namespace",
47  "DROP NAMESPACE ..... Removes a namespace",
48  "EXISTS TABLE ....... Check if table exists",
49  "CREATE TABLE ....... Creates a table",
50  "DELETE ............. Deletes all or part of a row from a table",
51  "DESCRIBE TABLE ..... Displays a table's schema",
52  "DROP TABLE ......... Removes a table",
53  "RENAME TABLE ....... Renames a table",
54  "DUMP TABLE ......... Create efficient backup file",
55  "ALTER TABLE ........ Add/remove column family from existing table",
56  "REBUILD INDICES .... Rebuilds a table's indices",
57  "INSERT ............. Inserts data into a table",
58  "LOAD DATA INFILE ... Loads data from a TSV input file into a table",
59  "SELECT ............. Selects (and display) cells from a table",
60  "SHOW CREATE TABLE .. Displays CREATE TABLE command used to create table",
61  "SHOW TABLES ........ Displays only the list of tables in the current namespace",
62  "STATUS ............. Checks system status",
63  "GET LISTING ........ Displays the list of tables and namespace in the current namespace",
64  "SET ................ Set system state variables",
65  "",
66  "Statements must be terminated with ';'. For more information on",
67  "a specific statement, type 'help <statement>', where <statement> is from",
68  "the preceding list.",
69  "",
70  0
71  };
72 
73  const char *help_text_rsclient_contents[] = {
74  "",
75  "COMPACT ............... Schedules range compactions",
76  "CREATE SCANNER ........ Creates a scanner and displays first block of results",
77  "DESTROY SCANNER ....... Destroys a scanner",
78  "DROP RANGE ............ Drop a range",
79  "FETCH SCANBLOCK ....... Fetch the next block results of a scan",
80  "LOAD RANGE ............ Load a range",
81  "REPLAY START .......... Start replay",
82  "REPLAY LOG ............ Replay a commit log",
83  "REPLAY COMMIT ......... Commit replay",
84  "SHUTDOWN ............ Shutdown the RangeServer",
85  "UPDATE ................ Selects (and display) cells from a table",
86  "WAIT FOR MAINTENANCE .. Blocks until maintenance queue is empty",
87  "",
88  "Statements must be terminated with ';'. For more information on",
89  "a specific statement, type 'help <statement>', where <statement> is from",
90  "the preceeding list.",
91  "",
92  0
93  };
94 
95  const char *help_text_master_contents[] = {
96  "",
97  "SHUTDOWN ............ Shutdown the Master",
98  "",
99  "Statements must be terminated with ';'. For more information on",
100  "a specific statement, type 'help <statement>', where <statement> is from",
101  "the preceeding list.",
102  "",
103  0
104  };
105 
106  const char *help_text_compact[] = {
107  "",
108  "COMPACT [TYPE '=' compaction_type] TABLE table_name [row]",
109  "COMPACT [TYPE '=' compaction_type] RANGES range_type ['|' range_type ...]",
110  "",
111  "compaction_type:",
112  " MINOR",
113  " | MAJOR",
114  " | MERGING",
115  " | GC",
116  "",
117  "range_type:",
118  " ALL",
119  " | ROOT",
120  " | METADATA",
121  " | SYSTEM",
122  " | USER",
123  "",
124  "This command schedules a compaction for each range specified",
125  "in the command. The TABLE version of the command will schedule",
126  "a major compaction for each range in the given table, or just the",
127  "range containing the row, if specified. The RANGES version of the",
128  "command will schedule compactions for all the ranges of the given",
129  "range type(s), regardless of what table they belong to. By default,",
130  "a major compaction is performed, but this can be changed by supplying",
131  "the TYPE option.",
132  "",
133  "NOTE: Compactions scheduled by this command are spread out over time.",
134  "During each maintenance interval, which by default happens once every",
135  "60 seconds, a limited number of these compactions will get scheduled",
136  "as controlled by the following property:",
137  "",
138  " Hypertable.RangeServer.Maintenance.MoveCompactionsPerInterval",
139  "",
140  "The default value for this property is 2.",
141  "",
142  0
143  };
144 
145  const char *help_text_create_scanner[] = {
146  "",
147  "CREATE SCANNER ON range_spec",
148  " [where_clause]",
149  " [options_spec]",
150  "",
151  "range_spec:",
152  " table_name '[' [start_row] \"..\" (end_row | ?? ) ']'",
153  "",
154  "where_clause:",
155  " WHERE where_predicate [AND where_predicate ...] ",
156  "",
157  "where_predicate: ",
158  " cell_predicate",
159  " | row_predicate",
160  " | timestamp_predicate",
161  "",
162  "relop: '=' | '<' | '<=' | '>' | '>=' | '=^'",
163  "",
164  "cell_spec: row_key ',' qualified_column",
165  "",
166  "cell_predicate: ",
167  " [cell_spec relop] CELL relop cell_spec",
168  " | '(' [cell_spec relop] CELL relop cell_spec",
169  " (OR [cell_spec relop] CELL relop cell_spec)* ')'",
170  "",
171  "row_predicate: ",
172  " [row_key relop] ROW relop row_key",
173  " | '(' [row_key relop] ROW relop row_key",
174  " (OR [row_key relop] ROW relop row_key)* ')'",
175  "",
176  "timestamp_predicate: ",
177  " [timestamp relop] TIMESTAMP relop timestamp",
178  "",
179  "options_spec:",
180  " (MAX_VERSIONS revision_count",
181  " | LIMIT row_count",
182  " | INTO FILE 'file_name'",
183  " | DISPLAY_TIMESTAMPS",
184  " | RETURN_DELETES",
185  " | KEYS_ONLY",
186  " | SCAN_AND_FILTER_ROWS)*",
187  "",
188  "timestamp:",
189  " 'YYYY-MM-DD HH:MM:SS[.ss|:nanoseconds]'",
190  "",
191  "NOTES: If the start_row is absent from a range_spec, it means NULL or",
192  "the beginning of the range. If the end_row is specified as ??, then it",
193  "will get converted to 0xff 0xff which indicates the end of the range.",
194  "",
195  "Example:",
196  "",
197  " CREATE SCANNER ON Test[..??]",
198  "",
199  0
200  };
201 
202  const char *help_text_destroy_scanner[] = {
203  "",
204  "DESTROY SCANNER [scanner_id]",
205  "",
206  "This command will destroy a scanner previously created with",
207  "a CREATE SCANNER command. If a scanner_id is supplied, then",
208  "the scanner corresponding to that ID will be destroyed, otherwise",
209  "the \"current\" or most recently created scanner will get destroyed.",
210  "",
211  0
212  };
213 
214  const char *help_text_fetch_scanblock[] = {
215  "",
216  "FETCH SCANBLOCK [scanner_id]",
217  "",
218  "This command will fetch and display the next block of results",
219  "of a scanner. If a scanner_id is supplied, then the scanner",
220  "corresponding to that ID will be destroyed, otherwise the",
221  "\"current\" or most recently created scanner will get destroyed.",
222  "",
223  0
224  };
225 
226  const char *help_text_load_range[] = {
227  "",
228  "LOAD RANGE range_spec",
229  "",
230  "range_spec:",
231  " table_name '[' [start_row] \"..\" (end_row | ?? ) ']'",
232  "",
233  "This command will issue a 'load range' command to the RangeServer",
234  "for the range specified with range_spec.",
235  "",
236  0
237  };
238 
239  const char *help_text_update[] = {
240  "",
241  "UPDATE table_name input_file",
242  "",
243  "This command will read blocks of key/value pairs from input_file",
244  "and send them to the range server. Here are some example input file",
245  "lines that illustrate the format of this file:",
246  "",
247  "1189631331826108 acaleph DELETE",
248  "1189631331826202 acrostolion apple:http://www.baseball.com/ Vilia miretur vulgus",
249  "1189631331826211 acerin banana:http://sports.espn.go.com/ DELETE",
250  "",
251  "The fields are separated by the tab character, with the following format:",
252  "",
253  "<timestamp> '\\t' <row-key> '\\t' <column-family>[:<column-qualfier>] '\\t' <value>",
254  "",
255  "The string \"DELETE\" has special meaning. In the first example line",
256  "above, it generates a 'delete row' for the row key 'acaleph'. In the",
257  "third example line above, it generates a 'delete cell' for the column",
258  "'banana:http://sports.espn.go.com/' of row 'acerin'.",
259  "",
260  0
261  };
262 
263  const char *help_text_shutdown_rangeserver[] = {
264  "",
265  "SHUTDOWN",
266  "",
267  "This command causes the RangeServer to shutdown. It will",
268  "return immediately, but the RangeServer will wait for all",
269  "running requests to complete before shutting down.",
270  "",
271  0
272  };
273 
274  const char *help_text_shutdown_server[] = {
275  "",
276  "SHUTDOWN",
277  "",
278  "This command causes the server to close open brokered FS files",
279  "and then terminate.",
280  "",
281  0
282  };
283 
284 
285  const char *help_text_drop_range[] = {
286  "",
287  "DROP RANGE range_spec",
288  "",
289  "range_spec:",
290  " table_name '[' [start_row] \"..\" (end_row | ?? ) ']'",
291  "",
292  "This command will issue a 'drop range' command to the RangeServer",
293  "for the range specified with range_spec.",
294  "",
295  0
296  };
297 
298  const char *help_text_alter_table[] = {
299  "",
300  "ALTER TABLE",
301  "===========",
302  "",
303  " ALTER TABLE name alter_specification [alter_specification]*",
304  " ALTER TABLE name WITH schema_file",
305  "",
306  " alter_specification:",
307  " ADD add_definitions",
308  " | MODIFY modify_definitions",
309  " | drop_specification",
310  " | RENAME COLUMN FAMILY '(' old_name ',' new_name ')'",
311  "",
312  " add_definitions:",
313  " '(' add_definition [',' add_definition]* ')'",
314  "",
315  " add_definition:",
316  " column_family_name [column_family_option ...]",
317  " | INDEX column_family_name",
318  " | QUALIFIER INDEX column_family_name",
319  " | ACCESS GROUP name '(' [column_family_name, ...] ')'",
320  " [access_group_options ...]",
321  "",
322  " modify_definitions:",
323  " '(' modify_definition [',' modify_definition]* ')'",
324  "",
325  " modify_definition:",
326  " column_family_name [modifiable_column_family_option ...]",
327  " | INDEX column_family_name",
328  " | QUALIFIER INDEX column_family_name",
329  " | ACCESS GROUP name '(' [column_family_name, ...] ')'",
330  " [access_group_options ...]",
331  "",
332  " drop_specification:",
333  " DROP '(' column_family_list ')'",
334  " | DROP INDEX '(' column_family_list ')'",
335  " | DROP QUALIFIER INDEX '(' column_family_list ')'",
336  "",
337  " column_family_list:",
338  " column_family_name [',' column_family_name]*",
339  "",
340  " column_family_option:",
341  " modifiable_column_family_option",
342  " | COUNTER",
343  " | TIME_ORDER asc|desc",
344  "",
345  " modifiable_column_family_option:",
346  " MAX_VERSIONS int",
347  " | TTL duration",
348  "",
349  " duration:",
350  " num MONTHS",
351  " | num WEEKS",
352  " | num DAYS",
353  " | num HOURS",
354  " | num MINUTES",
355  " | num [ SECONDS ]",
356  "",
357  " access_group_option:",
358  " IN_MEMORY",
359  " | BLOCKSIZE int",
360  " | REPLICATION int",
361  " | COMPRESSOR compressor_spec",
362  " | BLOOMFILTER bloom_filter_spec",
363  "",
364  " access_group_options:",
365  " column_family_option | access_group_option",
366  "",
367  " compressor_spec:",
368  " bmz [ bmz_options ]",
369  " | lzo",
370  " | quicklz",
371  " | snappy",
372  " | zlib [ zlib_options ]",
373  " | none",
374  "",
375  " bmz_options:",
376  " --fp-len int",
377  " | --offset int",
378  "",
379  " zlib_options:",
380  " -9",
381  " | --best",
382  " | --normal",
383  "",
384  " bloom_filter_spec:",
385  " rows [ bloom_filter_options ]",
386  " | rows+cols [ bloom_filter_options ]",
387  " | none ",
388  "",
389  " bloom_filter_options:",
390  " --false-positive float",
391  " --bits-per-item float",
392  " --num-hashes int",
393  " --max-approx-items int",
394  "",
395  "Description",
396  "-----------",
397  "",
398  "The ALTER TABLE command provides a way to alter a table by adding column",
399  "families, indices, and access groups, dropping column families and indices,",
400  "renaming column families, or modifying column family and access group,",
401  "definitions. See [CREATE TABLE] for a description of the column family and",
402  "access group options. The command takes two forms as described below.",
403  "",
404  "1. ALTER TABLE name WITH schema_file",
405  "",
406  " When a WITH clause is supplied, the command will modify the schema for",
407  " table 'name' with the schema read from file 'schema_file'. The",
408  " 'schema_file' must contain a schema in XML format as generated with the",
409  " DESCRIBE TABLE command supplied with the WITH IDS option, for example:",
410  "",
411  " DESCRIBE TABLE WITH IDS other_table",
412  "",
413  "2. ALTER TABLE name alter_specification [alter_specification]*",
414  "",
415  " In this form, the schema modifications are specified as arguments to the",
416  " command. The format of the schema modification arguments",
417  " (alter_specification) are described below.",
418  "",
419  "Column families that are not explicitly included in an access group",
420  "specification will automatically be assigned to the \"default\" access group.",
421  "Moving column families from one access group to another is currently not",
422  "supported.",
423  "",
424  "The MODIFY option to ALTER TABLE allows you to *replace* column family",
425  "and access group definitions with new ones. Column family options that are",
426  "specified as access group options are used as default option values for",
427  "column families that are subsequently added to the access group and do not",
428  "explicitly define those options in the column family definition. The",
429  "options COUNTER and TIME_ORDER of column family definitions cannot be modified.",
430  "",
431  "Adding a column index with the MODIFY command does *not* populate the index,",
432  "which means that the index will not be consistent with the table after the",
433  "command is run and may return empty results erroneously when used. To populate",
434  "an index after adding it with the MODIFY command, the REBUILD INDICES command",
435  "must be run. Likewise, when dropping a column index with the MODIFY command,",
436  "the space taken up by the index will not be reclaimend until the REBUILD INDICES",
437  "command is run.",
438  "",
439  "Example",
440  "-------",
441  "",
442  "The following statements:",
443  "",
444  " CREATE TABLE foo (",
445  " a MAX_VERSIONS 1,",
446  " b TTL 1 DAY,",
447  " c,",
448  " ACCESS GROUP primary BLOCKSIZE 1024 ( a ),",
449  " ACCESS GROUP secondary compressor \"zlib --best\" ( b, c )",
450  " );",
451  "",
452  " ALTER TABLE foo ",
453  " ADD (d MAX_VERSIONS 2) ",
454  " ADD (ACCESS GROUP tertiary BLOOMFILTER \"rows --false-positive 0.1\" (d))",
455  " DROP (c)",
456  " RENAME COLUMN FAMILY (a, e);",
457  "",
458  " ALTER TABLE foo MODIFY (e MAX_VERSIONS 3, b TTL 172800);",
459  "",
460  "will produce the following output with SHOW CREATE TABLE output foo:",
461  "",
462  " CREATE TABLE foo (",
463  " e MAX_VERSIONS 3,",
464  " b TTL 172800,",
465  " d MAX_VERSIONS 2,",
466  " ACCESS GROUP primary BLOCKSIZE 1024 (e),",
467  " ACCESS GROUP secondary COMPRESSOR \"zlib --best\" (b),",
468  " ACCESS GROUP tertiary BLOOMFILTER \"rows --false-positive 0.1\" (d),",
469  " );",
470  0
471  };
472 
473  const char *help_text_exists_table[] = {
474  "",
475  "EXISTS TABLE",
476  "===========",
477  "",
478  " EXISTS TABLE name ",
479  "",
480  "Description",
481  "-----------",
482  "",
483  "The EXISTS TABLE command provides a way to check if a table exists already or not.",
484  "",
485  "Example",
486  "-------",
487  "",
488  "The following statement:",
489  "",
490  " CREATE TABLE foo (a);",
491  "",
492  "will produce the following output with EXISTS TABLE foo; :",
493  "",
494  " true",
495  0
496  };
497 
498  const char *help_text_create_table[] = {
499  "CREATE TABLE",
500  "============",
501  "",
502  " CREATE TABLE name '(' [create_definition, ...] ')' [table_option ...]",
503  " CREATE TABLE name LIKE other_table",
504  " CREATE TABLE name WITH schema_file",
505  "",
506  " create_definition:",
507  " column_family_name [column_family_option ...]",
508  " | INDEX column_family_name",
509  " | QUALIFIER INDEX column_family_name",
510  " | ACCESS GROUP name '(' [column_family_name, ...] ')'",
511  " [access_group_options ...]",
512  "",
513  " column_family_option:",
514  " MAX_VERSIONS int",
515  " | TIME_ORDER ASC|DESC",
516  " | TTL duration",
517  " | COUNTER",
518  "",
519  " duration:",
520  " int MONTHS",
521  " | int WEEKS",
522  " | int DAYS",
523  " | int HOURS",
524  " | int MINUTES",
525  " | int [ SECONDS ]",
526  "",
527  " access_group_option:",
528  " IN_MEMORY",
529  " | BLOCKSIZE int",
530  " | REPLICATION int",
531  " | COMPRESSOR compressor_spec",
532  " | BLOOMFILTER bloom_filter_spec",
533  "",
534  " access_group_options:",
535  " column_family_option | access_group_option",
536  "",
537  " compressor_spec:",
538  " bmz [ bmz_options ]",
539  " | lzo",
540  " | quicklz",
541  " | snappy",
542  " | zlib [ zlib_options ]",
543  " | none",
544  "",
545  " bmz_options:",
546  " --fp-len int",
547  " | --offset int",
548  "",
549  " zlib_options:",
550  " -9",
551  " | --best",
552  " | --normal",
553  "",
554  " bloom_filter_spec:",
555  " rows [ bloom_filter_options ]",
556  " | rows+cols [ bloom_filter_options ]",
557  " | none ",
558  "",
559  " bloom_filter_options:",
560  " --false-positive float",
561  " --bits-per-item float",
562  " --num-hashes int",
563  " --max-approx-items int",
564  "",
565  " table_option:",
566  " access_group_option",
567  " | column_family_option",
568  " | GROUP_COMMIT_INTERVAL int",
569  "",
570  "Description",
571  "-----------",
572  "",
573  "CREATE TABLE creates a table with the given name. The command takes three",
574  "forms as described below.",
575  "",
576  "1. CREATE TABLE name LIKE other_table",
577  "",
578  " When a LIKE clause is supplied, the command will create a table 'name'",
579  " that has the same schema as table 'other_table'.",
580  "",
581  "2. CREATE TABLE name WITH schema_file",
582  "",
583  " When a WITH clause is supplied, the command will create a table 'name' with",
584  " the schema read from file 'schema_file'. The 'schema_file' must contain a",
585  " schema in XML format as generated with the DESCRIBE TABLE command supplied",
586  " with the WITH IDS option, for example:",
587  "",
588  " DESCRIBE TABLE WITH IDS other_table",
589  "",
590  "3. CREATE TABLE name '(' [create_definition, ...] ')' [table_option ...]",
591  "",
592  " In this form, the schema is specified as arguments to the command. The",
593  " schema consists of column family specifications, access group",
594  " specifications and optional table options which are described below.",
595  "",
596  "Column Families",
597  "---------------",
598  "",
599  "Column families are somewhat analogous to a traditional database column. The",
600  "main difference is that a theoretically infinite number of qualified columns",
601  "can be created within a column family. The qualifier is an optional NUL-",
602  "terminated string that can be supplied, along with the data, in the insert",
603  "statement. This is what gives tables in Hypertable their sparse nature. For",
604  "example, given a column family \"tag\", the following set of qualified columns",
605  "may be inserted for a single row.",
606  "",
607  " * tag:good",
608  " * tag:science",
609  " * tag:authoritative",
610  " * tag:green",
611  "",
612  "The column family is represented internally as a single byte, so there is a",
613  "limit of 255 column families (the 0 value is reserved) which may be supplied in",
614  "the CREATE TABLE statement.",
615  "",
616  "Secondary Indices",
617  "-----------------",
618  "",
619  "Tables can also have one or more indices, each indexing a single ",
620  "column family. Two types of indices exist: a cell value index, which ",
621  "optimizes scans on a single column family that do an exact ",
622  "match or prefix match of the cell value, and a qualifier index, which ",
623  "optimizes scans on a single column family that do an exact match or ",
624  "prefix match of the column qualifier. The use of indices is optional.",
625  "",
626  "The indices are stored in an index table which is created in the same ",
627  "namespace as the primary table and has the same name with one (cell value ",
628  "index) or two (qualifier index) caret signs ('^') as a prefix.",
629  "",
630  "A column family can have both types of indices (cell value index and qualifier ",
631  "index) at the same time. The following HQL command creates a table with ",
632  "three column families (a, b and c). Column family a has a cell value index,",
633  "column family b has a qualifier index and c has both.",
634  "",
635  " CREATE TABLE t (",
636  " a,",
637  " b,",
638  " c,",
639  " INDEX a,",
640  " QUALIFIER INDEX b,",
641  " INDEX c,",
642  " QUALIFIER INDEX c,",
643  " )",
644  "",
645  "Indices speed up some queries that match on column families. ",
646  "Accessing columns which are indexed is nearly as fast as accessing them by",
647  "their row key. On the downside indices require additional disk storage and",
648  "cause a very small performance impact when inserting data to an indexed column.",
649  "",
650  "Cell value indices are used when selecting cells by value ",
651  "(SELECT a FROM TABLE t WHERE a = \"cell-value\" ...) or by a value prefix",
652  "(SELECT a FROM TABLE t WHERE a =^ \"cell-prefix\" ...).",
653  "",
654  "Qualifier indices are used when selecting cells from a qualified column ",
655  "family (SELECT a:foo FROM TABLE t ...) or selecting cells with a qualifier ",
656  "prefix (SELECT a:^prefix FROM TABLE t ...).",
657  "",
658  "Access Groups",
659  "-------------",
660  "",
661  "Tables consist of one or more access groups, each containing some number of",
662  "column families. There is a default access group named \"default\" which",
663  "contains all column families that are not explicitly referenced in an ACCESS",
664  "GROUP clause. For example, the following two statements are equivalent.",
665  "",
666  " CREATE TABLE foo (",
667  " a,",
668  " b,",
669  " c,",
670  " ACCESS GROUP bar ( a, b ) ",
671  " )",
672  "",
673  " CREATE TABLE foo (",
674  " a,",
675  " b,",
676  " c,",
677  " ACCESS GROUP bar (a, b),",
678  " ACCESS GROUP default (c) ",
679  " )",
680  "",
681  "Access groups provide control over the physical layout of the table data on",
682  "disk. The data for all column families in the same access group are stored",
683  "physically together on disk. By carefully defining a set of access groups and",
684  "choosing which column families go into those access groups, performance can be",
685  "significantly improved for expected workloads. For example, say you have a",
686  "table with 100 column families, but two of the column families get access",
687  "together with much higher frequency than the rest of the 98 column families.",
688  "By putting the two frequently accessed column families in their own access",
689  "group, the system does much less disk i/o because only the data for the two",
690  "column families gets transfered whenever those column families are accessed. A",
691  "row-oriented database can be emulated by having a single access group. A",
692  "column-oriented database can be emulated by having each column family within",
693  "their own access group.",
694  "",
695  "Column Family Options",
696  "---------------------",
697  "",
698  "The following column family options are supported:",
699  "",
700  " * MAX_VERSIONS int",
701  " * TIME_ORDER ASC|DESC",
702  " * TTL duration",
703  " * COUNTER",
704  "",
705  "The MAX_VERSIONS option allows you to specify that you only want to keep",
706  "n versions of each cell. Cells are identified by a 3-tuple,",
707  "(row_key, column_family, column_qualifier). In addition to the 3-tuple",
708  "that identifies the cell, there is a 64-bit timestamp field that defines",
709  "a specific version of the cell. When specifying a MAX_VERSIONS n option,",
710  "depending on the value of the TIME_ORDER option (see below), either the",
711  "most recent n versions or the oldest n versions will be kept. Versions",
712  "outside the window (of size n) will be lazily garbage collected through",
713  "the normal compaction process.",
714  "",
715  "The TIME_ORDER option controls the order in which cell versions are",
716  "stored and returned. The TIME_ORDER option defines the order,",
717  "*within each cell*, in which the versions are stored and returned. By",
718  "default the order is reverse-chronological (ASC) so when a SELECT",
719  "statement is issued with MAX_VERSIONS 1, the most recent version is",
720  "returned for each cell. When specifying TIME_ORDER DESC for a column, a",
721  "SELECT statement that is issued with MAX_VERSIONS 1 will return the",
722  "oldest version of the cell.",
723  "",
724  "The TTL option allows you to specify that you only want to keep cell versions",
725  "that fall within some time window in the immediate past. For example, you can",
726  "specify that you only want to keep cells that were created within the past two",
727  "weeks. Like the MAX_VERSIONS option, older versions are lazily garbage",
728  "collected through the normal compaction process.",
729  "",
730  "The COUNTER option makes each instance of this column act as an atomic",
731  "counter. Counter columns are accessed using the same methods as other",
732  "columns. However, to modify the counter, the value must be formatted",
733  "specially, as described below.",
734  "",
735  "['+'] n Increment the counter by n",
736  "'-' n Decrement the counter by n",
737  "'=' n Reset the counter to n",
738  "",
739  "For example, consider the following sequence of values written to a counter",
740  "column:",
741  "",
742  " +9",
743  " =0",
744  " +3",
745  " +4",
746  " +5",
747  " -2",
748  "",
749  "After these six values get written to a counter column, a subsequent read of",
750  "that column would return the ASCII string \"10\".",
751  "",
752  "Access Group Options",
753  "--------------------",
754  "",
755  "Access group options are supplied after the column list and control physical",
756  "characteristics of the access group or provide default options for member",
757  "column families. The following options are supported:",
758  "",
759  " * <column_family_option>",
760  " * IN_MEMORY",
761  " * BLOCKSIZE int",
762  " * REPLICATION int",
763  " * COMPRESSOR compressor_spec",
764  " * BLOOMFILTER bloom_filter_spec",
765  "",
766  "Any of the column family options may be specified as access group options.",
767  "Column family options specified as access group options are taken to be",
768  "default values for any member column family that doesn't define the option",
769  "in its definition.",
770  "",
771  "The IN_MEMORY option indicates that all cell data for the access group should",
772  "remain memory resident. Queries against column families in IN_MEMORY access",
773  "groups can be efficient because no disk access is required.",
774  "",
775  "The cell data inserted into an access group resides in one of two places. The",
776  "recently inserted cells are stored in an in-memory data structure called the",
777  "cell cache and older cells get compacted into on-disk data structures called",
778  "cell stores. The cell stores are organized as a series of compressed blocks of",
779  "sorted key/value pairs (cells). At the end of the compressed blocks is a block",
780  "index which contains, for each block, the key (row,column,timestamp) of the",
781  "last cell in the block, followed by the block offset. It also contains a Bloom",
782  "Filter.",
783  "",
784  "The BLOCKSIZE option controls the size of the compressed blocks in the cell",
785  "stores. A smaller block size minimizes the amount of data that must be read",
786  "from disk and decompressed for a key lookup at the expense of a larger block",
787  "index which consumes memory. The default value for the block size is 65K.",
788  "",
789  "The REPLICATION option controls the replication level in the underlying",
790  "file system (FS) for cell store files created for this access group.",
791  "The default is unspecified, which translates to whatever the default",
792  "replication level is for the underlying file system.",
793  "",
794  "The COMPRESSOR option specifies the compression codec that should be used for",
795  "cell store blocks within an access group. See the Compressors section below",
796  "for a description of each compression codec.",
797  "",
798  "NOTE: if the block, after compression, is not significantly reduced in",
799  "size, then no compression will be performed on the block",
800  "",
801  "An access group can consist of many on-disk cell stores. A query for a single",
802  "row key can result probing each cell store to see if data is present for that",
803  "row even when most of the cell stores do not contain any data for that row.",
804  "To eliminate this inefficiency, each cell store contains an optional Bloom",
805  "Filter. The Bloom Filter is a probabilistic data structure that can",
806  "indicate, with high probability, if a key is present and also indicate",
807  "definitively if a key is not present. By mapping the bloom filters, for each",
808  "cell store in memory, queries can be made much more efficient because only the",
809  "cell stores that contain the row are searched.",
810  "",
811  "The bloom filter specification can take one of the following forms. The rows",
812  "form, which is the default, causes only row keys to be inserted into the bloom",
813  "filter. The rows+cols form causes the row key concatenated with the column",
814  "family to be inserted into the bloom filter. none disables the bloom",
815  "filter.",
816  "",
817  " * rows [ bloom_filter_options ]",
818  " * rows+cols [ bloom_filter_options ]",
819  " * none",
820  "",
821  "The following describes the bloom filter options:",
822  "",
823  " --false-positive arg Expected false positive probability (default = 0.01).",
824  " This option is (currently) mutually exclusive with",
825  " the --bits-per-item and --num-hashes options. If",
826  " specified it will choose the minimum number of bits",
827  " per item that can achieve the given false positive",
828  " probability and will choose the appropriate number of",
829  " hash functions",
830  "",
831  " --bits-per-item arg Number of bits to use per item. Used to compute size",
832  " of bloom filter, this option must be used in",
833  " conjunction with --num-hashes.",
834  "",
835  " --num-hashes arg Number of hash functions to use. Must be used in",
836  " conjunction with --bits-per-item.",
837  "",
838  " --max-approx-items arg Number of cell store items used to guess the number",
839  " of actual bloom filter entries (default = 1000)",
840  "",
841  "Compressors",
842  "-----------",
843  "",
844  "The cell store blocks within an access group are compressed using the",
845  "compression codec that is specified for the access group. The following",
846  "compression codecs are available:",
847  "",
848  " * bmz",
849  " * lzo",
850  " * quicklz",
851  " * zlib",
852  " * snappy",
853  " * none",
854  "",
855  "The default code is snappy for cell store blocks. The following list ",
856  " describes some of the available options.",
857  "",
858  " bmz --fp-len arg Minimum fingerpring length (default = 19)",
859  " bmz --offset arg Starting fingerprint offset (default = 0)",
860  " zlib -9 [ --best ] Highest compression ratio (at the cost of speed)",
861  " zlib --normal Normal compression ratio",
862  "",
863  "Table Options",
864  "-------------",
865  "",
866  "Table options are supplied at the end of the CREATE TABLE statement and",
867  "control the runtime characteristics of the table or provide default options",
868  "for access groups or column families. The following options are supported:",
869  "",
870  " * <access_group_option>",
871  " * <column_family_option>",
872  " * GROUP_COMMIT_INTERVAL int",
873  "",
874  "Any of the access group options may be specified as table options. Access",
875  "group options specified as table options are taken to be default values for any",
876  "member access group that doesn't define the option in its definition.",
877  "",
878  "Any of the column family options may be specified as table options. Column",
879  "family options specified as table options are taken to be default values for",
880  "any member column family that doesn't define the option in its definition.",
881  "Column family defaults specified in an access group take precedence over",
882  "column family defaults specified at the table level.",
883  "",
884  "These are the same options as the ones in the column family and access group",
885  "specification except that they act as defaults in the case where no",
886  "corresponding option is specified in the column family or access group",
887  "specifier. See the description under Access Group Options for option details.",
888  "",
889  "\"group commit\" is a feature whereby the system will accumulate update requests",
890  "for a table and commit them together as a group on a regular interval. This",
891  "improves the performance of systems that receive a large number of concurrent",
892  "updates by reducing the number of times sync() gets called on the commit log.",
893  "",
894  "The GROUP_COMMIT_INTERVAL option tells the system that updates to this table",
895  "should be carried out with group commit and also specifies the commit interval",
896  "in milliseconds. The interval is constrained by the value of the config property",
897  "Hypertable.RangeServer.CommitInterval, which acts as a lower bound and defaults",
898  "to 50ms. The value specified for GROUP_COMMIT_INTERVAL will get rounded up to",
899  "the nearest multiple of this property value.",
900  "",
901  0
902  };
903 
904  const char *help_text_select[] = {
905  "",
906  "SELECT",
907  "======",
908  "",
909  " SELECT ('*' | (column_predicate [',' column_predicate]*))",
910  " FROM table_name",
911  " [where_clause]",
912  " [options_spec]",
913  "",
914  " where_clause:",
915  " WHERE where_predicate [AND where_predicate ...]",
916  "",
917  " where_predicate:",
918  " cell_predicate",
919  " | row_predicate",
920  " | column_value_predicate",
921  " | timestamp_predicate",
922  " | value_predicate",
923  "",
924  " relop: '=' | '<' | '<=' | '>' | '>=' | '=^'",
925  "",
926  " column_predicate:",
927  " column_family",
928  " | column_family ':' column_qualifer",
929  " | column_family ':' '^'column_qualifer_prefix",
930  " | column_family ':' '/'column_qualifier_regexp'/'",
931  "",
932  " cell_spec: row ',' column",
933  "",
934  " cell_predicate:",
935  " [cell_spec relop] CELL relop cell_spec",
936  " | '(' [cell_spec relop] CELL relop cell_spec",
937  " (OR [cell_spec relop] CELL relop cell_spec)* ')'",
938  "",
939  " row_predicate:",
940  " [row_key relop] ROW relop row_key",
941  " | '(' [row_key relop] ROW relop row_key",
942  " (OR [row_key relop] ROW relop row_key)* ')'",
943  " | ROW REGEXP 'row_regexp'",
944  "",
945  " column_value_predicate:",
946  " column_family '=' value",
947  " | column_family '=' '^' value",
948  "",
949  " timestamp_predicate:",
950  " [timestamp relop] TIMESTAMP relop timestamp",
951  "",
952  " value_predicate:",
953  " VALUE REGEXP 'value_regexp'",
954  "",
955  " options_spec:",
956  " (MAX_VERSIONS revision_count",
957  " | OFFSET row_offset",
958  " | LIMIT row_count",
959  " | CELL_OFFSET cell_offset",
960  " | CELL_LIMIT max_cells",
961  " | CELL_LIMIT_PER_FAMILY max_cells_per_cf",
962  " | OFFSET row_offset",
963  " | CELL_OFFSET cell_offset",
964  " | INTO FILE filename[.gz]",
965  " | DISPLAY_TIMESTAMPS",
966  " | KEYS_ONLY",
967  " | FS = '<char>'",
968  " | NO_CACHE",
969  " | NO_ESCAPE",
970  " | RETURN_DELETES",
971  " | SCAN_AND_FILTER_ROWS)*",
972  "",
973  " timestamp:",
974  " 'YYYY-MM-DD HH:MM:SS[.ss|:nanoseconds]'",
975  "",
976  "Description",
977  "-----------",
978  "",
979  "SELECT is used to retrieve cells from a table. The retrieved cells are filtered",
980  "with predicates for row keys, timestamps or cell values.",
981  "",
982  "The parser only accepts a single timestamp predicate. The '=^' operator is the",
983  "\"starts with\" operator. It will return all rows that have the same prefix as",
984  "the operand. Use of the value_predicate without the \"CELLS\" modifier to the",
985  "SELECT command is deprecated.",
986  "",
987  "If your query selects several independent ranges by specifying multiple row ",
988  "predicates (i.e. WHERE ROW < 'a' OR ROW > 'c') then the OFFSET, LIMIT,",
989  "CELL_OFFSET, CELL_LIMIT, predicates are applied to each range independently.",
990  "",
991  "When specifying a column value predicate, the column family must be identical ",
992  "to the column family used in the SELECT clause, and exactly one column family",
993  "must be selected. The following examples are valid: ",
994  "",
995  " SELECT col FROM test WHERE col = \"foo\";",
996  " SELECT col FROM test WHERE col =^ \"prefix\";",
997  "",
998  "The following examples are NOT valid because they select more than one ",
999  "column family or because the column family in the select clause is different ",
1000  "from the one in the predicate (these limitations will be removed in future ",
1001  "versions of Hypertable):",
1002  "",
1003  " SELECT * FROM test WHERE col = \"foo\";",
1004  " SELECT col, col2 FROM test WHERE col =^ \"prefix\";",
1005  " SELECT foo FROM test WHERE bar = \"value\";",
1006  "",
1007  "Options",
1008  "-------",
1009  "",
1010  "MAX_VERSIONS revision_count",
1011  "",
1012  "Each cell in a Hypertable table can have multiple timestamped revisions. By",
1013  "default all revisions of a cell are returned by the SELECT statement. The",
1014  "MAX_VERSIONS option allows control over the number of cell revisions returned.",
1015  "The cell revisions are stored in reverse-chronological order, so MAX_VERSIONS",
1016  "1 will return the most recent version of the cell.",
1017  "",
1018  "OFFSET row_offset",
1019  "",
1020  "Skips the first row_offset rows returned by the SELECT statement. ",
1021  "This option cannot be combined with CELL_OFFSET and currently applies",
1022  "independently to each row (or cell) interval supplied in the WHERE clause.",
1023  "",
1024  "LIMIT row_count",
1025  "",
1026  "Limits the number of rows returned by the SELECT statement to row_count.",
1027  "The limit applies independently to each row (or cell) interval specified",
1028  "in the WHERE clause.",
1029  "",
1030  "CELL_LIMIT_PER_FAMILY max_cells_per_cf",
1031  "",
1032  "Limits the number of cells returned per row per column family by the SELECT",
1033  "statement to max_cells_per_cf.",
1034  "",
1035  "CELL_OFFSET cell_offset",
1036  "",
1037  "Skips the first cell_offset cells returned by the SELECT statement.",
1038  "This option cannot be combined with OFFSET and currently applies",
1039  "independently to each row (or cell) interval supplied in the WHERE clause.",
1040  "",
1041  "CELL_LIMIT max_cells",
1042  "",
1043  "Limits the total number of cells returned by the query to max_cells",
1044  "(applied after CELL_LIMIT_PER_FAMILY). The limit applies independently",
1045  "to each row (or cell) interval specified in the WHERE clause.",
1046  "",
1047  "OFFSET row_offset",
1048  "",
1049  "Skips the first row_offset rows returned by the SELECT statement.",
1050  "Not allowed in combination with CELL_OFFSET.",
1051  "",
1052  "CELL_OFFSET cell_offset",
1053  "",
1054  "Skips the first cell_offset cells returned by the SELECT statement.",
1055  "Not allowed in combination with OFFSET.",
1056  "",
1057  "INTO FILE [file://|fs://]filename[.gz]",
1058  "",
1059  "The result of a SELECT command is displayed to standard output by default. ",
1060  "The INTO FILE option allows the output to get redirected to a file. ",
1061  "If the file name starts with the location specifier 'fs://' then the output file is ",
1062  "assumed to reside in the brokered FS. If it starts with 'file://' then output is ",
1063  "sent to a local file. This is also the default location in the absence of any ",
1064  "location specifier.",
1065  "",
1066  "If the file name specified ends in a .gz extension, then the output is compressed",
1067  "with gzip before it is written to the file. The first line of the output,",
1068  "when using the INTO FILE option, is a header line, which will take one of",
1069  "the two following formats. The second format will be output if the",
1070  "DISPLAY_TIMESTAMPS option is supplied.",
1071  "",
1072  " #row '\\t' column '\\t' value",
1073  "",
1074  " #timestamp '\\t' row '\\t' column '\\t' value",
1075  "",
1076  "",
1077  "DISPLAY_TIMESTAMPS",
1078  "",
1079  "The SELECT command displays one cell per line of output. Each line contains",
1080  "three tab delimited fields, row, column, and value. The DISPLAY_TIMESTAMPS",
1081  "option causes the cell timestamp to be included in the output as well. When",
1082  "this option is used, each output line will contain four tab delimited fields",
1083  "in the following order:",
1084  "",
1085  " timestamp, row, column, value",
1086  "",
1087  "KEYS_ONLY",
1088  "",
1089  "The KEYS_ONLY option suppresses the output of the value. It is somewhat",
1090  "efficient because the option is processed by the RangeServers and not by",
1091  "the client. The value data is not transferred back to the client, only",
1092  "the key data.",
1093  "",
1094  "FS = '<char>'",
1095  "",
1096  "Set the field separator to character '<char>'. By default the field separator",
1097  "character is the tab character. This option allows you to change the",
1098  "field separator character to something different. When this option is",
1099  "supplied, the escaping rules change such that tab characters are not escaped.",
1100  "When this option is supplied, care must be taken to ensure that the field",
1101  "separator character is not present in the data.",
1102  "",
1103  "NO_CACHE",
1104  "",
1105  "The NO_CACHE option causes the RangeServer query cache to be bypassed for this",
1106  "query. It not only prevents cached results from being returned, but it also",
1107  "prevents the results of the query from being inserted into the query cache.",
1108  "",
1109  "NO_ESCAPE",
1110  "",
1111  "The output format of a SELECT command comprises tab delimited lines, one",
1112  "cell per line, which is suitable for input to the LOAD DATA INFILE",
1113  "command. However, if the value portion of the cell contains either newline",
1114  "or tab characters, then it will confuse the LOAD DATA INFILE input parser.",
1115  "To prevent this from happening, newline, tab, and backslash characters are",
1116  "converted into two character escape sequences, described in the following",
1117  "table.",
1118  "",
1119  " --------------------------------",
1120  " | Character | Escape Sequence |",
1121  " |--------------------------------|",
1122  " | backslash \\ | '\\' '\\' |",
1123  " | newline \\n | '\\' 'n' |",
1124  " | tab \\t | '\\' 't' |",
1125  " | NUL \\0 | '\\' '0' |",
1126  " --------------------------------",
1127  "",
1128  "The NO_ESCAPE option turns off this escaping mechanism.",
1129  "",
1130  "RETURN_DELETES",
1131  "",
1132  "The RETURN_DELETES option is used internally for debugging. When data is",
1133  "deleted from a table, the data is not actually deleted right away. A delete",
1134  "key will get inserted into the database and the delete will get processed",
1135  "and applied during subsequent scans. The RETURN_DELETES option will return",
1136  "the delete keys in addition to the normal cell keys and values. This option",
1137  "can be useful when used in conjuction with the DISPLAY_TIMESTAMPS option to",
1138  "understand how the delete mechanism works.",
1139  "",
1140  "SCAN_AND_FILTER_ROWS",
1141  "",
1142  "The SCAN_AND_FILTER_ROWS option can be used to improve query performance",
1143  "for queries that select a very large number of individual rows. The default",
1144  "algorithm for fetching a set of rows is to fetch each row individually, which",
1145  "involves a network roundtrip to a range server for each row. Supplying the",
1146  "SCAN_AND_FILTER_ROWS option tells the system to scan over the data and",
1147  "filter the requested rows at the range server, which will reduce the number of",
1148  "network roundtrips required when the number of rows requested is very large.",
1149  "",
1150  "Examples",
1151  "--------",
1152  "",
1153  " SELECT * FROM test WHERE ('a' <= ROW <= 'e') and",
1154  " '2008-07-28 00:00:02' < TIMESTAMP < '2008-07-28 00:00:07';",
1155  " SELECT * FROM test WHERE ROW =^ 'b';",
1156  " SELECT * FROM test WHERE (ROW = 'a' or ROW = 'c' or ROW = 'g');",
1157  " SELECT * FROM test WHERE ('a' < ROW <= 'c' or ROW = 'g' or ROW = 'c');",
1158  " SELECT * FROM test WHERE (ROW < 'c' or ROW > 'd');",
1159  " SELECT * FROM test WHERE (ROW < 'b' or ROW =^ 'b');",
1160  " SELECT * FROM test WHERE \"farm\",\"tag:abaca\" < CELL <= \"had\",\"tag:abacinate\";",
1161  " SELECT * FROM test WHERE \"farm\",\"tag:abaca\" <= CELL <= \"had\",\"tag:abacinate\";",
1162  " SELECT * FROM test WHERE CELL = \"foo\",\"tag:adactylism\";",
1163  " SELECT * FROM test WHERE CELL =^ \"foo\",\"tag:ac\";",
1164  " SELECT * FROM test WHERE CELL =^ \"foo\",\"tag:a\";",
1165  " SELECT * FROM test WHERE CELL > \"old\",\"tag:abacate\";",
1166  " SELECT * FROM test WHERE CELL >= \"old\",\"tag:abacate\";",
1167  " SELECT * FROM test WHERE \"old\",\"tag:foo\" < CELL >= \"old\",\"tag:abacate\";",
1168  " SELECT * FROM test WHERE (CELL = \"maui\",\"tag:abaisance\" OR ",
1169  " CELL = \"foo\",\"tag:adage\" OR ",
1170  " CELL = \"cow\",\"tag:Ab\" OR ",
1171  " CELL =^ \"foo\",\"tag:acya\");",
1172  " SELECT * FROM test INTO FILE \"fs:///tmp/foo\";",
1173  " SELECT col2:\"bird\" FROM RegexpTest WHERE ROW REGEXP \"http://.*\";",
1174  " SELECT col1:/^w[^a-zA-Z]*$/ FROM RegexpTest WHERE ROW REGEXP \"m.*\\s\\S\";",
1175  " SELECT CELLS col1:/^w[^a-zA-Z]*$/ FROM RegexpTest WHERE VALUE REGEXP \"l.*e\";",
1176  " SELECT CELLS col1:/^w[^a-zA-Z]*$/ FROM RegexpTest WHERE ROW REGEXP \"^\\D+\" AND VALUE REGEXP \"l.*e\";",
1177  " SELECT col FROM test WHERE col = \"foo\";",
1178  " SELECT col FROM test WHERE col =^ \"prefix\";",
1179  " SELECT tags:^prefix FROM test;",
1180  "",
1181  0
1182  };
1183 
1184  const char *help_text_stop[] = {
1185  "",
1186  "STOP",
1187  "======",
1188  "",
1189  " STOP rangeserver",
1190  "",
1191  "Description",
1192  "-----------",
1193  "",
1194  "STOP is used to shutdown a RangeServer without triggering a recovery ",
1195  "operation and moving all ranges of this RangeServer to other RangeServers.",
1196  "",
1197  "Examples",
1198  "--------",
1199  "",
1200  " STOP rs1",
1201  "",
1202  0
1203  };
1204 
1205  const char *help_text_describe_table[] = {
1206  "",
1207  "DESCRIBE TABLE",
1208  "==============",
1209  "",
1210  " DESCRIBE TABLE [ WITH IDS ] table_name",
1211  "",
1212  "Description",
1213  "-----------",
1214  "",
1215  "The DESCRIBE TABLE command displays the XML-style schema for a table. The",
1216  "output of the straight DESCRIBE TABLE command can be passed into the",
1217  "Hypertable C++ Client::create_table() API as the schema parameter. If the",
1218  "optional WITH IDS clause is supplied, then the schema \"generation\" attribute",
1219  "and the column family \"id\" attributes are included in the XML output. For",
1220  "example, the following table creation statement:",
1221  "",
1222  " CREATE TABLE foo (",
1223  " a MAX_VERSIONS 1,",
1224  " b TTL 1 DAY,",
1225  " c,",
1226  " ACCESS GROUP primary BLOCKSIZE 1024 ( a, b ),",
1227  " ACCESS GROUP secondary compressor \"zlib --best\" ( c )",
1228  " )",
1229  "",
1230  "will create a table with the following schema as reported by the CREATE TABLE",
1231  "command:",
1232  "",
1233  " <Schema>",
1234  " <AccessGroup name=\"primary\" blksz=\"1024\">",
1235  " <ColumnFamily>",
1236  " <Name>a</Name>",
1237  " <MaxVersions>1</MaxVersions>",
1238  " <deleted>false</deleted>",
1239  " </ColumnFamily>",
1240  " <ColumnFamily>",
1241  " <Name>b</Name>",
1242  " <ttl>86400</ttl>",
1243  " <deleted>false</deleted>",
1244  " </ColumnFamily>",
1245  " </AccessGroup>",
1246  " <AccessGroup name=\"secondary\" compressor=\"zlib --best\">",
1247  " <ColumnFamily>",
1248  " <Name>c</Name>",
1249  " <deleted>false</deleted>",
1250  " </ColumnFamily>",
1251  " </AccessGroup>",
1252  " </Schema>",
1253  "",
1254  "and the following output will be generated when the WITH IDS clause is",
1255  "supplied in the CREATE TABLE statement:",
1256  "",
1257  " <Schema generation=\"1\">",
1258  " <AccessGroup name=\"primary\" blksz=\"1024\">",
1259  " <ColumnFamily id=\"1\">",
1260  " <Generation>1</Generation>",
1261  " <Name>a</Name>",
1262  " <MaxVersions>1</MaxVersions>",
1263  " <deleted>false</deleted>",
1264  " </ColumnFamily>",
1265  " <ColumnFamily id=\"2\">",
1266  " <Generation>1</Generation>",
1267  " <Name>b</Name>",
1268  " <ttl>86400</ttl>",
1269  " <deleted>false</deleted>",
1270  " </ColumnFamily>",
1271  " </AccessGroup>",
1272  " <AccessGroup name=\"secondary\" compressor=\"zlib --best\">",
1273  " <ColumnFamily id=\"3\">",
1274  " <Generation>1</Generation>",
1275  " <Name>c</Name>",
1276  " <deleted>false</deleted>",
1277  " </ColumnFamily>",
1278  " </AccessGroup>",
1279  " </Schema>",
1280  "",
1281  0
1282  };
1283 
1284  const char *help_text_use[] = {
1285  "",
1286  "USE",
1287  "==========",
1288  "",
1289  " USE namespace_name",
1290  "",
1291  "Description",
1292  "-----------",
1293  "",
1294  "The USE command sets the current namespace.",
1295  "If namespace_name starts with '/' it treats the namespace_name as an absolute path, ",
1296  "otherwise it considers it to be a sub-namespace relative to the current namespace.",
1297  "",
1298  "Example",
1299  "-------",
1300  "",
1301  " hypertable> USE \"/\";",
1302  " hypertable> USE \"/test\";",
1303  " hypertable> USE \"subtest\";",
1304  "",
1305  0
1306  };
1307 
1308  const char *help_text_create_namespace[] = {
1309  "",
1310  "CREATE NAMESPACE",
1311  "==========",
1312  "",
1313  " CREATE NAMESPACE namespace_name [IF NOT EXISTS]",
1314  "",
1315  "Description",
1316  "-----------",
1317  "",
1318  "The CREATE NAMESPACE command creates a new namespace. If the IF NOT EXISTS",
1319  "clause is specified, the command won't generate an error if the namespace",
1320  "namespace_name already exists. ",
1321  "If namespace_name starts with '/' it treats the namespace_name as an absolute",
1322  "path, otherwise it considers it to be a sub-namespace relative to the",
1323  "current namespace.",
1324  "",
1325  0
1326  };
1327 
1328  const char *help_text_drop_namespace[] = {
1329  "",
1330  "DROP NAMESPACE",
1331  "==========",
1332  "",
1333  " DROP NAMESPACE [IF EXISTS] namespace_name",
1334  "",
1335  "Description",
1336  "-----------",
1337  "",
1338  "The DROP NAMESPACE removes a namespace. If the IF EXISTS clause is specified, ",
1339  "the command won't generate an error if the namespace namespace_name does not exist. ",
1340  "A namespace can only be dropped if it is empty (ie has contains no tables or sub-namespaces",
1341  "If namespace_name starts with '/' it treats the namespace_name as an absolute path, ",
1342  "otherwise it considers it to be a sub-namespace relative to the current namespace.",
1343  "",
1344  0
1345  };
1346 
1347  const char *help_text_show_create_table[] = {
1348  "",
1349  "SHOW CREATE TABLE name",
1350  "",
1351  "Example:",
1352  "",
1353  "hypertable> show create table Test1;",
1354  "",
1355  "CREATE TABLE Test1 (",
1356  " banana,",
1357  " apple,",
1358  " cherry,",
1359  " onion,",
1360  " cassis,",
1361  " ACCESS GROUP jan (cherry),",
1362  " ACCESS GROUP default (banana apple),",
1363  " ACCESS GROUP marsha (onion cassis)",
1364  ")",
1365  "",
1366  0
1367  };
1368 
1369  const char *help_text_load_data_infile[] = {
1370  "",
1371  "LOAD DATA INFILE",
1372  "================",
1373  "",
1374  " LOAD DATA INFILE [options] fname INTO TABLE name",
1375  "",
1376  " LOAD DATA INFILE [options] fname INTO FILE fname",
1377  "",
1378  " options:",
1379  "",
1380  " (ROW_KEY_COLUMN = column_specifier ['+' column_specifier ...]",
1381  " | TIMESTAMP_COLUMN = name |",
1382  " | HEADER_FILE = \" filename \"",
1383  " | ROW_UNIQUIFY_CHARS '=' n",
1384  " | DUPLICATE_KEY_COLUMNS",
1385  " | IGNORE_UNKNOWN_COLUMNS",
1386  " | FS = '<char>'",
1387  " | NO_LOG",
1388  " | NO_ESCAPE)*",
1389  "",
1390  " column_specifier =",
1391  " [ column_format ] column_name",
1392  "",
1393  " column_format",
1394  " \"%0\" int",
1395  " | \"%-\"",
1396  " | \"%\"",
1397  "",
1398  "Description",
1399  "-----------",
1400  "",
1401  "The LOAD DATA INFILE command provides a way to bulk load data from an",
1402  "optionally compressed file or stdin (fname of \"-\", see Load from STDIN",
1403  "below), into a table. The input is assumed to start with a header line",
1404  "that indicates the format of the lines in the file. The header can",
1405  "optionlly be stored in a separate file and referenced with the",
1406  "HEADER_FILE option. The header is expected to have the following format:",
1407  "",
1408  " header = ",
1409  " single_cell_format ",
1410  " | multi_cell_format",
1411  "",
1412  " single_cell_format =",
1413  " \"row\" '\\t' \"column\" '\\t' \"value\" '\\n'",
1414  " | \"timestamp\" '\\t' \"row\" '\\t' \"column\" '\\t' \"value\" '\\n'",
1415  "",
1416  " multi_cell_format =",
1417  " column | string ( '\\t' ( column | string ) )*",
1418  "",
1419  " column = column_family [ ':' column_qualifier ]",
1420  "",
1421  "Two basic tab-delimited formats are supported, a single cell format in which",
1422  "each line contains a single cell, and a multi-cell format in which each line",
1423  "can contain a list of cells. The following example shows the single-cell",
1424  "format:",
1425  "",
1426  "= Example 1 =",
1427  "",
1428  " #row column value",
1429  " 1127071 query guardianship",
1430  " 1127071 item:rank 8",
1431  " 1127071 click_url http://adopting.adoption.com",
1432  " 1246036 query polish american priests association",
1433  " 1246036 item:rank 6",
1434  " 1246036 click_url http://www.palichicago.org",
1435  " 12653 query lowes",
1436  " 12653 item:rank 1",
1437  " 12653 click_url http://www.lowes.com",
1438  " 1270972 query head hunters",
1439  " 1270972 item:rank 2",
1440  " 1270972 click_url http://www.headhunters.com",
1441  " 2648672 query jamie farr",
1442  " 2648672 item:rank 1",
1443  " 2648672 click_url http://www.imdb.com",
1444  " ...",
1445  "",
1446  "An optional initial timestamp column can be included which represents the cell",
1447  "timestamp, for example:",
1448  "",
1449  "= Example 2 =",
1450  "",
1451  " #timestamp row column value",
1452  " 2009-08-12 00:01:08 1127071 query guardianship",
1453  " 2009-08-12 00:01:08 1127071 item:rank 8",
1454  " 2009-08-12 00:01:08 1127071 click_url http://adopting.adoption.com",
1455  " 2009-08-12 00:01:18 1246036 query polish american priests association",
1456  " 2009-08-12 00:01:18 1246036 item:rank 6",
1457  " 2009-08-12 00:01:18 1246036 click_url http://www.palichicago.org",
1458  " 2009-08-12 00:01:14 12653 query lowes",
1459  " 2009-08-12 00:01:14 12653 item:rank 1",
1460  " 2009-08-12 00:01:14 12653 click_url http://www.lowes.com",
1461  " 2009-08-12 00:01:10 1270972 query head hunters",
1462  " 2009-08-12 00:01:10 1270972 item:rank 2",
1463  " 2009-08-12 00:01:10 1270972 click_url http://www.headhunters.com",
1464  " 2009-08-12 00:01:17 2648672 query jamie farr",
1465  " 2009-08-12 00:01:17 2648672 item:rank 1",
1466  " 2009-08-12 00:01:17 2648672 click_url http://www.imdb.com",
1467  " ...",
1468  "",
1469  "Deleting data from Hypertable involves inserting delete \"tombstones\". A delete",
1470  "tombstone is just a key with a special delete flag and an empty value. The",
1471  "system will logically remove the data described by the tombstone during query",
1472  "execution. The deleted data will be physically removed (garbage collected) over",
1473  "time via background maintenance tasks. The following list describes the",
1474  "supported tombstone types:",
1475  "",
1476  "DELETE_ROW ............ Remove row content that is chronologically",
1477  " less than or equal to the given timestamp.",
1478  "DELETE_COLUMN_FAMILY .. Remove all cells within the given column",
1479  " family of the given row with a timestamp",
1480  " that is chronologically less than or equal",
1481  " to the given timestamp.",
1482  "DELETE_CELL ........... Remove all versions of a cell whose timestamp",
1483  " is chronologically less than or equal to the",
1484  " given timestamp.",
1485  "DELETE_CELL_VERSION ... Remove cell version whose timestamp exactly",
1486  " matches the given timestamp.",
1487  "",
1488  "Delete tombstones may be specified in either the three column or four column of",
1489  "the single-cell-per-line .tsv formats by supplying an additional column, after",
1490  "an empty value column, that contains one of the delete markers described in the",
1491  "above list. For the three column format, the timestamp will be auto-assigned",
1492  "to the \"current\" time.",
1493  "",
1494  "= Example 3 =",
1495  "",
1496  "#timestamp row column value",
1497  "2013-08-27 00:13:46 com.hypertable.www DELETE_ROW",
1498  "2013-08-27 00:13:46 com.hypertable.www tag DELETE_COLUMN_FAMILY",
1499  "2013-08-27 00:13:46 com.hypertable.www tag:foo DELETE_CELL",
1500  "2013-08-27 00:13:46 com.hypertable.www tag:foo DELETE_CELL_VERSION ",
1501  "",
1502  "The multi-line format assumes that each tab delimited field represents a cell",
1503  "value and the column header specifies the name of the column. Unless otherwise",
1504  "specified, the first column is assumed to be the rowkey. For example:",
1505  "",
1506  "= Example 4 =",
1507  "",
1508  " #anon_id query item:rank click_url",
1509  " 3613173 batman signal images 18 http://www.icomania.com",
1510  " 1127071 guardianship 8 http://adopting.adoption.com",
1511  " 1270972 head hunters 2 http://www.headhunters.com",
1512  " 465778 google 1 http://www.google.com",
1513  " 12653 lowes 1 http://www.lowes.com",
1514  " 48785 address locator 2 http://www.usps.com/ncsc/",
1515  " 48785 address locator 3 http://factfinder.census.gov",
1516  " 2648672 jamie farr 1 http://www.imdb.com",
1517  " 1246036 polish american 6 http://www.palichicago.org",
1518  " 605089 dachshunds for sale 2 http://www.houstonzone.org",
1519  " 760038 stds 1 http://www.ashastd.org",
1520  "",
1521  "When loaded into a table with a straight LOAD DATA INFILE command, the above",
1522  "file will produce a set of cells equivalent to Example 1 above.",
1523  "",
1524  "Options",
1525  "-------",
1526  "",
1527  "ROW_KEY_COLUMN = column_specifier [ + column_specifier ... ]",
1528  "",
1529  "The LOAD DATA INFILE command accepts a number of options. The first is the",
1530  "ROW_KEY_COLUMN option. This is used in conjunction with the multi-cell",
1531  "input file format. It provides a way to select which column in the input",
1532  "file should be used as the row key. By separating two or more column names",
1533  "with the '+' character, multiple column values will be concatenated together,",
1534  "separated by a single space character to form the row key. Also, each",
1535  "column specifier can have one of the following prefixes to control field width",
1536  "and justification:",
1537  "",
1538  "%0<n> For numeric columns, specifies a field width of &lt;n&gt;",
1539  " and right-justify with '0' padding",
1540  "",
1541  "%-<n> Specifies a field width of &lt;n&gt; and right-justification",
1542  " with ' ' (space) padding",
1543  "",
1544  "%<n> Specifies a field width of &lt;n&gt; and left-justification",
1545  " with ' ' (space) padding",
1546  "",
1547  "",
1548  "For example, assuming the data in Example 3 above is contained in a file",
1549  "named \"query-log.tsv\", then the following LOAD DATA INFILE command:",
1550  "",
1551  " LOAD DATA INFILE ROW_KEY_COLUMN=\"%09anon_id\"+query \"query-log.tsv\" INTO TABLE 'anon-id-query';",
1552  "",
1553  "will populated the 'anon-id-query' table with the following content:",
1554  "",
1555  " 000012653 lowes item:rank 1",
1556  " 000012653 lowes click_url http://www.lowes.com",
1557  " 000048785 address locator item:rank 3",
1558  " 000048785 address locator item:rank 2",
1559  " 000048785 address locator click_url http://factfinder.census.gov",
1560  " 000048785 address locator click_url http://www.usps.com/ncsc/",
1561  " 000465778 google item:rank 1",
1562  " 000465778 google click_url http://www.google.com",
1563  " 000605089 dachshunds for sale item:rank 2",
1564  " 000605089 dachshunds for sale click_url http://www.houstonzone.org",
1565  " 000760038 stds item:rank 1",
1566  " 000760038 stds click_url http://www.ashastd.org",
1567  " 001127071 guardianship item:rank 8",
1568  " 001127071 guardianship click_url http://adopting.adoption.com",
1569  " 001246036 polish american item:rank 6",
1570  " 001246036 polish american click_url http://www.palichicago.org",
1571  " 001270972 head hunters item:rank 2",
1572  " 001270972 head hunters click_url http://www.headhunters.com",
1573  " 002648672 jamie farr item:rank 1",
1574  " 002648672 jamie farr click_url http://www.imdb.com",
1575  " 003613173 batman signal images item:rank 18",
1576  " 003613173 batman signal images click_url http://www.icomania.com",
1577  "",
1578  "TIMESTAMP_COLUMN = column_name",
1579  "",
1580  "The TIMESTAMP_COLUMN option is used in conjunction with the multi-cell input",
1581  "file format to specify which field of the input file should be used as the",
1582  "timestamp. The timestamp extracted from this field will be used for each cell",
1583  "in the row. The timestamp field is assumed to have the format YYYY-MM-DD HH:MM:SS",
1584  "",
1585  "HEADER_FILE = \"filename\"",
1586  "",
1587  "The HEADER_FILE option is used to specify an alternate file that contains",
1588  "the header line for the data file. This is useful in situations where you have",
1589  "log files that roll periodically and/or you want to be able to concatenate",
1590  "them. This option allows the input files to just contain data and the header",
1591  "to be specified in a separate file.",
1592  "",
1593  "ROW_UNIQUIFY_CHARS = n",
1594  "",
1595  "The ROW_UNIQUIFY_CHARS option provides a way to append a random string of",
1596  "characters to the end of the row keys to ensure that they are unique. The",
1597  "maximum number of characters you can specify is 21 and each character",
1598  "represents 6 random bits. It is useful in situations where the row key isn't",
1599  "discriminating enough to cause each input line to wind up in its own row.",
1600  "For example, let's say you want to dump a server log into a table, using the",
1601  "timestamp as the row key. However, as in the case of an Apache log, the",
1602  "timestamp usually only has resolution down to the second and there may be",
1603  "many entries that fall within the same second.",
1604  "",
1605  "DUPLICATE_KEY_COLUMNS",
1606  "",
1607  "Normally input fields that represent the row key (the first field or the",
1608  "ones designated in the ROW_KEY_COLUMN option) are not inserted as cell",
1609  "data. This option causes the system to also insert the row key fields",
1610  "as cell data.",
1611  "",
1612  "IGNORE_UNKNOWN_COLUMNS",
1613  "",
1614  "Skip input lines that refer to unknown (non-existent) column families.",
1615  "",
1616  "FS = '<char>'",
1617  "",
1618  "Set the field separator to character '<char>'. By default the field separator",
1619  "character is the tab character. This option allows you to change the",
1620  "field separator character to something different. When this option is",
1621  "supplied, the escaping rules change such that tabs are not escaped.",
1622  "When this option is supplied, care must be taken to ensure that the field",
1623  "separator character is not present in the data.",
1624  "",
1625  "NO_LOG",
1626  "",
1627  "The NO_LOG option tells the servers to skip the commit log write for the",
1628  "data being loaded which can significantly improve the loading speed.",
1629  "WARNING: Use this option with caution because failure of a RangeServer",
1630  "during the execution of this command may result in data loss. To avoid data",
1631  "loss after successfully running LOAD DATA INFILE with the NO_LOG option, the",
1632  "table should be compacted with the COMPACT command.",
1633  "",
1634  "NO_ESCAPE",
1635  "",
1636  "The NO_ESCAPE option provides a way to disable the escaping mechanism. The",
1637  "newline and tab characters are escaped and unescaped when transferred in",
1638  "and out of the system. The LOAD DATA INFILE command will scan the input",
1639  "for the two character sequences '\\' 'n', '\\' 't', '\\' '0', and '\\' '\\'",
1640  "and will convert them into a newline, tab, and backslash, respectively.",
1641  "The NO_ESCAPE option disables this conversion.",
1642  "",
1643  "Compression",
1644  "-----------",
1645  "",
1646  "If the name of the input file ends with a \".gz\", the file is assumed to be",
1647  "compressed and will be streamed in through a decompressor (gzip).",
1648  "",
1649  "Load from STDIN",
1650  "---------------",
1651  "",
1652  "The LOAD DATA INFILE command has the ability to load data from standard input",
1653  "by specifying a file name of \"-\". The following is an example of how to use",
1654  "this feature:",
1655  "",
1656  " cat data.tsv | ht shell --batch -e 'load data infile \"-\" into table foo;'",
1657  "",
1658  "Load from brokered FS file",
1659  "--------------------------",
1660  "If the data file name starts with the location specifier \"fs://\" then the file is ",
1661  "read from the FS over the FsBroker. If it begins with the specifier \"file://\" then ",
1662  "it is read from the local FS (this is the default in the absence of a location ",
1663  " specifier).",
1664  "",
1665  0
1666  };
1667 
1668  const char *help_text_insert[] = {
1669  "",
1670  "INSERT",
1671  "======",
1672  "",
1673  " INSERT INTO table_name VALUES value_list",
1674  " ",
1675  " value_list:",
1676  " value_spec [',' value_spec ...]",
1677  " ",
1678  " value_spec:",
1679  " '(' row ',' column ',' value ')'",
1680  " '(' timestamp ',' row ',' column ',' value ')'",
1681  "",
1682  " column:",
1683  " family [ ':' qualifier ]",
1684  " ",
1685  " timestamp:",
1686  " YYYY-MM-DD HH:MM:SS[.ss|:nanoseconds]",
1687  "",
1688  "Description",
1689  "-----------",
1690  "",
1691  "The INSERT command inserts data (cells) into a table. The data is supplied",
1692  "as a list of comma separated tuples. Each tuple represents a cell and can take",
1693  "one of two forms:",
1694  "",
1695  " * (row, column, value)",
1696  " * (timestamp, row, column, value)",
1697  "",
1698  "The first form just supplies the row key, column key, and value as strings and",
1699  "the cell timestamp is auto-assigned. The second form supplies the timestamp in",
1700  "addition to the row key, column key, and value. For example, the following",
1701  "INSERT statement:",
1702  "",
1703  " INSERT INTO fruit VALUES (\"cantelope\", \"tag:good\", \"Had with breakfast\"),",
1704  " (\"2009-08-02 08:30:00\", \"cantelope\", \"description\", \"A cultivated variety",
1705  " of muskmelon with orange flesh\"),(\"banana\", \"tag:great\", \"Had with lunch\");",
1706  "",
1707  "might yield the following output from the SELECT command:",
1708  "",
1709  " SELECT * FROM fruit DISPLAY_TIMESTAMPS;",
1710  " 2009-08-11 05:06:17.246062001 banana tag:great Had with lunch",
1711  " 2009-08-11 05:06:17.246062002 cantelope tag:good Had with breakfast",
1712  " 2009-08-02 08:30:00.000000000 cantelope description A cultivated variety",
1713  " of muskmelon with orange flesh",
1714  "",
1715  "If timestamps are not supplied, then they will be automatically assigned by ",
1716  "the RangeServers for non-indexed column families, and will be automatically ",
1717  "assigned by the client library for indexed column families. It is ",
1718  "therefore important that the system clock of the application servers be ",
1719  "synchronized with the clocks of the Hypertable RangeServer machines. ",
1720  "",
1721  "Hypertable supports the GUID() function call for row key and value. It will ",
1722  "generate a globally unique ID:",
1723  "",
1724  " INSERT INTO test VALUES (GUID(), \"username\", \"bloefeld\");",
1725  " INSERT INTO test VALUES (\"harddisk0\", \"device\", GUID());",
1726  "",
1727  "might yield the following output from the SELECT command:",
1728  "",
1729  " 3a983b8e-b7c7-49ae-b3e4-e221610f33ec username bloefeld",
1730  " harddisk0 device 6d38d110-8790-4a40-8653-701742343d1e",
1731  0
1732  };
1733 
1734  const char *help_text_delete[] = {
1735  "",
1736  "DELETE",
1737  "======",
1738  "",
1739  " DELETE ('*' | column [',' column ...])",
1740  " FROM table_name",
1741  " WHERE ROW '=' row_key",
1742  " [(TIMESTAMP timestamp | VERSION timestamp)]",
1743  "",
1744  " column:",
1745  " column_family [':' column_qualifier]",
1746  "",
1747  " timestamp:",
1748  " YYYY-MM-DD HH:MM:SS[.ss|:nanoseconds]",
1749  "",
1750  "Description",
1751  "-----------",
1752  "",
1753  "The DELETE command provides a way to delete cells from a row in a table. The",
1754  "command applies to a single row only and can be used to delete, for a given",
1755  "row, all of the cells in a qualified column, all the cells in a column family,",
1756  "or all of the cells in the row. If the TIMESTAMP clause is given, then the",
1757  "delete will only apply to those cells whose internal timestamp field is equal",
1758  "to or less than the given timestamp. An example of each type of delete is",
1759  "shown below. Assume that we're starting with a table that contains the",
1760  "following:",
1761  "",
1762  " hypertable> SELECT * FROM crawldb DISPLAY_TIMESTAMPS;",
1763  "2010-01-01 00:00:02.00000000 org.hypertable.www status-code 200",
1764  "2010-01-01 00:00:01.00000000 org.hypertable.www status-code 200",
1765  "2010-01-01 00:00:04.00000000 org.hypertable.www anchor:http://www.news.com/ Hypertable",
1766  "2010-01-01 00:00:03.00000000 org.hypertable.www anchor:http://www.news.com/ Hypertable",
1767  "2010-01-01 00:00:06.00000000 org.hypertable.www anchor:http://www.opensource.org/ Hypertable.org",
1768  "2010-01-01 00:00:05.00000000 org.hypertable.www anchor:http://www.opensource.org/ Hypertable.org",
1769  "2010-01-01 00:00:08.00000000 org.hypertable.www checksum 822828699",
1770  "2010-01-01 00:00:07.00000000 org.hypertable.www checksum 2921728",
1771  "",
1772  "The first example shows how to delete one specific version of a cells in the column",
1773  "anchor:http://www.opensource.org/ of the row \"org.hypertable.www\".",
1774  "",
1775  " hypertable> DELETE \"anchor:http://www.opensource.org/\" FROM crawldb WHERE",
1776  " ROW='org.hypertable.www' VERSION \"2010-01-01 00:00:06\";",
1777  " hypertable> select \"anchor\" from crawldb DISPLAY_TIMESTAMPS;",
1778  " 2010-01-01 00:00:04.00000000 org.hypertable.www anchor:http://www.news.com/ Hypertable",
1779  " 2010-01-01 00:00:03.00000000 org.hypertable.www anchor:http://www.news.com/ Hypertable",
1780  " 2010-01-01 00:00:05.00000000 org.hypertable.www anchor:http://www.opensource.org/ Hypertable.org",
1781  "",
1782  "This example shows how to delete the cells in the column",
1783  "anchor:http://www.opensource.org/ of the row \"org.hypertable.www\".",
1784  "",
1785  " hypertable> DELETE \"anchor:http://www.opensource.org/\" FROM crawldb WHERE",
1786  " ROW='org.hypertable.www';",
1787  " ",
1788  " hypertable> select * from crawldb;",
1789  " org.hypertable.www status-code 200",
1790  " org.hypertable.www status-code 200",
1791  " org.hypertable.www anchor:http://www.news.com/ Hypertable",
1792  " org.hypertable.www anchor:http://www.news.com/ Hypertable",
1793  " org.hypertable.www checksum 822828699",
1794  " org.hypertable.www checksum 2921728",
1795  "",
1796  "The next example shows how to delete all of the cells in the column family",
1797  "checksum of the row \"org.hypertable.www\".",
1798  "",
1799  " hypertable> DELETE checksum FROM crawldb WHERE ROW=\"org.hypertable.www\";",
1800  "",
1801  " hypertable> select * from crawldb;",
1802  " org.hypertable.www status-code 200",
1803  " org.hypertable.www status-code 200",
1804  " org.hypertable.www anchor:http://www.news.com/ Hypertable",
1805  " org.hypertable.www anchor:http://www.news.com/ Hypertable",
1806  "",
1807  "Here's how to delete all of the cells in the row",
1808  "\"org.hypertable.www\".",
1809  "",
1810  " hypertable> DELETE * FROM crawldb WHERE ROW=\"org.hypertable.www\";",
1811  "",
1812  " hypertable> SELECT * FROM crawldb;",
1813  "",
1814  0
1815  };
1816 
1817  const char *help_text_get_listing[] = {
1818  "",
1819  "GET LISTING",
1820  "===========",
1821  "",
1822  " GET LISTING",
1823  "",
1824  "Description",
1825  "-----------",
1826  "",
1827  "The GET LISTING command lists the tables and namespaces in the current namespace",
1828  "",
1829  "Example",
1830  "-------",
1831  "",
1832  " hypertable> GET LISTING;",
1833  " foo",
1834  " SYS (namespace)",
1835  " Test",
1836  "",
1837  0
1838  };
1839 
1840  const char *help_text_show_tables[] = {
1841  "",
1842  "SHOW TABLES",
1843  "===========",
1844  "",
1845  " SHOW TABLES",
1846  "",
1847  "Description",
1848  "-----------",
1849  "",
1850  "The SHOW TABLES command lists only the tables in the current namespace",
1851  "",
1852  "Example",
1853  "-------",
1854  "",
1855  " hypertable> SHOW TABLES;",
1856  " foo",
1857  " Test",
1858  "",
1859  0
1860  };
1861 
1862  const char *help_text_drop_table[] = {
1863  "",
1864  "DROP TABLE",
1865  "==========",
1866  "",
1867  " DROP TABLE [IF EXISTS] table_name",
1868  "",
1869  "Description",
1870  "-----------",
1871  "",
1872  "The DROP TABLE command removes the table table_name from the system. If",
1873  "the IF EXIST clause is supplied, the command won't generate an error if a",
1874  "table by the name of table_name does not exist.",
1875  "",
1876  0
1877  };
1878 
1879  const char *help_text_rename_table[] = {
1880  "",
1881  "RENAME TABLE",
1882  "==========",
1883  "",
1884  " RENAME TABLE table_name TO new_table_name",
1885  "",
1886  "Description",
1887  "-----------",
1888  "",
1889  "The RENAME TABLE command renames the existing table_name to the new_table_name.",
1890  "",
1891  0
1892  };
1893 
1894  const char *help_text_shutdown[] = {
1895  "",
1896  "SHUTDOWN",
1897  "========",
1898  "",
1899  " SHUTDOWN",
1900  "",
1901  "Description",
1902  "-----------",
1903  "",
1904  "The SHUTDOWN command gracefully shuts down the range servers by invoking the",
1905  "RangeServer::shutdown() command on each server. The RangeServer::shutdown()",
1906  "command performs the following sequence of steps:",
1907  "",
1908  " * close the RSML (range transaction log)",
1909  " * close the ROOT commit log",
1910  " * close the METADATA commit log",
1911  " * close the USER commit log",
1912  "",
1913  "Hypertable must be shut down with this command when running on a filesystem",
1914  "such as HDFS 0.20 since it doesn't have a properly functioning fsync()",
1915  "operation. Any other method of shutting down the range servers could result",
1916  "in loss of data, or worse, inconsistent or corrupt system state.",
1917  "",
1918  0
1919  };
1920 
1921  const char *help_text_dump_table[] = {
1922  "",
1923  "DUMP TABLE",
1924  "==========",
1925  "",
1926  " DUMP TABLE table_name",
1927  " [COLUMNS ('*' | (column_predicate [',' column_predicate]*))]",
1928  " [where_clause]",
1929  " [options_spec]",
1930  "",
1931  " where_clause:",
1932  " WHERE where_predicate [AND where_predicate ...]",
1933  "",
1934  " relop: '=' | '<' | '<=' | '>' | '>='",
1935  "",
1936  " where_predicate:",
1937  " row_predicate",
1938  " | timestamp_predicate",
1939  " | value_predicate",
1940  "",
1941  " row_predicate:",
1942  " ROW REGEXP 'row_regexp'",
1943  "",
1944  " timestamp_predicate:",
1945  " [timestamp relop] TIMESTAMP relop timestamp",
1946  "",
1947  " value_predicate:",
1948  " VALUE REGEXP 'value_regexp'",
1949  "",
1950  " options_spec:",
1951  " (MAX_VERSIONS revision_count",
1952  " | INTO FILE filename[.gz]",
1953  " | BUCKETS <n>",
1954  " | FS = '<char>'",
1955  " | NO_ESCAPE",
1956  " | NO_TIMESTAMPS)*",
1957  "",
1958  " timestamp:",
1959  " 'YYYY-MM-DD HH:MM:SS[.nanoseconds]'",
1960  "",
1961  "Description",
1962  "-----------",
1963  "",
1964  "The DUMP TABLE command provides a way to create efficient table backups",
1965  "which can be loaded with LOAD DATA INFILE. The problem with using SELECT",
1966  "to create table backups is that it outputs table data in order of row key.",
1967  "LOAD DATA INFILE yields worst-case performance when loading data that is",
1968  "sorted by the row key because only one RangeServer at a time will be actively",
1969  "receiving updates. Backup file generated with DUMP TABLE are much more",
1970  "efficient because the data distribution in the backup file causes many (or all)",
1971  "of the RangeServers to actively receive updates during the loading process.",
1972  "The DUMP TABLE command will randomly select n ranges and output cells from",
1973  "those ranges in round-robin fashion. n is the number of buckets (default is 20)",
1974  "and can be specified with the BUCKETS option.",
1975  "",
1976  "Options",
1977  "-------",
1978  "",
1979  "MAX_VERSIONS revision_count",
1980  "",
1981  "Each cell in a Hypertable table can have multiple timestamped revisions. By",
1982  "default all revisions of a cell are returned by the DUMP TABLE statement. The",
1983  "MAX_VERSIONS option allows control over the number of cell revisions returned.",
1984  "The cell revisions are stored in reverse-chronological order, so MAX_VERSIONS 1",
1985  "will return the most recent version of the cell.",
1986  "",
1987  "INTO FILE [file://|fs://]filename[.gz]",
1988  "",
1989  "The result of a DUMP TABLE command is displayed to standard output by default.",
1990  "The INTO FILE option allows the output to get redirected to a file.",
1991  "If the file name starts with the location specifier 'fs://' then the output file is ",
1992  "assumed to reside in the brokered FS. If it starts with 'file://' then output is ",
1993  "sent to a local file. This is also the default location in the absence of any ",
1994  "location specifier.",
1995  "",
1996  "If the file name specified ends in a .gz extension, then the output is compressed",
1997  "with gzip before it is written to the file.",
1998  "",
1999  "BUCKETS <n>",
2000  "",
2001  "This option causes the DUMP TABLE command to use <n> buckets. The default is",
2002  "20. It is recommended that <n> is at least as large as the number of nodes",
2003  "in the cluster that the backup with be restored to.",
2004  "",
2005  "FS = '<char>'",
2006  "",
2007  "Set the field separator to character '<char>'. By default the field separator",
2008  "character is the tab character. This option allows you to change the",
2009  "field separator character to something different. When this option is",
2010  "supplied, the escaping rules change such that tabs are not escaped.",
2011  "When this option is supplied, care must be taken to ensure that the field",
2012  "separator character is not present in the data.",
2013  "",
2014  "NO_ESCAPE",
2015  "",
2016  "The output format of a DUMP TABLE command comprises tab delimited lines, one",
2017  "cell per line, which is suitable for input to the LOAD DATA INFILE",
2018  "command. However, if the value portion of the cell contains either newline",
2019  "or tab characters, then it will confuse the LOAD DATA INFILE input parser.",
2020  "To prevent this from happening, newline, tab, and backslash characters are",
2021  "converted into two character escape sequences, described in the following table.",
2022  "",
2023  "",
2024  " --------------------------------",
2025  " | Character | Escape Sequence |",
2026  " |--------------------------------|",
2027  " | backslash \\ | '\\' '\\' |",
2028  " | newline \\n | '\\' 'n' |",
2029  " | tab \\t | '\\' 't' |",
2030  " | NUL \\0 | '\\' '0' |",
2031  " --------------------------------",
2032  "",
2033  "",
2034  "The NO_ESCAPE option turns off this escaping mechanism.",
2035  "",
2036  "NO_TIMESTAMPS",
2037  "",
2038  "The NO_TIMESTAMPS option prevents the timestamp field from getting generated",
2039  "in the output.",
2040  "",
2041  "Examples",
2042  "--------",
2043  "",
2044  " DUMP TABLE foo;",
2045  " DUMP TABLE foo WHERE '2008-07-28 00:00:02' < TIMESTAMP < '2008-07-28 00:00:07';",
2046  " DUMP TABLE foo INTO FILE 'foo.tsv.gz'",
2047  " DUMP TABLE foo MAX_VERSIONS 1 BUCKETS 1000;",
2048  " DUMP TABLE LoadTest COLUMNS user:/^a/ WHERE ROW REGEXP \"1.*2\" AND VALUE REGEXP \"foob\";",
2049  "",
2050  0
2051  };
2052 
2053  const char *help_text_rebuild_indices[] = {
2054  "",
2055  "REBUILD INDICES",
2056  "===============",
2057  "",
2058  "REBUILD [QUALIFIER|VALUE] INDICES table_name",
2059  "",
2060  "This command will rebuild the indices for the table specified by",
2061  "table_name. It can be used to rebuild the qualifier indices, the value",
2062  "indices, or both. It does this by first dropping and recreating the",
2063  "index table(s) and then scanning over the primary table, reconstructing",
2064  "the indices by repopulating the index tables.",
2065  "",
2066  "NOTE: This command is not atomic with respect to queries. While this",
2067  "command is running, queries against the indices that are being rebuilt",
2068  "may return incorrect results. Also, the command is not serialized with",
2069  "other REBUILD INDICES commands for the same table. Multiple concurrent",
2070  "invocations of this command for the same table will interfere with one",
2071  "another, causing one of the commands to fail.",
2072  "",
2073  "Examples:",
2074  "",
2075  " REBUILD INDICES mytable;",
2076  " REBUILD QUALIFIER INDICES mytable;",
2077  " REBUILD VALUE INDICES mytable;",
2078  "",
2079  0
2080  };
2081 
2082  const char *help_text_set[] = {
2083  "",
2084  "SET",
2085  "===",
2086  "",
2087  " SET set_variable_spec (',' set_variable_spec)*",
2088  "",
2089  " set_variable_spec:",
2090  " system_variable '=' (TRUE|FALSE)",
2091  "",
2092  " system_variable:",
2093  " READONLY",
2094  "",
2095  "Description",
2096  "-----------",
2097  "",
2098  "The SET command provides a way to administratively set system state",
2099  "variables.",
2100  "",
2101  "Variables",
2102  "---------",
2103  "",
2104  "READONLY",
2105  "",
2106  "Puts all of the RangeServers in readonly mode which will cause inserts into",
2107  "non-system tables to fail with the Error::RANGESERVER_SERVER_IN_READONLY_MODE.",
2108  "",
2109  "Examples",
2110  "--------",
2111  "",
2112  " SET READONLY=true;",
2113  "",
2114  0
2115  };
2116 
2117  const char *help_text_status[] = {
2118  "",
2119  "STATUS",
2120  "======",
2121  "",
2122  " STATUS",
2123  "",
2124  "Description",
2125  "-----------",
2126  "",
2127  "The STATUS command performs a status check of Hypertable.",
2128  "",
2129  0
2130  };
2131 
2132  typedef std::unordered_map<std::string, const char **> HelpTextMap;
2133 
2134  HelpTextMap &build_help_text_map() {
2135  HelpTextMap *map = new HelpTextMap();
2136  (*map)[""] = help_text_contents;
2137  (*map)["compact"] = help_text_compact;
2138  (*map)["compact table"] = help_text_compact;
2139  (*map)["compact ranges"] = help_text_compact;
2140  (*map)["contents"] = help_text_contents;
2141  (*map)["use"] = help_text_use;
2142  (*map)["create namespace"] = help_text_create_namespace;
2143  (*map)["drop namespace"] = help_text_drop_namespace;
2144  (*map)["exists table"] = help_text_exists_table;
2145  (*map)["create table"] = help_text_create_table;
2146  (*map)["alter table"] = help_text_alter_table;
2147  (*map)["delete"] = help_text_delete;
2148  (*map)["insert"] = help_text_insert;
2149  (*map)["select"] = help_text_select;
2150  (*map)["stop"] = help_text_stop;
2151  (*map)["describe table"] = help_text_describe_table;
2152  (*map)["describe"] = help_text_describe_table;
2153  (*map)["show create table"] = help_text_show_create_table;
2154  (*map)["show create"] = help_text_show_create_table;
2155  (*map)["load data infile"] = help_text_load_data_infile;
2156  (*map)["load data"] = help_text_load_data_infile;
2157  (*map)["load"] = help_text_load_data_infile;
2158  (*map)["get listing"] = help_text_get_listing;
2159  (*map)["show tables"] = help_text_show_tables;
2160  (*map)["drop"] = help_text_drop_table;
2161  (*map)["drop table"] = help_text_drop_table;
2162  (*map)["rename"] = help_text_rename_table;
2163  (*map)["rename table"] = help_text_rename_table;
2164  (*map)["shutdown"] = help_text_shutdown;
2165  (*map)["dump"] = help_text_dump_table;
2166  (*map)["dump table"] = help_text_dump_table;
2167  (*map)["rebuild"] = help_text_rebuild_indices;
2168  (*map)["rebuild indices"] = help_text_rebuild_indices;
2169  (*map)["set"] = help_text_set;
2170  (*map)["status"] = help_text_status;
2171  return *map;
2172  }
2173 
2174  HelpTextMap &text_map = build_help_text_map();
2175 }
2176 
2177 
2178 const char **HqlHelpText::get(const string &subject) {
2179  HelpTextMap::const_iterator iter = text_map.find(subject);
2180  if (iter == text_map.end())
2181  return 0;
2182  return (*iter).second;
2183 }
2184 
2185 
2187  text_map.clear();
2188  text_map[""] = help_text_rsclient_contents;
2189  text_map["compact"] = help_text_compact;
2190  text_map["compact table"] = help_text_compact;
2191  text_map["compact ranges"] = help_text_compact;
2192  text_map["contents"] = help_text_rsclient_contents;
2193  text_map["select"] = help_text_select;
2194  text_map["stop"] = help_text_stop;
2195  text_map["create"] = help_text_create_scanner;
2196  text_map["create scanner"] = help_text_create_scanner;
2197  text_map["destroy"] = help_text_destroy_scanner;
2198  text_map["destroy scanner"] = help_text_destroy_scanner;
2199  text_map["drop range"] = help_text_drop_range;
2200  text_map["fetch"] = help_text_fetch_scanblock;
2201  text_map["fetch scanblock"] = help_text_fetch_scanblock;
2202  text_map["load"] = help_text_load_range;
2203  text_map["load range"] = help_text_load_range;
2204  text_map["update"] = help_text_update;
2205  text_map["shutdown"] = help_text_shutdown_rangeserver;
2206 }
2207 
2208 
2210  text_map.clear();
2211  text_map[""] = help_text_master_contents;
2212  text_map["contents"] = help_text_master_contents;
2213  text_map["shutdown"] = help_text_shutdown_server;
2214 }
static void install_master_client_text()
Installs help text for hypertable (HQL) command interpreter.
STL namespace.
Compatibility Macros for C/C++.
static const char ** get(const std::string &subject)
Returns help text string for a command.
Hypertable definitions
static void install_range_server_client_text()
Installs help text for rsclient command interpreter.
Declarations for HqlHelpText.
String extensions and helpers: sets, maps, append operators etc.