We're updating the issue view to help you get more done.Learn more

DNN Version Upgrade fails on some NAS-Filesystems that don't have alphabetically file-lists

During a DNN version-upgrade multiple SQL-scripts are executed. The order of these scripts is defined by the filenames, like 08.00.00.01.SqlDataProvider, 08.00.00.02.SqlDataProvider and so on. So the list of files must be sorted alphabetically. Most file-system provide the list of files in an alphabetical sort-order by default but some don't (like a NAS running on linux/unix). On such a file-system the DNN version upgrade runs the SQL-scripts in an invalid order and crashes!

We're currently having this issue on multiple QNAP-NAS. QNAP has made a feature request to provide the possibility of presorted-filelist by default but this will also affect the performance in a negative way. Currently we have no working solution and probably other linux/unix systems/NAS may be also affected by this issue.

The list of the upgrade-scripts is defined in https://github.com/dnnsoftware/Dnn.Platform/blob/development/DNN%20Platform/Library/Services/Upgrade/Upgrade.cs#L4216 and uses

System.IO.Directory.GetFiles()

Microsoft explicit writes in the documencation: "The order of the returned file names is not guaranteed; use the Sort method if a specific sort order is required."

So the solution is simple:

Line 4463: add this (inside GetUpgradeScripts()):

Array.Sort(files); // The order of the returned file names is not guaranteed; use the Sort method if a specific sort order is required.

Change Line 4520 to 4523 to this (inside AddAvailableIncrementalFiles()):

var files = Directory.GetFiles(providerPath, GetStringVersion(version) + ".*." + DefaultProvider);
Array.Sort(files); // The order of the returned file names is not guaranteed; use the Sort method if a specific sort order is required.

return files;

We tested this solution successfully on DNN 8.0.4.226.

Status

Assignee

Unassigned