Commit f5dabd7a authored by Kentoku SHIBA's avatar Kentoku SHIBA

Update Mroonga to the latest version on 2015-02-17T13:34:27+0900

parent 162446a6
# -*- indent-tabs-mode: nil -*-
#
# Copyright(C) 2012-2014 Kouhei Sutou <kou@clear-code.com>
# Copyright(C) 2012-2015 Kouhei Sutou <kou@clear-code.com>
# Copyright(C) 2013 Kentoku SHIBA
#
# This library is free software; you can redistribute it and/or
......@@ -75,6 +75,28 @@ file(READ ${MRN_SOURCE_DIR}/version_in_hex MRN_VERSION_IN_HEX)
file(READ ${MRN_SOURCE_DIR}/plugin_version MRN_PLUGIN_VERSION)
if(MRN_GROONGA_BUNDLED)
option(MRN_GROONGA_EMBED
"Embed libgroonga"
ON)
if(MRN_GROONGA_EMBED)
set(GRN_EMBED ON)
endif()
set(MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR
"${MRN_BUNDLED_GROONGA_DIR}/vendor/plugins/groonga-normalizer-mysql")
option(MRN_GROONGA_NORMALIZER_MYSQL_EMBED
"Embed groonga-normalizer-mysql Groonga plugin"
ON)
if(EXISTS ${MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR})
set(GROONGA_NORMALIZER_MYSQL_FOUND ON)
else()
set(GROONGA_NORMALIZER_MYSQL_FOUND OFF)
set(MRN_GROONGA_NORMALIZER_MYSQL_EMBED OFF)
endif()
if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED)
set(GROONGA_NORMALIZER_MYSQL_EMBED ON)
endif()
add_subdirectory("${MRN_BUNDLED_GROONGA_RELATIVE_DIR}")
else()
file(READ ${MRN_SOURCE_DIR}/required_groonga_version REQUIRED_GROONGA_VERSION)
......@@ -98,15 +120,21 @@ set(MRN_C_COMPILE_FLAGS "")
set(MRN_CXX_COMPILE_FLAGS "")
macro(mrn_check_cflag flag)
check_c_compiler_flag(${flag} "HAVE_C_${flag}")
if(HAVE_C_${flag})
string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
set(temporary_variable_name "CFLAG${temporary_variable_name}")
check_c_compiler_flag(${flag} ${temporary_variable_name})
if(${temporary_variable_name})
set(MRN_C_COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS} ${flag}")
endif()
endmacro()
macro(mrn_check_cxxflag flag)
check_cxx_compiler_flag(${flag} "HAVE_CXX_${flag}")
if(HAVE_CXX_${flag})
string(REGEX REPLACE "[-=]" "_" temporary_variable_name ${flag})
string(TOUPPER "${temporary_variable_name}" temporary_variable_name)
set(temporary_variable_name "CXXFLAG${temporary_variable_name}")
check_cxx_compiler_flag(${flag} ${temporary_variable_name})
if(${temporary_variable_name})
set(MRN_CXX_COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS} ${flag}")
endif()
endmacro()
......@@ -122,7 +150,7 @@ else()
set(MRN_RELATIVE_DIR_PREFIX "")
endif()
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am MROONGA_SOURCES)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am MRN_SOURCES)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/lib/libmrn_no_mysql_sources.am
LIBMRN_NO_MYSQL_SOURCES)
string(REGEX REPLACE "([^;]+)" "${MRN_RELATIVE_DIR_PREFIX}lib/\\1"
......@@ -157,11 +185,18 @@ else()
set(MYSQL_REGEX_INCLUDE_DIR "${MYSQL_SOURCE_DIR}/regex")
endif()
if(EXISTS "${MYSQL_SOURCE_DIR}/extra/rapidjson")
set(MYSQL_RAPIDJSON_INCLUDE_DIR "${MYSQL_SOURCE_DIR}/extra/rapidjson/include")
else()
set(MYSQL_RAPIDJSON_INCLUDE_DIR)
endif()
set(MYSQL_INCLUDE_DIRS
"${MYSQL_BUILD_DIR}/include"
"${MYSQL_SOURCE_DIR}/sql"
"${MYSQL_SOURCE_DIR}/include"
"${MYSQL_REGEX_INCLUDE_DIR}"
"${MYSQL_RAPIDJSON_INCLUDE_DIR}"
"${MYSQL_SOURCE_DIR}")
if(MRN_BUNDLED)
......@@ -190,6 +225,12 @@ else()
set_mysql_config_value("--version" MYSQL_VERSION)
endif()
if(${MYSQL_VERSION} VERSION_LESS "5.5.0")
message(FATAL_ERROR
"Mroonga doesn't support MySQL < 5.5.0: <${MYSQL_VERSION}>")
return()
endif()
if(${MYSQL_VERSION} VERSION_GREATER "10.0.0" AND
${MYSQL_VERSION} VERSION_LESS "10.0.9")
message(FATAL_ERROR
......@@ -201,10 +242,14 @@ if(MRN_GROONGA_BUNDLED)
set(GROONGA_INCLUDE_DIRS "${MRN_BUNDLED_GROONGA_DIR}/include")
set(GROONGA_LIBRARY_DIRS "${MRN_BUNDLED_GROONGA_DIR}/lib")
set(GROONGA_LIBRARIES "libgroonga")
if(EXISTS "${MRN_BUNDLED_GROONGA_DIR}/vendor/plugins/groonga-normalizer-mysql")
set(GROONGA_NORMALIZER_MYSQL_FOUND TRUE)
else()
set(GROONGA_NORMALIZER_MYSQL_FOUND FALSE)
set(MRN_LIBRARY_DIRS ${GROONGA_LIBRARY_DIRS})
set(MRN_LIBRARIES ${GROONGA_LIBRARIES})
if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED)
set(MRN_LIBRARY_DIRS
${MRN_LIBRARY_DIRS}
"${MRN_BUNDLED_GROONGA_NORMALIZER_MYSQL_DIR}/normalizers")
set(MRN_LIBRARIES ${MRN_LIBRARIES} mysql_normalizer)
endif()
else()
include(FindPkgConfig)
......@@ -213,12 +258,6 @@ else()
"groonga-normalizer-mysql >= ${REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION}")
endif()
if(GROONGA_NORMALIZER_MYSQL_FOUND AND MRN_GROONGA_BUNDLED)
read_file_list(${MRN_BUNDLED_GROONGA_DIR}/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_sources.am MRN_GRN_NORMALIZER_MYSQL_SOURCES)
string(REGEX REPLACE "([^;]+)" "${MRN_BUNDLED_GROONGA_DIR}/vendor/plugins/groonga-normalizer-mysql/normalizers/\\1"
MRN_GRN_NORMALIZER_MYSQL_SOURCES "${MRN_GRN_NORMALIZER_MYSQL_SOURCES}")
endif()
include_directories(
"${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}"
......@@ -235,28 +274,22 @@ else()
"${MYSQL_SERVICES_LIB_DIR}")
endif()
link_directories(
${GROONGA_LIBRARY_DIRS}
${MRN_LIBRARY_DIRS}
${MYSQL_LIBRARY_DIRS})
set(MRN_ALL_SOURCES
${MRN_SOURCES}
${MRN_UDF_SOURCES}
${LIBMRN_NO_MYSQL_SOURCES}
${LIBMRN_NEED_MYSQL_SOURCES})
if(MRN_BUNDLED)
if(GROONGA_NORMALIZER_MYSQL_FOUND AND MRN_GROONGA_BUNDLED)
mysql_add_plugin(mroonga
"${MROONGA_SOURCES};${MRN_UDF_SOURCES};${MRN_GRN_NORMALIZER_MYSQL_SOURCES};${LIBMRN_NEED_MYSQL_SOURCES};${LIBMRN_NO_MYSQL_SOURCES}"
STORAGE_ENGINE MODULE_ONLY
LINK_LIBRARIES ${GROONGA_LIBRARIES})
else()
mysql_add_plugin(mroonga
"${MROONGA_SOURCES};${MRN_UDF_SOURCES};${LIBMRN_NEED_MYSQL_SOURCES};${LIBMRN_NO_MYSQL_SOURCES}"
${MRN_ALL_SOURCES}
STORAGE_ENGINE MODULE_ONLY
LINK_LIBRARIES ${GROONGA_LIBRARIES})
endif()
else()
LINK_LIBRARIES ${MRN_LIBRARIES})
else()
add_library(mroonga MODULE
${MROONGA_SOURCES}
${MRN_UDF_SOURCES}
${LIBMRN_NO_MYSQL_SOURCES}
${LIBMRN_NEED_MYSQL_SOURCES})
add_library(mroonga MODULE ${MRN_ALL_SOURCES})
set(MYSQL_LIBRARIES "mysqlservices")
target_link_libraries(mroonga ${GROONGA_LIBRARIES} ${MYSQL_LIBRARIES})
......@@ -303,14 +336,14 @@ else()
mrn_check_cxxflag("-fno-rtti")
mrn_check_cxxflag("-felide-constructors")
endif()
set_source_files_properties(${MROONGA_SOURCES} PROPERTIES
set_source_files_properties(${MRN_SOURCES} PROPERTIES
COMPILE_FLAGS "${MYSQL_CFLAGS} ${MRN_CXX_COMPILE_FLAGS}")
set_source_files_properties(${LIBMRN_NEED_MYSQL_SOURCES} PROPERTIES
COMPILE_FLAGS "${MYSQL_CFLAGS} ${MRN_CXX_COMPILE_FLAGS}")
set_source_files_properties(${MRN_UDF_SOURCES} PROPERTIES
COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS}")
COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS}")
set_source_files_properties(${LIBMRN_NO_MYSQL_SOURCES} PROPERTIES
COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS}")
COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS}")
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
set_target_properties(mroonga PROPERTIES
......@@ -321,19 +354,20 @@ else()
endif()
if(GROONGA_NORMALIZER_MYSQL_FOUND)
set(WITH_GROONGA_NORMALIZER_MYSQL 1)
ADD_DEFINITIONS(-DWITH_GROONGA_NORMALIZER_MYSQL=1)
if(MRN_GROONGA_BUNDLED)
ADD_DEFINITIONS(-DGROONGA_NORMALIZER_MYSQL_PLUGIN_IS_BUNDLED_STATIC=1)
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "WITH_GROONGA_NORMALIZER_MYSQL=1")
if(MRN_GROONGA_NORMALIZER_MYSQL_EMBED)
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "MRN_GROONGA_NORMALIZER_MYSQL_EMBED")
else()
set(GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME \"normalizers/mysql\")
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME=\"normalizers/mysql\"")
endif()
endif()
set(MRN_DEFAULT_PARSER "TokenBigram" CACHE STRING "The default fulltext parser")
ADD_DEFINITIONS(-DMRN_PARSER_DEFAULT="${MRN_DEFAULT_PARSER}")
set_property(TARGET mroonga APPEND PROPERTY
COMPILE_DEFINITIONS "MRN_PARSER_DEFAULT=\"${MRN_DEFAULT_PARSER}\"")
configure_file(
"${PROJECT_SOURCE_DIR}/mrn_version.h.in"
......
......@@ -67,8 +67,6 @@ update-latest-release: misc
misc/update-latest-release.rb \
$(PACKAGE) $(OLD_RELEASE) $(OLD_RELEASE_DATE) \
$(VERSION) $(NEW_RELEASE_DATE) \
packages/rpm/fedora/mysql-mroonga.spec.in \
packages/rpm/fedora/mariadb-mroonga.spec.in \
packages/rpm/centos/mariadb-mroonga.spec.in \
packages/rpm/centos/mysql55-mroonga.spec.in \
packages/rpm/centos/mysql56-community-mroonga.spec.in \
......
version: "{build}"
clone_depth: 10
install:
- cd ..
- choco install curl 7zip.commandline
- curl -O http://mirror.jmu.edu/pub/mariadb/mariadb-10.0.16/source/mariadb-10.0.16.tar.gz
- 7z x mariadb-10.0.16.tar.gz
- 7z x mariadb-10.0.16.tar > nul
- cd mariadb-10.0.16
- rmdir /S /Q storage\mroonga\
- move ..\mroonga storage\mroonga
- git clone --quiet --depth 1 https://github.com/groonga/groonga.git ..\groonga
- rmdir /S /Q ..\groonga\test\
- mkdir storage\mroonga\vendor
- move ..\groonga storage\mroonga\vendor\groonga
- git clone --quiet --depth 1 https://github.com/groonga/groonga-normalizer-mysql.git storage\mroonga\vendor\groonga\vendor\plugins\groonga-normalizer-mysql
build_script:
- "echo # > win\\packaging\\CMakeLists.txt"
- cmake . -G "Visual Studio 12 Win64"
-DCMAKE_BUILD_TYPE=Debug
-DWITHOUT_ARCHIVE=ON
-DWITHOUT_BLACKHOLE=ON
-DWITHOUT_CASSANDRA=ON
-DWITHOUT_CONNECT=ON
-DWITHOUT_CSV=ON
-DWITHOUT_EXAMPLE=ON
-DWITHOUT_FEDERATED=ON
-DWITHOUT_FEDERATEDX=ON
-DWITHOUT_HEAP=ON
-DWITHOUT_INNOBASE=ON
-DWITHOUT_MYISAM=ON
-DWITHOUT_MYISAMMRG=ON
-DWITHOUT_OQGRAPH=ON
-DWITHOUT_PERFSCHEMA=OFF
-DWITHOUT_SEQUENCE=ON
-DWITHOUT_SPHINX=ON
-DWITHOUT_SPIDER=ON
-DWITHOUT_TEST_SQL_DISCOVERY=ON
-DWITHOUT_TOKUDB=ON
-DWITHOUT_XTRADB=ON
-DWITH_UNIT_TESTS=OFF
- cmake --build . --config Debug
notifications:
- provider: Email
to:
- groonga-mysql-commit@lists.sourceforge.jp
- kou@clear-code.com
on_build_status_changed: true
test: off
......@@ -174,6 +174,10 @@ AC_DEFUN([CONFIG_OPTION_MYSQL],[
MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_build_dir/include"
MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/sql"
MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/include"
if test -d "$ac_mysql_source_dir/extra/rapidjson"; then
mysql_rapidjson_include_dir="$ac_mysql_source_dir/extra/rapidjson/include"
MYSQL_INCLUDES="$MYSQL_INCLUDES -I$mysql_rapidjson_include_dir"
fi
if test -d "$ac_mysql_source_dir/pcre"; then
mysql_regex_include_dir="$ac_mysql_source_dir/pcre"
else
......@@ -461,7 +465,6 @@ AC_CONFIG_FILES([
packages/Makefile
packages/rpm/Makefile
packages/rpm/centos/Makefile
packages/rpm/fedora/Makefile
packages/yum/Makefile
packages/apt/Makefile
packages/source/Makefile
......@@ -486,8 +489,6 @@ AC_OUTPUT([
packages/rpm/centos/mysql55-mroonga.spec
packages/rpm/centos/mysql56-community-mroonga.spec
packages/rpm/centos/mariadb-mroonga.spec
packages/rpm/fedora/mysql-mroonga.spec
packages/rpm/fedora/mariadb-mroonga.spec
packages/yum/env.sh
data/install.sql
])
This diff is collapsed.
......@@ -263,7 +263,6 @@ private:
grn_obj **grn_column_ranges;
grn_obj **grn_index_tables;
grn_obj **grn_index_columns;
bool grn_table_is_referenced;
// buffers
grn_obj encoded_key_buffer;
......@@ -641,7 +640,7 @@ private:
void storage_store_field_geometry(Field *field,
const char *value, uint value_length);
void storage_store_field(Field *field, const char *value, uint value_length);
void storage_store_field_column(Field *field,
void storage_store_field_column(Field *field, bool is_primary_key,
int nth_column, grn_id record_id);
void storage_store_fields(uchar *buf, grn_id record_id);
void storage_store_fields_for_prep_update(const uchar *old_data,
......@@ -742,7 +741,6 @@ private:
int wrapper_open(const char *name, int mode, uint test_if_locked);
int wrapper_open_indexes(const char *name);
int storage_open(const char *name, int mode, uint test_if_locked);
void update_grn_table_is_referenced();
int open_table(const char *name);
int storage_open_columns(void);
int storage_open_indexes(const char *name);
......@@ -785,7 +783,9 @@ private:
grn_obj *index_column);
int storage_write_row_multiple_column_indexes(uchar *buf, grn_id record_id);
int storage_write_row_unique_index(uchar *buf,
KEY *key_info, grn_obj *index_table,
KEY *key_info,
grn_obj *index_table,
grn_obj *index_column,
grn_id *key_id);
int storage_write_row_unique_indexes(uchar *buf);
int wrapper_get_record_id(uchar *data, grn_id *record_id, const char *context);
......@@ -904,6 +904,7 @@ private:
grn_obj *match_columns,
uint *consumed_keyword_length,
grn_obj *tmp_objects);
grn_expr_flags expr_flags_in_boolean_mode();
grn_rc generic_ft_init_ext_prepare_expression_in_boolean_mode(
struct st_mrn_ft_info *info,
String *key,
......@@ -1029,6 +1030,7 @@ private:
bool storage_is_crashed() const;
bool wrapper_auto_repair(int error) const;
bool storage_auto_repair(int error) const;
int generic_disable_index(int i, KEY *key_info);
int wrapper_disable_indexes(uint mode);
int storage_disable_indexes(uint mode);
int wrapper_enable_indexes(uint mode);
......
......@@ -26,6 +26,8 @@
#include "mrn_lock.hpp"
#include "mrn_path_mapper.hpp"
#include <groonga/plugin.h>
// for debug
#define MRN_CLASS_NAME "mrn::DatabaseManager"
......@@ -38,19 +40,19 @@
# define MRN_MKDIR(pathname, mode) mkdir((pathname), (mode))
#endif
extern "C" {
grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(init, normalizers_mysql)(grn_ctx *ctx);
grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(register, normalizers_mysql)(grn_ctx *ctx);
}
namespace mrn {
DatabaseManager::DatabaseManager(grn_ctx *ctx)
DatabaseManager::DatabaseManager(grn_ctx *ctx, mysql_mutex_t *mutex)
: ctx_(ctx),
cache_(NULL),
mutex_(),
mutex_initialized_(false) {
mutex_(mutex) {
}
DatabaseManager::~DatabaseManager(void) {
if (mutex_initialized_) {
pthread_mutex_destroy(&mutex_);
}
if (cache_) {
void *db_address;
GRN_HASH_EACH(ctx_, cache_, id, NULL, 0, &db_address, {
......@@ -75,13 +77,6 @@ namespace mrn {
DBUG_RETURN(false);
}
if (pthread_mutex_init(&mutex_, NULL) != 0) {
GRN_LOG(ctx_, GRN_LOG_ERROR,
"failed to initialize mutex for opened database cache hash table");
DBUG_RETURN(false);
}
mutex_initialized_ = true;
DBUG_RETURN(true);
}
......@@ -92,7 +87,7 @@ namespace mrn {
*db = NULL;
mrn::PathMapper mapper(path);
mrn::Lock lock(&mutex_);
mrn::Lock lock(mutex_);
error = mrn::encoding::set(ctx_, system_charset_info);
if (error) {
......@@ -145,7 +140,7 @@ namespace mrn {
MRN_DBUG_ENTER_METHOD();
mrn::PathMapper mapper(path);
mrn::Lock lock(&mutex_);
mrn::Lock lock(mutex_);
grn_id id;
void *db_address;
......@@ -171,7 +166,7 @@ namespace mrn {
MRN_DBUG_ENTER_METHOD();
mrn::PathMapper mapper(path);
mrn::Lock lock(&mutex_);
mrn::Lock lock(mutex_);
grn_id id;
void *db_address;
......@@ -211,7 +206,7 @@ namespace mrn {
int error = 0;
mrn::Lock lock(&mutex_);
mrn::Lock lock(mutex_);
grn_hash_cursor *cursor;
cursor = grn_hash_cursor_open(ctx_, cache_,
......@@ -323,15 +318,12 @@ namespace mrn {
if (mysql_normalizer) {
grn_obj_unlink(ctx_, mysql_normalizer);
} else {
#ifdef GROONGA_NORMALIZER_MYSQL_PLUGIN_IS_BUNDLED_STATIC
char ref_path[FN_REFLEN + 1], *tmp;
tmp = strmov(ref_path, opt_plugin_dir);
tmp = strmov(tmp, "/ha_mroonga");
strcpy(tmp, SO_EXT);
grn_plugin_register_by_path(ctx_, ref_path);
#else
# ifdef MRN_GROONGA_NORMALIZER_MYSQL_EMBED
GRN_PLUGIN_IMPL_NAME_TAGGED(init, normalizers_mysql)(ctx_);
GRN_PLUGIN_IMPL_NAME_TAGGED(register, normalizers_mysql)(ctx_);
# else
grn_plugin_register(ctx_, GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME);
#endif
# endif
}
}
#endif
......
......@@ -27,7 +27,7 @@
namespace mrn {
class DatabaseManager {
public:
DatabaseManager(grn_ctx *ctx);
DatabaseManager(grn_ctx *ctx, mysql_mutex_t *mutex);
~DatabaseManager(void);
bool init(void);
int open(const char *path, grn_obj **db);
......@@ -38,8 +38,7 @@ namespace mrn {
private:
grn_ctx *ctx_;
grn_hash *cache_;
pthread_mutex_t mutex_;
bool mutex_initialized_;
mysql_mutex_t *mutex_;
void mkdir_p(const char *directory);
void ensure_database_directory(void);
......
......@@ -20,12 +20,12 @@
#include "mrn_lock.hpp"
namespace mrn {
Lock::Lock(pthread_mutex_t *mutex)
Lock::Lock(mysql_mutex_t *mutex)
: mutex_(mutex) {
pthread_mutex_lock(mutex_);
mysql_mutex_lock(mutex_);
}
Lock::~Lock() {
pthread_mutex_unlock(mutex_);
mysql_mutex_unlock(mutex_);
}
}
......@@ -26,10 +26,10 @@
namespace mrn {
class Lock {
public:
Lock(pthread_mutex_t *mutex);
Lock(mysql_mutex_t *mutex);
~Lock();
private:
pthread_mutex_t *mutex_;
mysql_mutex_t *mutex_;
};
}
......
......@@ -35,10 +35,10 @@ namespace mrn {
};
~Parameter() {
if (key_) {
my_free(key_, MYF(0));
my_free(key_);
}
if (value_) {
my_free(value_, MYF(0));
my_free(value_);
}
};
};
......
......@@ -2,7 +2,7 @@
/*
Copyright(C) 2010 Tetsuro IKEDA
Copyright(C) 2011-2013 Kentoku SHIBA
Copyright(C) 2011-2012 Kouhei Sutou <kou@clear-code.com>
Copyright(C) 2011-2015 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
......@@ -184,6 +184,9 @@ namespace mrn {
int i = len, j = 0;
for (; mysql_path_[--i] != FN_LIBCHAR ;) {}
for (; i < len ;) {
if (len - i - 1 >= 3 && strncmp(mysql_path_ + i + 1, "#P#", 3) == 0) {
break;
}
mysql_table_name_[j++] = mysql_path_[++i];
}
mysql_table_name_[j] = '\0';
......
......@@ -28,5 +28,11 @@
#define ER_MRN_ERROR_FROM_GROONGA_STR "Error from Groonga [%s]"
#define ER_MRN_INVALID_NULL_VALUE_NUM 16505
#define ER_MRN_INVALID_NULL_VALUE_STR "NULL value can't be used for %s"
#define ER_MRN_UNSUPPORTED_COLUMN_FLAG_NUM 16506
#define ER_MRN_UNSUPPORTED_COLUMN_FLAG_STR \
"The column flag '%-.64s' is unsupported. It is ignored"
#define ER_MRN_INVALID_COLUMN_FLAG_NUM 16507
#define ER_MRN_INVALID_COLUMN_FLAG_STR \
"The column flag '%-.64s' is invalid. '%-64s' is used instead"
#endif /* MRN_ERR_H_ */
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
Copyright(C) 2011-2014 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
......@@ -22,15 +22,6 @@
#include "mrn_mysql.h"
#if MYSQL_VERSION_ID >= 50500
# define my_free(PTR, FLAG) my_free(PTR)
#endif
#if MYSQL_VERSION_ID < 50500
# define mysql_mutex_lock(mutex) pthread_mutex_lock(mutex)
# define mysql_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
#endif
#if MYSQL_VERSION_ID >= 50604
# define MRN_HAVE_MYSQL_TYPE_TIMESTAMP2
# define MRN_HAVE_MYSQL_TYPE_DATETIME2
......
......@@ -61,14 +61,16 @@ extern "C" {
#endif
extern HASH mrn_open_tables;
extern pthread_mutex_t mrn_open_tables_mutex;
extern mysql_mutex_t mrn_open_tables_mutex;
extern HASH mrn_long_term_share;
extern pthread_mutex_t mrn_long_term_share_mutex;
extern mysql_mutex_t mrn_long_term_share_mutex;
extern char *mrn_default_parser;
extern char *mrn_default_wrapper_engine;
extern handlerton *mrn_hton_ptr;
extern HASH mrn_allocated_thds;
extern pthread_mutex_t mrn_allocated_thds_mutex;
extern mysql_mutex_t mrn_allocated_thds_mutex;
extern PSI_mutex_key mrn_share_mutex_key;
extern PSI_mutex_key mrn_long_term_share_auto_inc_mutex_key;
static char *mrn_get_string_between_quote(const char *ptr)
{
......@@ -424,7 +426,7 @@ int mrn_parse_table_param(MRN_SHARE *share, TABLE *table)
}
}
my_free(params_string, MYF(0));
my_free(params_string);
params_string = NULL;
}
}
......@@ -455,7 +457,7 @@ int mrn_parse_table_param(MRN_SHARE *share, TABLE *table)
!strncasecmp(share->engine, MRN_GROONGA_STR, MRN_GROONGA_LEN)
)
) {
my_free(share->engine, MYF(0));
my_free(share->engine);
share->engine = NULL;
share->engine_length = 0;
} else {
......@@ -474,7 +476,7 @@ int mrn_parse_table_param(MRN_SHARE *share, TABLE *table)
error:
if (params_string)
my_free(params_string, MYF(0));
my_free(params_string);
DBUG_RETURN(error);
}
......@@ -500,7 +502,7 @@ int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i)
if (key_info->comment.length == 0)
{
if (share->key_parser[i]) {
my_free(share->key_parser[i], MYF(0));
my_free(share->key_parser[i]);
}
if (
!(share->key_parser[i] = my_strdup(mrn_default_parser, MYF(MY_WME)))
......@@ -574,12 +576,12 @@ int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i)
}
if (param_string)
my_free(param_string, MYF(0));
my_free(param_string);
DBUG_RETURN(0);
error:
if (param_string)
my_free(param_string, MYF(0));
my_free(param_string);
#if MYSQL_VERSION_ID >= 50500
error_alloc_param_string:
#endif
......@@ -677,12 +679,12 @@ int mrn_add_column_param(MRN_SHARE *share, Field *field, int i)
}
if (param_string)
my_free(param_string, MYF(0));
my_free(param_string);
DBUG_RETURN(0);
error:
if (param_string)
my_free(param_string, MYF(0));
my_free(param_string);
error_alloc_param_string:
DBUG_RETURN(error);
}
......@@ -714,26 +716,26 @@ int mrn_free_share_alloc(
uint i;
MRN_DBUG_ENTER_FUNCTION();
if (share->engine)
my_free(share->engine, MYF(0));
my_free(share->engine);
if (share->default_tokenizer)
my_free(share->default_tokenizer, MYF(0));
my_free(share->default_tokenizer);
if (share->normalizer)
my_free(share->normalizer, MYF(0));
my_free(share->normalizer);
if (share->token_filters)
my_free(share->token_filters, MYF(0));
my_free(share->token_filters);
for (i = 0; i < share->table_share->keys; i++)
{
if (share->index_table && share->index_table[i])
my_free(share->index_table[i], MYF(0));
my_free(share->index_table[i]);
if (share->key_parser[i])
my_free(share->key_parser[i], MYF(0));
my_free(share->key_parser[i]);
}
for (i = 0; i < share->table_share->fields; i++)
{
if (share->col_flags && share->col_flags[i])
my_free(share->col_flags[i], MYF(0));
my_free(share->col_flags[i]);
if (share->col_type && share->col_type[i])
my_free(share->col_type[i], MYF(0));
my_free(share->col_type[i]);
}
DBUG_RETURN(0);
}
......@@ -745,8 +747,8 @@ void mrn_free_long_term_share(MRN_LONG_TERM_SHARE *long_term_share)
mrn::Lock lock(&mrn_long_term_share_mutex);
my_hash_delete(&mrn_long_term_share, (uchar*) long_term_share);
}
pthread_mutex_destroy(&long_term_share->auto_inc_mutex);
my_free(long_term_share, MYF(0));
mysql_mutex_destroy(&long_term_share->auto_inc_mutex);
my_free(long_term_share);
DBUG_VOID_RETURN;
}
......@@ -775,8 +777,9 @@ MRN_LONG_TERM_SHARE *mrn_get_long_term_share(const char *table_name,
long_term_share->table_name = tmp_name;
long_term_share->table_name_length = table_name_length;
memcpy(long_term_share->table_name, table_name, table_name_length);
if (pthread_mutex_init(&long_term_share->auto_inc_mutex,
MY_MUTEX_INIT_FAST))
if (mysql_mutex_init(mrn_long_term_share_auto_inc_mutex_key,
&long_term_share->auto_inc_mutex,
MY_MUTEX_INIT_FAST) != 0)
{
*error = HA_ERR_OUT_OF_MEM;
goto error_init_auto_inc_mutex;
......@@ -790,9 +793,9 @@ MRN_LONG_TERM_SHARE *mrn_get_long_term_share(const char *table_name,
DBUG_RETURN(long_term_share);
error_hash_insert:
pthread_mutex_destroy(&long_term_share->auto_inc_mutex);
mysql_mutex_destroy(&long_term_share->auto_inc_mutex);
error_init_auto_inc_mutex:
my_free(long_term_share, MYF(0));
my_free(long_term_share);
error_alloc_long_term_share:
DBUG_RETURN(NULL);
}
......@@ -912,7 +915,9 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
share->wrap_table_share = wrap_table_share;
}
if (pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST))
if (mysql_mutex_init(mrn_share_mutex_key,
&share->mutex,
MY_MUTEX_INIT_FAST) != 0)
{
*error = HA_ERR_OUT_OF_MEM;
goto error_init_mutex;
......@@ -934,11 +939,11 @@ MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error)
error_hash_insert:
error_get_long_term_share:
pthread_mutex_destroy(&share->mutex);
mysql_mutex_destroy(&share->mutex);
error_init_mutex:
error_parse_table_param:
mrn_free_share_alloc(share);
my_free(share, MYF(0));
my_free(share);
error_alloc_share:
DBUG_RETURN(NULL);
}
......@@ -954,7 +959,7 @@ int mrn_free_share(MRN_SHARE *share)
plugin_unlock(NULL, share->plugin);
mrn_free_share_alloc(share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
mysql_mutex_destroy(&share->mutex);
if (share->wrapper_mode) {
#ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE
mysql_mutex_destroy(&(share->wrap_table_share->LOCK_share));
......@@ -963,7 +968,7 @@ int mrn_free_share(MRN_SHARE *share)
mysql_mutex_destroy(&(share->wrap_table_share->LOCK_ha_data));
#endif
}
my_free(share, MYF(0));
my_free(share);
}
DBUG_RETURN(0);
}
......@@ -1025,9 +1030,9 @@ TABLE_SHARE *mrn_create_tmp_table_share(TABLE_LIST *table_list, const char *path
}
share->tmp_table = INTERNAL_TMP_TABLE; // TODO: is this right?
share->path.str = (char *) path;
share->path.length = strlen(path);
share->normalized_path.str = share->path.str;
share->normalized_path.length = share->path.length;
share->path.length = strlen(share->path.str);
share->normalized_path.str = my_strdup(path, MYF(MY_WME));
share->normalized_path.length = strlen(share->normalized_path.str);
if (open_table_def(thd, share, GTS_TABLE))
{
*error = ER_CANT_OPEN_FILE;
......@@ -1039,7 +1044,9 @@ TABLE_SHARE *mrn_create_tmp_table_share(TABLE_LIST *table_list, const char *path
void mrn_free_tmp_table_share(TABLE_SHARE *tmp_table_share)
{
MRN_DBUG_ENTER_FUNCTION();
char *normalized_path = tmp_table_share->normalized_path.str;
free_table_share(tmp_table_share);
my_free(normalized_path);
DBUG_VOID_RETURN;
}
......@@ -1131,11 +1138,11 @@ void mrn_clear_alter_share(THD *thd)
slot_data->alter_create_info = NULL;
slot_data->disable_keys_create_info = NULL;
if (slot_data->alter_connect_string) {
my_free(slot_data->alter_connect_string, MYF(0));
my_free(slot_data->alter_connect_string);
slot_data->alter_connect_string = NULL;
}
if (slot_data->alter_comment) {
my_free(slot_data->alter_comment, MYF(0));
my_free(slot_data->alter_comment);
slot_data->alter_comment = NULL;
}
}
......
......@@ -33,7 +33,7 @@ typedef struct st_mroonga_long_term_share
uint table_name_length;
// for auto_increment (storage mode only)
pthread_mutex_t auto_inc_mutex;
mysql_mutex_t auto_inc_mutex;
bool auto_inc_inited;
ulonglong auto_inc_value;
} MRN_LONG_TERM_SHARE;
......@@ -43,7 +43,7 @@ typedef struct st_mroonga_share
char *table_name;
uint table_name_length;
uint use_count;
pthread_mutex_t mutex;
mysql_mutex_t mutex;
THR_LOCK lock;
TABLE_SHARE *table_share;
TABLE_SHARE *wrap_table_share;
......
# Copyright(C) 2014 Naoya Murakami <naoya@createfield.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--disable_query_log
let $libgroonga_support_lz4 =
`SELECT @@mroonga_libgroonga_support_lz4;`;
--enable_query_log
# Copyright(C) 2014 Naoya Murakami <naoya@createfield.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--disable_query_log
let $libgroonga_support_zlib =
`SELECT @@mroonga_libgroonga_support_zlib;`;
--enable_query_log
# Copyright(C) 2014 Naoya Murakami <naoya@createfield.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/check_libgroonga_support_lz4.inc
if (!$libgroonga_support_lz4) {
--source ../../include/mroonga/have_mroonga_deinit.inc
skip "This test is for libgroonga supports lz4";
}
# Copyright(C) 2014 Naoya Murakami <naoya@createfield.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/check_libgroonga_support_zlib.inc
if (!$libgroonga_support_zlib) {
--source ../../include/mroonga/have_mroonga_deinit.inc
skip "This test is for libgroonga supports zlib";
}
# Copyright(C) 2014 Naoya Murakami <naoya@createfield.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/check_libgroonga_support_lz4.inc
if ($libgroonga_support_lz4) {
--source ../../include/mroonga/have_mroonga_deinit.inc
skip "This test is for libgroonga doesn't support lz4";
}
# Copyright(C) 2014 Naoya Murakami <naoya@createfield.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/check_libgroonga_support_zlib.inc
if ($libgroonga_support_zlib) {
--source ../../include/mroonga/have_mroonga_deinit.inc
skip "This test is for libgroonga doesn't support zlib";
}
......@@ -6,4 +6,5 @@ create_table_token_filters_index_comment_one_token_filter : Bundled Mroonga does
create_table_token_filters_table_comment_multiple_token_filters : Bundled Mroonga does not support token filter yet.
create_table_token_filters_table_comment_one_token_filter : Bundled Mroonga does not support token filter yet.
foreign_key_create : Bundled Mroonga does not support this test yet.
partition_insert : Bundled Mroonga does not support this test yet.
DROP TABLE IF EXISTS ids;
CREATE TABLE ids (
id1 INT,
id2 INT
) DEFAULT CHARSET=utf8mb4;
INSERT INTO ids (id1, id2) values (1, 2), (1, 2);
ALTER TABLE ids ADD UNIQUE INDEX (id1, id2);
ERROR 23000: Can't write, because of unique constraint, to table 'ids'
SHOW CREATE TABLE ids;
Table Create Table
ids CREATE TABLE `ids` (
`id1` int(11) DEFAULT NULL,
`id2` int(11) DEFAULT NULL
) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4
SELECT * FROM ids;
id1 id2
1 2
1 2
DROP TABLE ids;
SET NAMES utf8;
CREATE TABLE terms (
term varchar(256) NOT NULL PRIMARY KEY
) COMMENT='default_tokenizer "TokenBigram", normalizer "NormalizerAuto"'
DEFAULT CHARSET=utf8;
CREATE TABLE memos (
id int PRIMARY KEY,
content text NOT NULL,
FULLTEXT INDEX content_index (content) COMMENT 'table "terms"'
) DEFAULT CHARSET=utf8;
SELECT mroonga_command("dump");
mroonga_command("dump")
table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
column_create terms term COLUMN_SCALAR ShortText
table_create memos TABLE_PAT_KEY Int32
column_create memos content COLUMN_SCALAR LongText
column_create memos id COLUMN_SCALAR Int32
column_create terms content_index COLUMN_INDEX|WITH_POSITION memos content
ALTER TABLE memos DISABLE KEYS;
SELECT mroonga_command("dump");
mroonga_command("dump")
table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
column_create terms term COLUMN_SCALAR ShortText
table_create memos TABLE_PAT_KEY Int32
column_create memos content COLUMN_SCALAR LongText
column_create memos id COLUMN_SCALAR Int32
DROP TABLE memos;
SET NAMES utf8;
CREATE TABLE terms (
term varchar(256) NOT NULL PRIMARY KEY
) COMMENT='default_tokenizer "TokenBigram", normalizer "NormalizerAuto"'
DEFAULT CHARSET=utf8;
CREATE TABLE memos (
id int PRIMARY KEY,
content text NOT NULL,
FULLTEXT INDEX content_index (content) COMMENT 'table "terms"'
) DEFAULT CHARSET=utf8;
ALTER TABLE memos DISABLE KEYS;
SELECT mroonga_command("dump");
mroonga_command("dump")
table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
column_create terms term COLUMN_SCALAR ShortText
table_create memos TABLE_PAT_KEY Int32
column_create memos content COLUMN_SCALAR LongText
column_create memos id COLUMN_SCALAR Int32
ALTER TABLE memos ENABLE KEYS;
SELECT mroonga_command("dump");
mroonga_command("dump")
table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
column_create terms term COLUMN_SCALAR ShortText
table_create memos TABLE_PAT_KEY Int32
column_create memos content COLUMN_SCALAR LongText
column_create memos id COLUMN_SCALAR Int32
column_create terms content_index COLUMN_INDEX|WITH_POSITION memos content
DROP TABLE memos;
DROP DATABASE IF EXISTS mroonga;
CREATE DATABASE mroonga;
USE mroonga;
CREATE TABLE tags (
CREATE TABLE terms (
name VARCHAR(64) PRIMARY KEY
) DEFAULT CHARSET=utf8
COLLATE=utf8_bin
COMMENT='default_tokenizer "TokenDelimit"';
COMMENT='default_tokenizer "TokenBigram"';
CREATE TABLE bugs (
id INT UNSIGNED PRIMARY KEY,
tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"',
FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"'
title TEXT,
FULLTEXT INDEX (title) COMMENT 'table "terms"'
) DEFAULT CHARSET=utf8;
INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga");
SELECT mroonga_command("dump");
mroonga_command("dump")
table_create tags TABLE_PAT_KEY ShortText --default_tokenizer TokenDelimit
column_create tags name COLUMN_SCALAR ShortText
table_create bugs TABLE_PAT_KEY UInt32
column_create bugs id COLUMN_SCALAR UInt32
column_create bugs tags COLUMN_VECTOR tags
column_create tags bugs_tags_index COLUMN_INDEX|WITH_POSITION bugs tags
load --table tags
[
["_key","name"],
["Linux",""],
["MySQL",""],
["groonga",""]
]
load --table bugs
[
["_key","id","tags"],
[1,1,["Linux","MySQL","groonga"]]
]
SELECT *, MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE) AS score
INSERT INTO bugs (id, title) VALUES (1, "Mroonga can't build with MySQL X.Y.Z");
SELECT * FROM terms ORDER BY name;
name
'
.
BUILD
CAN
MROONGA
MYSQL
T
WITH
X
Y
Z
SELECT *, MATCH (title) AGAINST ("+MySQL" IN BOOLEAN MODE) AS score
FROM bugs
WHERE MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE);
id tags score
1 Linux MySQL groonga 1
WHERE MATCH (title) AGAINST ("+MySQL" IN BOOLEAN MODE);
id title score
1 Mroonga can't build with MySQL X.Y.Z 1
DROP TABLE bugs;
DROP TABLE tags;
DROP DATABASE mroonga;
DROP TABLE terms;
DROP DATABASE IF EXISTS mroonga;
CREATE DATABASE mroonga;
USE mroonga;
CREATE TABLE tags (
name VARCHAR(64) PRIMARY KEY
) DEFAULT CHARSET=utf8
COLLATE=utf8_bin
COMMENT='default_tokenizer "TokenDelimit"';
CREATE TABLE bugs (
id INT UNSIGNED PRIMARY KEY,
tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"',
FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"'
) DEFAULT CHARSET=utf8;
INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga");
SELECT mroonga_command("dump");
mroonga_command("dump")
table_create tags TABLE_PAT_KEY ShortText --default_tokenizer TokenDelimit
column_create tags name COLUMN_SCALAR ShortText
table_create bugs TABLE_PAT_KEY UInt32
column_create bugs id COLUMN_SCALAR UInt32
column_create bugs tags COLUMN_VECTOR tags
column_create tags bugs_tags_index COLUMN_INDEX|WITH_POSITION bugs tags
load --table tags
[
["_key","name"],
["Linux",""],
["MySQL",""],
["groonga",""]
]
load --table bugs
[
["_key","id","tags"],
[1,1,["Linux","MySQL","groonga"]]
]
SELECT *, MATCH (tags) AGAINST ("+MySQL" IN BOOLEAN MODE) AS score
FROM bugs
WHERE MATCH (tags) AGAINST ("+MySQL" IN BOOLEAN MODE);
id tags score
1 Linux MySQL groonga 1
DROP TABLE bugs;
DROP TABLE tags;
DROP DATABASE mroonga;
DROP TABLE IF EXISTS entries;
CREATE TABLE entries (
id INT UNSIGNED PRIMARY KEY,
content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_LZ4"'
) DEFAULT CHARSET=utf8;
INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
SELECT * FROM entries;
id content
1 I found Mroonga that is a MySQL storage engine to use Groonga!
DROP TABLE entries;
DROP TABLE IF EXISTS entries;
CREATE TABLE entries (
id INT UNSIGNED PRIMARY KEY,
content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_ZLIB"'
) DEFAULT CHARSET=utf8;
INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
SELECT * FROM entries;
id content
1 I found Mroonga that is a MySQL storage engine to use Groonga!
DROP TABLE entries;
DROP TABLE IF EXISTS entries;
CREATE TABLE entries (
id INT UNSIGNED PRIMARY KEY,
content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_LZ4"'
) DEFAULT CHARSET=utf8;
Warnings:
Warning 16506 The column flag 'COMPRESS_LZ4' is unsupported. It is ignored
INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
SELECT * FROM entries;
id content
1 I found Mroonga that is a MySQL storage engine to use Groonga!
DROP TABLE entries;
DROP TABLE IF EXISTS entries;
CREATE TABLE entries (
id INT UNSIGNED PRIMARY KEY,
content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_ZLIB"'
) DEFAULT CHARSET=utf8;
Warnings:
Warning 16506 The column flag 'COMPRESS_ZLIB' is unsupported. It is ignored
INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
SELECT * FROM entries;
id content
1 I found Mroonga that is a MySQL storage engine to use Groonga!
DROP TABLE entries;
DROP TABLE IF EXISTS diaries;
SET NAMES utf8;
CREATE TABLE diaries (
day DATE PRIMARY KEY,
content VARCHAR(64) NOT NULL,
FULLTEXT INDEX (content) COMMENT 'normalizer "none"'
) DEFAULT CHARSET=utf8;
INSERT INTO diaries VALUES ("2013-04-23", "Mroonga");
SELECT * FROM diaries
WHERE MATCH (content) AGAINST ("+Mroonga" IN BOOLEAN MODE);
day content
2013-04-23 Mroonga
SELECT * FROM diaries
WHERE MATCH (content) AGAINST ("+mroonga" IN BOOLEAN MODE);
day content
DROP TABLE diaries;
DROP TABLE IF EXISTS users;
CREATE TABLE users (
id int PRIMARY KEY,
name varchar(100) NOT NULL,
UNIQUE KEY (name)
) DEFAULT CHARSET=utf8;
INSERT INTO users VALUES (1, "Alice");
INSERT INTO users VALUES (2, "Bob");
INSERT INTO users VALUES (3, "Bob");
ERROR 23000: Duplicate entry 'Bob' for key 'name'
SELECT * FROM users;
id name
1 Alice
2 Bob
SELECT * FROM users WHERE name = "Bob";
id name
2 Bob
DROP TABLE users;
select PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE
from information_schema.plugins where plugin_name = "Mroonga";
PLUGIN_NAME PLUGIN_VERSION PLUGIN_TYPE
Mroonga 4.6 STORAGE ENGINE
Mroonga 5.0 STORAGE ENGINE
......@@ -15,16 +15,19 @@ diaries CREATE TABLE `diaries` (
UNIQUE KEY `day` (`day`)
) ENGINE=Mroonga DEFAULT CHARSET=utf8
INSERT INTO diaries (day, title)
VALUES ("2012-02-14", "clear day")
ON DUPLICATE KEY UPDATE title = "clear day (duplicated)";
VALUES ("2012-02-14", "clear day1")
ON DUPLICATE KEY UPDATE title = "clear day1 (duplicated)";
INSERT INTO diaries (day, title)
VALUES ("2012-02-14", "rainy day")
ON DUPLICATE KEY UPDATE title = "rainy day (duplicated)";
VALUES ("2012-02-14", "clear day2")
ON DUPLICATE KEY UPDATE title = "clear day2 (duplicated)";
INSERT INTO diaries (day, title)
VALUES ("2012-02-14", "clear day3")
ON DUPLICATE KEY UPDATE title = "clear day3 (duplicated)";
INSERT INTO diaries (day, title)
VALUES ("2012-02-15", "cloudy day")
ON DUPLICATE KEY UPDATE title = "cloudy day (duplicated)";
SELECT * FROM diaries;
id day title
1 2012-02-14 rainy day (duplicated)
3 2012-02-15 cloudy day
1 2012-02-14 clear day3 (duplicated)
4 2012-02-15 cloudy day
DROP TABLE diaries;
DROP TABLE IF EXISTS logs;
SET NAMES UTF8;
CREATE TABLE logs (
timestamp DATETIME,
message TEXT
) DEFAULT CHARSET=UTF8
PARTITION BY RANGE (TO_DAYS(timestamp)) (
PARTITION p201501 VALUES LESS THAN (TO_DAYS('2015-02-01')),
PARTITION p201502 VALUES LESS THAN (TO_DAYS('2015-03-01')),
PARTITION p201503 VALUES LESS THAN (TO_DAYS('2015-04-01')),
PARTITION pfuture VALUES LESS THAN MAXVALUE
);
SHOW CREATE TABLE logs;
Table Create Table
logs CREATE TABLE `logs` (
`timestamp` datetime DEFAULT NULL,
`message` text
) ENGINE=Mroonga DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (TO_DAYS(timestamp))
(PARTITION p201501 VALUES LESS THAN (735995) ENGINE = Mroonga,
PARTITION p201502 VALUES LESS THAN (736023) ENGINE = Mroonga,
PARTITION p201503 VALUES LESS THAN (736054) ENGINE = Mroonga,
PARTITION pfuture VALUES LESS THAN MAXVALUE ENGINE = Mroonga) */
INSERT INTO logs VALUES('2015-01-01 00:00:00', 'Start');
INSERT INTO logs VALUES('2015-01-31 23:59:59', 'Shutdown');
INSERT INTO logs VALUES('2015-02-01 00:00:00', 'Start');
INSERT INTO logs VALUES('2015-02-28 23:59:59', 'Shutdown');
INSERT INTO logs VALUES('2015-03-01 00:00:00', 'Start');
INSERT INTO logs VALUES('2015-03-31 23:59:59', 'Shutdown');
INSERT INTO logs VALUES('2015-04-01 00:00:00', 'Start');
INSERT INTO logs VALUES('2015-04-30 23:59:59', 'Shutdown');
SELECT * FROM logs ORDER BY timestamp;
timestamp message
2015-01-01 00:00:00 Start
2015-01-31 23:59:59 Shutdown
2015-02-01 00:00:00 Start
2015-02-28 23:59:59 Shutdown
2015-03-01 00:00:00 Start
2015-03-31 23:59:59 Shutdown
2015-04-01 00:00:00 Start
2015-04-30 23:59:59 Shutdown
DROP TABLE logs;
DROP TABLE IF EXISTS diaries;
SET NAMES utf8;
CREATE TABLE diaries (
id varchar(32) NOT NULL PRIMARY KEY,
content text,
FULLTEXT INDEX (content)
) DEFAULT CHARSET=utf8;
REPLACE INTO diaries(content) VALUES("Hello");
ERROR HY000: primary key is empty
DROP TABLE diaries;
SET @mroonga_boolean_mode_syntax_flags_backup =
@@mroonga_boolean_mode_syntax_flags;
SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_COLUMN";
SET NAMES UTF8;
CREATE TABLE diaries (
title TEXT,
content TEXT,
FULLTEXT KEY (title),
FULLTEXT KEY (content)
) DEFAULT CHARSET=utf8;
INSERT INTO diaries VALUES("Groonga", "Hello Groonga");
SELECT * FROM diaries
WHERE MATCH(title) AGAINST("content:@Hello" IN BOOLEAN MODE);
title content
Groonga Hello Groonga
DROP TABLE diaries;
SET mroonga_boolean_mode_syntax_flags =
@mroonga_boolean_mode_syntax_flags_backup;
SET @mroonga_boolean_mode_syntax_flags_backup =
@@mroonga_boolean_mode_syntax_flags;
SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_LEADING_NOT";
SET NAMES UTF8;
CREATE TABLE diaries (
title TEXT,
FULLTEXT KEY (title)
) DEFAULT CHARSET=utf8;
INSERT INTO diaries VALUES("Groonga");
INSERT INTO diaries VALUES("Mroonga");
SELECT * FROM diaries WHERE MATCH(title) AGAINST("-Groonga" IN BOOLEAN MODE);
title
Mroonga
DROP TABLE diaries;
SET mroonga_boolean_mode_syntax_flags =
@mroonga_boolean_mode_syntax_flags_backup;
SET @mroonga_boolean_mode_syntax_flags_backup =
@@mroonga_boolean_mode_syntax_flags;
SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_COLUMN,ALLOW_UPDATE";
SET NAMES UTF8;
CREATE TABLE diaries (
title TEXT,
content TEXT,
FULLTEXT KEY (title),
FULLTEXT KEY (content)
) DEFAULT CHARSET=utf8;
INSERT INTO diaries VALUES("Groonga", "Hello Groonga");
SELECT * FROM diaries
WHERE MATCH(title) AGAINST('content:="Hello Mroonga"' IN BOOLEAN MODE);
title content
Groonga Hello Mroonga
DROP TABLE diaries;
SET mroonga_boolean_mode_syntax_flags =
@mroonga_boolean_mode_syntax_flags_backup;
SET @mroonga_boolean_mode_syntax_flags_backup =
@@mroonga_boolean_mode_syntax_flags;
SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY";
SET NAMES UTF8;
CREATE TABLE diaries (
title TEXT,
FULLTEXT KEY (title)
) DEFAULT CHARSET=utf8;
INSERT INTO diaries VALUES("Re:Mroonga");
SELECT * FROM diaries WHERE MATCH(title) AGAINST("Re:Mroonga" IN BOOLEAN MODE);
title
Re:Mroonga
DROP TABLE diaries;
SET mroonga_boolean_mode_syntax_flags =
@mroonga_boolean_mode_syntax_flags_backup;
SET @mroonga_boolean_mode_syntax_flags_backup =
@@mroonga_boolean_mode_syntax_flags;
SET mroonga_boolean_mode_syntax_flags = "SYNTAX_SCRIPT";
SET NAMES UTF8;
CREATE TABLE diaries (
title TEXT,
FULLTEXT KEY (title)
) DEFAULT CHARSET=utf8;
INSERT INTO diaries VALUES("Re:Mroonga");
SELECT * FROM diaries
WHERE MATCH(title) AGAINST("title @ 'Re:Mroonga'" IN BOOLEAN MODE);
title
Re:Mroonga
DROP TABLE diaries;
SET mroonga_boolean_mode_syntax_flags =
@mroonga_boolean_mode_syntax_flags_backup;
show variables like 'mroonga_version';
Variable_name Value
mroonga_version 4.06
mroonga_version 5.00
# Copyright(C) 2015 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
DROP TABLE IF EXISTS ids;
--enable_warnings
CREATE TABLE ids (
id1 INT,
id2 INT
) DEFAULT CHARSET=utf8mb4;
INSERT INTO ids (id1, id2) values (1, 2), (1, 2);
--error ER_DUP_UNIQUE
ALTER TABLE ids ADD UNIQUE INDEX (id1, id2);
SHOW CREATE TABLE ids;
SELECT * FROM ids;
DROP TABLE ids;
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_query_log
DROP DATABASE test;
CREATE DATABASE test;
USE test;
--enable_query_log
SET NAMES utf8;
CREATE TABLE terms (
term varchar(256) NOT NULL PRIMARY KEY
) COMMENT='default_tokenizer "TokenBigram", normalizer "NormalizerAuto"'
DEFAULT CHARSET=utf8;
CREATE TABLE memos (
id int PRIMARY KEY,
content text NOT NULL,
FULLTEXT INDEX content_index (content) COMMENT 'table "terms"'
) DEFAULT CHARSET=utf8;
SELECT mroonga_command("dump");
ALTER TABLE memos DISABLE KEYS;
SELECT mroonga_command("dump");
DROP TABLE memos;
--source ../../include/mroonga/unload_mroonga_functions.inc
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_query_log
DROP DATABASE test;
CREATE DATABASE test;
USE test;
--enable_query_log
SET NAMES utf8;
CREATE TABLE terms (
term varchar(256) NOT NULL PRIMARY KEY
) COMMENT='default_tokenizer "TokenBigram", normalizer "NormalizerAuto"'
DEFAULT CHARSET=utf8;
CREATE TABLE memos (
id int PRIMARY KEY,
content text NOT NULL,
FULLTEXT INDEX content_index (content) COMMENT 'table "terms"'
) DEFAULT CHARSET=utf8;
ALTER TABLE memos DISABLE KEYS;
SELECT mroonga_command("dump");
ALTER TABLE memos ENABLE KEYS;
SELECT mroonga_command("dump");
DROP TABLE memos;
--source ../../include/mroonga/unload_mroonga_functions.inc
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2013 Kouhei Sutou <kou@clear-code.com>
# Copyright(C) 2014 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
......@@ -16,39 +16,27 @@
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_warnings
DROP DATABASE IF EXISTS mroonga;
--enable_warnings
CREATE DATABASE mroonga;
USE mroonga;
CREATE TABLE tags (
CREATE TABLE terms (
name VARCHAR(64) PRIMARY KEY
) DEFAULT CHARSET=utf8
COLLATE=utf8_bin
COMMENT='default_tokenizer "TokenDelimit"';
COMMENT='default_tokenizer "TokenBigram"';
CREATE TABLE bugs (
id INT UNSIGNED PRIMARY KEY,
tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"',
FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"'
title TEXT,
FULLTEXT INDEX (title) COMMENT 'table "terms"'
) DEFAULT CHARSET=utf8;
INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga");
INSERT INTO bugs (id, title) VALUES (1, "Mroonga can't build with MySQL X.Y.Z");
SELECT mroonga_command("dump");
SELECT * FROM terms ORDER BY name;
SELECT *, MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE) AS score
SELECT *, MATCH (title) AGAINST ("+MySQL" IN BOOLEAN MODE) AS score
FROM bugs
WHERE MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE);
WHERE MATCH (title) AGAINST ("+MySQL" IN BOOLEAN MODE);
DROP TABLE bugs;
DROP TABLE tags;
DROP DATABASE mroonga;
DROP TABLE terms;
--source ../../include/mroonga/unload_mroonga_functions.inc
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2013 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source include/not_embedded.inc
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_warnings
DROP DATABASE IF EXISTS mroonga;
--enable_warnings
CREATE DATABASE mroonga;
USE mroonga;
CREATE TABLE tags (
name VARCHAR(64) PRIMARY KEY
) DEFAULT CHARSET=utf8
COLLATE=utf8_bin
COMMENT='default_tokenizer "TokenDelimit"';
CREATE TABLE bugs (
id INT UNSIGNED PRIMARY KEY,
tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"',
FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"'
) DEFAULT CHARSET=utf8;
INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga");
SELECT mroonga_command("dump");
SELECT *, MATCH (tags) AGAINST ("+MySQL" IN BOOLEAN MODE) AS score
FROM bugs
WHERE MATCH (tags) AGAINST ("+MySQL" IN BOOLEAN MODE);
DROP TABLE bugs;
DROP TABLE tags;
DROP DATABASE mroonga;
--source ../../include/mroonga/unload_mroonga_functions.inc
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 Naoya Murakami <naoya@createfield.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/support_libgroonga_lz4.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_warnings
DROP TABLE IF EXISTS entries;
--enable_warnings
CREATE TABLE entries (
id INT UNSIGNED PRIMARY KEY,
content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_LZ4"'
) DEFAULT CHARSET=utf8;
INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
SELECT * FROM entries;
DROP TABLE entries;
--source ../../include/mroonga/unload_mroonga_functions.inc
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 Naoya Murakami <naoya@createfield.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/support_libgroonga_zlib.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_warnings
DROP TABLE IF EXISTS entries;
--enable_warnings
CREATE TABLE entries (
id INT UNSIGNED PRIMARY KEY,
content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_ZLIB"'
) DEFAULT CHARSET=utf8;
INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
SELECT * FROM entries;
DROP TABLE entries;
--source ../../include/mroonga/unload_mroonga_functions.inc
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 Naoya Murakami <naoya@createfield.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/unsupport_libgroonga_lz4.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_warnings
DROP TABLE IF EXISTS entries;
--enable_warnings
CREATE TABLE entries (
id INT UNSIGNED PRIMARY KEY,
content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_LZ4"'
) DEFAULT CHARSET=utf8;
INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
SELECT * FROM entries;
DROP TABLE entries;
--source ../../include/mroonga/unload_mroonga_functions.inc
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 Naoya Murakami <naoya@createfield.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/unsupport_libgroonga_zlib.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_warnings
DROP TABLE IF EXISTS entries;
--enable_warnings
CREATE TABLE entries (
id INT UNSIGNED PRIMARY KEY,
content TEXT COMMENT 'flags "COLUMN_SCALAR|COMPRESS_ZLIB"'
) DEFAULT CHARSET=utf8;
INSERT INTO entries (id, content) VALUES (1, "I found Mroonga that is a MySQL storage engine to use Groonga!");
SELECT * FROM entries;
DROP TABLE entries;
--source ../../include/mroonga/unload_mroonga_functions.inc
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
--source ../../include/mroonga/load_mroonga_functions.inc
--disable_warnings
DROP TABLE IF EXISTS diaries;
--enable_warnings
SET NAMES utf8;
CREATE TABLE diaries (
day DATE PRIMARY KEY,
content VARCHAR(64) NOT NULL,
FULLTEXT INDEX (content) COMMENT 'normalizer "none"'
) DEFAULT CHARSET=utf8;
INSERT INTO diaries VALUES ("2013-04-23", "Mroonga");
SELECT * FROM diaries
WHERE MATCH (content) AGAINST ("+Mroonga" IN BOOLEAN MODE);
SELECT * FROM diaries
WHERE MATCH (content) AGAINST ("+mroonga" IN BOOLEAN MODE);
DROP TABLE diaries;
--source ../../include/mroonga/unload_mroonga_functions.inc
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2015 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
DROP TABLE IF EXISTS users;
--enable_warnings
CREATE TABLE users (
id int PRIMARY KEY,
name varchar(100) NOT NULL,
UNIQUE KEY (name)
) DEFAULT CHARSET=utf8;
INSERT INTO users VALUES (1, "Alice");
INSERT INTO users VALUES (2, "Bob");
-- error ER_DUP_ENTRY
INSERT INTO users VALUES (3, "Bob");
SELECT * FROM users;
SELECT * FROM users WHERE name = "Bob";
DROP TABLE users;
--source ../../include/mroonga/have_mroonga_deinit.inc
......@@ -29,11 +29,14 @@ CREATE TABLE diaries (
SHOW CREATE TABLE diaries;
INSERT INTO diaries (day, title)
VALUES ("2012-02-14", "clear day")
ON DUPLICATE KEY UPDATE title = "clear day (duplicated)";
VALUES ("2012-02-14", "clear day1")
ON DUPLICATE KEY UPDATE title = "clear day1 (duplicated)";
INSERT INTO diaries (day, title)
VALUES ("2012-02-14", "rainy day")
ON DUPLICATE KEY UPDATE title = "rainy day (duplicated)";
VALUES ("2012-02-14", "clear day2")
ON DUPLICATE KEY UPDATE title = "clear day2 (duplicated)";
INSERT INTO diaries (day, title)
VALUES ("2012-02-14", "clear day3")
ON DUPLICATE KEY UPDATE title = "clear day3 (duplicated)";
INSERT INTO diaries (day, title)
VALUES ("2012-02-15", "cloudy day")
ON DUPLICATE KEY UPDATE title = "cloudy day (duplicated)";
......
# Copyright(C) 2015 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
DROP TABLE IF EXISTS logs;
--enable_warnings
SET NAMES UTF8;
CREATE TABLE logs (
timestamp DATETIME,
message TEXT
) DEFAULT CHARSET=UTF8
PARTITION BY RANGE (TO_DAYS(timestamp)) (
PARTITION p201501 VALUES LESS THAN (TO_DAYS('2015-02-01')),
PARTITION p201502 VALUES LESS THAN (TO_DAYS('2015-03-01')),
PARTITION p201503 VALUES LESS THAN (TO_DAYS('2015-04-01')),
PARTITION pfuture VALUES LESS THAN MAXVALUE
);
SHOW CREATE TABLE logs;
INSERT INTO logs VALUES('2015-01-01 00:00:00', 'Start');
INSERT INTO logs VALUES('2015-01-31 23:59:59', 'Shutdown');
INSERT INTO logs VALUES('2015-02-01 00:00:00', 'Start');
INSERT INTO logs VALUES('2015-02-28 23:59:59', 'Shutdown');
INSERT INTO logs VALUES('2015-03-01 00:00:00', 'Start');
INSERT INTO logs VALUES('2015-03-31 23:59:59', 'Shutdown');
INSERT INTO logs VALUES('2015-04-01 00:00:00', 'Start');
INSERT INTO logs VALUES('2015-04-30 23:59:59', 'Shutdown');
SELECT * FROM logs ORDER BY timestamp;
DROP TABLE logs;
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
--disable_warnings
DROP TABLE IF EXISTS diaries;
--enable_warnings
SET NAMES utf8;
CREATE TABLE diaries (
id varchar(32) NOT NULL PRIMARY KEY,
content text,
FULLTEXT INDEX (content)
) DEFAULT CHARSET=utf8;
-- error ER_ERROR_ON_WRITE
REPLACE INTO diaries(content) VALUES("Hello");
DROP TABLE diaries;
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
SET @mroonga_boolean_mode_syntax_flags_backup =
@@mroonga_boolean_mode_syntax_flags;
SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_COLUMN";
SET NAMES UTF8;
CREATE TABLE diaries (
title TEXT,
content TEXT,
FULLTEXT KEY (title),
FULLTEXT KEY (content)
) DEFAULT CHARSET=utf8;
INSERT INTO diaries VALUES("Groonga", "Hello Groonga");
SELECT * FROM diaries
WHERE MATCH(title) AGAINST("content:@Hello" IN BOOLEAN MODE);
DROP TABLE diaries;
SET mroonga_boolean_mode_syntax_flags =
@mroonga_boolean_mode_syntax_flags_backup;
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
SET @mroonga_boolean_mode_syntax_flags_backup =
@@mroonga_boolean_mode_syntax_flags;
SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_LEADING_NOT";
SET NAMES UTF8;
CREATE TABLE diaries (
title TEXT,
FULLTEXT KEY (title)
) DEFAULT CHARSET=utf8;
INSERT INTO diaries VALUES("Groonga");
INSERT INTO diaries VALUES("Mroonga");
SELECT * FROM diaries WHERE MATCH(title) AGAINST("-Groonga" IN BOOLEAN MODE);
DROP TABLE diaries;
SET mroonga_boolean_mode_syntax_flags =
@mroonga_boolean_mode_syntax_flags_backup;
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
SET @mroonga_boolean_mode_syntax_flags_backup =
@@mroonga_boolean_mode_syntax_flags;
SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY,ALLOW_COLUMN,ALLOW_UPDATE";
SET NAMES UTF8;
CREATE TABLE diaries (
title TEXT,
content TEXT,
FULLTEXT KEY (title),
FULLTEXT KEY (content)
) DEFAULT CHARSET=utf8;
INSERT INTO diaries VALUES("Groonga", "Hello Groonga");
SELECT * FROM diaries
WHERE MATCH(title) AGAINST('content:="Hello Mroonga"' IN BOOLEAN MODE);
DROP TABLE diaries;
SET mroonga_boolean_mode_syntax_flags =
@mroonga_boolean_mode_syntax_flags_backup;
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
SET @mroonga_boolean_mode_syntax_flags_backup =
@@mroonga_boolean_mode_syntax_flags;
SET mroonga_boolean_mode_syntax_flags = "SYNTAX_QUERY";
SET NAMES UTF8;
CREATE TABLE diaries (
title TEXT,
FULLTEXT KEY (title)
) DEFAULT CHARSET=utf8;
INSERT INTO diaries VALUES("Re:Mroonga");
SELECT * FROM diaries WHERE MATCH(title) AGAINST("Re:Mroonga" IN BOOLEAN MODE);
DROP TABLE diaries;
SET mroonga_boolean_mode_syntax_flags =
@mroonga_boolean_mode_syntax_flags_backup;
--source ../../include/mroonga/have_mroonga_deinit.inc
# Copyright(C) 2014 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source ../../include/mroonga/have_mroonga.inc
SET @mroonga_boolean_mode_syntax_flags_backup =
@@mroonga_boolean_mode_syntax_flags;
SET mroonga_boolean_mode_syntax_flags = "SYNTAX_SCRIPT";
SET NAMES UTF8;
CREATE TABLE diaries (
title TEXT,
FULLTEXT KEY (title)
) DEFAULT CHARSET=utf8;
INSERT INTO diaries VALUES("Re:Mroonga");
SELECT * FROM diaries
WHERE MATCH(title) AGAINST("title @ 'Re:Mroonga'" IN BOOLEAN MODE);
DROP TABLE diaries;
SET mroonga_boolean_mode_syntax_flags =
@mroonga_boolean_mode_syntax_flags_backup;
--source ../../include/mroonga/have_mroonga_deinit.inc
SUBDIRS = \
apt \
rpm \
source \
ubuntu \
windows \
yum
REPOSITORIES_PATH = repositories
DISTRIBUTIONS = debian
ARCHITECTURES = i386 amd64
CODE_NAMES = wheezy
all:
release: build sign-packages update-repository sign-repository upload
remove-existing-packages:
for distribution in $(DISTRIBUTIONS); do \
find $(REPOSITORIES_PATH)/$${distribution}/pool \
-type f -delete; \
done
download:
for distribution in $(DISTRIBUTIONS); do \
rsync -avz --progress --delete \
$(RSYNC_PATH)/$${distribution} $(REPOSITORIES_PATH)/; \
done
sign-packages:
./sign-packages.sh '$(GPG_UID)' '$(REPOSITORIES_PATH)/' '$(CODE_NAMES)'
update-repository:
./update-repository.sh '$(PACKAGE_NAME)' '$(REPOSITORIES_PATH)/' \
'$(ARCHITECTURES)' '$(CODE_NAMES)'
sign-repository:
./sign-repository.sh '$(GPG_UID)' '$(REPOSITORIES_PATH)/' '$(CODE_NAMES)'
ensure-rsync-path:
@if test -z "$(RSYNC_PATH)"; then \
echo "--with-rsync-path configure option must be specified."; \
false; \
fi
upload: ensure-rsync-path
for distribution in $(DISTRIBUTIONS); do \
(cd $(REPOSITORIES_PATH)/$${distribution}; \
rsync -avz --progress --delete \
dists pool $(RSYNC_PATH)/$${distribution}; \
); \
done
build: build-package-deb
build-package-deb: prepare-build-package-deb
vagrant destroy --force
for architecture in $(ARCHITECTURES); do \
for code_name in $(CODE_NAMES); do \
id=debian-$$code_name-$$architecture; \
vagrant up $$id || exit 1; \
vagrant destroy --force $$id; \
done; \
done
prepare-build-package-deb: source env.sh
cp env.sh tmp/
rm -rf tmp/debian
cp -rp $(srcdir)/../debian tmp/
source: tmp/$(PACKAGE)-$(VERSION).tar.gz
tmp/$(PACKAGE)-$(VERSION).tar.gz: $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz
mkdir -p tmp
cp $(abs_top_builddir)/$(PACKAGE)-$(VERSION).tar.gz $@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
vms = [
{
:id => "debian-wheezy-i386",
:box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8-i386_chef-provisionerless.box",
},
{
:id => "debian-wheezy-amd64",
:box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8_chef-provisionerless.box",
},
]
vms.each do |vm|
config.vm.define(vm[:id]) do |node|
node.vm.box = vm[:id]
node.vm.box_url = vm[:box_url]
node.vm.provision(:shell, :path => "build-deb.sh")
node.vm.provider("virtualbox") do |virtual_box|
virtual_box.memory = 768
end
end
end
end
#!/bin/sh
LANG=C
mysql_server_package=mysql-server
run()
{
"$@"
if test $? -ne 0; then
echo "Failed $@"
exit 1
fi
}
. /vagrant/tmp/env.sh
grep '^deb ' /etc/apt/sources.list | \
sed -e 's/^deb /deb-src /' > /etc/apt/sources.list.d/base-source.list
run apt-get update
run apt-get install -y lsb-release
distribution=$(lsb_release --id --short | tr 'A-Z' 'a-z')
code_name=$(lsb_release --codename --short)
case "${distribution}" in
debian)
component=main
run cat <<EOF > /etc/apt/sources.list.d/groonga.list
deb http://packages.groonga.org/debian/ wheezy main
deb-src http://packages.groonga.org/debian/ wheezy main
EOF
if ! grep --quiet security /etc/apt/sources.list; then
run cat <<EOF > /etc/apt/sources.list.d/security.list
deb http://security.debian.org/ ${code_name}/updates main
deb-src http://security.debian.org/ ${code_name}/updates main
EOF
fi
run apt-get update
run apt-get install -y --allow-unauthenticated groonga-keyring
run apt-get update
;;
ubuntu)
component=universe
run cat <<EOF > /etc/apt/sources.list.d/security.list
deb http://security.ubuntu.com/ubuntu ${code_name}-security main restricted
deb-src http://security.ubuntu.com/ubuntu ${code_name}-security main restricted
EOF
run sed -e 's/main/universe/' /etc/apt/sources.list > \
/etc/apt/sources.list.d/universe.list
run apt-get -y install software-properties-common
run add-apt-repository -y universe
run add-apt-repository -y ppa:groonga/ppa
run apt-get update
;;
esac
run apt-get install -V -y build-essential devscripts ${DEPENDED_PACKAGES}
run apt-get build-dep -y ${mysql_server_package}
run mkdir -p build
run cp /vagrant/tmp/${PACKAGE}-${VERSION}.tar.gz \
build/${PACKAGE}_${VERSION}.orig.tar.gz
run cd build
run tar xfz ${PACKAGE}_${VERSION}.orig.tar.gz
run cd ${PACKAGE}-${VERSION}/
run cp -rp /vagrant/tmp/debian debian
# export DEB_BUILD_OPTIONS=noopt
MYSQL_PACKAGE_INFO=$(apt-cache show mysql-server | grep Version | sort | tail -1)
MYSQL_PACKAGE_VERSION=${MYSQL_PACKAGE_INFO##Version: }
sed -i "s/MYSQL_VERSION/$MYSQL_PACKAGE_VERSION/" debian/control
run debuild -us -uc
run cd -
package_initial=$(echo "${PACKAGE}" | sed -e 's/\(.\).*/\1/')
pool_dir="/vagrant/repositories/${distribution}/pool/${code_name}/${component}/${package_initial}/${PACKAGE}"
run mkdir -p "${pool_dir}/"
run cp *.tar.gz *.diff.gz *.dsc *.deb "${pool_dir}/"
PACKAGE=@PACKAGE@
VERSION=@VERSION@
DEPENDED_PACKAGES="
debhelper
autotools-dev
libgroonga-dev
pkg-config
libmecab-dev
mecab-utils
libmysqlclient-dev
libmysqld-dev
libssl-dev
groonga-normalizer-mysql
wget
"
#!/bin/sh
script_base_dir=`dirname $0`
if [ $# != 3 ]; then
echo "Usage: $0 GPG_UID DESITINATION CODES"
echo " e.g.: $0 'F10399C0' repositories/ 'lenny unstable hardy karmic'"
exit 1
fi
GPG_UID=$1
DESTINATION=$2
CODES=$3
run()
{
"$@"
if test $? -ne 0; then
echo "Failed $@"
exit 1
fi
}
for code_name in ${CODES}; do
case ${code_name} in
squeeze|wheezy|jessie|unstable)
distribution=debian
;;
*)
distribution=ubuntu
;;
esac
base_directory=${DESTINATION}${distribution}
debsign -pgpg2 --re-sign -k${GPG_UID} \
$(find ${base_directory} -name '*.dsc' -or -name '*.changes') &
if [ "${PARALLEL}" != "yes" ]; then
wait
fi
done
wait
#!/bin/sh
script_base_dir=`dirname $0`
if [ $# != 3 ]; then
echo "Usage: $0 GPG_UID DESTINATION CODES"
echo " e.g.: $0 'F10399C0' repositories/ 'lenny unstable hardy karmic'"
exit 1
fi
GPG_UID=$1
DESTINATION=$2
CODES=$3
run()
{
"$@"
if test $? -ne 0; then
echo "Failed $@"
exit 1
fi
}
for code_name in ${CODES}; do
case ${code_name} in
squeeze|wheezy|jessie|unstable)
distribution=debian
;;
*)
distribution=ubuntu
;;
esac
release=${DESTINATION}${distribution}/dists/${code_name}/Release
rm -f ${release}.gpg
gpg2 --sign --detach-sign --armor \
--local-user ${GPG_UID} \
--output ${release}.gpg \
${release} &
if [ "${PARALLEL}" != "yes" ]; then
wait
fi
done
wait
#!/bin/sh
script_base_dir=`dirname $0`
if [ $# != 4 ]; then
echo "Usage: $0 PROJECT_NAME DESTINATION ARCHITECTURES CODES"
echo " e.g.: $0 mroonga repositories/ 'i386 amd64' 'lenny unstable hardy karmic'"
exit 1
fi
PROJECT_NAME=$1
DESTINATION=$2
ARCHITECTURES=$3
CODES=$4
run()
{
"$@"
if test $? -ne 0; then
echo "Failed $@"
exit 1
fi
}
update_repository()
{
distribution=$1
code_name=$2
component=$3
rm -rf dists/${code_name}
mkdir -p dists/${code_name}/${component}/binary-i386/
mkdir -p dists/${code_name}/${component}/binary-amd64/
mkdir -p dists/${code_name}/${component}/source/
cat <<EOF > dists/.htaccess
Options +Indexes
EOF
cat <<EOF > dists/${code_name}/${component}/binary-i386/Release
Archive: ${code_name}
Component: ${component}
Origin: The ${PROJECT_NAME} project
Label: The ${PROJECT_NAME} project
Architecture: i386
EOF
cat <<EOF > dists/${code_name}/${component}/binary-amd64/Release
Archive: ${code_name}
Component: ${component}
Origin: The ${PROJECT_NAME} project
Label: The ${PROJECT_NAME} project
Architecture: amd64
EOF
cat <<EOF > dists/${code_name}/${component}/source/Release
Archive: ${code_name}
Component: ${component}
Origin: The ${PROJECT_NAME} project
Label: The ${PROJECT_NAME} project
Architecture: source
EOF
cat <<EOF > generate-${code_name}.conf
Dir::ArchiveDir ".";
Dir::CacheDir ".";
TreeDefault::Directory "pool/${code_name}/${component}";
TreeDefault::SrcDirectory "pool/${code_name}/${component}";
Default::Packages::Extensions ".deb";
Default::Packages::Compress ". gzip bzip2";
Default::Sources::Compress ". gzip bzip2";
Default::Contents::Compress "gzip bzip2";
BinDirectory "dists/${code_name}/${component}/binary-i386" {
Packages "dists/${code_name}/${component}/binary-i386/Packages";
Contents "dists/${code_name}/Contents-i386";
SrcPackages "dists/${code_name}/${component}/source/Sources";
};
BinDirectory "dists/${code_name}/${component}/binary-amd64" {
Packages "dists/${code_name}/${component}/binary-amd64/Packages";
Contents "dists/${code_name}/Contents-amd64";
SrcPackages "dists/${code_name}/${component}/source/Sources";
};
Tree "dists/${code_name}" {
Sections "${component}";
Architectures "i386 amd64 source";
};
EOF
apt-ftparchive generate generate-${code_name}.conf
chmod 644 dists/${code_name}/Contents-*
rm -f dists/${code_name}/Release*
rm -f *.db
cat <<EOF > release-${code_name}.conf
APT::FTPArchive::Release::Origin "The ${PROJECT_NAME} project";
APT::FTPArchive::Release::Label "The ${PROJECT_NAME} project";
APT::FTPArchive::Release::Architectures "i386 amd64";
APT::FTPArchive::Release::Codename "${code_name}";
APT::FTPArchive::Release::Suite "${code_name}";
APT::FTPArchive::Release::Components "${component}";
APT::FTPArchive::Release::Description "${PACKAGE_NAME} packages";
EOF
apt-ftparchive -c release-${code_name}.conf \
release dists/${code_name} > /tmp/Release
mv /tmp/Release dists/${code_name}
}
for code_name in ${CODES}; do
case ${code_name} in
squeeze|wheezy|jessie|unstable)
distribution=debian
component=main
;;
*)
distribution=ubuntu
component=universe
;;
esac
mkdir -p ${DESTINATION}${distribution}
(cd ${DESTINATION}${distribution}
update_repository $distribution $code_name $component) &
if [ "${PARALLEL}" != "yes" ]; then
wait
fi
done
wait
This diff is collapsed.
/usr/lib/groonga/plugins/ r,
/usr/lib/groonga/plugins/** rm,
/etc/mecabrc r,
/var/lib/mecab/dic/** r,
#include <local/mysql-server-mroonga>
This diff is collapsed.
Source: mroonga
Section: database
Priority: optional
Maintainer: Kouhei Sutou <kou@clear-code.com>
Build-Depends:
debhelper (>= 7.0.50),
autotools-dev,
pkg-config,
libgroonga-dev (>= @REQUIRED_GROONGA_VERSION@),
groonga-normalizer-mysql,
libmysqlclient-dev,
libmysqld-dev,
libssl-dev,
wget,
lsb-release
Standards-Version: 3.9.1
Homepage: http://mroonga.org/
Package: mysql-server-mroonga
Section: database
Architecture: any
Replaces: mysql-server-groonga (<< 1.10-1)
Breaks: mysql-server-groonga (<< 1.10-1)
Depends:
${misc:Depends},
${shlibs:Depends},
libgroonga0 (>= @REQUIRED_GROONGA_VERSION@),
mysql-server (= MYSQL_VERSION),
groonga-normalizer-mysql
Description: A fast fulltext searchable storage engine for MySQL.
Mroonga is a fast fulltext searchable storage engine for MySQL.
It is based on Groonga, a fast fulltext search engine and column store.
Groonga is good at real time update.
.
This package provides a MySQL storage engine as a shared library.
This provides "mroonga" storage engine. It means you can use
"ENGINE = mroonga" in "CREATE TABLE".
Package: mysql-server-mroonga-doc
Section: doc
Architecture: all
Replaces: mysql-server-groonga-doc (<< 1.10-1)
Breaks: mysql-server-groonga-doc (<< 1.10-1)
Depends:
${misc:Depends}
Description: Documentation of Mroonga.
Mroonga is a fast fulltext searchable storage engine for MySQL.
It is based on Groonga, a fast fulltext search engine and column store.
Groonga is good at real time update.
.
This package provides documentation of Mroonga.
This work was packaged for Debian by:
Kouhei Sutou <kou@clear-code.com> on Thu, 02 Sep 2010 13:51:56 +0900.
It was downloaded:
<http://github.com/mroonga/mroonga/downloads>
Upstream Author(s):
Tetsuro IKEDA <ikdttr at gmail.com>
Daijiro MORI <morita at razil. jp>
Tasuku SUENAGA <a at razil. jp>
Kouhei Sutou <kou at clear-code. com>
Copyright:
Copyright(C) 2009-2010 Tetsuro IKEDA
License:
LGPLv2.1
See `/usr/share/common-licenses/LGPL-2.1'.
The Debian packaging is done by Kouhei Sutou <kou@clear-code.com> in 2010,
and put into public domain, anyone can use it for any purpose.
usr/lib/mysql/plugin/ha_mroonga.so*
usr/share/mroonga/*
debian/apparmor/mysql-server-mroonga etc/apparmor.d/abstractions/
This diff is collapsed.
#! /bin/sh
set -e
if [ "$1" = "purge" ]; then
mysql_apparmor_profile_name=usr.sbin.mysqld
mysql_apparmor_profile=/etc/apparmor.d/${mysql_apparmor_profile_name}
mysql_local_apparmor_profile=/etc/apparmor.d/local/${mysql_apparmor_profile_name}
mysql_abstraction_apparmor_profile=/etc/apparmor.d/abstractions/mysql
apparmor_profile_name=mysql-server-mroonga
if test -f "${mysql_local_apparmor_profile}"; then
include_profile="#include <abstractions/${apparmor_profile_name}>"
if grep -q "${include_profile}" "${mysql_local_apparmor_profile}"; then
sed -i'' -e "s,${include_profile},," \
"${mysql_local_apparmor_profile}"
fi
else
start_marker_re="^# ${apparmor_profile_name}: START$"
end_marker_re="^# ${apparmor_profile_name}: END$"
if test -f "${mysql_abstraction_apparmor_profile}" && \
grep -q "${start_marker_re}" \
"${mysql_abstraction_apparmor_profile}"; then
sed -i'' -e "/${start_marker_re}/,/${end_marker_re}/d" \
"${mysql_abstraction_apparmor_profile}"
fi
fi
rm -f "/etc/apparmor.d/local/${apparmor_profile_name}" || true
rmdir /etc/apparmor.d/local 2>/dev/null || true
if aa-status --enabled 2>/dev/null; then
apparmor_parser -r -T -W "${mysql_apparmor_profile}" || true
fi
fi
#DEBHELPER#
exit 0
#! /bin/sh
set -e
cat /usr/share/mroonga/uninstall.sql | \
mysql --defaults-file=/etc/mysql/debian.cnf || true
#DEBHELPER#
exit 0
This diff is collapsed.
EXTRA_DIST = \
mysql55-mroonga.spec.in \
mysql56-community-mroonga.spec.in \
mariadb-mroonga.spec.in
noinst_DATA = \
mysql55-mroonga.spec \
mysql56-community-mroonga.spec \
mariadb-mroonga.spec
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment