@@ -181,47 +181,44 @@ class MetadataStore(fetchContext: FetchContext) {
181
181
182
182
def parseJoins (response : ListResponse ): Seq [String ] = {
183
183
val result = response.values
184
- .map {
185
- seqListValues =>
186
-
187
- seqListValues
188
- .map(kv => new String (kv.valueBytes, StandardCharsets .UTF_8 ))
189
- .map(v => ThriftJsonCodec .fromJsonStr[Join ](v, check = false , classOf [Join ]))
190
- .filter(_.join.metaData.online == isOnline)
191
- .map(_.metaData.name)
192
-
193
- }.recover {
194
- case e : Exception =>
195
- logger.error(" Failed to list & parse joins from list response" , e)
196
- context.withSuffix(" join_list" ).increment(Metrics .Name .Exception )
197
- throw e
184
+ .map { seqListValues =>
185
+ seqListValues
186
+ .map(kv => new String (kv.valueBytes, StandardCharsets .UTF_8 ))
187
+ .map(v => ThriftJsonCodec .fromJsonStr[Join ](v, check = false , classOf [Join ]))
188
+ .filter(_.join.metaData.online == isOnline)
189
+ .map(_.metaData.name)
190
+
191
+ }
192
+ .recover { case e : Exception =>
193
+ logger.error(" Failed to list & parse joins from list response" , e)
194
+ context.withSuffix(" join_list" ).increment(Metrics .Name .Exception )
195
+ throw e
198
196
}
199
197
200
198
result.get
201
199
}
202
200
203
- def doRetrieveAllListConfs (acc : mutable.ArrayBuffer [String ], paginationKey : Option [Any ] = None ): Future [Seq [String ]] = {
201
+ def doRetrieveAllListConfs (acc : mutable.ArrayBuffer [String ],
202
+ paginationKey : Option [Any ] = None ): Future [Seq [String ]] = {
204
203
val propsMap = {
205
204
paginationKey match {
206
205
case Some (key) => Map (ListEntityType -> JoinKeyword , ContinuationKey -> key)
207
- case None => Map (ListEntityType -> JoinKeyword )
206
+ case None => Map (ListEntityType -> JoinKeyword )
208
207
}
209
208
}
210
209
211
210
val listRequest = ListRequest (fetchContext.metadataDataset, propsMap)
212
- fetchContext.kvStore.list(listRequest).flatMap {
213
- response =>
214
-
215
- val joinSeq : Seq [String ] = parseJoins(response)
216
- val newAcc = acc ++ joinSeq
217
- if (response.resultProps.contains(ContinuationKey )) {
218
- doRetrieveAllListConfs(newAcc, response.resultProps.get(ContinuationKey ))
219
- } else {
220
- context
221
- .withSuffix(" join_list" )
222
- .distribution(Metrics .Name .LatencyMillis , System .currentTimeMillis() - startTimeMs)
223
- Future .successful(newAcc)
224
- }
211
+ fetchContext.kvStore.list(listRequest).flatMap { response =>
212
+ val joinSeq : Seq [String ] = parseJoins(response)
213
+ val newAcc = acc ++ joinSeq
214
+ if (response.resultProps.contains(ContinuationKey )) {
215
+ doRetrieveAllListConfs(newAcc, response.resultProps.get(ContinuationKey ))
216
+ } else {
217
+ context
218
+ .withSuffix(" join_list" )
219
+ .distribution(Metrics .Name .LatencyMillis , System .currentTimeMillis() - startTimeMs)
220
+ Future .successful(newAcc)
221
+ }
225
222
}
226
223
}
227
224
0 commit comments