1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
‘¨"hc@sºddlTddlmZedƒZddlZddlmZmZddl    Z    d„Z
d„Z d„Z d    „Z d
„Zd „Zd „Zed kr¶eƒejdƒndS(iÿÿÿÿ(t*(tmylogsConfig.DBConfigN(tGlobalFunctionsterrorcCs"i}tjj|ƒs-tjd|ƒ|Stjd|ƒzfyt|ƒ}|jƒ}WnCtk
r¢}tj    dtj
d||fƒ}tj |ƒ|SXWd|j ƒXtjd|ƒyt |ƒ}Wn7tj    dtjd||fƒ}tj |ƒ|SXtjd|ƒ|S(Ns %s not found!sReading index file %s...tfatalsOpen %s exception %ssParsing index file %s...sfile %s content eval error %ssRead index file %s ok!(tostpathtisfileRtinfotopentreadtIOErrorRt    formatMsgt ERROR_NO_164Rtclosetevalt ERROR_NO_165(t indexInfoFilet indexInfoDicttfileObjt    indexInfotetmsg((sf.\\ZoneServerGroup\map1_8G\MapServer\MapServerData\Script\PyMongoDB\Collections\CheckAndUpdateIndex.pyt ReadIndexInfos. "      " cCs$|jddƒ}|jddƒ}|dkrL|dkr?qˆ|rˆtSn<|dkrf|sbtStS|rw| rwtS| rˆ|rˆtS|jddƒ}|jddƒ}|dkrÎ|dkrÇq tSnR|dkrÞtSx|D]}||kråtSqåWx|D]}||krtSqWtS(Ntuniquetkey(tgettNonetFalsetTrue(t curIndexDicttexpectIndexDictt    curUniquet expectUniquet
curKeyListt expectKeyListtpair((sf.\\ZoneServerGroup\map1_8G\MapServer\MapServerData\Script\PyMongoDB\Collections\CheckAndUpdateIndex.pyt CompareIndex/s>            c    Csö||}tjd|ƒ|jƒ}x·|jƒD]©\}}|dkrRq4n||kr‘tjdtjd||fƒ}tj|ƒtSt    |||ƒs4tjdtj
d||||fƒ}tj|ƒtSq4Wtjd|ƒt S(Nschecking index info on %s...t_id_Rsunexpect index %s.%s found!sCunmatched index %s.%s found! index in db:
%s
 expect index:
%s
scheck indx info on %s ok!( RRtindex_informationtitemsRR t ERROR_NO_166RRR%t ERROR_NO_167R(tdbtcolNametexpectIndexInfotcolt    indexDicttktvR((sf.\\ZoneServerGroup\map1_8G\MapServer\MapServerData\Script\PyMongoDB\Collections\CheckAndUpdateIndex.pyt CheckIndexes_s 
   " ( c Csÿ||}tjd|ƒ|jƒ}xÀ|jƒD]²\}}||kr4||}|jdtƒ}y!|j|dd|d|ƒWnFtk
rÑ}    tj    dtj
d|||    fƒ}
tj |
ƒtSXtjd|ƒq4q4Wtjd|ƒt S(    sÌí¼ÓË÷Òýsadding index on %sRRtnameRscreate index %s.%s failed!%sscreate index %s ok!sadd index on %s ok!( RRR'R(RRt create_indext    ExceptionRR t ERROR_NO_168RR( R+R,t expectIndexesR.tcurIndexesDictR0R1R-tisUniqueRR((sf.\\ZoneServerGroup\map1_8G\MapServer\MapServerData\Script\PyMongoDB\Collections\CheckAndUpdateIndex.pyt
AddIndexesvs 
 
!% cCset|ƒ}xR|jƒD]D\}}|}|}t|||ƒsGtSt|||ƒstSqWtS(sf¶ÔÓÚË÷ÒýÎļþÖеÄÿ¸ö±í£¬Êý¾Ý¿âÖиñíÓеÄË÷ÒýÐÅÏ¢£¬Ë÷ÒýÎļþÖбØÐëÓв¢ÇÒÆ¥ÅäuniqueºÍ(key, direction)list(RR(R2RR:R(R+RRR0R1R,t colIndexDict((sf.\\ZoneServerGroup\map1_8G\MapServer\MapServerData\Script\PyMongoDB\Collections\CheckAndUpdateIndex.pytCheckAndUpdateIndexOnDbŽs cCs&tjjtjƒdƒ}tjtjtj    dt
ƒ}tj tj tj d|ƒsŸtjdtjdtjtj    tj tj fƒ}tj|tƒdS|tj}tjj|dƒ}tjdtj|fƒt||ƒstjdtj|fƒt
Stjd    tj|fƒtS(
Ntindextauto_start_requestt
connectiont DeployErrors:LoginMongoDB failed:ip = %s, port = %s, user = %s,pwd = %ss GameUser.txts"CheckAndUpdateIndexOnDb(%s, %s)...s'CheckAndUpdateIndexOnDb(%s, %s) failed!s#CheckAndUpdateIndexOnDb(%s, %s) ok!(RRtjoinRt
getAppPathtpymongot
ConnectiontDBConfigt
USER_DB_IPt USER_DB_PORTRt LoginMongoDBt userdb_usert
userdb_pwdRR t ERROR_NO_13RR@Rt USER_DB_NAMERR<(t    indexPathtusrDBConRtuserDBtuserDBIndexFileName((sf.\\ZoneServerGroup\map1_8G\MapServer\MapServerData\Script\PyMongoDB\Collections\CheckAndUpdateIndex.pytCheckAndUpdateIndexšs$     cCspddl}|jƒ}|j}|jddƒsIdGHtjdƒdStƒsZdGHndGHtjdƒdS(Niÿÿÿÿtsas auth failed!tpauses!#info CheckAndUpdateIndex failed!s#info CheckAndUpdateIndex ok(RCRDtadmint authenticateRtsystemRQ(RCtconR+((sf.\\ZoneServerGroup\map1_8G\MapServer\MapServerData\Script\PyMongoDB\Collections\CheckAndUpdateIndex.pyttest²s           t__main__RS(tCollectionDefinetCommonRt
__import__RERtDBCommonRRRCRR%R2R:R<RQRXt__name__RV(((sf.\\ZoneServerGroup\map1_8G\MapServer\MapServerData\Script\PyMongoDB\Collections\CheckAndUpdateIndex.pyt<module> s
           0