[
https://issues.apache.org/jira/browse/GEODE-5197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
nabarun updated GEODE-5197:
---------------------------
Description:
As a gemfire developer, while creating a lucene index on the data region the
addition/verification/[or removal] to the region's cache service profile should
not be affected by concurrent index creation.
The below code needs to be synchronized
{code:java}
private void createIndexOnExistingRegion(PartitionedRegion region, String
indexName,
String regionPath, String[] fields, Analyzer analyzer, Map<String,
Analyzer> fieldAnalyzers,
LuceneSerializer serializer) {
validateRegionAttributes(region.getAttributes());
LuceneIndexCreationProfile luceneIndexCreationProfile = new
LuceneIndexCreationProfile(
indexName, regionPath, fields, analyzer, fieldAnalyzers, serializer);
region.addCacheServiceProfile(luceneIndexCreationProfile);
try {
validateLuceneIndexProfile(region);
} catch (Exception e) {
region.removeCacheServiceProfile(luceneIndexCreationProfile.getId());
throw new UnsupportedOperationException(
LocalizedStrings.LuceneIndexCreation_INDEX_CANNOT_BE_CREATED_DUE_TO_PROFILE_VIOLATION
.toString(indexName),
e);
}
String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, regionPath);
region.updatePRConfigWithNewGatewaySender(aeqId);
LuceneIndexImpl luceneIndex = beforeDataRegionCreated(indexName, regionPath,
region.getAttributes(), analyzer, fieldAnalyzers, aeqId, serializer,
fields);
afterDataRegionCreated(luceneIndex);
createLuceneIndexOnDataRegion(region, luceneIndex);
}
{code}
was:
As a gemfire developer, while creating a lucene index on the data region the
addition/verification/[or removal] should not be affected by concurrent index
creation.
The below code needs to be synchronized
{code:java}
private void createIndexOnExistingRegion(PartitionedRegion region, String
indexName,
String regionPath, String[] fields, Analyzer analyzer, Map<String,
Analyzer> fieldAnalyzers,
LuceneSerializer serializer) {
validateRegionAttributes(region.getAttributes());
LuceneIndexCreationProfile luceneIndexCreationProfile = new
LuceneIndexCreationProfile(
indexName, regionPath, fields, analyzer, fieldAnalyzers, serializer);
region.addCacheServiceProfile(luceneIndexCreationProfile);
try {
validateLuceneIndexProfile(region);
} catch (Exception e) {
region.removeCacheServiceProfile(luceneIndexCreationProfile.getId());
throw new UnsupportedOperationException(
LocalizedStrings.LuceneIndexCreation_INDEX_CANNOT_BE_CREATED_DUE_TO_PROFILE_VIOLATION
.toString(indexName),
e);
}
String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName, regionPath);
region.updatePRConfigWithNewGatewaySender(aeqId);
LuceneIndexImpl luceneIndex = beforeDataRegionCreated(indexName, regionPath,
region.getAttributes(), analyzer, fieldAnalyzers, aeqId, serializer,
fields);
afterDataRegionCreated(luceneIndex);
createLuceneIndexOnDataRegion(region, luceneIndex);
}
{code}
> synchronize the adding and removal of cache service profiles while reindexing
> -----------------------------------------------------------------------------
>
> Key: GEODE-5197
> URL: https://issues.apache.org/jira/browse/GEODE-5197
> Project: Geode
> Issue Type: Sub-task
> Components: lucene
> Reporter: nabarun
> Priority: Major
>
> As a gemfire developer, while creating a lucene index on the data region the
> addition/verification/[or removal] to the region's cache service profile
> should not be affected by concurrent index creation.
> The below code needs to be synchronized
> {code:java}
> private void createIndexOnExistingRegion(PartitionedRegion region, String
> indexName,
> String regionPath, String[] fields, Analyzer analyzer, Map<String,
> Analyzer> fieldAnalyzers,
> LuceneSerializer serializer) {
> validateRegionAttributes(region.getAttributes());
> LuceneIndexCreationProfile luceneIndexCreationProfile = new
> LuceneIndexCreationProfile(
> indexName, regionPath, fields, analyzer, fieldAnalyzers, serializer);
> region.addCacheServiceProfile(luceneIndexCreationProfile);
> try {
> validateLuceneIndexProfile(region);
> } catch (Exception e) {
> region.removeCacheServiceProfile(luceneIndexCreationProfile.getId());
> throw new UnsupportedOperationException(
>
> LocalizedStrings.LuceneIndexCreation_INDEX_CANNOT_BE_CREATED_DUE_TO_PROFILE_VIOLATION
> .toString(indexName),
> e);
> }
> String aeqId = LuceneServiceImpl.getUniqueIndexName(indexName,
> regionPath);
> region.updatePRConfigWithNewGatewaySender(aeqId);
> LuceneIndexImpl luceneIndex = beforeDataRegionCreated(indexName,
> regionPath,
> region.getAttributes(), analyzer, fieldAnalyzers, aeqId, serializer,
> fields);
> afterDataRegionCreated(luceneIndex);
> createLuceneIndexOnDataRegion(region, luceneIndex);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)