You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/07/14 01:24:40 UTC

[GitHub] [skywalking] sonatype-lift[bot] commented on a diff in pull request #9339: Optimize elasticsearch query performance by using `_mGet` and physical index name

sonatype-lift[bot] commented on code in PR #9339:
URL: https://github.com/apache/skywalking/pull/9339#discussion_r920639478


##########
oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/requests/factory/v7/V7DocumentFactory.java:
##########
@@ -88,6 +90,30 @@ public HttpRequest mget(String index, String type, Iterable<String> ids) {
                           .build();
     }
 
+    @SneakyThrows
+    @Override
+    public HttpRequest mget(final String type, final Map<String, List<String>> indexIds) {
+        checkArgument(!isNullOrEmpty(type), "type cannot be null or empty");
+        checkArgument(indexIds != null && !indexIds.isEmpty(), "ids cannot be null or empty");
+        final List<Map<String, String>> indexIdList = new ArrayList<>();
+        indexIds.forEach((index, ids) -> {
+            checkArgument(ids != null && !isEmpty(ids), "ids cannot be null or empty");
+            ids.forEach(id -> {
+                indexIdList.add(ImmutableMap.of("_index", index, "_id", id));
+            });
+        });
+        final Map<String, Iterable<Map<String, String>>> m = ImmutableMap.of("docs", indexIdList);
+        final byte[] content = version.codec().encode(m);
+        if (log.isDebugEnabled()) {
+            log.debug("mget indexIds request: {}", new String(content));

Review Comment:
   *[DefaultCharset](https://errorprone.info/bugpattern/DefaultCharset):*  Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn't match expectations.
   
   
   ```suggestion
               log.debug("mget indexIds request: {}", new String(content, Charset.defaultCharset()));
   ```
   
   
   
   Reply with *"**@sonatype-lift help**"* for info about LiftBot commands.
   Reply with *"**@sonatype-lift ignore**"* to tell LiftBot to leave out the above finding from this PR.
   Reply with *"**@sonatype-lift ignoreall**"* to tell LiftBot to leave out all the findings from this PR and from the status bar in Github.
   
   When talking to LiftBot, you need to **refresh** the page to see its response. [Click here](https://help.sonatype.com/lift/talking-to-lift) to get to know more about LiftBot commands.
   
   ---
   
   Was this a good recommendation?
   [ [🙁 Not relevant](https://www.sonatype.com/lift-comment-rating?comment=297463968&lift_comment_rating=1) ] - [ [😕 Won't fix](https://www.sonatype.com/lift-comment-rating?comment=297463968&lift_comment_rating=2) ] - [ [😑 Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=297463968&lift_comment_rating=3) ] - [ [🙂 Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=297463968&lift_comment_rating=4) ] - [ [😊 Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=297463968&lift_comment_rating=5) ]



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org