service_rpl_transaction_write_set.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License, version 2.0,
  4. as published by the Free Software Foundation.
  5. This program is also distributed with certain software (including
  6. but not limited to OpenSSL) that is licensed under separate terms,
  7. as designated in a particular file or component or in included license
  8. documentation. The authors of MySQL hereby grant you an additional
  9. permission to link the program and your derivative works with the
  10. separately licensed software that they have included with MySQL.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License, version 2.0, for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
  18. #ifndef MYSQL_SERVICE_TRANSACTION_WRITE_SET_INCLUDED
  19. /**
  20. @file include/mysql/service_rpl_transaction_write_set.h
  21. This service provides a function for plugins to get the write set of a given
  22. transaction.
  23. SYNOPSIS
  24. get_transaction_write_set()
  25. This service is used to fetch the write_set extracted for the currently
  26. executing transaction by passing the thread_id as an input parameter for
  27. the method.
  28. @param [in] - thread_id - It is the thread identifier of the currently
  29. executing thread.
  30. In the current implementation it is being called during RUN_HOOK macro,
  31. on which we know that thread is on plugin context.
  32. Cleanup :
  33. The service caller must take of the memory allocated during the service
  34. call to prevent memory leaks.
  35. */
  36. #ifndef MYSQL_ABI_CHECK
  37. #include <stdlib.h>
  38. #endif
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. /**
  43. This structure is used to keep the list of the hash values of the records
  44. changed in the transaction.
  45. */
  46. struct st_trans_write_set
  47. {
  48. unsigned int m_flags; // reserved
  49. unsigned long write_set_size; // Size of the PKE set of the transaction.
  50. unsigned long long* write_set; // A pointer to the PKE set.
  51. };
  52. typedef struct st_trans_write_set Transaction_write_set;
  53. extern struct transaction_write_set_service_st {
  54. Transaction_write_set* (*get_transaction_write_set)(unsigned long m_thread_id);
  55. } *transaction_write_set_service;
  56. #ifdef MYSQL_DYNAMIC_PLUGIN
  57. #define get_transaction_write_set(m_thread_id) \
  58. (transaction_write_set_service->get_transaction_write_set((m_thread_id)))
  59. #else
  60. Transaction_write_set* get_transaction_write_set(unsigned long m_thread_id);
  61. #endif
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #define MYSQL_SERVICE_TRANSACTION_WRITE_SET_INCLUDED
  66. #endif