summaryrefslogtreecommitdiff
path: root/storage/archive
diff options
context:
space:
mode:
Diffstat (limited to 'storage/archive')
-rw-r--r--storage/archive/CMakeLists.txt2
-rw-r--r--storage/archive/archive_reader.c5
-rw-r--r--storage/archive/archive_test.c2
-rw-r--r--storage/archive/ha_archive.cc54
-rw-r--r--storage/archive/ha_archive.h5
5 files changed, 43 insertions, 25 deletions
diff --git a/storage/archive/CMakeLists.txt b/storage/archive/CMakeLists.txt
index 78fb95c0d26..5b6818fc921 100644
--- a/storage/archive/CMakeLists.txt
+++ b/storage/archive/CMakeLists.txt
@@ -11,7 +11,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
SET(ARCHIVE_SOURCES azio.c ha_archive.cc ha_archive.h)
MYSQL_ADD_PLUGIN(archive ${ARCHIVE_SOURCES} STORAGE_ENGINE LINK_LIBRARIES ${ZLIB_LIBRARY})
diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c
index 1b15fa16ce4..0e02127ea32 100644
--- a/storage/archive/archive_reader.c
+++ b/storage/archive/archive_reader.c
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
#include "azlib.h"
#include <string.h>
@@ -408,8 +408,7 @@ static void print_version(void)
static void get_options(int *argc, char ***argv)
{
- if (load_defaults("my", load_default_groups, argc, argv))
- exit(1);
+ load_defaults_or_exit("my", load_default_groups, argc, argv);
default_argv= *argv;
handle_options(argc, argv, my_long_options, get_one_option);
diff --git a/storage/archive/archive_test.c b/storage/archive/archive_test.c
index bb052b8409c..72f6d05e711 100644
--- a/storage/archive/archive_test.c
+++ b/storage/archive/archive_test.c
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
#include "azlib.h"
#include <string.h>
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 6842319b86d..49b5ef97097 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
*/
#ifdef USE_PRAGMA_IMPLEMENTATION
@@ -1650,7 +1650,6 @@ void ha_archive::update_create_info(HA_CREATE_INFO *create_info)
DBUG_VOID_RETURN;
}
-
/*
Hints for optimizer, see ha_tina for more information
*/
@@ -1658,22 +1657,7 @@ int ha_archive::info(uint flag)
{
DBUG_ENTER("ha_archive::info");
- mysql_mutex_lock(&share->mutex);
- if (share->dirty)
- {
- DBUG_PRINT("ha_archive", ("archive flushing out rows for scan"));
- DBUG_ASSERT(share->archive_write_open);
- azflush(&(share->archive_write), Z_SYNC_FLUSH);
- share->dirty= FALSE;
- }
-
- /*
- This should be an accurate number now, though bulk and delayed inserts can
- cause the number to be inaccurate.
- */
- stats.records= share->rows_recorded;
- mysql_mutex_unlock(&share->mutex);
-
+ flush_and_clear_pending_writes();
stats.deleted= 0;
DBUG_PRINT("ha_archive", ("Stats rows is %d\n", (int)stats.records));
@@ -1716,6 +1700,38 @@ int ha_archive::info(uint flag)
}
+int ha_archive::external_lock(THD *thd, int lock_type)
+{
+ if (lock_type == F_RDLCK)
+ {
+ // We are going to read from the table. Flush any pending writes that we
+ // may have
+ flush_and_clear_pending_writes();
+ }
+ return 0;
+}
+
+
+void ha_archive::flush_and_clear_pending_writes()
+{
+ mysql_mutex_lock(&share->mutex);
+ if (share->dirty)
+ {
+ DBUG_PRINT("ha_archive", ("archive flushing out rows for scan"));
+ DBUG_ASSERT(share->archive_write_open);
+ azflush(&(share->archive_write), Z_SYNC_FLUSH);
+ share->dirty= FALSE;
+ }
+
+ /*
+ This should be an accurate number now, though bulk and delayed inserts can
+ cause the number to be inaccurate.
+ */
+ stats.records= share->rows_recorded;
+ mysql_mutex_unlock(&share->mutex);
+}
+
+
/*
This method tells us that a bulk insert operation is about to occur. We set
a flag which will keep write_row from saying that its data is dirty. This in
@@ -1888,7 +1904,7 @@ maria_declare_plugin(archive)
&archive_storage_engine,
"ARCHIVE",
"Brian Aker, MySQL AB",
- "Archive storage engine",
+ "gzip-compresses tables for a low storage footprint",
PLUGIN_LICENSE_GPL,
archive_db_init, /* Plugin Init */
NULL, /* Plugin Deinit */
diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h
index 56ff566db8c..a4911fe9e32 100644
--- a/storage/archive/ha_archive.h
+++ b/storage/archive/ha_archive.h
@@ -11,7 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
@@ -169,5 +169,8 @@ public:
int unpack_row(azio_stream *file_to_read, uchar *record);
unsigned int pack_row(uchar *record, azio_stream *writer);
bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes);
+ int external_lock(THD *thd, int lock_type);
+private:
+ void flush_and_clear_pending_writes();
};