transactd 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/bin/common/{tdclc_32_3_3.dll → tdclc_32_3_4.dll} +0 -0
  3. data/bin/common/tdclc_64_3_4.dll +0 -0
  4. data/build/swig/ruby/tdclrb_wrap.cpp +66 -11
  5. data/build/swig/tdcl.i +0 -1
  6. data/build/tdclc/tdclc.cbproj +1 -1
  7. data/build/tdclc/tdclc.rc +4 -4
  8. data/build/tdclcpp/tdclcpp.rc +4 -4
  9. data/build/tdclcpp/tdclcpp_bc.cbproj +1 -1
  10. data/build/tdclrb/tdclrb.rc +4 -4
  11. data/source/bzs/db/engine/mysql/database.cpp +14 -5
  12. data/source/bzs/db/engine/mysql/database.h +2 -1
  13. data/source/bzs/db/engine/mysql/mysqlInternal.h +3 -0
  14. data/source/bzs/db/engine/mysql/mysqlProtocol.cpp +103 -72
  15. data/source/bzs/db/engine/mysql/mysqlProtocol.h +0 -2
  16. data/source/bzs/db/protocol/tdap/client/connMgr.cpp +51 -4
  17. data/source/bzs/db/protocol/tdap/client/connMgr.h +2 -1
  18. data/source/bzs/db/protocol/tdap/client/database.cpp +30 -13
  19. data/source/bzs/db/protocol/tdap/client/database.h +2 -0
  20. data/source/bzs/db/protocol/tdap/client/errorMessage.cpp +13 -3
  21. data/source/bzs/db/protocol/tdap/client/errorMessage_ja.cpp +13 -3
  22. data/source/bzs/db/protocol/tdap/client/field.cpp +2 -1
  23. data/source/bzs/db/protocol/tdap/client/field.h +4 -2
  24. data/source/bzs/db/protocol/tdap/client/filter.h +2 -1
  25. data/source/bzs/db/protocol/tdap/client/nsDatabase.cpp +65 -1
  26. data/source/bzs/db/protocol/tdap/client/nsDatabase.h +14 -2
  27. data/source/bzs/db/protocol/tdap/client/table.cpp +72 -21
  28. data/source/bzs/db/protocol/tdap/client/trdboostapi.h +10 -1
  29. data/source/bzs/db/protocol/tdap/fieldComp.h +175 -43
  30. data/source/bzs/db/protocol/tdap/myDateTime.cpp +8 -4
  31. data/source/bzs/db/protocol/tdap/myDateTime.h +4 -4
  32. data/source/bzs/db/protocol/tdap/mysql/tdapCommandExecuter.cpp +2 -2
  33. data/source/bzs/db/protocol/tdap/tdapSchema.h +1 -1
  34. data/source/bzs/db/protocol/tdap/tdapcapi.h +7 -5
  35. data/source/bzs/db/protocol/tdap/uri.h +1 -1
  36. data/source/bzs/db/transactd/connectionRecord.h +29 -14
  37. data/source/bzs/netsvc/client/tcpClient.cpp +4 -3
  38. data/source/bzs/netsvc/client/tcpClient.h +2 -2
  39. data/source/bzs/netsvc/server/serverPipe.cpp +2 -8
  40. data/source/bzs/test/tdclatl/test_v3.js +7 -4
  41. data/source/bzs/test/tdclphp/transactd_v3_Test.php +7 -4
  42. data/source/bzs/test/tdclrb/transactd_v3_spec.rb +5 -4
  43. data/source/bzs/test/trdclengn/testField.h +7 -0
  44. data/source/global/tdclatl/ConnMgr.cpp +2 -1
  45. data/source/global/tdclatl/Database.cpp +10 -0
  46. data/source/global/tdclatl/Database.h +1 -1
  47. data/source/global/tdclatl/tdclatl.idl +3 -1
  48. metadata +4 -4
  49. data/bin/common/tdclc_64_3_3.dll +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c79eae100f0cec327f7c7256987271b359b033e
4
- data.tar.gz: b613533af7f33d4b9f402b9d62af82c256ad0481
3
+ metadata.gz: a3578c2d4a1064ceb3608b8c3b734f876e31b55f
4
+ data.tar.gz: dfa2ea21477268383d17d6781c9ea77ca4e558c4
5
5
  SHA512:
6
- metadata.gz: 6f777f66e171ca8b93a880c0815dd5f7452d2ccb69e8e65255298b7d8fba114cdd08280651992afbfe3719950d5dadf3e2403fdc45bc706bb161d359ec17ac8b
7
- data.tar.gz: f1a3f062f6522ea6f739f1b4d0c0d72d9170df06d960d60e00baaab0cb5900216561c991d53a4e1d14ff33801b46e5075b9babd1732dbe2ea3ede27ef52cf371
6
+ metadata.gz: ae426f5b61c1e4753330196b29622a321ad4d76d2e76dfcf4b15e46886804dd0963e9214d1816909884021389849ef3dcb9e472b98cfe6fdfb7164642717eff9
7
+ data.tar.gz: cec557719b08f7ce2458b08401cdc1ca81282c4e98020e7edd72099d9a01cf33a2a148807c5069d4fbeab60e876c94df3c5b6da5563cb5a0bc97965ac8856ce5
Binary file
@@ -12996,23 +12996,33 @@ fail:
12996
12996
 
12997
12997
  SWIGINTERN VALUE
