List:Maria Storage Engine« Previous MessageNext Message »
From:Guilhem Bichot Date:June 26 2008 8:13pm
Subject:bzr commit into mysql-6.0-maria branch (guilhem:2687)
View as plain text  
#At file:///home/mysql_src/bzrrepos/mysql-6.0-maria2/

 2687 Guilhem Bichot	2008-06-26 [merge]
      Merge from 5.1-maria (mysql-maria branch: sanja@stripped)
      and fix for Windows compiler errors
modified:
  sql/item_subselect.cc
  storage/maria/ma_loghandler.c
  storage/maria/ma_test3.c

per-file messages:
  sql/item_subselect.cc
    VC++ preprocessor probably not recursive enough, gives error
  storage/maria/ma_test3.c
    move #include in part where maria.h is available, otherwise some structs were undefined.
=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2008-06-17 20:04:19 +0000
+++ b/sql/item_subselect.cc	2008-06-26 20:13:19 +0000
@@ -3031,11 +3031,12 @@ bool subselect_hash_sj_engine::init_perm
   {
 #ifndef DBUG_OFF
     handlerton *tmp_table_hton= tmp_table->s->db_type();
-    DBUG_ASSERT((tmp_table_hton == myisam_hton)
 #if defined(WITH_MARIA_STORAGE_ENGINE) && defined(USE_MARIA_FOR_TMP_TABLES)
-                || (tmp_table_hton == maria_hton)
+    DBUG_ASSERT((tmp_table_hton == myisam_hton) ||
+                (tmp_table_hton == maria_hton));
+#else
+    DBUG_ASSERT(tmp_table_hton == myisam_hton);
 #endif
-                );
 #endif
     DBUG_ASSERT(
       tmp_table->s->uniques ||

=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c	2008-06-26 17:48:42 +0000
+++ b/storage/maria/ma_loghandler.c	2008-06-26 20:13:19 +0000
@@ -95,6 +95,10 @@ typedef union
 #define MAX_NUMBER_OF_LSNS_PER_RECORD 2
 
 
+/* max lsn calculation for buffer */
+#define BUFFER_MAX_LSN(B)  \
+  ((B)->last_lsn == LSN_IMPOSSIBLE ? (B)->prev_last_lsn : (B)->last_lsn)
+
 /* log write buffer descriptor */
 struct st_translog_buffer
 {
@@ -2093,9 +2097,7 @@ static my_bool translog_buffer_next(TRAN
   }
   log_descriptor.buffers[old_buffer_no].next_buffer_offset= new_buffer->offset;
   new_buffer->prev_last_lsn=
-    ((log_descriptor.buffers[old_buffer_no].last_lsn != LSN_IMPOSSIBLE) ?
-     log_descriptor.buffers[old_buffer_no].last_lsn :
-     log_descriptor.buffers[old_buffer_no].prev_last_lsn);
+    BUFFER_MAX_LSN(log_descriptor.buffers + old_buffer_no);
   DBUG_PRINT("info", ("prev_last_lsn set to (%lu,0x%lx)  buffer: 0x%lx",
                       LSN_IN_PARTS(new_buffer->prev_last_lsn),
                       (ulong) new_buffer));
@@ -7515,7 +7517,7 @@ my_bool translog_flush(TRANSLOG_ADDRESS 
     {
       /* fix lsn if it was horizon */
       if (cmp_translog_addr(lsn, log_descriptor.bc.buffer->last_lsn) > 0)
-          lsn= log_descriptor.bc.buffer->last_lsn;
+          lsn= BUFFER_MAX_LSN(log_descriptor.bc.buffer);
       translog_flush_wait_for_end(lsn);
       pthread_mutex_unlock(&log_descriptor.log_flush_lock);
       DBUG_RETURN(0);
@@ -7550,11 +7552,24 @@ my_bool translog_flush(TRANSLOG_ADDRESS 
        i= (i + 1) % TRANSLOG_BUFFERS_NO) {}
   start_buffer_no= i;
 
-  /* if we have to flush last buffer then we will finish it */
-  if (cmp_translog_addr(lsn, log_descriptor.bc.buffer->prev_last_lsn) > 0)
+  DBUG_PRINT("info",
+             ("start from: %u  current: %u  prev last lsn: (%lu,0x%lx)",
+              (uint) start_buffer_no, (uint) log_descriptor.bc.buffer_no,
+              LSN_IN_PARTS(log_descriptor.bc.buffer->prev_last_lsn)));
+
+
+  /*
+    if LSN up to which we have to flush bigger then maximum LSN of previous
+    buffer and at least one LSN was saved in the current buffer (last_lsn !=
+    LSN_IMPOSSIBLE) then we better finish the current buffer.
+  */
+  if (cmp_translog_addr(lsn, log_descriptor.bc.buffer->prev_last_lsn) > 0 &&
+      log_descriptor.bc.buffer->last_lsn != LSN_IMPOSSIBLE)
   {
     struct st_translog_buffer *buffer= log_descriptor.bc.buffer;
     lsn= log_descriptor.bc.buffer->last_lsn; /* fix lsn if it was horizon */
+    DBUG_PRINT("info", ("LSN to flush fixed to last lsn: (%lu,0x%lx)",
+               LSN_IN_PARTS(log_descriptor.bc.buffer->last_lsn)));
     last_buffer_no= log_descriptor.bc.buffer_no;
     log_descriptor.is_everything_flushed= 1;
     translog_force_current_buffer_to_finish();

=== modified file 'storage/maria/ma_test3.c'
--- a/storage/maria/ma_test3.c	2008-05-29 15:44:11 +0000
+++ b/storage/maria/ma_test3.c	2008-06-26 20:13:19 +0000
@@ -488,6 +488,8 @@ int test_update(MARIA_HA *file,int id,in
   return 0;
 }
 
+#include "ma_check_standalone.h"
+
 #else /* __NETWARE__ || __WIN__ */
 
 #include <stdio.h>
@@ -499,5 +501,3 @@ int main()
 }
 
 #endif /* __NETWARE__|| __WIN__ */
-
-#include "ma_check_standalone.h"

Thread
bzr commit into mysql-6.0-maria branch (guilhem:2687) Guilhem Bichot26 Jun