Comments (2)
John Blum commented
Note, 1 possible workaround to this Apache Geode induced problem is to "conditionally" define the Index on the PR in each peer member node. This can be easily accomplished using Spring's bean definition profiles.
This works quite nicely especially when several Geode Servers in a cluster are all configured with the same Spring (Data Geode) configuration meta-data.
Essentially, the "Index bean definition" can be wrapped in a Spring Profile. For example...
XML
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
">
<!-- other bean definitions here -->
<beans profile="EnableIndex">
<gfe:index name="SharePartitionRegionIndex" expression=".." from="/SomePartitionRegion" .../>
</beans>
</beans>
JAVA
@Configuration
class GeodeConfiguration {
// other @Bean definitions defining Geode objects here...
@Bean("SharedPartitionRegionIndex")
@Profile("EnableIndex")
public IndexFactoryBean sharedPrIndex(GemFireCache gemfireCache) {
IndexFactoryBean indexFactory = new IndexFactoryBean();
indexFactory.setCache(gemfireCache);
indexFactory.setExpression("...");
indexFactory.setFrom("/SomePartitionRegion");
...
return indexFactory;
}
}
Then all you need do is launch the Spring (Data Geode) configured, Geode peer cache application with the JVM System Property...
-Dspring.profiles.active=EnableIndex
.
This Spring Profile (i.e. "EnableIndex
) should only be enabled on 1 of the peer member nodes hosting the same PR, defining the same Index. If it is defined on more that 1 peer member node having the same PR and Index definition, then there will be a possibility of a IndexNameConflictException
.
from spring-data-geode.
John Blum commented
Final changes resolving this ticket include:
override
now defaults to false.
This is a significant behavioral change to SDG so please adjust accordingly. It is atypical for the Spring Data team to introduce a behavioral change of this magnitude in any Service Release. However, this decision was not made lightly and is directly due to the race condition / bug in Apache Geode. In order for SDG to do the right thing and function correctly, the override
default had to change to false.
- Introduced a new property/attribute,
ignoreIfExists
on theo.s.d.g.IndexFactoryBean
or...
<gfe:index id="myIndex" expression=".." from=".." ignore-if-exists="true"/>
This option effectively "ignores" the Index
that would have been created by the Index
bean definition / declaration in Spring config (specified with the <gfe:index/>
element using the SDG XML namespace or the IndexFactoryBean
when using Spring Java config).
- Both
ignoreIfExists
andoverride
are applicable to either theIndexExistsException
or theIndexNameConflictException
. Each option performs a slightly different action depending on theException
. You should make sure you understand each option relative to the type ofIndex
Exception
thrown by Geode before using the option.
Both options may be used but ignoreIfExists
takes precedence over override
.
Read the updated, attached documentation from the Spring Data Geode Reference Guide on Configuring an Index for more details
from spring-data-geode.
Related Issues (20)
- Release 2.7.9 (2021.2.9)
- Upgrade to Maven Wrapper 3.9.0
- Release 2.7.10 (2021.2.10)
- Release 2.7.11 (2021.2.11)
- Upgrade to Maven Wrapper 3.9.1
- Release 2.7.12 (2021.2.12)
- Add Integration Tests for @EnableDiskStore annotation and DiskStoreConfiguration class
- Release 2.7.13 (2021.2.13)
- Use snapshots and milestone repositories instead of libs-snapshot and libs-milestone
- Upgrade to Maven Wrapper 3.9.2
- Release 2.7.14 (2021.2.14)
- Fix (Jenkins) CI build issues involving Java 11 & Java 17 HOT 1
- Upgrade to Maven Wrapper 3.9.3
- Release 2.7.15 (2021.2.15)
- Upgrade to Maven Wrapper 3.9.4
- Release 2.7.16 (2021.2.16)
- Release 2.7.17 (2021.2.17)
- Upgrade to Maven Wrapper 3.9.5
- Region Not Found with Spring Boot due to Java 11 ForkJoinPool `ClassLoader` change HOT 4
- Release 2.7.18 (2021.2.18)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-geode.