how to ensure data integrity using the function storeFile() of the php driver of mongodb? -
I ask my questions here because I have not yet found any further information.
Reference:
- replicaSet architecture with 3 servers.
- PHP as the main language - The average size of the photo is around 2Mo - Usage: function of PHP driver in Mangode () using lots of gallery store files
I'm worried about storage during and after primary server.
If I store a full file of 80 MO using the store file, then the customer directs the query to the replication set, which begins with storing the data.
If now, the writing operation has ended 60%, and if the primary fails, then what would be the writing task?
I know I'll get an exception, who tries to try me again for the operation. But what about the data already written?
Do I have an existing file in the database, which is part of the original picture and thus corrupted?
Or, it works like a transaction, and so if there is an error, then the Mongodb withdraws the operation and throws an exception?
Link to my group on Google Groups:
Therefore the data will now be in the collection of segments, but there will be no metadata (and actual file information), because it does not complete successfully by writing the entire gridoff. Normally this is not a problem because you should not face many failures. If it is a real concern that you are storing some megabyte data that you can not actually access, then you will need to create some kind of background / cronback function that will recapture the volume collection and identify the orphan part. Be careful though, because you do not want to delete the segment you are currently making :)
Comments
Post a Comment