# _database_close/_database_reopen can't use with HTTP because requests via HTTP are always # processed by workers. Workers never use primary WAL role. #@require-interface stdio #@require-feature message_pack #$GROONGA_ALLOW_DATABASE_REOPEN=yes #$GRN_ENABLE_REFERENCE_COUNT=no #$GRN_WAL_ROLE=primary #@disable-logging cache_limit --max 0 #@enable-logging table_create Memos TABLE_HASH_KEY ShortText column_create Memos content COLUMN_SCALAR Text io_flush #@copy-path #{db_path}.0000101 #{db_path}.0000101.initial #@timeout 300 #@disable-logging #@generate-series 0 1 Memos '{"_key" => "huge: 4MiB <=: 1 segment", "content" => "abcd" * ((4 * 1024 * 1024) / 4)}' #@enable-logging plugin_register functions/string select \ --table Memos \ --columns[content_head].stage output \ --columns[content_head].flags COLUMN_SCALAR \ --columns[content_head].type ShortText \ --columns[content_head].value 'string_slice(content, 0, 5)' \ --columns[content_tail].stage output \ --columns[content_tail].flags COLUMN_SCALAR \ --columns[content_tail].type ShortText \ --columns[content_tail].value 'string_slice(content, -5, 5)' \ --columns[content_length].stage output \ --columns[content_length].flags COLUMN_SCALAR \ --columns[content_length].type UInt32 \ --columns[content_length].value 'string_length(content)' \ --output_columns _key,content_head,content_tail,content_length #@copy-path #{db_path}.0000101.wal #{db_path}.0000101.wal.keep _database_close #@copy-path #{db_path}.0000101.initial #{db_path}.0000101 #@copy-path #{db_path}.0000101.wal.keep #{db_path}.0000101.wal _database_reopen select \ --table Memos \ --columns[content_head].stage output \ --columns[content_head].flags COLUMN_SCALAR \ --columns[content_head].type ShortText \ --columns[content_head].value 'string_slice(content, 0, 5)' \ --columns[content_tail].stage output \ --columns[content_tail].flags COLUMN_SCALAR \ --columns[content_tail].type ShortText \ --columns[content_tail].value 'string_slice(content, -5, 5)' \ --columns[content_length].stage output \ --columns[content_length].flags COLUMN_SCALAR \ --columns[content_length].type UInt32 \ --columns[content_length].value 'string_length(content)' \ --output_columns _key,content_head,content_tail,content_length