Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEODE-5047: list lucene index result modified #1799

Merged
merged 1 commit into from May 3, 2018

Conversation

nabarunnag
Copy link
Contributor

* list lucene index gfsh command will now display on of three states
* NOT_INITIALIZED if the index is present in only in defined map
* INITIALIZED if the index is present in the index map
* INDEXING_IN_PROGRESS if the index creation is in progress.

Thank you for submitting a contribution to Apache Geode.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Has your PR been rebased against the latest commit within the target branch (typically develop)?

  • Is your initial contribution a single, squashed commit?

  • Does gradlew build run cleanly?

  • Have you written or updated unit tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

Note:

Please ensure that once the PR is submitted, you check travis-ci for build issues and
submit an update to your PR as soon as possible. If you need help, please send an
email to dev@geode.apache.org.

@nabarunnag
Copy link
Contributor Author

all precheckin tests passed

for (LuceneIndex index : service.getAllIndexes()) {
LuceneIndexStatus initialized = LuceneIndexStatus.INITIALIZED;
if (index instanceof LuceneIndexForPartitionedRegion) {
PartitionedRegion userRegion = (PartitionedRegion) cache.getRegion(index.getRegionPath());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe introduce a method on LuceneIndex to check the status of the index? Then we could avoid the direct cast here and just call the index.getStatus() method. Each index would know how to report it's status?

Copy link
Contributor

@jhuynh1 jhuynh1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, added some "food for thought" but not needed for this PR.

I didn't go through the entire gfsh command logic, but I trust that it's all correct with the testing.

* @Return boolean status of the index.
*/

boolean isIndexingInProgress();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be better named as "isIndexReady()" (if so, you'd have to invert all the checks)...

note- (not for this PR but maybe for some future rework)
I think the better option would have been isIndexAvailable() but it looks like we added a similar method call for that already on the InternalLuceneIndex.isIndexAvailable(id)(we might be able to move that call directly to LuceneIndexforPartitionedRegion and have the PartitionedRegionManager go back to having the explicit variable type. A different LuceneIndexImplementation (say for replicate regions) probably wouldn't even know what to do with an "id-bucketId"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted this API to be more precise from a developer's point of view. As in what is the status of the index, isIndexingInProgress will tell reindexing is in progress but isIndexReady()'s boolean answer is like index cannot be ready (maybe because it is defined but not initialized or because it is in process of reindexing). I was thinking maybe we need to add more operation checks in the future and thought that isIndexingInProgress pinpoints directly to the indexing process.

* true - if indexing is in progress
* false - if indexing is complete
*
* @Return boolean status of the index.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really make sense, I think the above explanation should be written into the return value javaDoc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok will modify the return value

this.getFileAndChunkRegion().getDataStore().getAllLocalPrimaryBucketIds();
for (Integer bucketId : fileRegionPrimaryBucketIds) {
BucketRegion userBucket = userRegion.getDataStore().getLocalBucketById(bucketId);
if (!userBucket.isEmpty() && !this.isIndexAvailable(bucketId)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about the case when userBucket isEmpty()==true? Can we treat it as "isIndexReady() == true"?

	* list lucene index gfsh command will now display on of three states
	* NOT_INITIALIZED if the index is present in only in defined map
	* INITIALIZED if the index is present in the index map
	* INDEXING_IN_PROGRESS if the index creation is in progress.
@nabarunnag nabarunnag merged commit 8f0b97a into apache:develop May 3, 2018
nabarunnag added a commit to nabarunnag/geode that referenced this pull request May 3, 2018
         * list lucene index gfsh command will now display on of three states
	* NOT_INITIALIZED if the index is present in only in defined map
	* INITIALIZED if the index is present in the index map
	* INDEXING_IN_PROGRESS if the index creation is in progress.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants