Skip to content
This repository was archived by the owner on Feb 18, 2021. It is now read-only.

Commit a5dabb4

Browse files
author
Xu Ning
committed
minor tuning
1 parent a40cd68 commit a5dabb4

3 files changed

Lines changed: 16 additions & 9 deletions

File tree

clients/metadata/metadata_cassandra.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const defaultDeleteTTLSeconds = int64(time.Hour*24*30) / int64(time.Second)
180180

181181
const destinationCacheSize = 1048576
182182
const consumerGroupCacheSize = 1048576
183-
const cacheTTL = time.Second
183+
const cacheTTL = 5 * time.Second
184184

185185
// CassandraMetadataService Implements TChanMetadataServiceClient interface
186186
// TODO: Convert all errors to the ones defined in the thrift API.

services/controllerhost/controllerhost.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ var (
8484

8585
const (
8686
nEventPipelineWorkers = 2048 // most workers expected to be blocked on I/O
87-
hashLockTableSize = 1024
87+
hashLockTableSize = 8192
8888
maxFailedExtentSealSetSize = 8192 // max # of failed extent seals we can keep track of
8989
maxExtentSealsPerSecond = 200
9090
)
@@ -108,6 +108,7 @@ type (
108108
failureDetector Dfdd
109109
log bark.Logger
110110
dstLock LockMgr
111+
cgLock LockMgr
111112
eventPipeline EventPipeline
112113
resultCache *resultCache
113114
extentMonitor *extentStateMonitor
@@ -158,9 +159,14 @@ func NewController(cfg configure.CommonAppConfig, sVice *common.Service, metadat
158159
deploymentName := sVice.GetConfig().GetDeploymentName()
159160
logger := (sVice.GetConfig().GetLogger()).WithFields(bark.Fields{common.TagCtrl: common.FmtCtrl(hostID), common.TagDplName: common.FmtDplName(deploymentName)})
160161

161-
lockMgr, err := NewLockMgr(hashLockTableSize, common.UUIDHashCode, logger)
162+
dstLockMgr, err := NewLockMgr(hashLockTableSize, common.UUIDHashCode, logger)
162163
if err != nil {
163-
logger.WithField(common.TagErr, err).Fatal(`Failed to create hash lock`)
164+
logger.WithField(common.TagErr, err).Fatal(`Failed to create hash lock dstLockMgr`)
165+
}
166+
167+
cgLockMgr, err := NewLockMgr(hashLockTableSize, common.UUIDHashCode, logger)
168+
if err != nil {
169+
logger.WithField(common.TagErr, err).Fatal(`Failed to create hash lock cgLockMgr`)
164170
}
165171

166172
context := &Context{
@@ -172,7 +178,8 @@ func NewController(cfg configure.CommonAppConfig, sVice *common.Service, metadat
172178
context.localZone, _ = common.GetLocalClusterInfo(strings.ToLower(deploymentName))
173179
context.zoneFailoverManager = zoneFailoverManager
174180

175-
context.dstLock = lockMgr
181+
context.dstLock = dstLockMgr
182+
context.cgLock = cgLockMgr
176183
context.m3Client = metrics.NewClient(instance.Service.GetMetricsReporter(), metrics.Controller)
177184
instance.mClient = metadata.NewMetadataMetricsMgr(metadataClient, context.m3Client, context.log)
178185
context.mm = NewMetadataMgr(instance.mClient, context.m3Client, context.log)
@@ -400,7 +407,7 @@ func (mcp *Mcp) GetOutputHosts(ctx thrift.Context, inReq *c.GetOutputHostsReques
400407
return response()
401408
}
402409

403-
if !context.dstLock.TryLock(dstUUID, getLockTimeout(result)) {
410+
if !context.cgLock.TryLock(cgUUID, getLockTimeout(result)) {
404411
context.m3Client.IncCounter(metrics.GetOutputHostsScope, metrics.ControllerErrTryLockCounter)
405412
return response()
406413
}
@@ -409,12 +416,12 @@ func (mcp *Mcp) GetOutputHosts(ctx thrift.Context, inReq *c.GetOutputHostsReques
409416
// refresh the cache in the mean time
410417
result = context.resultCache.readOutputHosts(cgUUID, now)
411418
if result.cacheHit && !result.refreshCache {
412-
context.dstLock.Unlock(dstUUID)
419+
context.cgLock.Unlock(cgUUID)
413420
return response()
414421
}
415422

416423
hostIDs, err := refreshOutputHostsForConsGroup(context, dstUUID, cgUUID, *result, now)
417-
context.dstLock.Unlock(dstUUID)
424+
context.cgLock.Unlock(cgUUID)
418425
if err != nil {
419426
if isEntityError(err) {
420427
context.m3Client.IncCounter(metrics.GetOutputHostsScope, metrics.ControllerErrBadEntityCounter)

services/retentionmgr/metadataDep.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (t *metadataDepImpl) GetDestinations() (destinations []*destinationInfo, er
9292
`status`: dest.status,
9393
`hardRetention`: dest.hardRetention,
9494
`softRetention`: dest.softRetention,
95-
}).Info("GetDestinations: ListDestinationsByUUID output")
95+
}).Debug("GetDestinations: ListDestinationsByUUID output")
9696
}
9797

9898
if len(resp.GetNextPageToken()) == 0 {

0 commit comments

Comments
 (0)