Permalink
Browse files

Revision: 17300

  • Loading branch information...
1 parent 06c8b49 commit 2a0d46e1923939739aa1181bfcce387849dbeb74 @wangzhonnew wangzhonnew committed Jun 12, 2015
Showing with 9,201 additions and 5,329 deletions.
  1. +52 −0 SConstruct
  2. +6 −1 SequoiaDB/engine/SConscript
  3. +22 −5 SequoiaDB/engine/SConscriptClientCpp
  4. +2 −3 SequoiaDB/engine/SConscriptTool
  5. +12 −0 SequoiaDB/engine/bson/bsonobj.cpp
  6. +4 −0 SequoiaDB/engine/cat/catCatalogManager.cpp
  7. +69 −0 SequoiaDB/engine/cat/catCommon.cpp
  8. +23 −0 SequoiaDB/engine/cat/catMainController.cpp
  9. +98 −2 SequoiaDB/engine/cat/catNodeManager.cpp
  10. +5 −0 SequoiaDB/engine/cat/catalogueCB.cpp
  11. +65 −17 SequoiaDB/engine/client/client.c
  12. +11 −0 SequoiaDB/engine/client/client.h
  13. +3 −3 SequoiaDB/engine/client/client.hpp
  14. +2 −1 SequoiaDB/engine/client/clientImpl.hpp
  15. +13 −4 SequoiaDB/engine/client/clientcpp.cpp
  16. +88 −0 SequoiaDB/engine/cls/clsCommand.cpp
  17. +6 −0 SequoiaDB/engine/cls/clsMgr.cpp
  18. +313 −0 SequoiaDB/engine/cls/clsReelection.cpp
  19. +109 −1 SequoiaDB/engine/cls/clsReplicateSet.cpp
  20. +9 −7 SequoiaDB/engine/cls/clsShardSession.cpp
  21. +21 −0 SequoiaDB/engine/cls/clsSyncManager.cpp
  22. +2 −0 SequoiaDB/engine/cls/clsVSPrimary.cpp
  23. +6 −4 SequoiaDB/engine/cls/clsVoteMachine.cpp
  24. +2 −0 SequoiaDB/engine/cls/clsVoteStatus.cpp
  25. +1 −2 SequoiaDB/engine/coord/coordSession.cpp
  26. +110 −42 SequoiaDB/engine/fap/mongodb/commands.cpp
  27. +6 −25 SequoiaDB/engine/fap/mongodb/mongoReplyHelper.cpp
  28. +4 −3 SequoiaDB/engine/fap/mongodb/mongoReplyHelper.hpp
  29. +109 −114 SequoiaDB/engine/fap/mongodb/mongoSession.cpp
  30. +8 −4 SequoiaDB/engine/fap/mongodb/mongoSession.hpp
  31. +10 −2 SequoiaDB/engine/fap/mongodb/msgBuffer.cpp
  32. +2 −1 SequoiaDB/engine/fap/mongodb/msgBuffer.hpp
  33. +12 −0 SequoiaDB/engine/include/catCommon.hpp
  34. +25 −10 SequoiaDB/engine/include/catDef.hpp
  35. +4 −0 SequoiaDB/engine/include/catNodeManager.hpp
  36. +1 −0 SequoiaDB/engine/include/catalogueCB.hpp
  37. +25 −0 SequoiaDB/engine/include/clsCommand.hpp
  38. +18 −0 SequoiaDB/engine/include/clsDef.hpp
  39. +1 −0 SequoiaDB/engine/include/clsMgr.hpp
  40. +87 −0 SequoiaDB/engine/include/clsReelection.hpp
  41. +14 −0 SequoiaDB/engine/include/clsReplicateSet.hpp
  42. +2 −0 SequoiaDB/engine/include/clsSyncManager.hpp
  43. +12 −0 SequoiaDB/engine/include/clsVoteMachine.hpp
  44. +13 −0 SequoiaDB/engine/include/msgDef.h
  45. +31 −127 SequoiaDB/engine/include/omagent.hpp
  46. +352 −0 SequoiaDB/engine/include/omagentBackgroundCmd.hpp
  47. +15 −44 SequoiaDB/engine/include/omagentDef.hpp
  48. +1 −1 SequoiaDB/engine/include/omagentHelper.hpp
  49. +1 −357 SequoiaDB/engine/include/omagentJob.hpp
  50. +6 −2 SequoiaDB/engine/include/omagentMsgDef.hpp
  51. +21 −1 SequoiaDB/engine/include/omagentSubTask.hpp
  52. +18 −27 SequoiaDB/engine/include/omagentSyncCmd.hpp
  53. +69 −175 SequoiaDB/engine/include/omagentTask.hpp
  54. +2 −1 SequoiaDB/engine/include/omagentTaskBase.hpp
  55. +36 −0 SequoiaDB/engine/include/ossSSLWrapper.h
  56. +3 −8 SequoiaDB/engine/include/ossSocket.hpp
  57. +1 −1 SequoiaDB/engine/include/ossVer_Autogen.h
  58. +1 −0 SequoiaDB/engine/include/pmd.hpp
  59. +2 −1 SequoiaDB/engine/include/pmdDef.hpp
  60. +9 −4 SequoiaDB/engine/include/pmdOptionsMgr.hpp
  61. +12 −0 SequoiaDB/engine/include/pmdSession.hpp
  62. +3 −15 SequoiaDB/engine/include/rtnBackgroundJobBase.hpp
  63. +2 −0 SequoiaDB/engine/include/rtnCommandDef.hpp
  64. +4 −11 SequoiaDB/engine/include/rtnCoord.hpp
  65. +14 −0 SequoiaDB/engine/include/rtnCoordCommands.hpp
  66. +59 −0 SequoiaDB/engine/include/rtnCoordImageCommands.hpp
  67. +6 −0 SequoiaDB/engine/include/sdbInterface.hpp
  68. +2 −3 SequoiaDB/engine/mon/monDump.cpp
  69. +1 −3 SequoiaDB/engine/net/netMultiRouteAgent.cpp
  70. +969 −0 SequoiaDB/engine/omagent/omagentBackgroundCmd.cpp
  71. +5 −2,697 SequoiaDB/engine/omagent/omagentJob.cpp
  72. +200 −130 SequoiaDB/engine/omagent/omagentSubTask.cpp
  73. +30 −124 SequoiaDB/engine/omagent/omagentSyncCmd.cpp
  74. +2,337 −426 SequoiaDB/engine/omagent/omagentTask.cpp
  75. +12 −4 SequoiaDB/engine/omsvc/omGetFileCommand.cpp
  76. +0 −108 SequoiaDB/engine/omsvc/omTaskManager.cpp
  77. +31 −0 SequoiaDB/engine/oss/ossSSLCertificate.c
  78. +30 −0 SequoiaDB/engine/oss/ossSSLContext.c
  79. +31 −0 SequoiaDB/engine/oss/ossSSLWrapper.c
  80. +15 −0 SequoiaDB/engine/oss/ossSocket.cpp
  81. +16 −0 SequoiaDB/engine/pmd/pmd.cpp
  82. +1 −1 SequoiaDB/engine/pmd/pmdEDUEntryPoint.cpp
  83. +41 −4 SequoiaDB/engine/pmd/pmdOptionsMgr.cpp
  84. +1 −0 SequoiaDB/engine/pmd/pmdRestSession.cpp
  85. +10 −0 SequoiaDB/engine/pmd/pmdSession.cpp
  86. +123 −1 SequoiaDB/engine/rtn/rtnCoord.cpp
  87. +110 −79 SequoiaDB/engine/rtn/rtnCoordCommands.cpp
  88. +59 −0 SequoiaDB/engine/rtn/rtnCoordImageCommands.cpp
  89. +0 −38 SequoiaDB/engine/rtn/rtnCoordOperator.cpp
  90. +36 −0 SequoiaDB/engine/spt/dbClasses.cpp
  91. +1 −1 client/admin/admintpl/php/ajax/a-group_l.php
  92. +3 −3 client/samples/C#/buildApp.bat
  93. +2 −2 client/samples/CPP/buildApp.sh
  94. +473 −227 conf/script/addHost.js
  95. +3 −3 conf/script/addHostPreCheck.js
  96. +7 −39 conf/script/checkAddHostInfo.js
  97. +28 −3 conf/script/common.js
  98. +3 −2 conf/script/define.js
  99. +4 −43 conf/script/func.js
  100. +330 −0 conf/script/installCatalog.js
  101. +271 −0 conf/script/installCoord.js
  102. +301 −0 conf/script/installDataNode.js
  103. +29 −10 conf/script/installStandalone.js
  104. +274 −0 conf/script/installTmpCoord.js
  105. +2 −51 conf/script/postCheckHost.js
  106. +31 −147 conf/script/preCheckHost.js
  107. +113 −16 conf/script/removeCatalogRG.js
  108. +115 −17 conf/script/removeCoordRG.js
  109. +126 −18 conf/script/removeDataRG.js
  110. +127 −26 conf/script/removeHost.js
  111. +117 −21 conf/script/removeStandalone.js
  112. +220 −0 conf/script/removeTmpCoord.js
  113. +112 −26 conf/script/rollbackCatalog.js
  114. +113 −24 conf/script/rollbackCoord.js
  115. +217 −0 conf/script/rollbackDataRG.js
  116. +27 −2 conf/script/scanHost.js
  117. +0 −2 driver/postgresql/sdb_fdw.c
  118. +15 −0 misc/autogen/optlist.xml
  119. +2 −2 misc/autogen/rclist.xml
  120. BIN thirdparty/crypto/openssl-1.0.1c/lib/linux64/libcrypto.a
  121. BIN thirdparty/crypto/openssl-1.0.1c/lib/linux64/libssl.a
