| 1 |
# _database_close/_database_reopen can't use with HTTP because requests via HTTP are always |
| 2 |
# processed by workers. Workers never use primary WAL role. |
| 3 |
#@require-interface stdio |
| 4 |
|
| 5 |
#@require-feature message_pack |
| 6 |
|
| 7 |
#$GROONGA_ALLOW_DATABASE_REOPEN=yes |
| 8 |
#$GRN_ENABLE_REFERENCE_COUNT=no |
| 9 |
#$GRN_WAL_ROLE=primary |
| 10 |
|
| 11 |
#@disable-logging |
| 12 |
cache_limit --max 0 |
| 13 |
#@enable-logging |
| 14 |
|
| 15 |
table_create Memos TABLE_HASH_KEY ShortText |
| 16 |
column_create Memos content COLUMN_SCALAR Text |
| 17 |
|
| 18 |
io_flush |
| 19 |
#@copy-path #{db_path}.0000101 #{db_path}.0000101.initial |
| 20 |
|
| 21 |
#@disable-logging |
| 22 |
#@generate-series 0 0 Memos '{"_key" => "sequential: 64KiB < && < 4MiB", "content" => "abcd" * ((64 * 1024) / 4) + "x"}' |
| 23 |
#@enable-logging |
| 24 |
|
| 25 |
check --obj Memos.content |
| 26 |
|
| 27 |
plugin_register functions/string |
| 28 |
|
| 29 |
select \ |
| 30 |
--table Memos \ |
| 31 |
--columns[content_head].stage output \ |
| 32 |
--columns[content_head].flags COLUMN_SCALAR \ |
| 33 |
--columns[content_head].type ShortText \ |
| 34 |
--columns[content_head].value 'string_slice(content, 0, 5)' \ |
| 35 |
--columns[content_tail].stage output \ |
| 36 |
--columns[content_tail].flags COLUMN_SCALAR \ |
| 37 |
--columns[content_tail].type ShortText \ |
| 38 |
--columns[content_tail].value 'string_slice(content, -5, 5)' \ |
| 39 |
--columns[content_length].stage output \ |
| 40 |
--columns[content_length].flags COLUMN_SCALAR \ |
| 41 |
--columns[content_length].type UInt32 \ |
| 42 |
--columns[content_length].value 'string_length(content)' \ |
| 43 |
--output_columns _key,content_head,content_tail,content_length |
| 44 |
|
| 45 |
#@copy-path #{db_path}.0000101.wal #{db_path}.0000101.wal.keep |
| 46 |
_database_close |
| 47 |
|
| 48 |
#@copy-path #{db_path}.0000101.initial #{db_path}.0000101 |
| 49 |
#@copy-path #{db_path}.0000101.wal.keep #{db_path}.0000101.wal |
| 50 |
_database_reopen |
| 51 |
|
| 52 |
select \ |
| 53 |
--table Memos \ |
| 54 |
--columns[content_head].stage output \ |
| 55 |
--columns[content_head].flags COLUMN_SCALAR \ |
| 56 |
--columns[content_head].type ShortText \ |
| 57 |
--columns[content_head].value 'string_slice(content, 0, 5)' \ |
| 58 |
--columns[content_tail].stage output \ |
| 59 |
--columns[content_tail].flags COLUMN_SCALAR \ |
| 60 |
--columns[content_tail].type ShortText \ |
| 61 |
--columns[content_tail].value 'string_slice(content, -5, 5)' \ |
| 62 |
--columns[content_length].stage output \ |
| 63 |
--columns[content_length].flags COLUMN_SCALAR \ |
| 64 |
--columns[content_length].type UInt32 \ |
| 65 |
--columns[content_length].value 'string_length(content)' \ |
| 66 |
--output_columns _key,content_head,content_tail,content_length |
| 67 |
|
| 68 |
check --obj Memos.content |