List:Maria Storage Engine« Previous MessageNext Message »
From:Michael Widenius Date:October 31 2008 11:15pm
Subject:bzr commit into MySQL/Maria:mysql-maria branch (monty:2695)
View as plain text  
#At bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-maria/

 2695 Michael Widenius	2008-11-01
      Added ha_maria::is_changed() (needed for Query cache)
modified:
  storage/maria/ha_maria.cc
  storage/maria/ha_maria.h
  storage/maria/ma_delete.c
  storage/maria/ma_open.c
  storage/maria/ma_state.c
  storage/maria/ma_state.h
  storage/maria/ma_update.c
  storage/maria/ma_write.c

per-file messages:
  storage/maria/ha_maria.cc
    Added ha_maria::is_changed()
  storage/maria/ha_maria.h
    Added ha_maria::is_changed()
  storage/maria/ma_delete.c
    Mark that table changed
  storage/maria/ma_open.c
    Ensure that info->state->changed is always reset from thr_lock()
  storage/maria/ma_state.c
    Reset handler->state->changed at first usage of transactional table
    Reset handler->state->changed when taking lock for not transactional table
  storage/maria/ma_state.h
    Added variable and function to track changes of table
  storage/maria/ma_update.c
    Mark that table changed
  storage/maria/ma_write.c
    Mark that table changed
=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc	2008-10-16 19:48:32 +0000
+++ b/storage/maria/ha_maria.cc	2008-10-31 23:14:58 +0000
@@ -3074,6 +3074,16 @@ static int mark_recovery_success(void)
 }
 
 
+/*
+  Return 1 if table has changed during the current transaction
+*/
+
+bool ha_maria::is_changed() const
+{
+  return file->state->changed;
+}
+
+
 static int ha_maria_init(void *p)
 {
   int res;

=== modified file 'storage/maria/ha_maria.h'
--- a/storage/maria/ha_maria.h	2008-07-09 20:47:46 +0000
+++ b/storage/maria/ha_maria.h	2008-10-31 23:14:58 +0000
@@ -139,6 +139,7 @@ public:
   int repair(THD * thd, HA_CHECK_OPT * check_opt);
   bool check_and_repair(THD * thd);
   bool is_crashed() const;
+  bool is_changed() const;
   bool auto_repair() const { return 1; }
   int optimize(THD * thd, HA_CHECK_OPT * check_opt);
   int restore(THD * thd, HA_CHECK_OPT * check_opt);

=== modified file 'storage/maria/ma_delete.c'
--- a/storage/maria/ma_delete.c	2008-09-05 13:52:21 +0000
+++ b/storage/maria/ma_delete.c	2008-10-31 23:14:58 +0000
@@ -116,6 +116,7 @@ int maria_delete(MARIA_HA *info,const uc
   info->update= HA_STATE_CHANGED+HA_STATE_DELETED+HA_STATE_ROW_CHANGED;
   share->state.changed|= (STATE_NOT_OPTIMIZED_ROWS | STATE_NOT_MOVABLE |
                           STATE_NOT_ZEROFILLED);
+  info->state->changed=1;
 
   mi_sizestore(lastpos, info->cur_row.lastpos);
   VOID(_ma_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));

=== modified file 'storage/maria/ma_open.c'
--- a/storage/maria/ma_open.c	2008-10-14 21:23:33 +0000
+++ b/storage/maria/ma_open.c	2008-10-31 23:14:58 +0000
@@ -824,6 +824,7 @@ MARIA_HA *maria_open(const char *name, i
     VOID(my_rwlock_init(&share->mmap_lock, NULL));
 
     share->row_is_visible= _ma_row_visible_always;
+    share->lock.get_status= _ma_reset_update_flag;
     if (!thr_lock_inited)
     {
       /* Probably a single threaded program; Don't use concurrent inserts */

=== modified file 'storage/maria/ma_state.c'
--- a/storage/maria/ma_state.c	2008-08-28 18:52:23 +0000
+++ b/storage/maria/ma_state.c	2008-10-31 23:14:58 +0000
@@ -96,6 +96,8 @@ my_bool _ma_setup_live_state(MARIA_HA *i
   pthread_mutex_unlock(&share->intern_lock);
   /* The current item can't be deleted as it's the first one visible for us */
   tables->state_start=  tables->state_current= history->state;
+  tables->state_current.changed= 0;
+
   DBUG_PRINT("info", ("records: %ld", (ulong) tables->state_start.records));
 
 end:
@@ -262,6 +264,7 @@ void _ma_get_status(void* param, my_bool
 #endif
   info->state_save= info->s->state.state;
   info->state= &info->state_save;
+  info->state->changed= 0;
   info->append_insert_at_end= concurrent_insert;
   DBUG_VOID_RETURN;
 }
@@ -315,6 +318,13 @@ void _ma_copy_status(void* to, void *fro
 }
 
 
+void _ma_reset_update_flag(void *param)
+{
+  MARIA_HA *info=(MARIA_HA*) param;
+  info->state->changed= 0;
+}
+
+
 /**
    @brief Check if should allow concurrent inserts
 

=== modified file 'storage/maria/ma_state.h'
--- a/storage/maria/ma_state.h	2008-07-12 14:14:28 +0000
+++ b/storage/maria/ma_state.h	2008-10-31 23:14:58 +0000
@@ -24,6 +24,7 @@ typedef struct st_maria_status_info
   my_off_t key_file_length;
   my_off_t data_file_length;
   ha_checksum checksum;
+  my_bool     changed;
 } MARIA_STATUS_INFO;
 
 
@@ -62,6 +63,7 @@ void _ma_get_status(void* param, my_bool
 void _ma_update_status(void* param);
 void _ma_restore_status(void *param);
 void _ma_copy_status(void* to, void *from);
+void _ma_reset_update_flag(void *param);
 my_bool _ma_check_status(void *param);
 void _ma_block_get_status(void* param, my_bool concurrent_insert);
 void _ma_block_update_status(void *param);

=== modified file 'storage/maria/ma_update.c'
--- a/storage/maria/ma_update.c	2008-08-25 11:49:47 +0000
+++ b/storage/maria/ma_update.c	2008-10-31 23:14:58 +0000
@@ -173,6 +173,7 @@ int maria_update(register MARIA_HA *info
   */
   info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED | key_changed);
   share->state.changed|= STATE_NOT_MOVABLE | STATE_NOT_ZEROFILLED;
+  info->state->changed= 1;
 
   /*
     Every Maria function that updates Maria table must end with

=== modified file 'storage/maria/ma_write.c'
--- a/storage/maria/ma_write.c	2008-10-09 20:03:54 +0000
+++ b/storage/maria/ma_write.c	2008-10-31 23:14:58 +0000
@@ -289,6 +289,7 @@ int maria_write(MARIA_HA *info, uchar *r
   info->update= (HA_STATE_CHANGED | HA_STATE_AKTIV | HA_STATE_WRITTEN |
 		 HA_STATE_ROW_CHANGED);
   share->state.changed|= STATE_NOT_MOVABLE | STATE_NOT_ZEROFILLED;
+  info->state->changed= 1;
 
   info->cur_row.lastpos= filepos;
   VOID(_ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE));

Thread
bzr commit into MySQL/Maria:mysql-maria branch (monty:2695) Michael Widenius1 Nov