[
https://issues.apache.org/jira/browse/GEODE-3929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16281074#comment-16281074
]
ASF GitHub Bot commented on GEODE-3929:
---------------------------------------
jhuynh1 commented on a change in pull request #1066: GEODE-3929: GFSH create
lucene index command allowed on existing regiā¦
URL: https://github.com/apache/geode/pull/1066#discussion_r155386620
##########
File path:
geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsDUnitTest.java
##########
@@ -154,24 +169,42 @@ public void listIndexWithStatsShouldReturnCorrectStats()
throws Exception {
@Test
- public void createIndexShouldCreateANewIndex() throws Exception {
+ @Parameters(method = "getRegionCreationOrder")
+ public void createIndexShouldCreateANewIndex(RegionCreationOrder
regionCreationOrder)
+ throws Exception {
CommandStringBuilder csb = new
CommandStringBuilder(LuceneCliStrings.LUCENE_CREATE_INDEX);
csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME, INDEX_NAME);
csb.addOption(LuceneCliStrings.LUCENE__REGION_PATH, REGION_NAME);
csb.addOption(LuceneCliStrings.LUCENE_CREATE_INDEX__FIELD,
"field1,field2,field3");
- gfsh.executeAndAssertThat(csb.toString()).statusIsSuccess();
+ createAndVerifyLuceneIndexAndRegion(regionCreationOrder, csb);
serverVM.invoke(() -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
- createRegion();
final LuceneIndex index = luceneService.getIndex(INDEX_NAME,
REGION_NAME);
assertArrayEquals(new String[] {"field1", "field2", "field3"},
index.getFieldNames());
});
}
+ private void createAndVerifyLuceneIndexAndRegion(RegionCreationOrder
regionCreationOrder,
+ CommandStringBuilder csb) {
+ if
(regionCreationOrder.equals(RegionCreationOrder.REGION_CREATED_BEFORE_LUCENE_INDEX))
{
+ serverVM.invoke(() -> LuceneServiceImpl.LUCENE_REINDEX = true);
+ serverVM.invoke(() -> createRegion());
+ gfsh.executeAndAssertThat(csb.toString()).statusIsSuccess()
+ .containsOutput("Successfully created lucene index");
+ } else if
(regionCreationOrder.equals(RegionCreationOrder.REGION_CREATED_AFTER_LUCENE_INDEX))
{
Review comment:
You might want a LUCENE_REINDEX = true and still create the index before the
region scenario
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Modify existing gfsh create lucene index command to create the index on an
> existing region
> ------------------------------------------------------------------------------------------
>
> Key: GEODE-3929
> URL: https://issues.apache.org/jira/browse/GEODE-3929
> Project: Geode
> Issue Type: Sub-task
> Components: docs, lucene
> Reporter: Jason Huynh
>
> After GEODE-3930 is done, we will have an internal API that lets us create a
> lucene index on an existing region (without indexing the data that is
> present). We should modify the existing LuceneCreateIndexFunction to check to
> see if the user region already exists. If so, instead of throwing an
> exception we should go ahead and call the internal API adding in GEODE-3930.
> Acceptance:
> Calling "create lucene index" on an existing region in gfsh succeeds. After
> calling create lucene index on an existing region, the index will be useable
> - new updates will be added to the index, and queries will work. Data that
> was already in the region before the create index will not be indexed as part
> of this story.
> After calling create lucene index on an existing region, cluster
> configuration should be updated and new members starting up should create the
> index.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)