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 0B7BE200C54 for ; Wed, 12 Apr 2017 23:09:43 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0A0E2160B95; Wed, 12 Apr 2017 21:09:43 +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 77F9B160B85 for ; Wed, 12 Apr 2017 23:09:42 +0200 (CEST) Received: (qmail 63924 invoked by uid 500); 12 Apr 2017 21:09:41 -0000 Mailing-List: contact dev-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 dev@geode.apache.org Received: (qmail 63913 invoked by uid 99); 12 Apr 2017 21:09:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Apr 2017 21:09:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4D180E3823; Wed, 12 Apr 2017 21:09:41 +0000 (UTC) From: gesterzhou To: dev@geode.apache.org Reply-To: dev@geode.apache.org References: In-Reply-To: Subject: [GitHub] geode pull request #451: GEODE-2768: Lucene Queries executed before index is... Content-Type: text/plain Message-Id: <20170412210941.4D180E3823@git1-us-west.apache.org> Date: Wed, 12 Apr 2017 21:09:41 +0000 (UTC) archived-at: Wed, 12 Apr 2017 21:09:43 -0000 Github user gesterzhou commented on a diff in the pull request: https://github.com/apache/geode/pull/451#discussion_r111261018 --- Diff: geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/distributed/LuceneQueryFunction.java --- @@ -132,6 +133,25 @@ private LuceneIndexImpl getLuceneIndex(final Region region, try { index = (LuceneIndexImpl) service.getIndex(searchContext.getIndexName(), region.getFullPath()); + if (index == null && service instanceof LuceneServiceImpl) { + if (((LuceneServiceImpl) service).getDefinedIndex(searchContext.getIndexName(), + region.getFullPath()) != null) { + // The node may be in the process of recovering, where we have the index defined but yet + // to be recovered + // If we retry fast enough, we could get a stack overflow based on the way function + // execution is currently written + // Instead we will add an artificial sleep to slow down the retry at this point + // Hopefully in the future, the function execution would retry without adding to the stack + // and this can be removed + try { --- End diff -- Is sleep 100 ms enough? How about using a 10 seconds timeout, but check if it's ready every 100ms? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---