Refactored enum and messages. Also added 9p to the list since mono misclassifies it.
This commit is contained in:
parent
7ff6342503
commit
243c779ca1
|
@ -20,7 +20,6 @@ namespace NzbDrone.Api.Config
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
public string LogLevel { get; set; }
|
public string LogLevel { get; set; }
|
||||||
public string ConsoleLogLevel { get; set; }
|
public string ConsoleLogLevel { get; set; }
|
||||||
public DatabaseJournalType DatabaseJournalMode { get; set; }
|
|
||||||
public string Branch { get; set; }
|
public string Branch { get; set; }
|
||||||
public string ApiKey { get; set; }
|
public string ApiKey { get; set; }
|
||||||
public string SslCertHash { get; set; }
|
public string SslCertHash { get; set; }
|
||||||
|
|
|
@ -185,7 +185,7 @@ namespace NzbDrone.Core.Configuration
|
||||||
public string LogLevel => GetValue("LogLevel", "Info");
|
public string LogLevel => GetValue("LogLevel", "Info");
|
||||||
public string ConsoleLogLevel => GetValue("ConsoleLogLevel", string.Empty, persist: false);
|
public string ConsoleLogLevel => GetValue("ConsoleLogLevel", string.Empty, persist: false);
|
||||||
|
|
||||||
public DatabaseJournalType DatabaseJournalMode => GetValueEnum("DatabaseJournalMode", DatabaseJournalType.Wal, persist: false);
|
public DatabaseJournalType DatabaseJournalMode => GetValueEnum("DatabaseJournalMode", DatabaseJournalType.Auto, persist: false);
|
||||||
|
|
||||||
public string SslCertHash => GetValue("SslCertHash", "");
|
public string SslCertHash => GetValue("SslCertHash", "");
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace NzbDrone.Core.Datastore
|
||||||
|
|
||||||
connectionBuilder.JournalMode = GetJournalMode(dbPath);
|
connectionBuilder.JournalMode = GetJournalMode(dbPath);
|
||||||
|
|
||||||
if (connectionBuilder.JournalMode == SQLiteJournalModeEnum.Truncate)
|
if (OsInfo.IsOsx)
|
||||||
{
|
{
|
||||||
connectionBuilder.Add("Full FSync", true);
|
connectionBuilder.Add("Full FSync", true);
|
||||||
}
|
}
|
||||||
|
@ -65,26 +65,36 @@ namespace NzbDrone.Core.Datastore
|
||||||
|
|
||||||
private SQLiteJournalModeEnum GetJournalMode(string path)
|
private SQLiteJournalModeEnum GetJournalMode(string path)
|
||||||
{
|
{
|
||||||
var driveType = _diskProvider.GetMount(path).DriveType;
|
if (_configFileProvider.DatabaseJournalMode != DatabaseJournalType.Auto)
|
||||||
|
|
||||||
if (driveType == DriveType.Network || driveType == DriveType.Unknown)
|
|
||||||
{
|
{
|
||||||
_logger.Debug("Network filesystem store for application data detected, disabling WAL mode for SQLite");
|
_logger.Debug("Database journal mode overridden by config.xml, using {0} journal mode", _configFileProvider.DatabaseJournalMode);
|
||||||
return SQLiteJournalModeEnum.Truncate;
|
return (SQLiteJournalModeEnum)_configFileProvider.DatabaseJournalMode;
|
||||||
}
|
|
||||||
|
|
||||||
if (_configFileProvider.DatabaseJournalMode != (DatabaseJournalType)SQLiteJournalModeEnum.Wal)
|
|
||||||
{
|
|
||||||
_logger.Debug("DatabaseJournalMode tag detected in config.xml, disabling WAL mode for SQLite");
|
|
||||||
return SQLiteJournalModeEnum.Truncate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OsInfo.IsOsx)
|
if (OsInfo.IsOsx)
|
||||||
{
|
{
|
||||||
_logger.Debug("macOS operating system detected, disabling WAL mode for SQLite");
|
_logger.Debug("macOS operating system, using Truncate database journal mode");
|
||||||
return SQLiteJournalModeEnum.Truncate;
|
return SQLiteJournalModeEnum.Truncate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var mount = _diskProvider.GetMount(path);
|
||||||
|
|
||||||
|
if (mount == null)
|
||||||
|
{
|
||||||
|
_logger.Debug("Database {0} located on unknown filesystem, using Truncate journal mode", path);
|
||||||
|
return SQLiteJournalModeEnum.Truncate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mount.DriveType == DriveType.Network || mount.DriveType == DriveType.Unknown)
|
||||||
|
{
|
||||||
|
_logger.Debug("Database {0} located on filesystem {1} with type {2}, using Truncate journal mode", path, mount.DriveFormat, mount.DriveType);
|
||||||
|
return SQLiteJournalModeEnum.Truncate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Debug("Database {0} located on filesystem {1} with type {2}, using WAL journal mode", path, mount.DriveFormat, mount.DriveType);
|
||||||
|
}
|
||||||
|
|
||||||
return SQLiteJournalModeEnum.Wal;
|
return SQLiteJournalModeEnum.Wal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,9 @@ namespace NzbDrone.Core.Datastore
|
||||||
{
|
{
|
||||||
public enum DatabaseJournalType
|
public enum DatabaseJournalType
|
||||||
{
|
{
|
||||||
|
Auto = SQLiteJournalModeEnum.Default,
|
||||||
Wal = SQLiteJournalModeEnum.Wal,
|
Wal = SQLiteJournalModeEnum.Wal,
|
||||||
Truncate = SQLiteJournalModeEnum.Truncate
|
Truncate = SQLiteJournalModeEnum.Truncate,
|
||||||
|
Delete = SQLiteJournalModeEnum.Delete
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,6 +136,7 @@
|
||||||
<Compile Include="Configuration\InvalidConfigFileException.cs" />
|
<Compile Include="Configuration\InvalidConfigFileException.cs" />
|
||||||
<Compile Include="Configuration\RescanAfterRefreshType.cs" />
|
<Compile Include="Configuration\RescanAfterRefreshType.cs" />
|
||||||
<Compile Include="Configuration\ResetApiKeyCommand.cs" />
|
<Compile Include="Configuration\ResetApiKeyCommand.cs" />
|
||||||
|
<Compile Include="Datastore\DatabaseJournalType.cs" />
|
||||||
<Compile Include="Datastore\Migration\134_add_specials_folder_format.cs" />
|
<Compile Include="Datastore\Migration\134_add_specials_folder_format.cs" />
|
||||||
<Compile Include="Datastore\Migration\132_add_download_client_priority.cs" />
|
<Compile Include="Datastore\Migration\132_add_download_client_priority.cs" />
|
||||||
<Compile Include="Datastore\Migration\131_download_propers_config.cs" />
|
<Compile Include="Datastore\Migration\131_download_propers_config.cs" />
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace NzbDrone.Mono.Disk
|
||||||
public class ProcMountProvider : IProcMountProvider
|
public class ProcMountProvider : IProcMountProvider
|
||||||
{
|
{
|
||||||
private static string[] _fixedTypes = new [] { "ext3", "ext2", "ext4", "vfat", "fuseblk", "xfs", "jfs", "msdos", "ntfs", "minix", "hfs", "hfsplus", "qnx4", "ufs", "btrfs" };
|
private static string[] _fixedTypes = new [] { "ext3", "ext2", "ext4", "vfat", "fuseblk", "xfs", "jfs", "msdos", "ntfs", "minix", "hfs", "hfsplus", "qnx4", "ufs", "btrfs" };
|
||||||
private static string[] _networkDriveTypes = new [] { "cifs", "nfs", "nfs4", "nfsd", "sshfs" };
|
private static string[] _networkDriveTypes = new [] { "cifs", "nfs", "nfs4", "nfsd", "sshfs", "9p" };
|
||||||
private static readonly Regex OctalRegex = new Regex(@"\\\d{3}", RegexOptions.Compiled);
|
private static readonly Regex OctalRegex = new Regex(@"\\\d{3}", RegexOptions.Compiled);
|
||||||
|
|
||||||
private const string PROC_MOUNTS_FILENAME = @"/proc/mounts";
|
private const string PROC_MOUNTS_FILENAME = @"/proc/mounts";
|
||||||
|
|
Loading…
Reference in New Issue