[GitHub] geode pull request #451: GEODE-2768: Lucene Queries executed before index is...

2017-04-17 Thread jhuynh1
Github user jhuynh1 closed the pull request at:

https://github.com/apache/geode/pull/451


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #451: GEODE-2768: Lucene Queries executed before index is...

2017-04-12 Thread jhuynh1
Github user jhuynh1 commented on a diff in the pull request:

https://github.com/apache/geode/pull/451#discussion_r111275346
  
--- 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 --

This is really an artificial time that was to avoid the stack overflow from 
the function execution retry.  The smaller the time, the greater chance we hit 
the stack overflow but also the quicker we return to the user if the index 
really doesn't exist.  I can understand maybe bumping this up to a second but 
10 seems a bit long...


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #451: GEODE-2768: Lucene Queries executed before index is...

2017-04-12 Thread nabarunnag
Github user nabarunnag commented on a diff in the pull request:

https://github.com/apache/geode/pull/451#discussion_r111272945
  
--- 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 --

Can there be a possibility that this node never recovers but another node 
is ready to execute the query and we are stuck here for 10 seconds?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #451: GEODE-2768: Lucene Queries executed before index is...

2017-04-12 Thread gesterzhou
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] geode pull request #451: GEODE-2768: Lucene Queries executed before index is...

2017-04-12 Thread jhuynh1
GitHub user jhuynh1 opened a pull request:

https://github.com/apache/geode/pull/451

GEODE-2768: Lucene Queries executed before index is fully created sho…

…uld be retried

  * Added a sleep to prevent rapid retries which lead to stack overflow
  * Sleep can be removed when Function Execution retry does not add to stack

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/geode feature/GEODE-2768

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/geode/pull/451.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #451


commit 60f5f06f18f8ea6c1d176a43a25bfbb4086e2f21
Author: Jason Huynh 
Date:   2017-04-12T18:39:28Z

GEODE-2768: Lucene Queries executed before index is fully created should be 
retried

  * Added a sleep to prevent rapid retries which lead to stack overflow
  * Sleep can be removed when Function Execution retry does not add to stack




---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---