CUBRID Engine  latest
transaction_sr.c
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 /*
20  * transaction_sr.c -
21  */
22 
23 #ident "$Id$"
24 
25 #include "config.h"
26 
27 #include <assert.h>
28 
29 #include "transaction_sr.h"
30 
31 #include "locator_sr.h"
32 #include "log_2pc.h"
33 #include "log_lsa.hpp"
34 #include "log_manager.h"
35 #if defined(SERVER_MODE)
36 #endif
37 #include "xserver_interface.h"
38 #if defined(ENABLE_SYSTEMTAP)
39 #include "probes.h"
40 #endif /* ENABLE_SYSTEMTAP */
41 #include "server_support.h"
42 #include "dbtype.h"
43 #include "thread_manager.hpp" // for thread_get_thread_entry_info and thread_sleep
44 
45 /*
46  * xtran_server_commit - Commit the current transaction
47  *
48  * return: state of operation
49  *
50  * thrd(in): this thread handle
51  * retain_lock(in): false = release locks (default)
52  * true = retain locks
53  *
54  * NOTE: Commit the current transaction. All transient class name
55  * entries are removed, and the commit is forwarded to the log
56  * and recovery manager. The log manager declares all changes of
57  * the transaction as permanent and releases all locks acquired
58  * by the transaction. The return value may indicate that the
59  * transaction has not been committed completely when there are
60  * some loose_end postpone actions to be done in the client
61  * machine. In this case the client transaction manager must
62  * obtain and execute these actions.
63  *
64  * This function should be called after all objects that have
65  * been updated by the transaction are flushed from the workspace
66  * (client) to the page buffer pool (server).
67  */
69 xtran_server_commit (THREAD_ENTRY * thread_p, bool retain_lock)
70 {
71  TRAN_STATE state;
72  int tran_index;
73 
74  /*
75  * Execute some few remaining actions before the log manager is notified of
76  * the commit
77  */
78 
79  tran_index = LOG_FIND_THREAD_TRAN_INDEX (thread_p);
80 
81  state = log_commit (thread_p, tran_index, retain_lock);
82 
83 #if defined(ENABLE_SYSTEMTAP)
85  {
86  CUBRID_TRAN_COMMIT (tran_index);
87  }
88 #endif /* ENABLE_SYSTEMTAP */
89 
90  return state;
91 }
92 
93 /*
94  * xtran_server_abort - Abort the current transaction
95  *
96  * return: state of operation
97  *
98  * thrd(in): this thread handle
99  *
100  * NOTE: Abort the current transaction. All transient class name
101  * entries are removed, and the abort operation is forwarded to
102  * to the log/recovery manager. The log manager undoes any
103  * changes made by the transaction and releases all lock acquired
104  * by the transaction. The return value may indicate that the
105  * transaction has not been aborted completely when there are
106  * some loose_end undo actions to be executed in the client
107  * machine. In this case the client transaction manager must
108  * obtain and execute these actions.
109  * This function should be called after all updated objects in
110  * the workspace are removed.
111  */
114 {
115  TRAN_STATE state;
116  int tran_index;
117 
118  /* Execute some few remaining actions before the log manager is notified of the commit */
119  tran_index = LOG_FIND_THREAD_TRAN_INDEX (thread_p);
120 
121  state = log_abort (thread_p, tran_index);
122 
123 #if defined(ENABLE_SYSTEMTAP)
124  CUBRID_TRAN_ABORT (tran_index, state);
125 #endif /* ENABLE_SYSTEMTAP */
126 
127  return state;
128 }
129 
130 #if defined (ENABLE_UNUSED_FUNCTION)
131 /*
132  * tran_server_unilaterally_abort - Unilaterally abort the current transaction
133  *
134  * return: states of transactions
135  *
136  * tran_index(in): Transaction index
137  *
138  * NOTE: The given transaction is unilaterally aborted by the server
139  * Execute tran_server_abort & set an error message
140  */
142 tran_server_unilaterally_abort (THREAD_ENTRY * thread_p, int tran_index)
143 {
144  TRAN_STATE state;
145  int save_tran_index;
146  const char *client_prog_name; /* Client user name for transaction */
147  const char *client_user_name; /* Client user name for transaction */
148  const char *client_host_name; /* Client host for transaction */
149  int client_pid; /* Client process identifier for transaction */
150 
151  if (thread_p == NULL)
152  {
153  thread_p = thread_get_thread_entry_info ();
154  }
155 
156  save_tran_index = LOG_FIND_THREAD_TRAN_INDEX (thread_p);
157  LOG_SET_CURRENT_TRAN_INDEX (thread_p, tran_index);
158 
159  (void) logtb_find_client_name_host_pid (tran_index, &client_prog_name, &client_user_name, &client_host_name,
160  &client_pid);
161  state = xtran_server_abort (thread_p);
162 
163  /* free any drivers used by this transaction */
164  LOG_SET_CURRENT_TRAN_INDEX (thread_p, save_tran_index);
165 
166  er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_LK_UNILATERALLY_ABORTED, 4, tran_index, client_user_name,
167  client_host_name, client_pid);
168 
169  return state;
170 }
171 #endif
172 
173 #if defined(SERVER_MODE)
174 /*
175  * tran_server_unilaterally_abort_tran -
176  *
177  * return: state of operation
178  *
179  * NOTE:this function is used when pgbuf_fix() results in deadlock.
180  * It is used by request handler functions to rollback gracefully,
181  */
184 {
185  if (thread_p == NULL)
186  {
187  thread_p = thread_get_thread_entry_info ();
188  }
189 
190  return xtran_server_abort (thread_p);
191 }
192 #endif /* SERVER_MODE */
193 
194 /*
195  * xtran_server_start_topop - Start a server macro nested top operation
196  *
197  * return: NO_ERROR if all OK, ER_ status otherwise
198  *
199  * topop_lsa(in/out): Address of top operation for rollback purposes
200  *
201  */
202 int
204 {
205  int error_code = NO_ERROR;
206 
207  /*
208  * Execute some few remaining actions before the start top nested action is
209  * started by the log manager.
210  */
211 
212  log_sysop_start (thread_p);
213  if (log_get_parent_lsa_system_op (thread_p, topop_lsa) == NULL)
214  {
215  assert_release (false);
216  return ER_FAILED;
217  }
218  error_code = locator_savepoint_transient_class_name_entries (thread_p, topop_lsa);
219  if (error_code != NO_ERROR)
220  {
221  ASSERT_ERROR ();
222  LSA_SET_NULL (topop_lsa);
223  return error_code;
224  }
225  return NO_ERROR;
226 }
227 
228 /*
229  * xtran_server_end_topop - End a macro nested top operation
230  *
231  * return: states of transactions
232  *
233  * result(in): Result of the nested top action
234  * topop_lsa(in): Address where the top operation for rollback purposes
235  * started.
236  *
237  * NOTE:Finish the latest nested top macro operation by either
238  * aborting or attaching to outer parent.
239  *
240  * Note that a top operation is not associated with the current
241  * transaction, thus, it can be aborted
242  * independently of the transaction.
243  */
246 {
247  TRAN_STATE state;
248  bool drop_transient_class = false;
249  LOG_TDES *tdes = LOG_FIND_CURRENT_TDES (thread_p);
250 
252 
253  /*
254  * Execute some few remaining actions before the start top nested action is
255  * started by the log manager.
256  */
257 
258  if (tdes == NULL)
259  {
260  int tran_index = LOG_FIND_THREAD_TRAN_INDEX (thread_p);
262  return TRAN_UNACTIVE_UNKNOWN;
263  }
264 
265  er_stack_push ();
266  switch (result)
267  {
270  if (log_get_parent_lsa_system_op (thread_p, topop_lsa) == topop_lsa)
271  {
272  drop_transient_class = true;
273  }
274  if (result == LOG_RESULT_TOPOP_COMMIT)
275  {
276  log_sysop_commit (thread_p);
277  state = TRAN_UNACTIVE_COMMITTED;
278  }
279  else
280  {
281  log_sysop_abort (thread_p);
282  state = TRAN_UNACTIVE_ABORTED;
283  }
284  if (drop_transient_class)
285  {
286  (void) locator_drop_transient_class_name_entries (thread_p, topop_lsa);
287  }
288  if (result == LOG_RESULT_TOPOP_ABORT)
289  {
290  tx_lob_locator_clear (thread_p, tdes, false, topop_lsa);
291  }
292  break;
293 
295  default:
296  log_sysop_attach_to_outer (thread_p);
297  state = tdes->state;
298  break;
299  }
300 
301  er_stack_pop ();
302  return state;
303 }
304 
305 /*
306  * xtran_server_savepoint - Declare a user savepoint
307  *
308  * return: NO_ERROR if all OK, ER_ status otherwise
309  *
310  * savept_name(in): Name of the savepoint
311  * savept_lsa(in): Address of save point operation.
312  *
313  * NOTE: A savepoint is established for the current transaction so
314  * that future transaction actions can be rolled back to this
315  * established savepoint. We call this operation a partial abort
316  * (rollback). That is, all database actions affected by the
317  * transaction after the savepoint are "undone", and all effects
318  * of the transaction preceding the savepoint remain. The
319  * transaction can then continue executing other database
320  * statements. It is permissible to abort to the same savepoint
321  * repeatedly within the same transaction.
322  * If the same savepoint name is used in multiple savepoint
323  * declarations within the same transaction, then only the latest
324  * savepoint with that name is available for aborts and the
325  * others are forgotten.
326  * There are no limits on the number of savepoints that a
327  * transaction can have.
328  */
329 int
330 xtran_server_savepoint (THREAD_ENTRY * thread_p, const char *savept_name, LOG_LSA * savept_lsa)
331 {
332  LOG_LSA *lsa;
333  int error_code = NO_ERROR;
334 
335  /*
336  * Execute some few remaining actions before the start top nested action is
337  * started by the log manager.
338  */
339 
340  lsa = log_append_savepoint (thread_p, savept_name);
341  if (lsa == NULL)
342  {
343  LSA_SET_NULL (savept_lsa);
344  error_code = ER_FAILED;
345  }
346  else
347  {
348  LSA_COPY (savept_lsa, lsa);
349  error_code = locator_savepoint_transient_class_name_entries (thread_p, lsa);
350  if (error_code != NO_ERROR)
351  {
352  LSA_SET_NULL (savept_lsa);
353  }
354  }
355 
356  return error_code;
357 }
358 
359 /*
360  * xtran_server_partial_abort -Abort operations of a transaction up to a savepoint
361  *
362  * return: state of partial aborted operation (i.e., notify if
363  * there are client actions that need to be undone).
364  *
365  * savept_name(in): Name of the savepoint
366  * savept_lsa(in/out): Address of save point operation.
367  *
368  * Note: All the effects of the current transaction after the
369  * given savepoint are undone and all the effects of the transaction
370  * preceding the given savepoint remain. After the partial abort
371  * the transaction can continue its normal execution as if
372  * the statements that were undone, were never executed.
373  * The return value may indicate that there are some client
374  * loose_end undo actions to be performed at the client machine.
375  * In this case the transaction manager must obtain and execute
376  * these actions at the client.
377  */
379 xtran_server_partial_abort (THREAD_ENTRY * thread_p, const char *savept_name, LOG_LSA * savept_lsa)
380 {
381  TRAN_STATE state;
382 
383  state = log_abort_partial (thread_p, savept_name, savept_lsa);
384 
385  return state;
386 }
387 
388 /*
389  * xtran_server_set_global_tran_info - Set global transaction information
390  *
391  * return: NO_ERROR if all OK, ER_ status otherwise
392  *
393  * gtrid(in): global transaction identifier
394  * info(in): pointer to the user information to be set
395  * size(in): size of the user information to be set
396  *
397  * NOTE: Set the user information related with the global transaction.
398  * The global transaction identified by the 'gtrid' should exist
399  * and should be the value returned by 'db_2pc_start_transaction'
400  * You can use this function to set the longer format of global
401  * transaction identifier such as XID of XA interface.
402  */
403 int
404 xtran_server_set_global_tran_info (THREAD_ENTRY * thread_p, int gtrid, void *info, int size)
405 {
406  return log_2pc_set_global_tran_info (thread_p, gtrid, info, size);
407 }
408 
409 /*
410  * xtran_server_get_global_tran_info - Get global transaction information
411  *
412  * return: NO_ERROR if all OK, ER_ status otherwise
413  *
414  * gtrid(in): global transaction identifier
415  * buffer(in):pointer to the buffer into which the user information is stored
416  * size(in): size of the buffer
417  *
418  * NOTE: Get the user information of the global transaction identified
419  * by the 'gtrid'.
420  * You can use this function to get the longer format of global
421  * transaction identifier such as XID of XA interface. This
422  * function is designed to use if you want to get XID after
423  * calling 'db_2pc_prepared_transactions' to support xa_recover()
424  */
425 int
426 xtran_server_get_global_tran_info (THREAD_ENTRY * thread_p, int gtrid, void *buffer, int size)
427 {
428  return log_2pc_get_global_tran_info (thread_p, gtrid, buffer, size);
429 }
430 
431 /*
432  * xtran_server_2pc_start - Start transaction as a part of global transaction
433  *
434  * return: return global transaction identifier
435  *
436  * Note: Make current transaction as a part of a global transaction by
437  * assigning a global transaction identifier(gtrid).
438  * It is recommended to call this function just after the end of
439  * a transaction(commit or abort) before executing other works.
440  * This function is one way of getting gtrid of the transaction.
441  * The other way is to use 'db_2pc_prepare_to_commit_transaction'
442  * The function 'db_2pc_prepare_transaction' should be used if
443  * this function is called.
444  */
445 int
447 {
448  return log_2pc_start (thread_p);
449 }
450 
451 /*
452  * xtran_server_2pc_prepare - Prepare transaction to commit
453  *
454  * return: TRAN_STATE
455  *
456  * Note: Prepare the current transaction for commitment in 2PC. The
457  * transaction should be made as a part of a global transaction
458  * before by 'db_2pc_start_transaction', a pair one of this
459  * function.
460  * The system promises not to unilaterally abort the transaction.
461  * After this function call, the only API functions that should
462  * be executed are 'db_commit_transaction' &
463  * 'db_abort_transaction'.
464  */
467 {
468  /* Make the transient classname entries permanent; If transaction aborted after this point, these operations will
469  * also be undone, just like previous operations of the transaction. */
471 
472  return log_2pc_prepare (thread_p);
473 }
474 
475 /*
476  * xtran_server_2pc_recovery_prepared - Obtain list of prepared transactions
477  *
478  * return: the number of ids copied into 'gtrids[]'
479  *
480  * gtrids(in): array into which global transaction identifiers are copied
481  * size(in): size of 'gtrids[]' array
482  *
483  * Note: For restart recovery of global transactions, this function
484  * returns gtrids of transactions in prepared state, which was
485  * a part of a global transaction.
486  * If the return value is less than the 'size', there's no more
487  * transactions to recover.
488  */
489 int
490 xtran_server_2pc_recovery_prepared (THREAD_ENTRY * thread_p, int gtrids[], int size)
491 {
492  return log_2pc_recovery_prepared (thread_p, gtrids, size);
493 }
494 
495 /*
496  * xtran_server_2pc_attach_global_tran - Attach to a loose end 2pc transaction
497  *
498  * return: New transaction index
499  *
500  * gtrid(in): Global transaction identifier
501  *
502  * Note:The current client index is attached to the given 2PC loose
503  * end (i.e., transaction wiating for decision) transaction with
504  * the given global transaction identifier.
505  * The old client transaction is aborted before the attachement,
506  * the old client transaction must not be in the middle of a 2PC.
507  * It is recommended to attach a client to a 2PC loose end
508  * transaction just after the client restart or after a commit
509  * or abort.
510  */
511 int
513 {
514  return log_2pc_attach_global_tran (thread_p, gtrid);
515 }
516 
517 /*
518  * xtran_server_2pc_prepare_global_tran - Prepare the transaction to commit
519  *
520  * return: TRAN_STATE
521  *
522  * global_tranid(in): Identifier of the global transaction
523  *
524  * Note:This function prepares the transaction identified by "gtrid"
525  * for commitment. Any objects and data that the transaction held
526  * or modified are placed in a state that can be guarantee the
527  * the commintment of the transaction by coordinator request
528  * regardless of failures. The shared type locks (IS, S) acquired
529  * by the transaction are released (SIX is demoted to IX lock)
530  * and the exclusive type locks (IX, X) acquired by the
531  * transaction are saved in the log as part of the prepare to
532  * commit log record. This is needed since, we must guarantee the
533  * consistency of the updated data until the transaction is
534  * either committed or aborted by the coordinator regardless of
535  * failures. If the transaction cannot be committed, it was
536  * previously aborted, and the coordinator is notified of such
537  * state.
538  */
540 xtran_server_2pc_prepare_global_tran (THREAD_ENTRY * thread_p, int global_tranid)
541 {
542  /* Make the transient classname entries permanent; If transaction aborted after this point, these operations will
543  * also be undone, just like previous operations of the transaction. */
545 
546  return log_2pc_prepare_global_tran (thread_p, global_tranid);
547 }
548 
549 /*
550  * xtran_is_blocked - Is transaction suspended ?
551  *
552  * return:
553  *
554  * tran_index(in): Transaction index
555  *
556  * NOTE: Find if current transaction is suspended.
557  */
558 bool
559 xtran_is_blocked (THREAD_ENTRY * thread_p, int tran_index)
560 {
561  return lock_is_waiting_transaction (tran_index);
562 }
563 
564 /*
565  * xtran_server_has_updated - Has transaction updated the database ?
566  *
567  * return:
568  *
569  * NOTE: Find if the transaction has dirtied the database. We say that
570  * a transaction has updated the database, if it has log
571  * something and it has a write lock on an object, or if there
572  * has been an update to a remote database.
573  */
574 bool
576 {
577  return ((logtb_has_updated (thread_p) && lock_has_xlock (thread_p)));
578 }
579 
580 /*
581  * xtran_wait_server_active_trans -
582  *
583  * return:
584  *
585  * NOTE: wait for server threads with current tran index to finish
586  */
587 int
589 {
590 #if defined(SERVER_MODE)
591  size_t prev_thrd_cnt, thrd_cnt;
592  CSS_CONN_ENTRY *p;
593  int tran_index, client_id;
594  bool continue_check;
595 
596  if (thread_p == NULL)
597  {
598  thread_p = thread_get_thread_entry_info ();
599  }
600 
601  p = thread_p->conn_entry;
602  if (p == NULL)
603  {
604  return 0;
605  }
606 
607  tran_index = thread_p->tran_index;
608  client_id = p->client_id;
609 
610 loop:
611  prev_thrd_cnt = css_count_transaction_worker_threads (thread_p, tran_index, client_id);
612  if (prev_thrd_cnt > 0)
613  {
614  if (!logtb_is_interrupted_tran (thread_p, false, &continue_check, tran_index))
615  {
616  logtb_set_tran_index_interrupt (thread_p, tran_index, true);
617  }
618  }
619 
620  while ((thrd_cnt = css_count_transaction_worker_threads (thread_p, tran_index, client_id)) >= prev_thrd_cnt
621  && thrd_cnt > 0)
622  {
623  /* Some threads may wait for data from the m-driver. It's possible from the fact that css_server_thread() is
624  * responsible for receiving every data from which is sent by a client and all m-drivers. We must have chance to
625  * receive data from them. */
626  thread_sleep (10); /* 10 msec */
627  }
628 
629  if (thrd_cnt > 0)
630  {
631  goto loop;
632  }
633 
634  logtb_set_tran_index_interrupt (thread_p, tran_index, false);
635 
636 #endif /* SERVER_MODE */
637  return 0;
638 }
639 
640 /*
641  * xtran_server_is_active_and_has_updated - Find if transaction is active and
642  * has updated the database ?
643  * return:
644  *
645  * NOTE: Find if the transaction is active and has dirtied the
646  * database. We say that a transaction has updated the database,
647  * if it has log something and it has a write lock on an object.
648  */
649 int
651 {
652  return (logtb_is_current_active (thread_p) && xtran_server_has_updated (thread_p));
653 }
654 
655 /*
656  * xtran_get_local_transaction_id -
657  *
658  * return: NO_ERROR if all OK, ER_ status otherwise
659  *
660  * trid(in):
661  *
662  * NOTE:
663  */
664 int
666 {
667  int error_code = NO_ERROR;
668 
669  assert (trid != (DB_VALUE *) NULL);
670 
671  error_code = db_value_domain_init (trid, DB_TYPE_INTEGER, 0, 0);
672  if (error_code == NO_ERROR)
673  {
674  db_make_int (trid, logtb_find_current_tranid (thread_p));
675  }
676 
677  return error_code;
678 }
679 
680 /*
681  * xtran_lock_rep_read - lock RR transaction with specified lock
682  *
683  * return: NO_ERROR if all OK, ER_ status otherwise
684  *
685  * thread_p(in):
686  * lock_rr_tran(in):
687  *
688  * NOTE:
689  */
690 int
691 xtran_lock_rep_read (THREAD_ENTRY * thread_p, LOCK lock_rr_tran)
692 {
693  return lock_rep_read_tran (thread_p, lock_rr_tran, LK_UNCOND_LOCK);
694 }
695 
696 #if defined(SERVER_MODE)
697 /*
698  * xtran_should_connection_reset - Reset on commit
699  *
700  * return: true if reset is required
701  *
702  * thread_p(in): this thread handle
703  * has_updated(in): true, if has updated
704  */
705 bool
706 xtran_should_connection_reset (THREAD_ENTRY * thread_p, bool has_updated)
707 {
708  int client_type;
709  const char *hostname;
710  HA_SERVER_STATE ha_state;
711  bool should_conn_reset = false;
712 
713  client_type = logtb_find_current_client_type (thread_p);
714  hostname = logtb_find_current_client_hostname (thread_p);
715  ha_state = css_ha_server_state ();
716 
717  if (has_updated && ha_state == HA_SERVER_STATE_TO_BE_STANDBY && BOOT_NORMAL_CLIENT_TYPE (client_type))
718  {
719  should_conn_reset = true;
721  "xtran_should_connection_reset: (has_updated && to-be-standby && normal client)"
722  " DB_CONNECTION_STATUS_RESET\n");
723  }
724  else if (ha_state == HA_SERVER_STATE_STANDBY)
725  {
726  /* be aware that the order of if conditions is important */
727  if (BOOT_CSQL_CLIENT_TYPE (client_type))
728  {
729  thread_p->conn_entry->reset_on_commit = false;
730  }
731  else if (client_type == DB_CLIENT_TYPE_BROKER)
732  {
733  should_conn_reset = true;
735  "xtran_should_connection_reset: (standby && read-write broker) DB_CONNECTION_STATUS_RESET\n");
736  }
737  else if (BOOT_NORMAL_CLIENT_TYPE (client_type) && thread_p->conn_entry->reset_on_commit == true)
738  {
739  should_conn_reset = true;
740  thread_p->conn_entry->reset_on_commit = false;
742  "xtran_should_connection_reset: (standby && conn->reset_on_commit && normal client)"
743  " DB_CONNECTION_STATUS_RESET\n");
744  }
745  else if (BOOT_BROKER_AND_DEFAULT_CLIENT_TYPE (client_type) && css_is_ha_repl_delayed () == true)
746  {
747  if (thread_p->conn_entry->ignore_repl_delay == false)
748  {
749  should_conn_reset = true;
751  "xtran_should_connection_reset: (standby && replication delay && broker and default client)"
752  " DB_CONNECTION_STATUS_RESET\n");
753  }
754  thread_p->conn_entry->reset_on_commit = false;
755  }
756  }
757  else if (ha_state == HA_SERVER_STATE_ACTIVE && client_type == DB_CLIENT_TYPE_SLAVE_ONLY_BROKER)
758  {
759  should_conn_reset = true;
761  "xtran_should_connection_reset: (active && slave only broker) DB_CONNECTION_STATUS_RESET\n");
762  }
763  else if (ha_state == HA_SERVER_STATE_MAINTENANCE
764  && !BOOT_IS_ALLOWED_CLIENT_TYPE_IN_MT_MODE (hostname, boot_Host_name, client_type))
765  {
766  should_conn_reset = true;
768  "xtran_should_connection_reset: (maintenance && remote normal client type)"
769  " DB_CONNECTION_STATUS_RESET\n");
770  }
771 
772  return should_conn_reset;
773 }
774 #endif
bool lock_has_xlock(THREAD_ENTRY *thread_p)
TRANID logtb_find_current_tranid(THREAD_ENTRY *thread_p)
void tx_lob_locator_clear(cubthread::entry *thread_p, log_tdes *tdes, bool at_commit, LOG_LSA *savept_lsa)
#define ER_LK_UNILATERALLY_ABORTED
Definition: error_code.h:130
cubthread::entry * thread_get_thread_entry_info(void)
#define NO_ERROR
Definition: error_code.h:46
int locator_drop_transient_class_name_entries(THREAD_ENTRY *thread_p, LOG_LSA *savep_lsa)
Definition: locator_sr.c:1258
void er_stack_push(void)
TRAN_STATE log_abort(THREAD_ENTRY *thread_p, int tran_index)
Definition: log_manager.c:5185
#define ASSERT_ERROR()
size_t css_count_transaction_worker_threads(THREAD_ENTRY *thread_p, int tran_index, int client_id)
void LSA_COPY(log_lsa *plsa1, const log_lsa *plsa2)
Definition: log_lsa.hpp:139
#define BOOT_CSQL_CLIENT_TYPE(client_type)
Definition: boot.h:61
int xtran_server_2pc_recovery_prepared(THREAD_ENTRY *thread_p, int gtrids[], int size)
#define ER_FAILED
Definition: error_code.h:47
#define BOOT_BROKER_AND_DEFAULT_CLIENT_TYPE(client_type)
Definition: boot.h:69
TRAN_STATE log_2pc_prepare(THREAD_ENTRY *thread_p)
Definition: log_2pc.c:921
int logtb_find_current_client_type(THREAD_ENTRY *thread_p)
bool logtb_set_tran_index_interrupt(THREAD_ENTRY *thread_p, int tran_index, bool set)
void thread_sleep(double millisec)
#define assert_release(e)
Definition: error_manager.h:96
const char * logtb_find_current_client_hostname(THREAD_ENTRY *thread_p)
int xtran_server_2pc_attach_global_tran(THREAD_ENTRY *thread_p, int gtrid)
void log_sysop_start(THREAD_ENTRY *thread_p)
Definition: log_manager.c:3578
int lock_rep_read_tran(THREAD_ENTRY *thread_p, LOCK lock, int cond_flag)
TRAN_STATE xtran_server_2pc_prepare_global_tran(THREAD_ENTRY *thread_p, int global_tranid)
bool xtran_should_connection_reset(THREAD_ENTRY *thread_p, bool has_updated)
TRAN_STATE xtran_server_commit(THREAD_ENTRY *thread_p, bool retain_lock)
int log_2pc_attach_global_tran(THREAD_ENTRY *thread_p, int gtrid)
Definition: log_2pc.c:1080
#define er_log_debug(...)
void THREAD_ENTRY
LOCK
char boot_Host_name[CUB_MAXHOSTNAMELEN]
Definition: boot_cl.c:158
int log_2pc_set_global_tran_info(THREAD_ENTRY *thread_p, int gtrid, void *info, int size)
Definition: log_2pc.c:749
int xtran_server_savepoint(THREAD_ENTRY *thread_p, const char *savept_name, LOG_LSA *savept_lsa)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
#define BOOT_NORMAL_CLIENT_TYPE(client_type)
Definition: boot.h:33
#define assert(x)
#define BOOT_IS_ALLOWED_CLIENT_TYPE_IN_MT_MODE(host1, host2, client_type)
Definition: boot.h:91
int xtran_wait_server_active_trans(THREAD_ENTRY *thread_p)
bool logtb_is_interrupted_tran(THREAD_ENTRY *thread_p, bool clear, bool *continue_checking, int tran_index)
int xtran_server_2pc_start(THREAD_ENTRY *thread_p)
bool logtb_is_current_active(THREAD_ENTRY *thread_p)
bool logtb_has_updated(THREAD_ENTRY *thread_p)
int log_2pc_start(THREAD_ENTRY *thread_p)
Definition: log_2pc.c:877
TRAN_STATE log_abort_partial(THREAD_ENTRY *thread_p, const char *savepoint_name, LOG_LSA *savept_lsa)
Definition: log_manager.c:5282
int xtran_lock_rep_read(THREAD_ENTRY *thread_p, LOCK lock_rr_tran)
LOG_LSA * log_get_parent_lsa_system_op(THREAD_ENTRY *thread_p, LOG_LSA *parent_lsa)
Definition: log_manager.c:4198
#define NULL
Definition: freelistheap.h:34
bool xtran_server_has_updated(THREAD_ENTRY *thread_p)
#define LOG_SET_CURRENT_TRAN_INDEX(thrd, index)
Definition: log_impl.h:178
#define ER_LOG_UNKNOWN_TRANINDEX
Definition: error_code.h:913
TRAN_STATE xtran_server_partial_abort(THREAD_ENTRY *thread_p, const char *savept_name, LOG_LSA *savept_lsa)
void log_sysop_abort(THREAD_ENTRY *thread_p)
Definition: log_manager.c:4017
void er_stack_pop(void)
LOG_TDES * LOG_FIND_CURRENT_TDES(THREAD_ENTRY *thread_p=NULL)
Definition: log_impl.h:1115
#define LOG_FIND_THREAD_TRAN_INDEX(thrd)
Definition: perf_monitor.h:158
#define ARG_FILE_LINE
Definition: error_manager.h:44
TRAN_STATE xtran_server_end_topop(THREAD_ENTRY *thread_p, LOG_RESULT_TOPOP result, LOG_LSA *topop_lsa)
TRAN_STATE tran_server_unilaterally_abort_tran(THREAD_ENTRY *thread_p)
int xtran_server_is_active_and_has_updated(THREAD_ENTRY *thread_p)
int xtran_server_start_topop(THREAD_ENTRY *thread_p, LOG_LSA *topop_lsa)
void LSA_SET_NULL(log_lsa *lsa_ptr)
Definition: log_lsa.hpp:146
int xtran_server_get_global_tran_info(THREAD_ENTRY *thread_p, int gtrid, void *buffer, int size)
bool css_is_ha_repl_delayed(void)
int logtb_find_client_name_host_pid(int tran_index, const char **client_prog_name, const char **client_user_name, const char **client_host_name, int *client_pid)
HA_SERVER_STATE css_ha_server_state(void)
int log_2pc_recovery_prepared(THREAD_ENTRY *thread_p, int gtrids[], int size)
Definition: log_2pc.c:959
void log_sysop_attach_to_outer(THREAD_ENTRY *thread_p)
Definition: log_manager.c:4076
void log_sysop_commit(THREAD_ENTRY *thread_p)
Definition: log_manager.c:3895
TRAN_STATE xtran_server_2pc_prepare(THREAD_ENTRY *thread_p)
int locator_savepoint_transient_class_name_entries(THREAD_ENTRY *thread_p, LOG_LSA *savep_lsa)
Definition: locator_sr.c:1604
int xtran_server_set_global_tran_info(THREAD_ENTRY *thread_p, int gtrid, void *info, int size)
TRAN_STATE state
Definition: log_impl.h:469
TRAN_STATE
Definition: log_comm.h:36
int db_make_int(DB_VALUE *value, const int num)
enum ha_server_state HA_SERVER_STATE
Definition: boot.h:126
LOG_RESULT_TOPOP
Definition: log_comm.h:73
TRAN_STATE log_commit(THREAD_ENTRY *thread_p, int tran_index, bool retain_lock)
Definition: log_manager.c:5076
LOG_LSA * log_append_savepoint(THREAD_ENTRY *thread_p, const char *savept_name)
Definition: log_manager.c:3344
TRAN_STATE xtran_server_abort(THREAD_ENTRY *thread_p)
TRAN_STATE log_2pc_prepare_global_tran(THREAD_ENTRY *thread_p, int gtrid)
Definition: log_2pc.c:1162
bool xtran_is_blocked(THREAD_ENTRY *thread_p, int tran_index)
bool lock_is_waiting_transaction(int tran_index)
const char ** p
Definition: dynamic_load.c:945
int xtran_get_local_transaction_id(THREAD_ENTRY *thread_p, DB_VALUE *trid)
int log_2pc_get_global_tran_info(THREAD_ENTRY *thread_p, int gtrid, void *buffer, int size)
Definition: log_2pc.c:816
int client_id
int db_value_domain_init(DB_VALUE *value, const DB_TYPE type, const int precision, const int scale)
Definition: db_macro.c:153