From notifications-return-3795-archive-asf-public=cust-asf.ponee.io@ignite.apache.org Tue Jun 11 15:24:04 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id AB40D180649 for ; Tue, 11 Jun 2019 17:24:03 +0200 (CEST) Received: (qmail 68829 invoked by uid 500); 11 Jun 2019 15:24:02 -0000 Mailing-List: contact notifications-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list notifications@ignite.apache.org Received: (qmail 68776 invoked by uid 99); 11 Jun 2019 15:24:02 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Jun 2019 15:24:02 +0000 From: GitBox To: notifications@ignite.apache.org Subject: [GitHub] [ignite] nizhikov commented on a change in pull request #5656: IGNITE-10663 Read Repair Message-ID: <156026664269.14153.9324167093273110790.gitbox@gitbox.apache.org> Date: Tue, 11 Jun 2019 15:24:02 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit nizhikov commented on a change in pull request #5656: IGNITE-10663 Read Repair URL: https://github.com/apache/ignite/pull/5656#discussion_r292516033 ########## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java ########## @@ -4802,48 +4892,211 @@ protected V get0( * @return Map of cached values. * @throws IgniteCheckedException If read failed. */ - protected Map getAll0(Collection keys, boolean deserializeBinary, - boolean needVer) throws IgniteCheckedException { - checkJta(); + protected Map repairableGetAll( + Collection keys, + boolean deserializeBinary, + boolean needVer, + boolean recovery, + boolean readRepair) throws IgniteCheckedException { + try { + return getAll(keys, deserializeBinary, needVer, recovery, readRepair); + } + catch (IgniteConsistencyViolationException e) { + repairAsync(keys, ctx.operationContextPerCall(), false).get(); - String taskName = ctx.kernalContext().job().currentTaskName(); + return repairableGetAll(keys, deserializeBinary, needVer, recovery, readRepair); + } + } - CacheOperationContext opCtx = ctx.operationContextPerCall(); + /** + * @param keys Keys. + * @param deserializeBinary Deserialize binary flag. + * @param needVer Need version. + * @return Map of cached values. + * @throws IgniteCheckedException If read failed. + */ + protected Map getAll( + Collection keys, + boolean deserializeBinary, + boolean needVer, + boolean recovery, + boolean readRepair) throws IgniteCheckedException { + checkJta(); return getAllAsync(keys, !ctx.config().isReadFromBackup(), /*skip tx*/false, /*subject id*/null, - taskName, + ctx.kernalContext().job().currentTaskName(), deserializeBinary, - opCtx != null && opCtx.recovery(), + recovery, + readRepair, /*skip vals*/false, needVer).get(); } /** * @param keys Keys. - * @param deserializeBinary Deserialize binary flag. + * @param forcePrimary Force primary. + * @param skipTx Skip tx. + * @param subjId Subj Id. + * @param taskName Task name. + * @param deserializeBinary Deserialize binary. + * @param recovery Recovery mode flag. + * @param skipVals Skip values. * @param needVer Need version. - * @return Read future. + * @return Future for the get operation. + * @see GridCacheAdapter#getAllAsync(Collection) */ - public IgniteInternalFuture> getAllAsync( + public IgniteInternalFuture> repairableGetAllAsync( @Nullable Collection keys, + boolean forcePrimary, + boolean skipTx, + @Nullable UUID subjId, + String taskName, boolean deserializeBinary, boolean recovery, - boolean needVer + boolean readRepair, + boolean skipVals, + final boolean needVer ) { - String taskName = ctx.kernalContext().job().currentTaskName(); - - return getAllAsync(keys, - !ctx.config().isReadFromBackup(), - /*skip tx*/false, - /*subject id*/null, + IgniteInternalFuture> fut = getAllAsync( + keys, + forcePrimary, + skipTx, + subjId, taskName, deserializeBinary, recovery, - /*skip vals*/false, + readRepair, + skipVals, needVer); + + if (readRepair) { + CacheOperationContext opCtx = ctx.operationContextPerCall(); + + return getWithRepairAsync( + fut, + () -> repairAsync(keys, opCtx, skipVals), + () -> repairableGetAllAsync( + keys, + forcePrimary, + skipTx, + subjId, + taskName, + deserializeBinary, + recovery, + readRepair, + skipVals, + needVer)); + } + + return fut; + } + + /** + * Performs repair and retries get. + */ + private IgniteInternalFuture getWithRepairAsync( Review comment: Please, add Javadocs. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services