~ubuntu-branches/ubuntu/wily/mysql-5.6/wily

« back to all changes in this revision

Viewing changes to plugin/semisync/semisync_master.h

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2015-07-21 07:09:29 UTC
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: package-import@ubuntu.com-20150721070929-mg4dpqkgg3it1ajf
Tags: upstream-5.6.25
ImportĀ upstreamĀ versionĀ 5.6.25

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Copyright (C) 2007 Google Inc.
2
 
   Copyright (c) 2008 MySQL AB, 2009 Sun Microsystems, Inc.
3
 
   Use is subject to license terms.
 
2
   Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
4
3
 
5
4
   This program is free software; you can redistribute it and/or modify
6
5
   it under the terms of the GNU General Public License as published by
30
29
 
31
30
struct TranxNode {
32
31
  char             log_name_[FN_REFLEN];
33
 
  my_off_t          log_pos_;
 
32
  my_off_t         log_pos_;
 
33
  mysql_cond_t     cond;
 
34
  int              n_waiters;
34
35
  struct TranxNode *next_;            /* the next node in the sorted list */
35
36
  struct TranxNode *hash_next_;    /* the next node during hash collision */
36
37
};
128
129
    trx_node->log_pos_= 0;
129
130
    trx_node->next_= 0;
130
131
    trx_node->hash_next_= 0;
 
132
    trx_node->n_waiters= 0;
131
133
    return trx_node;
132
134
  }
133
135
 
246
248
      /* New Block is always the current_block */
247
249
      current_block= block;
248
250
      ++block_num;
 
251
 
 
252
      for (int i=0; i< BLOCK_TRANX_NODES; i++)
 
253
        mysql_cond_init(key_ss_cond_COND_binlog_send_,
 
254
                        &current_block->nodes[i].cond,
 
255
                        NULL);
 
256
 
249
257
      return 0;
250
258
    }
251
259
    return 1;
257
265
   */
258
266
  void free_block(Block *block)
259
267
  {
 
268
    for (int i=0; i< BLOCK_TRANX_NODES; i++)
 
269
      mysql_cond_destroy(&block->nodes[i].cond);
260
270
    my_free(block);
261
271
    --block_num;
262
272
  }
330
340
  }
331
341
 
332
342
public:
 
343
  int signal_waiting_sessions_all();
 
344
  int signal_waiting_sessions_up_to(const char *log_file_name,
 
345
                                    my_off_t log_file_pos);
 
346
  TranxNode* find_active_tranx_node(const char *log_file_name,
 
347
                                    my_off_t log_file_pos);
333
348
  ActiveTranx(mysql_mutex_t *lock, unsigned long trace_level);
334
349
  ~ActiveTranx();
335
350
 
362
377
  static int compare(const char *log_file_name1, my_off_t log_file_pos1,
363
378
                     const char *log_file_name2, my_off_t log_file_pos2);
364
379
 
 
380
  /* Find out if active tranx node list is empty or not
 
381
   *
 
382
   * Return:
 
383
   *   True :  If there are no nodes
 
384
   *   False:  othewise
 
385
  */
 
386
  bool is_empty()
 
387
  {
 
388
    return (trx_front_ == NULL);
 
389
  }
 
390
 
365
391
};
366
392
 
367
393
/**
376
402
  /* True when initObject has been called */
377
403
  bool init_done_;
378
404
 
379
 
  /* This cond variable is signaled when enough binlog has been sent to slave,
380
 
   * so that a waiting trx can return the 'ok' to the client for a commit.
381
 
   */
382
 
  mysql_cond_t  COND_binlog_send_;
383
 
 
384
405
  /* Mutex that protects the following state variables and the active
385
406
   * transaction list.
386
407
   * Under no cirumstances we can acquire mysql_bin_log.LOCK_log if we are
434
455
 
435
456
  void lock();
436
457
  void unlock();
437
 
  void cond_broadcast();
438
 
  int  cond_timewait(struct timespec *wait_time);
439
458
 
440
459
  /* Is semi-sync replication on? */
441
460
  bool is_on() {