MCPcopy Create free account
hub / github.com/cortexproject/cortex / findCompactorByUserID

Function findCompactorByUserID

pkg/compactor/compactor_test.go:1467–1493  ·  view source on GitHub ↗
(compactors []*Compactor, logs []*concurrency.SyncBuffer, userID string)

Source from the content-addressed store, hash-verified

1465}
1466
1467func findCompactorByUserID(compactors []*Compactor, logs []*concurrency.SyncBuffer, userID string) (*Compactor, *concurrency.SyncBuffer, error) {
1468 var compactor *Compactor
1469 var log *concurrency.SyncBuffer
1470
1471 for i, c := range compactors {
1472 owned, err := c.ownUserForCompaction(userID)
1473 if err != nil {
1474 return nil, nil, err
1475 }
1476
1477 // Ensure the user is not owned by multiple compactors
1478 if owned && compactor != nil {
1479 return nil, nil, fmt.Errorf("user %s owned by multiple compactors", userID)
1480 }
1481 if owned {
1482 compactor = c
1483 log = logs[i]
1484 }
1485 }
1486
1487 // Return an error if we've not been able to find it
1488 if compactor == nil {
1489 return nil, nil, fmt.Errorf("user %s not owned by any compactor", userID)
1490 }
1491
1492 return compactor, log, nil
1493}
1494
1495func removeIgnoredLogs(input []string) []string {
1496 ignoredLogStringsMap := map[string]struct{}{

Calls 1

ownUserForCompactionMethod · 0.80

Tested by

no test coverage detected