View
@@ -20,6 +20,7 @@ import imp
import types
import re
import shutil
+import subprocess
import urllib
import urllib2
import stat
@@ -48,6 +49,46 @@ options = {}
options_topass = {}
+def mergeStaticLibrary(target, *sources):
+ if not sys.platform.startswith('linux'):
+ raise Exception('mergeStaticLibrary currently only support linux')
+ if not os.path.isabs(target):
+ raise Exception('target must be a absolute path: ' + target)
+ path = os.path.dirname(target)
+ file = os.path.basename(target)
+ if not os.path.exists(path):
+ raise Exception('target path not exists: ' + path)
+ if not file.endswith('.a'):
+ raise Exception('target not ends with ".a": ' + file)
+ if os.path.exists(target):
+ os.remove(target)
+ subdir = path + '/' + file[0:file.index(".a")] + '.objs'
+ if os.path.exists(subdir):
+ shutil.rmtree(subdir)
+ os.mkdir(subdir)
+ #print("current directory is " + os.getcwd())
+ print("create objs directory: " + subdir )
+ for s in sources:
+ if not os.path.isabs(s):
+ raise Exception('source must be a absolute path: ' + s)
+ if not os.path.exists(s):
+ raise Exception('source not exists: ' + s)
+ print("extract objs from " + s)
+ cmd = "ar x " + s
+ print(cmd)
+ subprocess.check_call(cmd, shell=True)
+ cmd = "mv `ar t " + s + "` " + subdir
+ print(cmd)
+ subprocess.check_call(cmd, shell=True)
+ cmd = "ar cr " + target + " " + subdir + "/*.o"
+ print(cmd)
+ subprocess.check_call(cmd, shell=True)
+ cmd = "ranlib " + target
+ print(cmd)
+ subprocess.check_call(cmd, shell=True)
+ shutil.rmtree(subdir)
+ print("remove objs directory: " + subdir)
+
def GuessOS():
id = platform.system()
if id == 'Linux':
@@ -175,6 +216,9 @@ add_option( "noscreenout", "do not send anything to screen", 0, True )
#fap options
add_option( "fap", "foreign access protocol", 0, False )
+#ssl options
+add_option( "ssl", "build engine with SSL (enterprise edition only) ", 0, False )
+
# don't run configure if user calls --help
if GetOption('help'):
Return()
@@ -255,6 +299,7 @@ hasShell = has_option( "shell" )
hasFmp = has_option("fmp")
hasAll = has_option( "all" )
hasFap = has_option("fap")
+hasSSL = has_option("ssl")
# if everything are set, let's set everything to true
if hasAll:
@@ -641,6 +686,11 @@ fmpEnv.Append( CPPDEFINES=[ "SDB_CLIENT" ] )
fapEnv.Append( CPPDEFINES=["SDB_ENGINE", "SDB_DLL_BUILD"])
#fapEnv.Append( CPPPATH=[join(engine_dir, "bson")])
+# drivers always set SSL definition
+clientCppEnv.Append( CPPDEFINES=[ "SDB_SSL" ] )
+if hasSSL:
+ env.Append( CPPDEFINES=[ "SDB_SSL" ] )
+
env['INSTALL_DIR'] = installDir
if testEnv is not None:
testEnv['INSTALL_DIR'] = installDir
@@ -682,6 +732,8 @@ Export("hasTestcase")
Export("hasTool")
Export("driverDir")
Export("guess_os")
+Export("mergeStaticLibrary")
+Export("hasSSL")
# Generating Versioning information
# In order to change the file location, we have to modify both win32 and linux
@@ -34,6 +34,9 @@ bpsFiles = [
]
ossFiles = [
+ "oss/ossSSLCertificate.c",
+ "oss/ossSSLWrapper.c",
+ "oss/ossSSLContext.c",
"oss/ossErr.cpp",
"oss/oss.cpp",
"oss/ossIO.cpp",
@@ -146,6 +149,7 @@ rtnFiles = [
"rtn/rtnBackup.cpp",
"rtn/rtnReorg.cpp",
"rtn/rtnCoordCommands.cpp",
+ "rtn/rtnCoordImageCommands.cpp",
"rtn/rtnCoordQuery.cpp",
"rtn/rtnCoordCommon.cpp",
"rtn/rtnCoordOperator.cpp",
@@ -338,7 +342,8 @@ clsFiles = [
"cls/clsCatalogPredicate.cpp",
"cls/clsReplBucket.cpp",
"cls/clsCataHashMatcher.cpp",
- "cls/clsCommand.cpp"
+ "cls/clsCommand.cpp",
+ "cls/clsReelection.cpp"
]
dpsFiles = [
@@ -2,6 +2,9 @@ import os
Import("clientCppEnv")
Import("linux")
+Import("ssllib_file")
+Import("ssllib_file1")
+Import("mergeStaticLibrary")
clientCPPFiles = [
"client/clientcpp.cpp"
@@ -12,6 +15,9 @@ clientCPPThreadSafe = [
]
clientCPPLibFiles = [
clientCPPFiles,
+ "oss/ossSSLCertificate.c",
+ "oss/ossSSLWrapper.c",
+ "oss/ossSSLContext.c",
"oss/oss.cpp",
"oss/ossUtil.cpp",
"oss/ossMem.cpp",
@@ -37,14 +43,25 @@ clientCPPLibFiles = [
"bson/nonce.cpp"
]
-#Client Library
+#Shared Library
clientCPPLib = clientCppEnv.SharedLibrary('sdbcpp', clientCPPLibFiles)
-if linux:
- clientCPPLibStatic = clientCppEnv.StaticLibrary('staticsdbcpp', clientCPPLibFiles)
-
clientCppEnv.Install( '#/client/lib/', clientCPPLib )
+
+#Static Library
+dir = ''
+def merge(target, source = None, env = clientCppEnv):
+ pureLib = dir + '/libstaticpuresdbcpp.a'
+ clientCPPLibStatic = dir + '/libstaticsdbcpp.a'
+ mergeStaticLibrary(clientCPPLibStatic, ssllib_file, ssllib_file1, pureLib)
+ clientCppEnv.Install( '#/client/lib/', clientCPPLibStatic )
+
if linux:
- clientCppEnv.Install( '#/client/lib/', clientCPPLibStatic )
+ staticPureSdbCPPLib = clientCppEnv.StaticLibrary('staticpuresdbcpp', clientCPPLibFiles)
+ dir = os.path.dirname(staticPureSdbCPPLib[0].get_abspath())
+ clientCPPLibStatic = dir + '/libstaticsdbcpp.a'
+ clientCppEnv.AddPostAction(staticPureSdbCPPLib, Action(merge))
+
+#Header files
clientCppEnv.Install( '#/client/include/', "client/client.hpp" )
clientCppEnv.Install( '#/client/include/', "include/core.hpp" )
clientCppEnv.Install( '#/client/include/', "include/ossFeat.hpp" )
@@ -140,13 +140,12 @@ omagentFiles = [
"omagent/omagentHelper.cpp",
"omagent/omagentCmdBase.cpp",
"omagent/omagentSyncCmd.cpp",
- "omagent/omagentAsyncCmd.cpp",
+ "omagent/omagentBackgroundCmd.cpp",
"omagent/omagentNodeCmd.cpp",
"omagent/omagentTaskBase.cpp",
"omagent/omagentTask.cpp",
"omagent/omagentSubTask.cpp",
- "omagent/omagentJob.cpp",
- "omagent/omagentRunJob.cpp"
+ "omagent/omagentJob.cpp"
]
sptFiles = [
@@ -485,10 +485,22 @@ namespace bson {
case Bool:
return *l.value() - *r.value();
case Timestamp:
+ {
+ OpTime l_optime( l.date() ) ;
+ OpTime r_optime( r.date() ) ;
+ if ( l_optime < r_optime )
+ {
+ return -1 ;
+ }
+
+ return l_optime == r_optime ? 0 : 1 ;
+ }
case Date:
+ {
if ( l.date() < r.date() )
return -1;
return l.date() == r.date() ? 0 : 1;
+ }
case NumberLong:
if( r.type() == NumberLong ) {
long long L = l._numberLong();
@@ -1206,6 +1206,10 @@ namespace engine
PD_CHECK ( !clInfo._isHash,
SDB_INVALID_MAIN_CL_TYPE, error, PDERROR,
"the sharding-type of main-collection must be range!" );
+
+ PD_CHECK( !( CAT_MASK_AUTOINDEXID & fieldMask ),
+ SDB_INVALIDARG, error, PDERROR,
+ "can not set auto-index-id on main collection" ) ;
}
if ( clInfo._autoSplit || clInfo._autoRebalance )
{
@@ -1580,6 +1580,75 @@ namespace engine
goto done ;
}
+ INT32 catCheckBaseInfoExist( const char *pTypeStr, BOOLEAN &isExist,
+ BSONObj &obj, pmdEDUCB *cb )
+ {
+ INT32 rc = SDB_OK ;
+ isExist = FALSE ;
+
+ BSONObj matcher = BSON( FIELD_NAME_TYPE << pTypeStr ) ;
+ BSONObj dummyObj ;
+
+ rc = catGetOneObj( CAT_SYSBASE_COLLECTION_NAME, dummyObj, matcher,
+ dummyObj, cb, obj ) ;
+ if ( SDB_DMS_EOC == rc )
+ {
+ isExist = FALSE ;
+ rc = SDB_OK ;
+ }
+ else if ( SDB_OK == rc )
+ {
+ isExist = TRUE ;
+ }
+ else
+ {
+ PD_LOG( PDERROR, "Failed to get obj(%s) from %s, rc: %d",
+ matcher.toString().c_str(), CAT_SYSBASE_COLLECTION_NAME,
+ rc ) ;
+ goto error ;
+ }
+
+ done :
+ return rc ;
+ error :
+ goto done ;
+ }
+
+ INT32 catUpdateBaseInfoAddr( const CHAR *pAddr, BOOLEAN self,
+ pmdEDUCB *cb, INT16 w )
+ {
+ INT32 rc = SDB_OK ;
+ BSONObj matcher = BSON( FIELD_NAME_TYPE << CAT_BASE_TYPE_GLOBAL_STR ) ;
+ BSONObj updator ;
+ pmdKRCB *krcb = pmdGetKRCB() ;
+ SDB_DMSCB *dmsCB = krcb->getDMSCB() ;
+ SDB_DPSCB *dpsCB = krcb->getDPSCB() ;
+
+ if ( self )
+ {
+ updator = BSON( "$set" << BSON( FIELD_NAME_DATACENTER"."
+ FIELD_NAME_ADDRESS << pAddr )
+ ) ;
+ }
+ else
+ {
+ updator = BSON( "$set" << BSON( FIELD_NAME_IMAGE"."
+ FIELD_NAME_ADDRESS << pAddr )
+ ) ;
+ }
+
+ rc = rtnUpdate( CAT_SYSBASE_COLLECTION_NAME, matcher, updator,
+ BSONObj(), 0, cb, dmsCB, dpsCB, w, NULL ) ;
+ PD_RC_CHECK( rc, PDERROR, "Update collection[%s] obj[%s] failed, rc: %d",
+ CAT_SYSBASE_COLLECTION_NAME, updator.toString().c_str(),
+ rc ) ;
+
+ done:
+ return rc ;
+ error:
+ goto done ;
+ }
+
// PD_TRACE_DECLARE_FUNCTION ( SDB_CATREMOVECLEX, "catRemoveCLEx" )
INT32 catRemoveCLEx( const CHAR * clFullName, pmdEDUCB * cb,
SDB_DMSCB * dmsCB, SDB_DPSCB * dpsCB, INT16 w,
@@ -504,6 +504,29 @@ namespace engine
goto error ;
}
+ rc = _createSysCollection( CAT_SYSBASE_COLLECTION_NAME, cb ) ;
+ if ( rc )
+ {
+ goto error ;
+ }
+ rc = _createSysIndex( CAT_SYSBASE_COLLECTION_NAME,
+ CAT_BASEINFO_TYPE_INDEX, cb ) ;
+ if ( rc )
+ {
+ goto error ;
+ }
+ rc = _createSysCollection( CAT_SYSIMAGE_COLLECTION_NAME, cb ) ;
+ if ( rc )
+ {
+ goto error ;
+ }
+ rc = _createSysIndex( CAT_SYSIMAGE_COLLECTION_NAME,
+ CAT_IMAGE_SRC_INDEX, cb ) ;
+ if ( rc )
+ {
+ goto error ;
+ }
+
done :
PD_TRACE_EXITRC ( SDB_CATMAINCT__ENSUREMETADATA, rc ) ;
return rc ;
Oops, something went wrong.

0 comments on commit 2a0d46e

Please sign in to comment.