INT32 _coordShardKicker::_kickShardingKey( const string &collectionName, const BSONObj &updator, BSONObj &newUpdator, BOOLEAN &isChanged, pmdEDUCB *cb, BOOLEAN keepShardingKey ) { INT32 rc = SDB_OK ; CoordCataInfoPtr cataPtr ; BOOLEAN hasShardingKey = FALSE ; rc = _pResource->getOrUpdateCataInfo( collectionName.c_str(), cataPtr, cb ) ; if ( SDB_CLS_COORD_NODE_CAT_VER_OLD == rc ) { rc = SDB_OK ; goto done ; } else if ( rc ) { PD_LOG( PDERROR, "Update collection[%s]'s catalog info failed, " "rc: %d", collectionName.c_str(), rc ) ; goto error ; } if ( !cataPtr->isSharded() ) { goto done ; } rc = _kickShardingKey( cataPtr, updator, newUpdator, hasShardingKey ) ; if ( rc ) { goto error ; } if ( keepShardingKey ) { if ( 1 != cataPtr->getGroupNum() && hasShardingKey ) { rc = SDB_UPDATE_SHARD_KEY ; PD_LOG( PDERROR, "When the partition cl falls on two or " "more groups, the update rule don't allow sharding" " key. rc: %d", rc ) ; goto error ; } } else { if ( hasShardingKey ) { isChanged = TRUE ; } } done: return rc ; error: goto done ; }