当前位置: 首页>>代码示例>>Golang>>正文


Golang TopicResponse.GetRollbackTimestamps方法代码示例

本文整理汇总了Golang中github.com/couchbase/indexing/secondary/protobuf/projector.TopicResponse.GetRollbackTimestamps方法的典型用法代码示例。如果您正苦于以下问题:Golang TopicResponse.GetRollbackTimestamps方法的具体用法?Golang TopicResponse.GetRollbackTimestamps怎么用?Golang TopicResponse.GetRollbackTimestamps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/couchbase/indexing/secondary/protobuf/projector.TopicResponse的用法示例。


在下文中一共展示了TopicResponse.GetRollbackTimestamps方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: updateRollbackTsFromResponse

func updateRollbackTsFromResponse(bucket string,
	rollbackTs *protobuf.TsVbuuid, res *protobuf.TopicResponse) *protobuf.TsVbuuid {

	rollbackTsList := res.GetRollbackTimestamps()
	for _, ts := range rollbackTsList {
		if ts != nil && !ts.IsEmpty() && ts.GetBucket() == bucket {
			if rollbackTs == nil {
				rollbackTs = ts.Clone()
			} else {
				rollbackTs = rollbackTs.Union(ts)
			}
		}
	}

	return rollbackTs

}
开发者ID:jchris,项目名称:indexing,代码行数:17,代码来源:kv_sender.go

示例2: shouldRetryAddInstances

//
// Handle error for adding instance.  The following error can be returned from projector:
// 1) Unconditional Recoverable error by worker
//      * generic http error
//      * ErrorStreamRequest
//      * ErrorResposneTimeout
//      * ErrorFeeder
// 2) Non Recoverable error
//      * ErrorInconsistentFeed
// 3) Recoverable error by other worker
//      * ErrorInvalidVbucketBranch
//      * ErrorNotMyVbucket
//      * ErrorInvalidKVaddrs
// 4) Error that may not need retry
//      * ErrorTopicExist
//
func (worker *adminWorker) shouldRetryAddInstances(requestTs []*protobuf.TsVbuuid,
	response *protobuf.TopicResponse,
	err error) ([]*protobuf.TsVbuuid, error) {

	logging.Debugf("adminWorker::shouldRetryAddInstances(): start")

	// First of all, let's check for any non-recoverable error.
	errStr := err.Error()
	logging.Debugf("adminWorker::shouldRetryAddInstances(): Error encountered when calling MutationTopicRequest. Error=%v", errStr)

	if strings.Contains(errStr, projectorC.ErrorTopicExist.Error()) {
		// TODO: Need pratap to define the semantic of ErrorTopExist.   Right now return as an non-recoverable error.
		return nil, NewError(ERROR_STREAM_REQUEST_ERROR, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorInconsistentFeed.Error()) {
		// This is fatal error.  Should only happen due to coding error.   Need to return this error.
		// For those projectors that have already been opened, let's leave it open. Eventually those
		// projectors will fill up the buffer and terminate the connection by itself.
		return nil, NewError(ERROR_STREAM_REQUEST_ERROR, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorNotMyVbucket.Error()) {
		return nil, NewError(ERROR_STREAM_WRONG_VBUCKET, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorInvalidVbucketBranch.Error()) {
		return nil, NewError(ERROR_STREAM_INVALID_TIMESTAMP, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorInvalidKVaddrs.Error()) {
		return nil, NewError(ERROR_STREAM_INVALID_KVADDRS, NORMAL, STREAM, err, "")
	}

	// There is no non-recoverable error, so we can retry.  For retry, recompute the new set of timestamps based on the response.
	rollbackTimestamps := response.GetRollbackTimestamps()
	var newRequestTs []*protobuf.TsVbuuid = nil
	for _, ts := range requestTs {
		ts = recomputeRequestTimestamp(ts, rollbackTimestamps)
		newRequestTs = append(newRequestTs, ts)
	}

	return newRequestTs, nil
}
开发者ID:jchris,项目名称:indexing,代码行数:56,代码来源:stream_admin.go

示例3: shouldRetryRestartVbuckets

//
// Handle error for restart vbuckets.  The following error can be returned from projector:
// 1) Unconditional Recoverable error by worker
//      * generic http error
//      * ErrorStreamRequest
//      * ErrorResposneTimeout
// 2) Non Recoverable error
//      * ErrorTopicMissing
//      * ErrorInvalidBucket
// 3) Recoverable error by other worker
//      * ErrorInvalidVbucketBranch
//      * ErrorNotMyVbucket
//      * ErrorFeeder
//      * ErrorStreamEnd
//
func (worker *adminWorker) shouldRetryRestartVbuckets(requestTs []*protobuf.TsVbuuid,
	response *protobuf.TopicResponse,
	err error) ([]*protobuf.TsVbuuid, error) {

	logging.Debugf("adminWorker::shouldRetryRestartVbuckets(): start")

	// First of all, let's check for any non-recoverable error.
	errStr := err.Error()
	logging.Debugf("adminWorker::shouldRetryRestartVbuckets(): Error encountered when calling RestartVbuckets. Error=%v", errStr)

	if strings.Contains(errStr, projectorC.ErrorTopicMissing.Error()) {
		return nil, NewError(ERROR_STREAM_REQUEST_ERROR, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorInvalidBucket.Error()) {
		return nil, NewError(ERROR_STREAM_REQUEST_ERROR, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorFeeder.Error()) {
		return nil, NewError(ERROR_STREAM_FEEDER, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorNotMyVbucket.Error()) {
		return nil, NewError(ERROR_STREAM_WRONG_VBUCKET, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorInvalidVbucketBranch.Error()) {
		return nil, NewError(ERROR_STREAM_INVALID_TIMESTAMP, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorStreamEnd.Error()) {
		return nil, NewError(ERROR_STREAM_STREAM_END, NORMAL, STREAM, err, "")
	}

	// There is no non-recoverable error, so we can retry.  For retry, recompute the new set of timestamps based on the response.
	rollbackTimestamps := response.GetRollbackTimestamps()
	var newRequestTs []*protobuf.TsVbuuid = nil
	for _, ts := range requestTs {
		ts = recomputeRequestTimestamp(ts, rollbackTimestamps)
		newRequestTs = append(newRequestTs, ts)
	}

	return newRequestTs, nil
}
开发者ID:jchris,项目名称:indexing,代码行数:54,代码来源:stream_admin.go


注:本文中的github.com/couchbase/indexing/secondary/protobuf/projector.TopicResponse.GetRollbackTimestamps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。