Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Expired leases doesn't remove their corresponding entity in persistence

We use Gigaspaces as an in-memory database and back up our data by mirror it to MongoDB, which is our persistence storage. We have a mirror service that makes sure everything we create, update and delete is either written or removed from the permanent storage.

Classes saved with leases have a field named "lease" of type long with a getter annotated with @SpaceLeaseExpiration. This ensures the entity is not loaded during an initial load if expired. This works as expected.

The problem arise when a lease expire while the space is running. The object does not get its corresponding entity removed from Mongo.

The workaround is to create a polling container which listen for expired leases and manually remove it from Mongo. This is a big pain though.

We expect it to work as a take operation, which does indeed removes the corresponding entity in Mongo.

Using Gigaspaces 12.1.1.

asked 2018-01-31 09:49:19 -0600

GS_User gravatar image

updated 2018-01-31 10:14:00 -0600

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

We've had this request from a couple of users before, and we've looked into implementing it. The thing is, enhancing replication to replicate lease expiration is not a complete solution: If the system is down and entries expire, they get ignored during initial load but stay in the underlying DB as zombies...

Using a polling container (as you've suggested) solves that problem, because those entries get loaded thru initial load and then removed from both space and DB by the polling container, so in fact this solution is more complete.

We've explained this in the past to users encountering this issue, and they've chose the polling container alternative and were satisfied with it (they don't see this as a workaround but as a valid solution).

you're referring to the polling container as "a big pain" - could you elaborate why? After all, it's an important component used by most of our users, who are very satisfied with it.

answered 2018-02-01 11:03:21 -0600

niv gravatar image
edit flag offensive delete link more

Comments

We see leases as a core feature of Gigaspaces. The same goes for mirroring/persistence. Thus, a workaround shouldn't be necessary, as it involves extra code for two features that should work together.

In our applications, we do not talk directly to Mongo since Gigaspaces does it for us. This luxury is taken away if we use leases since we would suddenly need to inject a Mongo client, convert our space object to a DBObject and then remove it through the client lib. This also require a bunch of integration tests to ensure this work as intended. So the complexity increases while the maintainability decreases. Due to this, some of my colleges stopped using leases and use dynamic template instead, which does indeed remove the corresponding entities in Mongo(this workaround comes with other downsides that are equally painful though).

GS_User gravatar imageGS_User ( 2018-02-12 05:14:54 -0600 )edit

Can you please elaborate regarding the downside of using the polling container as a solution?

Ester gravatar imageEster ( 2018-02-15 00:42:36 -0600 )edit

Sorry for being unclear. The downside did I explain where we need to inject a Mongo client etc. This is done in the polling container.

GS_User gravatar imageGS_User ( 2018-02-15 09:09:47 -0600 )edit

The solution we usually suggest is having polling container with dynamic template so it will operate when you want the object to expire and at the event handler do a take so the operation will propagate to the mirror and will be no need in injecting mongo client.simply take on time instead of lease. see:https://docs.gigaspaces.com/xap/12.3/dev-java/polling-container-overview.html ---> Dynamic Template Definition

Ester gravatar imageEster ( 2018-02-21 07:03:37 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-01-31 09:49:19 -0600

Seen: 218 times

Last updated: Feb 01