12998
12998
  _wrap_connMgr_slaveStatusName(int argc, VALUE *argv, VALUE self) {
12999
- uint_td arg1 ;
13000
- unsigned int val1 ;
13001
- int ecode1 = 0 ;
12999
+ bzs::db::protocol::tdap::client::connMgr *arg1 = 0 ;
13000
+ void *argp1 = 0 ;
13001
+ int res1 = 0 ;
13002
+ uint_td arg2 ;
13003
+ unsigned int val2 ;
13004
+ int ecode2 = 0 ;
13002
13005
  _TCHAR *result = 0 ;
13003
13006
  VALUE vresult = Qnil;
13004
13007
 
13005
13008
  if ((argc < 1) || (argc > 1)) {
13006
13009
  rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
13007
13010
  }
13008
- ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
13009
- if (!SWIG_IsOK(ecode1)) {
13010
- SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "uint_td","bzs::db::protocol::tdap::client::connMgr::slaveStatusName", 1, argv[0] ));
13011
+
13012
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bzs__db__protocol__tdap__client__connMgr, 0 | 0 );
13013
+ if (!SWIG_IsOK(res1)) {
13014
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "bzs::db::protocol::tdap::client::connMgr const *","statusvarName", 1, self ));
13015
+ }
13016
+ arg1 = reinterpret_cast< bzs::db::protocol::tdap::client::connMgr * >(argp1);
13017
+
13018
+ ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
13019
+ if (!SWIG_IsOK(ecode2)) {
13020
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "uint_td","bzs::db::protocol::tdap::client::connMgr::slaveStatusName", 2, argv[0] ));
13011
13021
  }
13012
- arg1 = static_cast< uint_td >(val1);
13022
+ arg2 = static_cast< uint_td >(val2);
13013
13023
  {
13014
13024
  try {
13015
- result = (_TCHAR *)bzs::db::protocol::tdap::client::connMgr::slaveStatusName(arg1);
13025
+ result = (_TCHAR *)arg1->slaveStatusName(arg2);
13016
13026
  } catch (bzs::rtl::exception& e) {
13017
13027
  static VALUE bzs_rtl_error = rb_define_class("BZS_RTL_Error", rb_eStandardError);
13018
13028
  rb_raise(bzs_rtl_error, (* bzs::rtl::getMsg(e)).c_str());
@@ -20977,7 +20987,6 @@ SWIGINTERN VALUE _wrap_nsdatabase_beginSnapshot(int nargs, VALUE *args, VALUE se
20977
20987
  short arg2;
20978
20988
  short val2;
20979
20989
  binlogPos* bpos = new binlogPos();
20980
- memset(bpos, 0, sizeof(binlogPos));
20981
20990
  int _v;
20982
20991
  void *vptr = 0;
20983
20992
  int res;
@@ -22765,6 +22774,51 @@ fail:
22765
22774
  }
22766
22775
 
22767
22776
 
22777
+ SWIGINTERN VALUE
22778
+ _wrap_database_execSql(int argc, VALUE *argv, VALUE self)
22779
+ {
22780
+ bzs::db::protocol::tdap::client::database *arg1 = (bzs::db::protocol::tdap::client::database *) 0 ;
22781
+ char *arg2 = (char *) 0 ;
22782
+ void *argp1 = 0 ;
22783
+ int res1 = 0 ;
22784
+ int res2 ;
22785
+ char *buf2 = 0 ;
22786
+ int alloc2 = 0 ;
22787
+ bool result;
22788
+ VALUE vresult = Qnil;
22789
+
22790
+ if ((argc < 1) || (argc > 1)) {
22791
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
22792
+ }
22793
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_bzs__db__protocol__tdap__client__database, 0 | 0 );
22794
+ if (!SWIG_IsOK(res1)) {
22795
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "bzs::db::protocol::tdap::client::database *","execSql", 1, self ));
22796
+ }
22797
+ arg1 = reinterpret_cast< bzs::db::protocol::tdap::client::database * >(argp1);
22798
+ res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
22799
+ if (!SWIG_IsOK(res2)) {
22800
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","execSql", 2, argv[0] ));
22801
+ }
22802
+ arg2 = reinterpret_cast< char * >(buf2);
22803
+ {
22804
+ try {
22805
+ result = (bool)(arg1)->execSql((char const *)arg2);
22806
+ } catch (bzs::rtl::exception& e) {
22807
+ static VALUE bzs_rtl_error = rb_define_class("BZS_RTL_Error", rb_eStandardError);
22808
+ rb_raise(bzs_rtl_error, (* bzs::rtl::getMsg(e)).c_str());
22809
+ } catch (std::exception &e) {
22810
+ static VALUE cpp_std_error = rb_define_class("CPP_STD_Error", rb_eStandardError);
22811
+ rb_raise(cpp_std_error, e.what());
22812
+ }
22813
+ }
22814
+ vresult = SWIG_From_bool(static_cast< bool >(result));
22815
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
22816
+ return vresult;
22817
+ fail:
22818
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
22819
+ return Qnil;
22820
+ }
22821
+
22768
22822
  SWIGINTERN VALUE
22769
22823
  _wrap_database_getSqlStringForCreateTable(int argc, VALUE *argv, VALUE self) {
22770
22824
  bzs::db::protocol::tdap::client::database *arg1 = (bzs::db::protocol::tdap::client::database *) 0 ;
@@ -36468,7 +36522,6 @@ SWIGINTERN VALUE _wrap_pooledDbManager_beginSnapshot(int nargs, VALUE *args, VAL
36468
36522
  short arg2;
36469
36523
  short val2;
36470
36524
  binlogPos* bpos = new binlogPos();
36471
- memset(bpos, 0, sizeof(binlogPos));
36472
36525
  int _v;
36473
36526
  void *vptr = 0;
36474
36527
  int res;
@@ -37709,6 +37762,7 @@ SWIGEXPORT void Init_transactd(void) {
37709
37762
  rb_define_const(mTransactd, "REPL_POSTYPE_NONE", SWIG_From_int(static_cast< int >(REPL_POSTYPE_NONE)));
37710
37763
  rb_define_const(mTransactd, "REPL_POSTYPE_MARIA_GTID", SWIG_From_int(static_cast< int >(REPL_POSTYPE_MARIA_GTID)));
37711
37764
  rb_define_const(mTransactd, "REPL_POSTYPE_POS", SWIG_From_int(static_cast< int >(REPL_POSTYPE_POS)));
37765
+ rb_define_const(mTransactd, "REPL_POSTYPE_GTID", SWIG_From_int(static_cast< int >(REPL_POSTYPE_GTID)));
37712
37766
  rb_define_const(mTransactd, "ROW_LOCK_X", SWIG_From_int(static_cast< int >(ROW_LOCK_X)));
37713
37767
  rb_define_const(mTransactd, "ROW_LOCK_S", SWIG_From_int(static_cast< int >(ROW_LOCK_S)));
37714
37768
  rb_define_const(mTransactd, "SRV_ISO_READ_UNCOMMITED", SWIG_From_int(static_cast< int >(SRV_ISO_READ_UNCOMMITED)));
@@ -38170,10 +38224,10 @@ SWIGEXPORT void Init_transactd(void) {
38170
38224
  rb_define_method(SwigClassConnMgr.klass, "postDisconnectAll", VALUEFUNC(_wrap_connMgr_postDisconnectAll), -1);
38171
38225
  rb_define_method(SwigClassConnMgr.klass, "stat", VALUEFUNC(_wrap_connMgr_stat), -1);
38172
38226
  rb_define_method(SwigClassConnMgr.klass, "db", VALUEFUNC(_wrap_connMgr_db), -1);
38227
+ rb_define_method(SwigClassConnMgr.klass, "slaveStatusName", VALUEFUNC(_wrap_connMgr_slaveStatusName), -1);
38173
38228
  rb_define_singleton_method(SwigClassConnMgr.klass, "removeSystemDb", VALUEFUNC(_wrap_connMgr_removeSystemDb), -1);
38174
38229
  rb_define_singleton_method(SwigClassConnMgr.klass, "sysvarName", VALUEFUNC(_wrap_connMgr_sysvarName), -1);
38175
38230
  rb_define_singleton_method(SwigClassConnMgr.klass, "statusvarName", VALUEFUNC(_wrap_connMgr_statusvarName), -1);
38176
- rb_define_singleton_method(SwigClassConnMgr.klass, "slaveStatusName", VALUEFUNC(_wrap_connMgr_slaveStatusName), -1);
38177
38231
  rb_define_singleton_method(SwigClassConnMgr.klass, "create", VALUEFUNC(_wrap_connMgr_create), -1);
38178
38232
  rb_define_method(SwigClassConnMgr.klass, "databases", VALUEFUNC(_wrap_connMgr_databases), -1);
38179
38233
  rb_define_method(SwigClassConnMgr.klass, "tables", VALUEFUNC(_wrap_connMgr_tables), -1);
@@ -38418,6 +38472,7 @@ SWIGEXPORT void Init_transactd(void) {
38418
38472
  rb_define_method(SwigClassDatabase.klass, "open", VALUEFUNC(_wrap_database_open), -1);
38419
38473
  rb_define_method(SwigClassDatabase.klass, "clone", VALUEFUNC(_wrap_database_clone), -1);
38420
38474
  rb_define_method(SwigClassDatabase.klass, "createTable", VALUEFUNC(_wrap_database_createTable), -1);
38475
+ rb_define_method(SwigClassDatabase.klass, "execSql", VALUEFUNC(_wrap_database_execSql), -1);
38421
38476
  rb_define_method(SwigClassDatabase.klass, "getSqlStringForCreateTable", VALUEFUNC(_wrap_database_getSqlStringForCreateTable), -1);
38422
38477
  rb_define_method(SwigClassDatabase.klass, "create", VALUEFUNC(_wrap_database_create), -1);
38423
38478
  rb_define_method(SwigClassDatabase.klass, "drop", VALUEFUNC(_wrap_database_drop), -1);
data/build/swig/tdcl.i CHANGED
@@ -693,7 +693,6 @@ using namespace bzs::db::protocol::tdap::client;
693
693
  %extend bzs::db::protocol::tdap::client::nsdatabase {
694
694
  binlogPos* beginSnapshot(short bias=CONSISTENT_READ) {
695
695
  binlogPos* bpos = new binlogPos();
696
- memset(bpos, 0, sizeof(binlogPos));
697
696
  if (bias == CONSISTENT_READ_WITH_BINLOG_POS)
698
697
  self->beginSnapshot(bias, bpos);
699
698
  else
@@ -62,7 +62,7 @@
62
62
  <VerInfo_Locale>1041</VerInfo_Locale>
63
63
  <BRCC_CompilerToUse>rc</BRCC_CompilerToUse>
64
64
  <BRCC_IncludePath>$(BDSINCLUDE)\windows\sdk;$(BRCC_IncludePath)</BRCC_IncludePath>
65
- <DllSuffix>_3_3</DllSuffix>
65
+ <DllSuffix>_3_4</DllSuffix>
66
66
  <DynamicRTL>false</DynamicRTL>
67
67
  <BPILibOutputDir>..\..\lib</BPILibOutputDir>
68
68
  <BCC_PCHUsage>None</BCC_PCHUsage>
data/build/tdclc/tdclc.rc CHANGED
@@ -29,8 +29,8 @@
29
29
  //
30
30
 
31
31
  VS_VERSION_INFO VERSIONINFO
32
- FILEVERSION 3,3,0,198
33
- PRODUCTVERSION 3,3,0,198
32
+ FILEVERSION 3,4,0,203
33
+ PRODUCTVERSION 3,4,0,203
34
34
  FILEFLAGSMASK 0x3fL
35
35
  #ifdef _DEBUG
36
36
  FILEFLAGS 0x1L
@@ -47,9 +47,9 @@ BEGIN
47
47
  BEGIN
48
48
  VALUE "CompanyName", "BizStation Corp."
49
49
  VALUE "FileDescription", "Transactd C client"
50
- VALUE "FileVersion", "3.3.0.198"
50
+ VALUE "FileVersion", "3.4.0.203"
51
51
  VALUE "LegalCopyright", "Copyright(C) 2016 BizStation Corp"
52
- VALUE "ProductVersion", "3.3.0.198"
52
+ VALUE "ProductVersion", "3.4.0.203"
53
53
  VALUE "ProductName", "Transactd Client (GPL V2)"
54
54
  END
55
55
  END
@@ -29,8 +29,8 @@
29
29
  //
30
30
 
31
31
  VS_VERSION_INFO VERSIONINFO
32
- FILEVERSION 3,3,0,198
33
- PRODUCTVERSION 3,3,0,198
32
+ FILEVERSION 3,4,0,203
33
+ PRODUCTVERSION 3,4,0,203
34
34
  FILEFLAGSMASK 0x3fL
35
35
  #ifdef _DEBUG
36
36
  FILEFLAGS 0x1L
@@ -47,9 +47,9 @@ BEGIN
47
47
  BEGIN
48
48
  VALUE "CompanyName", "BizStation Corp."
49
49
  VALUE "FileDescription", "Transactd C++ client"
50
- VALUE "FileVersion", "3.3.0.198"
50
+ VALUE "FileVersion", "3.4.0.203"
51
51
  VALUE "LegalCopyright", "Copyright(C) 2016 BizStation Corp"
52
- VALUE "ProductVersion", "3.3.0.198"
52
+ VALUE "ProductVersion", "3.4.0.203"
53
53
  VALUE "ProductName", "Transactd Client (GPL V2)"
54
54
  END
55
55
  END
@@ -153,7 +153,7 @@
153
153
  <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
154
154
  <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
155
155
  <TD_VER_MAJOR>3</TD_VER_MAJOR>
156
- <TD_VER_MINOR>3</TD_VER_MINOR>
156
+ <TD_VER_MINOR>4</TD_VER_MINOR>
157
157
  <DllSuffix>$(TD_VER_MAJOR)_$(TD_VER_MINOR)</DllSuffix>
158
158
  <TD_CPU>32</TD_CPU>
159
159
  </PropertyGroup>
@@ -29,8 +29,8 @@
29
29
  //
30
30
 
31
31
  VS_VERSION_INFO VERSIONINFO
32
- FILEVERSION 3,3,0,198
33
- PRODUCTVERSION 3,3,0,198
32
+ FILEVERSION 3,4,0,203
33
+ PRODUCTVERSION 3,4,0,203
34
34
  FILEFLAGSMASK 0x3fL
35
35
  #ifdef _DEBUG
36
36
  FILEFLAGS 0x1L
@@ -47,9 +47,9 @@ BEGIN
47
47
  BEGIN
48
48
  VALUE "CompanyName", "BizStation Corp."
49
49
  VALUE "FileDescription", "Transactd Ruby client"
50
- VALUE "FileVersion", "3.3.0.198"
50
+ VALUE "FileVersion", "3.4.0.203"
51
51
  VALUE "LegalCopyright", "Copyright(C) 2016 BizStation Corp"
52
- VALUE "ProductVersion", "3.3.0.198"
52
+ VALUE "ProductVersion", "3.4.0.203"
53
53
  VALUE "ProductName", "Transactd Client (GPL V2)"
54
54
  END
55
55
  END
@@ -32,6 +32,10 @@
32
32
 
33
33
  extern unsigned int g_timestamp_always;
34
34
 
35
+ /* implemnts in mysqlProtocol.cpp */
36
+ extern short getBinlogPos(THD* thd, binlogPos* pos, THD* tmpThd, bzs::db::IblobBuffer* bb);
37
+
38
+
35
39
  namespace bzs
36
40
  {
37
41
  namespace db
@@ -193,7 +197,7 @@ tableCacheCounter database::tableRef;
193
197
  database::database(const char* name, short cid)
194
198
  : m_dbname(name), m_thd(createThdForThread()),m_inAutoTransaction(NULL),
195
199
  m_privilege(0xFFFF), m_inTransaction(0), m_inSnapshot(0), m_stat(0),
196
- m_usingExclusive(false), m_trnType(0), m_cid(cid)
200
+ m_usingExclusive(false), m_trnType(0), m_cid(cid), m_inprocessSnapshot(false)
197
201
  {
198
202
  cp_security_ctx(m_thd)->skip_grants();
199
203
 
@@ -494,7 +498,7 @@ table* database::useTable(int index, enum_sql_command cmd, rowLockMode* lck)
494
498
  if (tb == NULL)
495
499
  THROW_BZS_ERROR_WITH_CODEMSG(STATUS_FILE_NOT_OPENED,
496
500
  "Invalid table id.");
497
- if (tb->m_blobBuffer && tb->blobFields())
501
+ if (tb->m_blobBuffer && tb->blobFields() && !m_inprocessSnapshot)
498
502
  tb->m_blobBuffer->clear();
499
503
 
500
504
  // Change to shared lock is user tranasction only.
@@ -710,7 +714,7 @@ void database::useAllTables()
710
714
  }
711
715
  }
712
716
 
713
- bool database::beginSnapshot(enum_tx_isolation iso, binlogPos* bpos, THD* tmpThd)
717
+ bool database::beginSnapshot(enum_tx_isolation iso, binlogPos* bpos, THD* tmpThd, IblobBuffer* bb)
714
718
  {
715
719
  if (m_inTransaction)
716
720
  THROW_BZS_ERROR_WITH_CODEMSG(STATUS_ALREADY_INTRANSACTION, "Transaction is already beginning.");
@@ -735,9 +739,14 @@ bool database::beginSnapshot(enum_tx_isolation iso, binlogPos* bpos, THD* tmpThd
735
739
  m_stat = STATUS_LOCK_ERROR;
736
740
  return false;
737
741
  }
738
- m_stat = getBinlogPos(m_thd, bpos, tmpThd);
742
+ bb->clear();
743
+
744
+ m_stat = getBinlogPos(m_thd, bpos, tmpThd, bb);
745
+
739
746
  if (m_stat) return false;
740
- useAllTables(); // execute scope in safe_commit_lock
747
+ m_inprocessSnapshot = true;
748
+ useAllTables(); // execute scope in safe_commit_lock
749
+ m_inprocessSnapshot = false;
741
750
  }else
742
751
  useAllTables();
743
752
  }
@@ -133,6 +133,7 @@ private:
133
133
  int m_usingExclusive;
134
134
  short m_trnType;
135
135
  short m_cid;
136
+ bool m_inprocessSnapshot;
136
137
  enum_tx_isolation m_iso;
137
138
  std::vector<sec_db> m_securityCtxs;
138
139
  Security_context* m_backup_sctx;
@@ -183,7 +184,7 @@ public:
183
184
  return m_tables;
184
185
  }
185
186
 
186
- bool beginSnapshot(enum_tx_isolation iso, binlogPos* bpos, THD* tmpThd);
187
+ bool beginSnapshot(enum_tx_isolation iso, binlogPos* bpos, THD* tmpThd, IblobBuffer* bb);
187
188
  bool endSnapshot();
188
189
  table* openTable(const std::string& name, short mode,
189
190
  const char* ownerName, std::string dbname);
@@ -476,6 +476,7 @@ inline int cp_store_create_info(THD *thd, TABLE_LIST *table_list, String *packet
476
476
  return store_create_info(thd, table_list, packet, create_info_arg, with_db_name!=0);
477
477
  }
478
478
 
479
+ #define cp_get_executed_gtids get_executed_gtids
479
480
 
480
481
  #else //Not MySQL 5.7
481
482
 
@@ -614,6 +615,8 @@ inline int cp_store_create_info(THD *thd, TABLE_LIST *table_list, String *packet
614
615
  return store_create_info(thd, table_list, packet, create_info_arg, with_db_name!=0);
615
616
  }
616
617
 
618
+ #define cp_get_executed_gtids get_logged_gtids
619
+
617
620
  #endif // Not MARIADB_10_1 || MARIADB_10_0
618
621
 
619
622
  #endif // Not MySQL 5.7
@@ -29,6 +29,7 @@
29
29
 
30
30
  #if defined(USE_BINLOG_VAR) && (!defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID > 50600)
31
31
  # include "sql/binlog.h"
32
+ # include "rpl_gtid.h"
32
33
  #endif
33
34
 
34
35
  //----------------------------------------------------------------------
@@ -47,28 +48,28 @@
47
48
 
48
49
  class dummyProtocol : public Protocol_mysql
49
50
  {
50
- THD* m_thd;
51
+ THD* m_thd;
51
52
  Protocol_mysql* m_backup;
52
53
 
53
54
  public:
54
55
  #if defined(MYSQL_5_7)
55
- inline dummyProtocol(THD *thd_arg) : Protocol_mysql()
56
- {
57
- m_thd = thd_arg;
56
+ inline dummyProtocol(THD *thd_arg) : Protocol_mysql()
57
+ {
58
+ m_thd = thd_arg;
58
59
  m_backup = m_thd->get_protocol();
59
- m_thd->set_protocol(this);
60
- }
61
- inline virtual ~dummyProtocol()
60
+ m_thd->set_protocol(this);
61
+ }
62
+ inline virtual ~dummyProtocol()
62
63
  {
63
64
  m_thd->set_protocol(m_backup);
64
65
  }
65
66
  #else
66
- inline dummyProtocol(THD *thd_arg) : Protocol_mysql(thd_arg)
67
- {
68
- m_thd = thd_arg;
67
+ inline dummyProtocol(THD *thd_arg) : Protocol_mysql(thd_arg)
68
+ {
69
+ m_thd = thd_arg;
69
70
  m_backup = m_thd->protocol;
70
71
  m_thd->protocol = this;
71
- }
72
+ }
72
73
  inline virtual ~dummyProtocol()
73
74
  {
74
75
  m_thd->protocol = m_backup;
@@ -92,7 +93,7 @@ public:
92
93
  const CHARSET_INFO* /*tocs*/){return false;}
93
94
 
94
95
  virtual bool send_out_parameters(List<Item_param> *sp_params){return false;}
95
- virtual Protocol::enum_protocol_type type(void){ return CP_PROTOCOL; };
96
+ virtual Protocol::enum_protocol_type type(void){ return CP_PROTOCOL; };
96
97
  #ifdef MARIADB_BASE_VERSION //Mariadb 5.5 10.0 10.1
97
98
  virtual bool store(MYSQL_TIME *time, int decimals){return false;}
98
99
  virtual bool store_time(MYSQL_TIME *time, int decimals){ return false;}
@@ -100,30 +101,30 @@ public:
100
101
  virtual bool store_time(MYSQL_TIME *time){return true;};
101
102
  virtual bool store(MYSQL_TIME *time){return true;}
102
103
  virtual bool store(const char *from, size_t length,
103
- CHARSET_INFO *fromcs, CHARSET_INFO *tocs){return false;}
104
+ CHARSET_INFO *fromcs, CHARSET_INFO *tocs){return false;}
104
105
  #elif defined(MYSQL_5_7)
105
- bool store_decimal(const my_decimal *, uint, uint){ return true; }
106
- bool store(Proto_field *){ return true; }
107
- void start_row(){}
108
- int read_packet(void){ return 0; }
109
- int get_command(COM_DATA *, enum_server_command *){ return m_thd->lex->sql_command; }
110
- enum_vio_type connection_type(void){ return VIO_TYPE_PLUGIN; }
111
- ulong get_client_capabilities(void){ return 0; }
112
- bool has_client_capability(unsigned long){ return false; }
113
- bool connection_alive(void){ return false; }
114
- bool end_row(void){ return false; }
115
- void abort_row(void){}
116
- void end_partial_result_set(void){}
117
- int shutdown(bool){ return 0; }
118
- SSL_handle get_ssl(void){ return NULL; }
119
- uint get_rw_status(void){ return 0; }
120
- bool get_compression(void){ return false; }
121
- bool start_result_metadata(uint, uint, const CHARSET_INFO *){ return false; }
122
- bool send_field_metadata(Send_field *, const CHARSET_INFO *){ return false; }
123
- bool end_result_metadata(void){ return false; }
124
- bool send_ok(uint, uint, ulonglong, ulonglong, const char *){ return false; }
125
- bool send_eof(uint, uint){ return false; }
126
- bool send_error(uint, const char *, const char *){ return false; }
106
+ bool store_decimal(const my_decimal *, uint, uint){ return true; }
107
+ bool store(Proto_field *){ return true; }
108
+ void start_row(){}
109
+ int read_packet(void){ return 0; }
110
+ int get_command(COM_DATA *, enum_server_command *){ return m_thd->lex->sql_command; }
111
+ enum_vio_type connection_type(void){ return VIO_TYPE_PLUGIN; }
112
+ ulong get_client_capabilities(void){ return 0; }
113
+ bool has_client_capability(unsigned long){ return false; }
114
+ bool connection_alive(void){ return false; }
115
+ bool end_row(void){ return false; }
116
+ void abort_row(void){}
117
+ void end_partial_result_set(void){}
118
+ int shutdown(bool){ return 0; }
119
+ SSL_handle get_ssl(void){ return NULL; }
120
+ uint get_rw_status(void){ return 0; }
121
+ bool get_compression(void){ return false; }
122
+ bool start_result_metadata(uint, uint, const CHARSET_INFO *){ return false; }
123
+ bool send_field_metadata(Send_field *, const CHARSET_INFO *){ return false; }
124
+ bool end_result_metadata(void){ return false; }
125
+ bool send_ok(uint, uint, ulonglong, ulonglong, const char *){ return false; }
126
+ bool send_eof(uint, uint){ return false; }
127
+ bool send_error(uint, const char *, const char *){ return false; }
127
128
  #endif
128
129
  };
129
130
 
@@ -134,10 +135,12 @@ public:
134
135
  class masterStatus : public dummyProtocol
135
136
  {
136
137
  binlogPos* m_bpos;
137
- bool m_writed;
138
+ bzs::db::IblobBuffer* m_bb;
139
+ int m_index;
140
+
138
141
  public:
139
- inline masterStatus(THD *thd_arg, binlogPos* bpos) :
140
- dummyProtocol(thd_arg), m_bpos(bpos), m_writed(false) {}
142
+ inline masterStatus(THD *thd_arg, binlogPos* bpos, bzs::db::IblobBuffer* bb) :
143
+ dummyProtocol(thd_arg), m_bpos(bpos), m_bb(bb), m_index(0) {}
141
144
  bool store_longlong(longlong from, bool unsigned_flag)
142
145
  {
143
146
  m_bpos->pos = (ulonglong)from;
@@ -148,21 +151,26 @@ public:
148
151
  #if (MYSQL_VERSION_ID < 50600 || defined(MARIADB_BASE_VERSION)) // mariadb 5.5
149
152
  bool store(const char *from, size_t length, CHARSET_INFO *cs)
150
153
  {
151
- if (!m_writed)
152
- {
153
- strncpy(m_bpos->filename, from, BINLOGNAME_SIZE);
154
- m_writed = true;
155
- }
154
+ if (m_index == 0)
155
+ strncpy(m_bpos->filename, from, BINLOGNAME_SIZE);
156
+ ++m_index;
156
157
  return false;
157
158
  }
158
159
  #else
159
160
  bool store(const char *from, size_t length, const CHARSET_INFO *cs)
160
161
  {
161
- if (!m_writed)
162
+ if (m_index == 0)
163
+ strncpy(m_bpos->filename, from, BINLOGNAME_SIZE);
164
+ else if (m_index == 3)
162
165
  {
163
- strncpy(m_bpos->filename, from, BINLOGNAME_SIZE);
164
- m_writed = true;
166
+ if (length)
167
+ {
168
+ m_bpos->type = REPL_POSTYPE_GTID;
169
+ m_bb->addBlob((unsigned int)length + 1, 0, (const unsigned char *)from);
170
+ m_bb->setFieldCount(1);
171
+ }
165
172
  }
173
+ ++m_index;
166
174
  return false;
167
175
  }
168
176
  #endif
@@ -182,11 +190,11 @@ bool safe_commit_lock::lock()
182
190
  if (m_thd)
183
191
  {
184
192
  MDL_request mdl_request;
185
- #if ((MYSQL_VERSION_NUM > 50700) && !defined(MARIADB_BASE_VERSION))
186
- mdl_request.init_with_source(MDL_key::COMMIT, "", "", MDL_SHARED, MDL_EXPLICIT, __FILE__, __LINE__);
187
- #else
188
- mdl_request.init(MDL_key::COMMIT, "", "", MDL_SHARED, MDL_EXPLICIT);
189
- #endif
193
+ #if ((MYSQL_VERSION_NUM > 50700) && !defined(MARIADB_BASE_VERSION))
194
+ mdl_request.init_with_source(MDL_key::COMMIT, "", "", MDL_SHARED, MDL_EXPLICIT, __FILE__, __LINE__);
195
+ #else
196
+ mdl_request.init(MDL_key::COMMIT, "", "", MDL_SHARED, MDL_EXPLICIT);
197
+ #endif
190
198
  if (m_thd->mdl_context.acquire_lock(&mdl_request,
191
199
  m_thd->variables.lock_wait_timeout))
192
200
  return false;
@@ -205,14 +213,14 @@ safe_commit_lock::~safe_commit_lock()
205
213
  }
206
214
 
207
215
 
208
- #ifdef NOTUSE_BINLOG_VAR
209
- inline short getBinlogPosInternal(THD* currentThd, binlogPos* bpos, THD* tmpThd)
216
+ #ifdef NOTUSE_BINLOG_VAR //Only MySQL 5.6 Windows
217
+ inline short getBinlogPosInternal(THD* currentThd, binlogPos* bpos, THD* tmpThd, bzs::db::IblobBuffer* bb)
210
218
  {
211
219
  short result = 0;
212
220
  {
213
221
  attachThd(tmpThd);
214
222
  copyGrant(tmpThd, currentThd, NULL);
215
- masterStatus p(tmpThd, bpos);
223
+ masterStatus p(tmpThd, bpos, bb);
216
224
  cp_query_command(tmpThd, "show master status");
217
225
  if (tmpThd->is_error())
218
226
  result = tmpThd->cp_get_sql_error();
@@ -223,8 +231,8 @@ safe_commit_lock::~safe_commit_lock()
223
231
  }
224
232
  #endif
225
233
 
226
- #ifdef USE_BINLOG_GTID
227
- inline short getBinlogPosInternal(THD* currentThd, binlogPos* bpos, THD* /*tmpThd*/)
234
+ #ifdef USE_BINLOG_GTID //MariaDB 10-
235
+ inline short getBinlogPosInternal(THD* currentThd, binlogPos* bpos, THD* /*tmpThd*/, bzs::db::IblobBuffer* /*bb*/)
228
236
  {
229
237
  if (mysql_bin_log.is_open())
230
238
  {
@@ -234,9 +242,9 @@ safe_commit_lock::~safe_commit_lock()
234
242
  {
235
243
  sprintf_s(bpos->gtid, GTID_SIZE, "%u-%u-%llu", gtid.domain_id, gtid.server_id, gtid.seq_no);
236
244
  size_t dir_len = dirname_length(mysql_bin_log.get_log_fname());
237
- strncpy(bpos->filename, mysql_bin_log.get_log_fname() + dir_len, BINLOGNAME_SIZE);
238
- bpos->pos = my_b_tell(mysql_bin_log.get_log_file());
239
- bpos->filename[BINLOGNAME_SIZE-1] = 0x00;
245
+ strncpy(bpos->filename, mysql_bin_log.get_log_fname() + dir_len, BINLOGNAME_SIZE);
246
+ bpos->pos = my_b_tell(mysql_bin_log.get_log_file());
247
+ bpos->filename[BINLOGNAME_SIZE-1] = 0x00;
240
248
  }
241
249
  }
242
250
  return 0;
@@ -244,34 +252,57 @@ safe_commit_lock::~safe_commit_lock()
244
252
  #endif
245
253
 
246
254
  #ifdef USE_BINLOG_VAR
255
+ inline void readGtid(binlogPos* bpos, bzs::db::IblobBuffer* bb)
256
+ {
257
+ #if (MYSQL_VERSION_ID > 50600)
258
+ char p[1024] = { 0 };
259
+ char* buf = p;
260
+ global_sid_lock->wrlock();
261
+ const Gtid_set* gtid_set = gtid_state->cp_get_executed_gtids();
262
+ int size = gtid_set->get_string_length();
263
+ if (size)
264
+ {
265
+ ++size;
266
+ if (size > 1024) buf = new char[size];
267
+ gtid_set->to_string(buf);
268
+ bpos->type = REPL_POSTYPE_GTID;
269
+ bb->addBlob((unsigned int)size, 0, (const unsigned char *)buf);
270
+ bb->setFieldCount(1);
271
+ if (p != buf) delete[] buf;
272
+ }
273
+ global_sid_lock->unlock();
274
+ #endif
275
+ }
276
+
247
277
  // Linux MySQL can access to the mysql_bin_log variable
248
- inline short getBinlogPosInternal(THD* , binlogPos* bpos, THD* /*tmpThd*/)
278
+ inline short getBinlogPosInternal(THD*, binlogPos* bpos, THD* /*tmpThd*/, bzs::db::IblobBuffer* bb)
249
279
  {
250
280
  if (mysql_bin_log.is_open())
251
281
  {
252
- size_t dir_len = dirname_length(mysql_bin_log.get_log_fname());
253
- strncpy(bpos->filename, mysql_bin_log.get_log_fname() + dir_len, BINLOGNAME_SIZE);
254
- bpos->pos = my_b_tell(mysql_bin_log.get_log_file());
255
- bpos->filename[BINLOGNAME_SIZE-1] = 0x00;
282
+ size_t dir_len = dirname_length(mysql_bin_log.get_log_fname());
283
+ strncpy(bpos->filename, mysql_bin_log.get_log_fname() + dir_len, BINLOGNAME_SIZE);
284
+ bpos->pos = my_b_tell(mysql_bin_log.get_log_file());
285
+ bpos->filename[BINLOGNAME_SIZE-1] = 0x00;
256
286
  bpos->type = REPL_POSTYPE_POS;
287
+ readGtid(bpos, bb);
257
288
  }
258
289
  return 0;
259
290
  }
260
291
  #endif //USE_BINLOG_VAR
261
292
 
262
- short getBinlogPos(THD* thd, binlogPos* bpos, THD* tmpThd)
293
+ short getBinlogPos(THD* thd, binlogPos* bpos, THD* tmpThd, bzs::db::IblobBuffer* bb)
263
294
  {
264
295
  #ifndef NOTUSE_BINLOG_VAR
265
296
  safe_mysql_mutex_lock lck(mysql_bin_log.get_log_lock());
266
297
  #endif
267
- return getBinlogPosInternal(thd, bpos, tmpThd);
298
+ return getBinlogPosInternal(thd, bpos, tmpThd, bb);
268
299
  }
269
300
 
270
301
  int execSql(THD* thd, const char* sql)
271
302
  {
272
303
  thd->variables.lock_wait_timeout = OPEN_TABLE_TIMEOUT_SEC;
273
304
  thd->clear_error();
274
- int result = cp_query_command(thd, (char*)sql);
305
+ int result = cp_query_command(thd, (char*)sql);
275
306
  if (thd->is_error())
276
307
  result = thd->cp_get_sql_error();
277
308
  cp_lex_clear(thd); // reset values for insert
@@ -349,8 +380,8 @@ public:
349
380
 
350
381
  int getSlaveStatus(THD* thd, connection::records& recs, bzs::db::IblobBuffer* bb)
351
382
  {
352
- slaveStatus ss(thd, recs, bb);
353
- return execSql(thd, "show slave status");
383
+ slaveStatus ss(thd, recs, bb);
384
+ return execSql(thd, "show slave status");
354
385
  }
355
386
 
356
387
  #pragma GCC diagnostic warning "-Woverloaded-virtual"
@@ -396,17 +427,17 @@ bool setGrant(THD* thd, const char* host, const char* user, const char* db)
396
427
  bool copyGrant(THD* thd, THD* thdSrc, const char* db)
397
428
  {
398
429
  Security_context* sctx = cp_security_ctx(thdSrc);
399
- if (sctx->cp_master_accsess() == (ulong)~NO_ACCESS)
430
+ if (sctx->cp_master_accsess() == (ulong)~NO_ACCESS)
400
431
  {
401
432
  cp_security_ctx(thd)->skip_grants();
402
433
  return true;
403
434
  }
404
- return setGrant(thd, sctx->cp_priv_host(), sctx->cp_priv_user(), db);
435
+ return setGrant(thd, sctx->cp_priv_host(), sctx->cp_priv_user(), db);
405
436
  }
406
437
 
407
438
  void setDbName(THD* thd, const char* name)
408
439
  {
409
- cp_set_db(thd, name);
440
+ cp_set_db(thd, name);
410
441
  }
411
442
 
412
443
  /*