Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E09CD200498 for ; Tue, 29 Aug 2017 22:18:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DD7491677CB; Tue, 29 Aug 2017 20:18:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 304CB1677C4 for ; Tue, 29 Aug 2017 22:18:04 +0200 (CEST) Received: (qmail 18115 invoked by uid 500); 29 Aug 2017 20:18:03 -0000 Mailing-List: contact issues-help@geode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.apache.org Delivered-To: mailing list issues@geode.apache.org Received: (qmail 18106 invoked by uid 99); 29 Aug 2017 20:18:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Aug 2017 20:18:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C5B8E1A1647 for ; Tue, 29 Aug 2017 20:18:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id UaK6f3YgQYOB for ; Tue, 29 Aug 2017 20:18:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 63CC160DA9 for ; Tue, 29 Aug 2017 20:18:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A9B68E0059 for ; Tue, 29 Aug 2017 20:18:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 59F7723F0D for ; Tue, 29 Aug 2017 20:18:00 +0000 (UTC) Date: Tue, 29 Aug 2017 20:18:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@geode.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GEODE-3385) Change GetAllRequest to return list of errors MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 29 Aug 2017 20:18:05 -0000 [ https://issues.apache.org/jira/browse/GEODE-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16146039#comment-16146039 ] ASF GitHub Bot commented on GEODE-3385: --------------------------------------- Github user kohlmu-pivotal commented on a diff in the pull request: https://github.com/apache/geode/pull/739#discussion_r135899858 --- Diff: geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java --- @@ -50,26 +53,52 @@ .makeErrorResponse(ProtocolErrorCode.REGION_NOT_FOUND.codeValue, "Region not found")); } - try { - Set keys = new HashSet<>(); - for (BasicTypes.EncodedValue key : request.getKeyList()) { - keys.add(ProtobufUtilities.decodeValue(serializationService, key)); - } - Map results = region.getAll(keys); - Set entries = new HashSet<>(); - for (Map.Entry entry : results.entrySet()) { - entries.add( - ProtobufUtilities.createEntry(serializationService, entry.getKey(), entry.getValue())); - } - return Success.of(RegionAPI.GetAllResponse.newBuilder().addAllEntries(entries).build()); - } catch (UnsupportedEncodingTypeException ex) { - return Failure.of(ProtobufResponseUtilities.makeErrorResponse( - ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue, "Encoding not supported.")); - } catch (CodecNotRegisteredForTypeException ex) { - return Failure.of(ProtobufResponseUtilities.makeErrorResponse( - ProtocolErrorCode.VALUE_ENCODING_ERROR.codeValue, - "Codec error in protobuf deserialization.")); + Map> resultsCollection = request.getKeyList().stream() + .map((key) -> processOneMessage(serializationService, region, key)) + .collect(Collectors.partitioningBy(x -> x instanceof BasicTypes.Entry)); + RegionAPI.GetAllResponse.Builder responseBuilder = RegionAPI.GetAllResponse.newBuilder(); + + for (Object entry : resultsCollection.get(true)) { + responseBuilder.addEntries((BasicTypes.Entry) entry); + } + + for (Object entry : resultsCollection.get(false)) { + responseBuilder.addFailures((BasicTypes.KeyedError) entry); } + + return Success.of(responseBuilder.build()); } + private Object processOneMessage(SerializationService serializationService, Region region, + BasicTypes.EncodedValue key) { + try { + Object decodedKey = ProtobufUtilities.decodeValue(serializationService, key); + Object value = region.get(decodedKey); --- End diff -- I agree with you that getAll should be used, but if the API does not provide the functionality that this interface is to expose, then get is a viable option until the API issues are addressed > Change GetAllRequest to return list of errors > --------------------------------------------- > > Key: GEODE-3385 > URL: https://issues.apache.org/jira/browse/GEODE-3385 > Project: Geode > Issue Type: Sub-task > Components: client/server > Reporter: Galen O'Sullivan > Assignee: Galen O'Sullivan > > GetAllRequest currently returns a list of successful keys or an error (if getting any key threw an exception). We should instead return a list of errors, similar to PutAllRequest. -- This message was sent by Atlassian JIRA (v6.4.14#64029)