I am using Java GAE. So far, i'm just scafolding my data objects and i'm seeing an interesting issue.
The records that i am playing around with are getting updated properly as long as my dev server is running up. The second that the my dev server gets restarted, i lose all of my changes.
That would be not alarming if i lost all of my records, but, there was a point of time where my data persisted through the server restart. I'm worried that i would lose production data if i launched without fixing this potential bugs?
ANy idea on wher ei should look?
The datastore is persisted between instances as described here. The Java SDK doesn't have any functionality to clear the datastore for you, so you, or something working on your behalf (eg, your build process) must be deleting it.
Sounds like local development environment problem. Check the location of local_db.bin and ensure your build process does not touch the database file. Maybe the restart happens before the data has been persisted? The local development datastore is not stable like local relational databases. E.g. after upgrading appengine sdk versions the old local datastore might not work at all.
How are you starting the dev server? Make sure you're not providing "c" or "clear" as a flag, which does erase all the persisted data.
How long is it before the dev server persists the data to disk. Do you see the log messages when the data is persisted?
Related
Luckily I was still in pretty early development mode.
I wanted to update my schema using some FlywayDB magic by just dropping and re-creating the public schema on my local development database, but I wasn't paying attention and I had the Heroku one open in PgAdmin as well! Well, I dropped the one for Heroku (the one that will become the "production" database once the application has some users), and it freaked me out, so here I am.
I would like some kind of safety from myself to keep me from dropping this without using the Heroku Toolbox, but I'm not sure if that's possible. All the drop schema prevention things I've seen by Googling require me to have admin rights, which I obviously don't have in a shared environment like Heroku.
Any help is greatly appreciated!
I'm not sure about preventing drop, but if you take regular backups with Heroku PGBackups you can easily import a backup if something bad happens.
EDIT
Here's some documentation on the default role and its limitations.
I have a problem with a product that I am currently working on. Essentially, There is some very commonly used (and very seldomly updated) information that is retrieved from the database on server start up. We do not want to query the database every time this information is needed because it is very frequent. There is a way to update this information through the application (only by an admin). When this method is used, the data in the database is updated and the cached data in that single server (1 of 4) is updated. Unfortunately, if a user hits any of the other servers they will not see the updated information. Restarting the cluster remedies the problem however, that is not a feasible solution for our production environment. Now that I have explained the situation, I am open to suggestions. Thank you for your time.
For a simple solution, you can go to the cluster in the admin console and ripple start it. That stops/stars the nodes gracefully and one at a time. The only impact is a 25% reduction in capacity while it is working.
IBM WebSphere Application Server has a Dynamic Cache that you can use to store Java objects. The cache can be set up to use replication over a replication domain so it can be shared across a cluster.
Your code would use the DistributedMap interface to interact with the cache. All settings for the dynamic cache can be included with your application or it can be pre-configured. Examples are included in the javadoc link.
(Similar to Java EE Application-scoped variables in a clustered environment (Websphere)?)
That is, I think the standard answer would be a "Distributed Object Store". But a crude alternative (that we use) would be to configure a list of server:port combinations to contact to inform each cluster member to update their own copy of the data.
i have a java project with mysql database
i am using advance installer to create a setup file...
i can embed jre to run the software(Without installing java in the system).
like wise,i want to embed the mysql database (system doesn't contains mysql )...
.There is any software to embed mysql database in my project setup...
MySQL is very difficult to embed correctly and there are a number of failure states that might occur if it is not shut down using the proper procedure. SQLite is a much better engine for this sort of thing and is used by a number of applications as a persistent backing store. While not as powerful as MySQL, it is much more resilient. It also has the advantage of not requiring a separate process.
SQLite's storage method is to persist things into a file that can be copied, moved, or backed-up without any issues. MySQL involves many such files, some of which are in an inconsistent state unless the correct FLUSH is called.
The best you can do with MySQL is bundle it, not embed it, but then you'll be responsible for setting it up on the host system, configuring it correctly, running the appropriate maintenance procedures, and providing some kind of back-up facility for the database itself.
Each time I rebuild local GAE application I loose my data and then have to reinitialise empty database. This can be very time consuming, especially if there are a lot of entity types.
How can I preserve data between rebuilds?
You can configure the dev server (via JVM options) to store blobstore data and datastore data in a different location and thus it will not be wiped out.
A convenient way to preload data in development environment datastore
The solution I found was simply to take a copy of the generated DB before rebuild and then to put it back afterwards.
To save you time it is located here:
...\out\artifacts\...\WEB-INF\appengine-generated\local_db.bin
Basically, find appengine-generated folder in your build output location and take a copy of it.
What exactly do you do to rebuild your app? Unless the file holding the data is explicitly cleared by this procedure it should be preserved. Are you perhaps using Windows and an old SDK? In SDK 1.6.3 and 1.6.4 there was a problem where if you stop the app in the launcher it would wipe the data (well, in fact it would just never write it in the first place, but it would be preserved in memory). This has been fixed with the 1.6.5 SDK.
We have a Grails app, and we are using Terracotta for caching. We have noticed that every time we add some fields in existing domain classes or add new domain classes, the app crashes with "unexpected end of block of data..." and we need to restart terracotta to get things running again.
The architecture we have is:
- Two servers behind a load balancer, running a grails app instance each
- A separate DB server
- Terracotta running on one of the web servers
Are we missing something there? Is there anything we can do to avoid having these downtimes on every domain modifying deployment?
UPDATE: Seems like a Terracotta issue: http://forums.terracotta.org/forums/posts/list/5065.page
Version 3.5 should fix this issue. Let's just wait and hope!
Thanks,
Iraklis
We use Terracotta for caching as well and never haven't gotten this error before. We have a similar set up as yours, two web servers behind a load balancer, but with the difference that Terracotta runs in a different set of servers, we have a cluster where one of the server is the master, not sure if this what makes the difference though but at least is an idea to try.