Le 20/10/10 12:03, Caleb James DeLisle a écrit
:
On 10/20/2010 05:33 AM, Ludovic Dubost wrote:
Hi,
We do want the availability of file attachment storage (Sergiu has done an implementation
during the
summer hackathon), but as Guillaume said it should be to the choice of the
administrator.
Now concerning database storage, about Hibernate, does it means streams are not available
at all in
Hibernate or does it mean they don't always work ?
If streams are available for the databases that support it, which ones support it ?
They are available, they require use of the blob type so we would have to add a
column. I was warned
about incompatibility issues. I understand that mysql and mssql stream the content back
onto the
heap before saving which ruins any memory savings. Postgres seems to support blobs but I
was warned
about strange issues, specifically this:
http://in.relation.to/Bloggers/PostgreSQLAndBLOBs
I was told that oracle has the best streaming support but I also read that oracle blob
support
requires the use of proprietary api.
This is why I had opted for chinking the data instead of using blobs.
Indeed if we are positive that mysql will use the heap to store the full BLOB then
there is no point
to this solution since it is our main database.
Concerning your proposal, it's interesting as indeed if we use streams for everything
else, we do
get rid of the memory consuption issue for attachments.
Now I have a few concerns:
- complexity and management of the data. What happens if we have a corrupted DB and one
of the
chunks fails to save. We might end up with invalid content.
I had planned on
committing the transaction only after all chunks are saved, if the database has
memory issues with large commits, another possibility would be to verify after saving and
throw an
exception if that fails.
That might indeed help if everything is in one transation except that MyISAM is
not transactional so
we can end up with incomplete data.
We do need a way to verify the coherency. We could consider that if the size is incorrect
we don't
accept the result.
It sounds like there might be a need for coherency verification
which runs only on mysql with myiasm.
- we also have to solve other large items (like
attachment history or recycle bin of attachments)
This is why I favor a generic
BinaryStore rather than a change to XWikiHibernateAttachmentStore.
Another issue which will have to be addressed is the memory consumption of JRCS for
AttachmentArchive.
At the same time we should avoid mixing apples and oranges. We
should not have data with different
meanings in different tables.
Do you mean not have data with different meaning in
the same table? If so, I'm not sure I'm sold on
the idea since it's how XWikiStringProperty works (holds string content for many
different types of
objects). A BinaryChunk table would hold data which would not make sense to query so I
think
anything which needed to store binary content in the database should be able to use the
same mechanism.