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

Async or write-behind is not working. #14

Closed
xenthik opened this issue May 25, 2016 · 9 comments
Closed

Async or write-behind is not working. #14

xenthik opened this issue May 25, 2016 · 9 comments

Comments

@xenthik
Copy link

xenthik commented May 25, 2016

There is no way to enable Aync mode/write-behind through API or XML configuration. is infinispan-cachestore-mongodb doen't support.

@tristantarrant
Copy link
Member

@xenthik
Copy link
Author

xenthik commented May 26, 2016

One thing i am trying to figure out the difference in putAsync and org.infinispan.configuration.cache.AsyncStoreConfiguration, even if it always shows AsyncStoreConfiguration.ENABLED is false. But putAsync is works like write-behind. is there any relationship between putAsync and AsyncStoreConfiguration ?

@tristantarrant
Copy link
Member

cache.putAsync() will asynchronously put the entry into the cache. The following should help you understand:
put() to a persistent write-through cache (i.e. write-behind disabled): writes to both memory and to the cache store before returning
put() to a persistent write-behind cache: writes to memory and returns. Writing to the cache store is performed asynchronously on a separate thread.
putAsync() to a persistent write-through cache (i.e. write-behind disabled): returns immediately. Writes to both memory and to the cache store happen on a single separate thread.
putAsync() to a persistent write-behind cache: returns immediately. Writes to memory and to the cache store is performed asynchronously on two separate threads.

@xenthik
Copy link
Author

xenthik commented May 26, 2016

How can i enable(use) write-behind through API ? my configurations looks like following?

AsyncStoreConfiguration asyncStore =
p.addStore(MongoDBStoreConfigurationBuilder.class).ignoreModifications(false)
.purgeOnStartup(false)
.fetchPersistentState(true)
.preload(true)
.connectionURI("mongodb://" + hostname + ":" + port + "/" + DATABASE + "?connectTimeoutMS=1000&w=1")
.collection(COLLECTION)
.create()
.async();
System.out.println(asyncStore.enabled()); // this gives false.
config = b.build();

@galderz
Copy link
Member

galderz commented May 26, 2016

This is now fixed, closing.

@galderz galderz closed this as completed May 26, 2016
@xenthik
Copy link
Author

xenthik commented May 27, 2016

Configuration conf = builder
.persistence()
.addStore(MongoDBStoreConfigurationBuilder.class)
.connectionURI(CONNECTION_URI)
.collection(COLLECTION)
.async().enable()
.build();

In MongoDBStoreConfigurationBuilderTest.java, follwoing test is getting failed , Why ? assertTrue(conf.persistence().fetchPersistentState());

@xenthik
Copy link
Author

xenthik commented May 27, 2016

Even if I have following configurations
<persistence passivation="false"> <mongodbStore xmlns="urn:infinispan:config:store:mongodb:8.2" **_shared="true" preload="true" fetch-state="true" purge="false" singleton="true"_**> <connection uri="mongodb://mongoUser:mongoPass@localhost:27017/infinispan_test_database?w=0&amp;connectTimeoutMS=2000" collection="infinispan_cachestore"/> <write-behind /> </mongodbStore> </persistence>

List stores give the following output against the configuration:
[AbstractStoreConfiguration [attributes=[shared=false, ignoreModifications=false, fetchPersistentState=false, purgeOnStartup=false, preload=false, properties={}], async=AsyncStoreConfiguration [attributes=[enabled=false, modificationQueueSize=1024, threadPoolSize=1]], singletonStore=SingletonStoreConfiguration [attributes=[pushStateWhenCoordinator=true, pushStateTimeout=10000, enabled=false]]]]

@tristantarrant
Copy link
Member

Running mvn clean install from master
Results :
Tests run: 14, Failures: 0, Errors: 0, Skipped: 0

How are you running it ?
I plan to do a release this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants