~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/replication/replication.cc

  • Committer: Brian Aker
  • Date: 2009-01-22 23:52:45 UTC
  • mto: This revision was merged to the branch mainline in revision 801.
  • Revision ID: brian@tangent.org-20090122235245-86jal8k1zku98lfd
Detangle more of the session object

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
      Now they sync is done for next read.
52
52
*/
53
53
 
54
 
void adjust_linfo_offsets(my_off_t purge_offset)
 
54
void adjust_linfo_offsets(my_off_t)
55
55
{
56
 
  Session *tmp;
57
 
 
58
 
  pthread_mutex_lock(&LOCK_thread_count);
59
 
  I_List_iterator<Session> it(threads);
60
 
 
61
 
  while ((tmp=it++))
62
 
  {
63
 
    LOG_INFO* linfo;
64
 
    if ((linfo = tmp->current_linfo))
65
 
    {
66
 
      pthread_mutex_lock(&linfo->lock);
67
 
      /*
68
 
        Index file offset can be less that purge offset only if
69
 
        we just started reading the index file. In that case
70
 
        we have nothing to adjust
71
 
      */
72
 
      if (linfo->index_file_offset < purge_offset)
73
 
        linfo->fatal = (linfo->index_file_offset != 0);
74
 
      else
75
 
        linfo->index_file_offset -= purge_offset;
76
 
      pthread_mutex_unlock(&linfo->lock);
77
 
    }
78
 
  }
79
 
  pthread_mutex_unlock(&LOCK_thread_count);
80
56
}
81
57
 
82
58
 
83
 
bool log_in_use(const char* log_name)
 
59
bool log_in_use(const char*)
84
60
{
85
 
  int log_name_len = strlen(log_name) + 1;
86
 
  Session *tmp;
87
 
  bool result = 0;
88
 
 
89
 
  pthread_mutex_lock(&LOCK_thread_count);
90
 
  I_List_iterator<Session> it(threads);
91
 
 
92
 
  while ((tmp=it++))
93
 
  {
94
 
    LOG_INFO* linfo;
95
 
    if ((linfo = tmp->current_linfo))
96
 
    {
97
 
      pthread_mutex_lock(&linfo->lock);
98
 
      result = !memcmp(log_name, linfo->log_file_name, log_name_len);
99
 
      pthread_mutex_unlock(&linfo->lock);
100
 
      if (result)
101
 
        break;
102
 
    }
103
 
  }
104
 
 
105
 
  pthread_mutex_unlock(&LOCK_thread_count);
106
 
  return result;
 
61
  return 0;
107
62
}
108
63
 
109
64
bool purge_error_message(Session* session, int res)