@@ -80,14 +80,13 @@ var _ Index = &RedisIndex{}
80
80
// If the podIdentifierSet is empty, all pods are returned.
81
81
//
82
82
// It returns:
83
- // 1. A slice of the hit keys.
84
- // 2. A map where the keys are those in (1) and the values are pod-identifiers.
85
- // 3. An error if any occurred during the operation.
83
+ // 1. A map where the keys are those in (1) and the values are pod-identifiers.
84
+ // 2. An error if any occurred during the operation.
86
85
func (r * RedisIndex ) Lookup (ctx context.Context , keys []Key ,
87
86
podIdentifierSet sets.Set [string ],
88
- ) ([] Key , map [Key ][]string , error ) {
87
+ ) (map [Key ][]string , error ) {
89
88
if len (keys ) == 0 {
90
- return nil , nil , nil
89
+ return nil , nil
91
90
}
92
91
93
92
logger := klog .FromContext (ctx ).WithName ("kvblock.RedisIndex.Lookup" )
@@ -105,11 +104,10 @@ func (r *RedisIndex) Lookup(ctx context.Context, keys []Key,
105
104
106
105
_ , execErr := pipe .Exec (ctx )
107
106
if execErr != nil {
108
- return nil , nil , fmt .Errorf ("redis pipeline execution failed: %w" , execErr )
107
+ return nil , fmt .Errorf ("redis pipeline execution failed: %w" , execErr )
109
108
}
110
109
111
110
filterPods := len (podIdentifierSet ) > 0 // predicate for filtering
112
- highestHitIdx := 0
113
111
114
112
for idx , cmd := range results {
115
113
key := keys [idx ]
@@ -121,7 +119,7 @@ func (r *RedisIndex) Lookup(ctx context.Context, keys []Key,
121
119
logger .Error (cmdErr , "failed to get pods for key" , "key" , key )
122
120
}
123
121
124
- return keys [: idx ], podsPerKey , nil // early stop since prefix-chain breaks here
122
+ return podsPerKey , nil // early stop since prefix-chain breaks here
125
123
}
126
124
127
125
var filteredPods []string
@@ -134,14 +132,13 @@ func (r *RedisIndex) Lookup(ctx context.Context, keys []Key,
134
132
135
133
if len (filteredPods ) == 0 {
136
134
logger .Info ("no pods found for key, cutting search" , "key" , key )
137
- return keys [: idx ], podsPerKey , nil // early stop since prefix-chain breaks here
135
+ return podsPerKey , nil // early stop since prefix-chain breaks here
138
136
}
139
137
140
- highestHitIdx = idx
141
138
podsPerKey [key ] = filteredPods
142
139
}
143
140
144
- return keys [: highestHitIdx + 1 ], podsPerKey , nil
141
+ return podsPerKey , nil
145
142
}
146
143
147
144
// Add adds a set of keys and their associated pod entries to the index backend.
0 commit comments