diff options
author | Justin Clarke Casey | 2008-01-30 17:39:40 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-01-30 17:39:40 +0000 |
commit | dee0d1e55de4d63bc330ef08bfb3af1c415db2e1 (patch) | |
tree | f1f5060749efb343afac67aa7a8d83162f591618 | |
parent | * Insert 'assets served per hour' speed to asset server stats (diff) | |
download | opensim-SC_OLD-dee0d1e55de4d63bc330ef08bfb3af1c415db2e1.zip opensim-SC_OLD-dee0d1e55de4d63bc330ef08bfb3af1c415db2e1.tar.gz opensim-SC_OLD-dee0d1e55de4d63bc330ef08bfb3af1c415db2e1.tar.bz2 opensim-SC_OLD-dee0d1e55de4d63bc330ef08bfb3af1c415db2e1.tar.xz |
* Print out exception information when a mysql asset fetch fails
* Attempt reconnection on fetch and create exceptions.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLAssetData.cs | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs index b20c54e..d55d891 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs | |||
@@ -95,9 +95,12 @@ namespace OpenSim.Framework.Data.MySQL | |||
95 | cmd.Dispose(); | 95 | cmd.Dispose(); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | catch (Exception) | 98 | catch (Exception e) |
99 | { | 99 | { |
100 | MainLog.Instance.Warn("ASSETS", "MySql failure fetching asset"); | 100 | MainLog.Instance.Error( |
101 | "ASSETS", "MySql failure fetching asset" + Environment.NewLine + e.ToString() | ||
102 | + Environment.NewLine + "Attempting reconnection"); | ||
103 | _dbConnection.Reconnect(); | ||
101 | } | 104 | } |
102 | } | 105 | } |
103 | return asset; | 106 | return asset; |
@@ -112,20 +115,30 @@ namespace OpenSim.Framework.Data.MySQL | |||
112 | _dbConnection.Connection); | 115 | _dbConnection.Connection); |
113 | 116 | ||
114 | // need to ensure we dispose | 117 | // need to ensure we dispose |
115 | using (cmd) | 118 | try |
116 | { | 119 | { |
117 | MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); | 120 | using (cmd) |
118 | p.Value = asset.FullID.GetBytes(); | 121 | { |
119 | cmd.Parameters.AddWithValue("?name", asset.Name); | 122 | MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); |
120 | cmd.Parameters.AddWithValue("?description", asset.Description); | 123 | p.Value = asset.FullID.GetBytes(); |
121 | cmd.Parameters.AddWithValue("?assetType", asset.Type); | 124 | cmd.Parameters.AddWithValue("?name", asset.Name); |
122 | cmd.Parameters.AddWithValue("?invType", asset.InvType); | 125 | cmd.Parameters.AddWithValue("?description", asset.Description); |
123 | cmd.Parameters.AddWithValue("?local", asset.Local); | 126 | cmd.Parameters.AddWithValue("?assetType", asset.Type); |
124 | cmd.Parameters.AddWithValue("?temporary", asset.Temporary); | 127 | cmd.Parameters.AddWithValue("?invType", asset.InvType); |
125 | cmd.Parameters.AddWithValue("?data", asset.Data); | 128 | cmd.Parameters.AddWithValue("?local", asset.Local); |
126 | cmd.ExecuteNonQuery(); | 129 | cmd.Parameters.AddWithValue("?temporary", asset.Temporary); |
127 | cmd.Dispose(); | 130 | cmd.Parameters.AddWithValue("?data", asset.Data); |
131 | cmd.ExecuteNonQuery(); | ||
132 | cmd.Dispose(); | ||
133 | } | ||
128 | } | 134 | } |
135 | catch (Exception e) | ||
136 | { | ||
137 | MainLog.Instance.Error( | ||
138 | "ASSETS", "MySql failure creating asset" + Environment.NewLine + e.ToString() | ||
139 | + Environment.NewLine + "Attempting reconnection"); | ||
140 | _dbConnection.Reconnect(); | ||
141 | } | ||
129 | } | 142 | } |
130 | 143 | ||
131 | public void UpdateAsset(AssetBase asset) | 144 | public void UpdateAsset(AssetBase asset) |
@@ -176,4 +189,4 @@ namespace OpenSim.Framework.Data.MySQL | |||
176 | 189 | ||
177 | #endregion | 190 | #endregion |
178 | } | 191 | } |
179 | } \ No newline at end of file | 192 | } |