mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Update Mroonga to the latest version on 2017-10-16T09:50:49+0900
This commit is contained in:
@@ -73,6 +73,8 @@ update-latest-release: ensure-cutter-source-path
|
||||
$(PACKAGE) $(OLD_RELEASE) $(OLD_RELEASE_DATE) \
|
||||
$(VERSION) $(NEW_RELEASE_DATE) \
|
||||
packages/rpm/centos/mariadb-mroonga.spec.in \
|
||||
packages/rpm/centos/mariadb-10.1-mroonga.spec.in \
|
||||
packages/rpm/centos/mariadb-10.2-mroonga.spec.in \
|
||||
packages/rpm/centos/mysql55-mroonga.spec.in \
|
||||
packages/rpm/centos/mysql56-community-mroonga.spec.in \
|
||||
packages/rpm/centos/mysql57-community-mroonga.spec.in \
|
||||
|
||||
@@ -22,6 +22,7 @@ let $version_5_5 = `SELECT $version_major_minor = 5.5`;
|
||||
let $version_5_6 = `SELECT $version_major_minor = 5.6`;
|
||||
let $version_5_7 = `SELECT $version_major_minor = 5.7`;
|
||||
let $version_10_0 = `SELECT $version_major_minor = 10.0`;
|
||||
let $version_10_1 = `SELECT $version_major_minor = 10.1`;
|
||||
let $version_10_2 = `SELECT $version_major_minor = 10.2`;
|
||||
|
||||
let $version_5_5_or_later = `SELECT $version_major_minor >= 5.5`;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# Copyright(C) 2017 Kouhei Sutou <kou@clear-code.com>
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
--source ../../include/mroonga/check_version.inc
|
||||
--source ../../include/mroonga/check_mariadb.inc
|
||||
|
||||
if ($version_10_1) {
|
||||
if ($mariadb) {
|
||||
--skip This test is not for MariaDB 10.1.x
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,5 @@ articles CREATE TABLE `articles` (
|
||||
KEY `comment` (`comment`),
|
||||
CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE=Mroonga DEFAULT CHARSET=latin1
|
||||
SELECT * FROM information_schema.referential_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME
|
||||
def test comment def test PRIMARY NONE RESTRICT RESTRICT articles comments
|
||||
DROP TABLE articles;
|
||||
DROP TABLE comments;
|
||||
|
||||
@@ -17,7 +17,5 @@ articles CREATE TABLE `articles` (
|
||||
`comment` int(10) unsigned DEFAULT NULL,
|
||||
KEY `comment` (`comment`)
|
||||
) ENGINE=Mroonga DEFAULT CHARSET=latin1
|
||||
SELECT * FROM information_schema.referential_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME
|
||||
DROP TABLE articles;
|
||||
DROP TABLE comments;
|
||||
|
||||
@@ -18,7 +18,5 @@ articles CREATE TABLE `articles` (
|
||||
CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT
|
||||
) ENGINE=Mroonga DEFAULT CHARSET=latin1
|
||||
SELECT * FROM information_schema.referential_constraints;
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME
|
||||
def test comment def test PRIMARY NONE RESTRICT RESTRICT articles comments
|
||||
DROP TABLE articles;
|
||||
DROP TABLE comments;
|
||||
|
||||
@@ -1,12 +1,32 @@
|
||||
SET GLOBAL mroonga_enable_operations_recording = true;
|
||||
FLUSH TABLES;
|
||||
DROP TABLE IF EXISTS diaries;
|
||||
CREATE TABLE diaries (
|
||||
title TEXT
|
||||
) DEFAULT CHARSET=utf8;
|
||||
INSERT INTO diaries VALUES("Research for Mroonga");
|
||||
SELECT * FROM diaries;
|
||||
title
|
||||
Research for Mroonga
|
||||
DROP TABLE diaries;
|
||||
SELECT mroonga_command('truncate mroonga_operations');
|
||||
mroonga_command('truncate mroonga_operations')
|
||||
true
|
||||
INSERT INTO diaries VALUES("Unlogged: Research for Mroonga");
|
||||
SELECT mroonga_command('load --table mroonga_operations --values "[{}]"');
|
||||
mroonga_command('load --table mroonga_operations --values "[{}]"')
|
||||
1
|
||||
SELECT mroonga_command('select mroonga_operations --output_columns _id');
|
||||
mroonga_command('select mroonga_operations --output_columns _id')
|
||||
[[[1],[["_id","UInt32"]],[2]]]
|
||||
SET GLOBAL mroonga_enable_operations_recording = false;
|
||||
FLUSH TABLES;
|
||||
SELECT mroonga_command('truncate mroonga_operations');
|
||||
mroonga_command('truncate mroonga_operations')
|
||||
true
|
||||
INSERT INTO diaries VALUES("Logged: Research for Mroonga");
|
||||
SELECT mroonga_command('load --table mroonga_operations --values "[{}]"');
|
||||
mroonga_command('load --table mroonga_operations --values "[{}]"')
|
||||
1
|
||||
SELECT mroonga_command('select mroonga_operations --output_columns _id');
|
||||
mroonga_command('select mroonga_operations --output_columns _id')
|
||||
[[[1],[["_id","UInt32"]],[1]]]
|
||||
DROP TABLE diaries;
|
||||
SELECT mroonga_command('truncate mroonga_operations');
|
||||
mroonga_command('truncate mroonga_operations')
|
||||
true
|
||||
SET GLOBAL mroonga_enable_operations_recording = default;
|
||||
FLUSH TABLES;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
--source ../../include/mroonga/skip_mysql_5_5.inc
|
||||
--source ../../include/mroonga/skip_mariadb_5_5.inc
|
||||
--source ../../include/mroonga/skip_mariadb_10_1.inc
|
||||
--source include/have_innodb.inc
|
||||
--source ../../include/mroonga/have_mroonga.inc
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
--source ../../include/mroonga/skip_mysql_5_5.inc
|
||||
--source ../../include/mroonga/skip_mariadb_5_5.inc
|
||||
--source ../../include/mroonga/skip_mariadb_10_1.inc
|
||||
--source include/have_innodb.inc
|
||||
--source ../../include/mroonga/have_mroonga.inc
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
--source ../../include/mroonga/skip_mysql_5_5.inc
|
||||
--source ../../include/mroonga/skip_mariadb_5_5.inc
|
||||
--source ../../include/mroonga/skip_mariadb_10_1.inc
|
||||
--source include/have_innodb.inc
|
||||
--source ../../include/mroonga/have_mroonga.inc
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
--source ../../include/mroonga/skip_mysql_5_5.inc
|
||||
--source ../../include/mroonga/skip_mariadb_5_5.inc
|
||||
--source ../../include/mroonga/skip_mariadb_10_1.inc
|
||||
--source include/have_innodb.inc
|
||||
--source ../../include/mroonga/have_mroonga.inc
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Copyright(C) 2017 Naoya Murakami <naoya@createfield.com>
|
||||
# Copyright(C) 2017 Kouhei Sutou <kou@clear-code.com>
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -14,23 +15,36 @@
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
--source include/not_embedded.inc
|
||||
--source ../../include/mroonga/have_mroonga.inc
|
||||
--source ../../include/mroonga/have_mroonga_helper.inc
|
||||
--source ../../include/mroonga/load_mroonga_functions.inc
|
||||
|
||||
SET GLOBAL mroonga_enable_operations_recording = true;
|
||||
FLUSH TABLES;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS diaries;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE diaries (
|
||||
title TEXT
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO diaries VALUES("Research for Mroonga");
|
||||
|
||||
SELECT * FROM diaries;
|
||||
|
||||
DROP TABLE diaries;
|
||||
SELECT mroonga_command('truncate mroonga_operations');
|
||||
INSERT INTO diaries VALUES("Unlogged: Research for Mroonga");
|
||||
SELECT mroonga_command('load --table mroonga_operations --values "[{}]"');
|
||||
SELECT mroonga_command('select mroonga_operations --output_columns _id');
|
||||
|
||||
SET GLOBAL mroonga_enable_operations_recording = false;
|
||||
FLUSH TABLES;
|
||||
|
||||
SELECT mroonga_command('truncate mroonga_operations');
|
||||
INSERT INTO diaries VALUES("Logged: Research for Mroonga");
|
||||
SELECT mroonga_command('load --table mroonga_operations --values "[{}]"');
|
||||
SELECT mroonga_command('select mroonga_operations --output_columns _id');
|
||||
|
||||
DROP TABLE diaries;
|
||||
SELECT mroonga_command('truncate mroonga_operations');
|
||||
|
||||
SET GLOBAL mroonga_enable_operations_recording = default;
|
||||
FLUSH TABLES;
|
||||
|
||||
--source ../../include/mroonga/unload_mroonga_functions.inc
|
||||
--source ../../include/mroonga/have_mroonga_deinit.inc
|
||||
|
||||
2
storage/mroonga/packages/apt/Vagrantfile
vendored
2
storage/mroonga/packages/apt/Vagrantfile
vendored
@@ -16,7 +16,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
},
|
||||
{
|
||||
:id => "debian-stretch-i386",
|
||||
:box_url => "http://packages.groonga.org/tmp/debian-9.0-i386.virtualbox.box",
|
||||
:box => "bento/debian-9.1-i386",
|
||||
},
|
||||
{
|
||||
:id => "debian-stretch-amd64",
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
Name: mariadb-mroonga
|
||||
Version: @VERSION@
|
||||
Release: 2%{?dist}
|
||||
Release: 1%{?dist}
|
||||
Summary: A fast fulltext searchable storage engine for MariaDB
|
||||
|
||||
Group: Applications/Databases
|
||||
@@ -154,6 +154,9 @@ fi
|
||||
%doc mysql-mroonga-doc/*
|
||||
|
||||
%changelog
|
||||
* Thu Oct 12 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.07-1
|
||||
- new upstream release.
|
||||
|
||||
* Fri Sep 15 2017 Kouhei Sutou <kou@clear-code.com> - 7.06-2
|
||||
- rebuild against the latest MariaDB.
|
||||
|
||||
|
||||
@@ -163,6 +163,9 @@ fi
|
||||
%doc mysql-mroonga-doc/*
|
||||
|
||||
%changelog
|
||||
* Thu Oct 12 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.07-1
|
||||
- new upstream release.
|
||||
|
||||
* Tue Aug 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.06-1
|
||||
- new upstream release.
|
||||
|
||||
|
||||
@@ -184,6 +184,9 @@ fi
|
||||
%doc mysql-mroonga-doc/*
|
||||
|
||||
%changelog
|
||||
* Thu Oct 12 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.07-1
|
||||
- new upstream release.
|
||||
|
||||
* Tue Aug 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.06-1
|
||||
- new upstream release.
|
||||
|
||||
|
||||
@@ -179,6 +179,9 @@ fi
|
||||
%doc mysql-mroonga-doc/*
|
||||
|
||||
%changelog
|
||||
* Thu Oct 12 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.07-1
|
||||
- new upstream release.
|
||||
|
||||
* Tue Aug 29 2017 Kentaro Hayashi <hayashi@clear-code.com> - 7.06-1
|
||||
- new upstream release.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
MROONGA_BASE = $(PACKAGE)-$(VERSION)
|
||||
MROONGA_TAR_GZ = $(MROONGA_BASE).tar.gz
|
||||
|
||||
GROONGA_VERSION = 7.0.6
|
||||
GROONGA_VERSION = 7.0.7
|
||||
GROONGA_BASE = groonga-$(GROONGA_VERSION)
|
||||
GROONGA_TAR_GZ = $(GROONGA_BASE).tar.gz
|
||||
|
||||
@@ -11,7 +11,7 @@ GROONGA_NORMALIZER_MYSQL_BASE = \
|
||||
GROONGA_NORMALIZER_MYSQL_TAR_GZ = \
|
||||
$(GROONGA_NORMALIZER_MYSQL_BASE).tar.gz
|
||||
|
||||
MARIADB_VERSION = 10.1.26
|
||||
MARIADB_VERSION = 10.1.28
|
||||
MARIADB_BASE = mariadb-$(MARIADB_VERSION)
|
||||
MARIADB_TAR_GZ = $(MARIADB_BASE).tar.gz
|
||||
|
||||
|
||||
2
storage/mroonga/packages/yum/Vagrantfile
vendored
2
storage/mroonga/packages/yum/Vagrantfile
vendored
@@ -16,7 +16,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
},
|
||||
{
|
||||
:id => "centos-7-x86_64",
|
||||
:box => "bento/centos-7.3",
|
||||
:box => "bento/centos-7.4",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
7.6
|
||||
7.7
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright(C) 2010 Tetsuro IKEDA
|
||||
# Copyright(C) 2010-2015 Kouhei Sutou <kou@clear-code.com>
|
||||
# Copyright(C) 2010-2017 Kouhei Sutou <kou@clear-code.com>
|
||||
# Copyright(C) 2011 Kazuhiko
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
@@ -228,7 +228,6 @@ mysql_test_run_args=""
|
||||
if [ "${percona}" != "yes" ]; then
|
||||
mysql_test_run_args="${mysql_test_run_args} --mem"
|
||||
fi
|
||||
mysql_test_run_args="${mysql_test_run_args} --no-check-testcases"
|
||||
mysql_test_run_args="${mysql_test_run_args} --parallel=${n_processors}"
|
||||
mysql_test_run_args="${mysql_test_run_args} --retry=1"
|
||||
mysql_test_run_args="${mysql_test_run_args} --suite=${test_suite_names}"
|
||||
|
||||
@@ -22,7 +22,8 @@ set -e
|
||||
# export GROONGA_MASTER=yes
|
||||
# export GROONGA_NORMALIZER_MYSQL_MASTER=yes
|
||||
|
||||
mariadb_download_base=http://mirror.jmu.edu/pub/mariadb
|
||||
#mariadb_download_base=http://mirror.jmu.edu/pub/mariadb
|
||||
mariadb_download_base=http://ftp.osuosl.org/pub/mariadb
|
||||
|
||||
version=$(echo "$MYSQL_VERSION" | sed -r -e 's/^(mysql|mariadb|percona-server)-//')
|
||||
series=$(echo "$version" | sed -r -e 's/^([0-9]+\.[0-9]+).*$/\1/g')
|
||||
|
||||
@@ -25,7 +25,8 @@ include_directories(
|
||||
${LIBZSTD_INCLUDE_DIRS}
|
||||
${MESSAGE_PACK_INCLUDE_DIRS})
|
||||
|
||||
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am LIBGROONGA_SOURCES)
|
||||
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/c_sources.am LIBGROONGA_C_SOURCES)
|
||||
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/cpp_sources.am LIBGROONGA_CPP_SOURCES)
|
||||
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/dat/sources.am LIBGRNDAT_SOURCES)
|
||||
string(REGEX REPLACE "([^;]+)" "dat/\\1"
|
||||
LIBGRNDAT_SOURCES "${LIBGRNDAT_SOURCES}")
|
||||
@@ -51,23 +52,27 @@ else()
|
||||
endif()
|
||||
|
||||
set_source_files_properties(
|
||||
${LIBGROONGA_SOURCES}
|
||||
${LIBGROONGA_C_SOURCES}
|
||||
${LIBGRNMRB_SOURCES}
|
||||
${LIBGRNPROC_SOURCES}
|
||||
${LIBGRNTS_SOURCES}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
|
||||
set_source_files_properties(
|
||||
${LIBGROONGA_SOURCES}
|
||||
${LIBGROONGA_C_SOURCES}
|
||||
${LIBGROONGA_CPP_SOURCES}
|
||||
${LIBGRNMRB_SOURCES}
|
||||
PROPERTIES
|
||||
COMPILE_DEFINITIONS "${MRUBY_DEFINITIONS}")
|
||||
set_source_files_properties(dat.cpp ${LIBGRNDAT_SOURCES}
|
||||
set_source_files_properties(
|
||||
${LIBGROONGA_CPP_SOURCES}
|
||||
${LIBGRNDAT_SOURCES}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS}")
|
||||
|
||||
set(GRN_ALL_SOURCES
|
||||
${LIBGROONGA_SOURCES}
|
||||
${LIBGROONGA_C_SOURCES}
|
||||
${LIBGROONGA_CPP_SOURCES}
|
||||
${LIBGRNDAT_SOURCES}
|
||||
${LIBGRNMRB_SOURCES}
|
||||
${LIBGRNPROC_SOURCES}
|
||||
|
||||
@@ -36,7 +36,11 @@ DEFAULT_INCLUDES = \
|
||||
|
||||
DEFS += -D_REENTRANT $(GRN_DEFS) -DGRN_DAT_EXPORT
|
||||
|
||||
include sources.am
|
||||
include c_sources.am
|
||||
include cpp_sources.am
|
||||
libgroonga_la_SOURCES = \
|
||||
$(libgroonga_c_sources) \
|
||||
$(libgroonga_cpp_source)
|
||||
|
||||
#nfkc.c:
|
||||
# $(RUBY) nfkc.rb --impl=table
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
libgroonga_la_SOURCES = \
|
||||
libgroonga_c_sources = \
|
||||
alloc.c \
|
||||
grn_alloc.h \
|
||||
arrow.cpp \
|
||||
cache.c \
|
||||
grn_cache.h \
|
||||
column.c \
|
||||
@@ -15,7 +14,6 @@ libgroonga_la_SOURCES = \
|
||||
grn_ctx_impl.h \
|
||||
ctx_impl_mrb.c \
|
||||
grn_ctx_impl_mrb.h \
|
||||
dat.cpp \
|
||||
grn_dat.h \
|
||||
db.c \
|
||||
grn_db.h \
|
||||
3
storage/mroonga/vendor/groonga/lib/cpp_sources.am
vendored
Normal file
3
storage/mroonga/vendor/groonga/lib/cpp_sources.am
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
libgroonga_cpp_source = \
|
||||
arrow.cpp \
|
||||
dat.cpp
|
||||
129
storage/mroonga/vendor/groonga/tools/groonga-benchmark-indexing.rb
vendored
Executable file
129
storage/mroonga/vendor/groonga/tools/groonga-benchmark-indexing.rb
vendored
Executable file
@@ -0,0 +1,129 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require "fileutils"
|
||||
require "json"
|
||||
require "optparse"
|
||||
|
||||
class IndexingBenchmarker
|
||||
def initialize
|
||||
@groonga = "groonga"
|
||||
@database_path = nil
|
||||
@benchmark_database_dir = detect_benchmark_database_dir
|
||||
end
|
||||
|
||||
def run
|
||||
catch(:run) do
|
||||
parse_options!
|
||||
end
|
||||
|
||||
dump_no_indexes = dump("dump-no-indexes.grn",
|
||||
"--dump_indexes", "no")
|
||||
dump_only_indexes = dump("dump-only-indexes.grn",
|
||||
"--dump_plugins", "no",
|
||||
"--dump_schema", "no",
|
||||
"--dump_records", "no",
|
||||
"--dump_configs", "no")
|
||||
dump_no_records = dump("dump-no-records.grn",
|
||||
"--dump_records", "no")
|
||||
dump_only_records = dump("dump-only-records.grn",
|
||||
"--dump_plugins", "no",
|
||||
"--dump_schema", "no",
|
||||
"--dump_indexes", "no",
|
||||
"--dump_configs", "no")
|
||||
|
||||
create_benchmark_database do
|
||||
p [:load_record, measure(dump_no_indexes)]
|
||||
p [:static_index_creation, measure(dump_only_indexes)]
|
||||
end
|
||||
|
||||
create_benchmark_database do
|
||||
p [:create_schema, measure(dump_no_records)]
|
||||
p [:load_record_and_create_index, measure(dump_only_records)]
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
private
|
||||
def detect_benchmark_database_dir
|
||||
candiates = [
|
||||
"/dev/shm",
|
||||
"tmp",
|
||||
]
|
||||
candiates.find do |candidate|
|
||||
File.exist?(candidate)
|
||||
end
|
||||
end
|
||||
|
||||
def benchmark_database_path
|
||||
"#{@benchmark_database_dir}/bench-db/db"
|
||||
end
|
||||
|
||||
def parse_options!
|
||||
option_parser = OptionParser.new do |parser|
|
||||
parser.banner += " SOURCE_DATABASE"
|
||||
|
||||
parser.on("--groonga=PATH",
|
||||
"Use PATH as groonga command path") do |path|
|
||||
@groonga = path
|
||||
end
|
||||
|
||||
parser.on("--benchmark-database-dir=DIR",
|
||||
"Use DIR to put benchmark database") do |dir|
|
||||
@benchmark_database_dir = dir
|
||||
end
|
||||
end
|
||||
|
||||
@database_path, = option_parser.parse!(ARGV)
|
||||
if @database_path.nil?
|
||||
puts(option_parser)
|
||||
throw(:run)
|
||||
end
|
||||
end
|
||||
|
||||
def dump(path, *dump_options)
|
||||
return path if File.exist?(path)
|
||||
unless system(@groonga,
|
||||
@database_path,
|
||||
"dump",
|
||||
*dump_options,
|
||||
:out => path)
|
||||
raise "failed to dump: #{dump_options.inspect}"
|
||||
end
|
||||
path
|
||||
end
|
||||
|
||||
def create_benchmark_database
|
||||
dir = File.dirname(benchmark_database_path)
|
||||
FileUtils.rm_rf(dir)
|
||||
FileUtils.mkdir_p(dir)
|
||||
system(@groonga,
|
||||
"-n", benchmark_database_path,
|
||||
"shutdown",
|
||||
:out => IO::NULL)
|
||||
begin
|
||||
yield
|
||||
ensure
|
||||
FileUtils.rm_rf(dir)
|
||||
end
|
||||
end
|
||||
|
||||
def measure(dump_path)
|
||||
result = "result"
|
||||
begin
|
||||
system(@groonga,
|
||||
"--file", dump_path,
|
||||
benchmark_database_path,
|
||||
:out => result)
|
||||
File.open(result) do |output|
|
||||
output.each_line.inject(0) do |result, line|
|
||||
result + JSON.parse(line)[0][2]
|
||||
end
|
||||
end
|
||||
ensure
|
||||
FileUtils.rm_f(result)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
exit(IndexingBenchmarker.new.run)
|
||||
@@ -1 +1 @@
|
||||
7.06
|
||||
7.07
|
||||
@@ -1 +1 @@
|
||||
0x0706
|
||||
0x0707
|
||||
@@ -1 +1 @@
|
||||
6
|
||||
7
|
||||
Reference in New Issue
Block a user