Ok – So we have this project where we needed CSV export of data. We went ahead and used Views Data Export module.

So far so good.

CSV download is working great in our dev environment. It works great on our staging environment where the client does UAT. Great!

It even works great on Acquia server – the dev instance AND the staging instance. Cool!

Now – we make the site live – and for that we move the site to the production instance of Acquia servers, and suddenly – the CSV downloads start misbehaving. Help! The downloads are incomplete!!! No errors, no warnings – just incomplete data.

So – what needs to be done now?

As per Acquia support,


This sounds like it’s most likely a problem with the views_data_export module using a temp directory to assemble the file from multiple pieces, which becomes problematic only when there are multiple webservers (which is only the case for prod). We see this problem with other modules like plupload; the code tries to use a temp directory to gather some pieces of a file which it later tries to assemble, but because there’s more than one webserver, the pieces end up spread across different servers and the code which eventually tries to put the pieces together can’t see all of them.

It looks like one of the changes made in 7.x-3.0-beta7 is the introduction of a new variable:

Untitled

We’d recommend that you upgrade to the recommended release of this module, and try setting this variable to point at a path on the shared gluster file system, in a similar way to what’s outlined in this article relating to the plupload module:

https://docs.acquia.com/articles/correcting-broken-uploads-plupload-acquia-cloud-enterprise

This variable could be controlled via the $conf array in settings.php if we find that this is a solution to the problem.

Please let us know if we can be of any further assistance.


So – went ahead and did the needful. Set the value of the variable views_data_export_directory using drush and pointed it to a dir in the files dir – and voila!! Things work now.

Whew!

P.S.: If you are using batch mode to download the exports, this process still fails. Am in the process of talking to the Acquia support for a solution to this – will update the blog as and when I get a solution.

P.P.S.: Batch downloads also work now. Apparently, you need to set the variable, not as a file path. So doing something like the following works:

drush vset views_data_export_directory 'public://'

This article was originally published January 30, 2014. It has been updated since then for clarity.