aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Storage
diff options
context:
space:
mode:
authorJeff Ames2008-02-05 19:44:27 +0000
committerJeff Ames2008-02-05 19:44:27 +0000
commit6ed5283bc06a62f38eb517e67b975832b603bf61 (patch)
treee5f635018789b73a99ddeca0883a68368fa5eece /OpenSim/Region/Storage
parentCut down on the number of packets sent during terraforming. Terraforming shou... (diff)
downloadopensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.zip
opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.gz
opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.bz2
opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.xz
Converted logging to use log4net.
Changed LogBase to ConsoleBase, which handles console I/O. This is mostly an in-place conversion, so lots of refactoring can still be done.
Diffstat (limited to 'OpenSim/Region/Storage')
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs13
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs48
2 files changed, 29 insertions, 32 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs
index 5125709..992f931 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.DB4o/DB4oDataStore.cs
@@ -42,9 +42,10 @@ using Db4objects.Db4o.Query;
42 42
43namespace OpenSim.DataStore.DB4oStorage 43namespace OpenSim.DataStore.DB4oStorage
44{ 44{
45
46 public class SceneObjectQuery : Predicate 45 public class SceneObjectQuery : Predicate
47 { 46 {
47 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
48
48 private LLUUID globalIDSearch; 49 private LLUUID globalIDSearch;
49 50
50 public SceneObjectQuery(LLUUID find) 51 public SceneObjectQuery(LLUUID find)
@@ -58,17 +59,14 @@ namespace OpenSim.DataStore.DB4oStorage
58 } 59 }
59 } 60 }
60 61
61
62 public class DB4oDataStore : IRegionDataStore 62 public class DB4oDataStore : IRegionDataStore
63 { 63 {
64 private IObjectContainer db; 64 private IObjectContainer db;
65 65
66 public void Initialise(string dbfile, string dbname) 66 public void Initialise(string dbfile, string dbname)
67 { 67 {
68 MainLog.Instance.Verbose("DATASTORE", "DB4O - Opening " + dbfile); 68 m_log.Info("[DATASTORE]: DB4O - Opening " + dbfile);
69 db = Db4oFactory.OpenFile(dbfile); 69 db = Db4oFactory.OpenFile(dbfile);
70
71 return;
72 } 70 }
73 71
74 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) 72 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
@@ -91,7 +89,7 @@ namespace OpenSim.DataStore.DB4oStorage
91 IObjectSet result = db.Get(typeof(SceneObjectGroup)); 89 IObjectSet result = db.Get(typeof(SceneObjectGroup));
92 List<SceneObjectGroup> retvals = new List<SceneObjectGroup>(); 90 List<SceneObjectGroup> retvals = new List<SceneObjectGroup>();
93 91
94 MainLog.Instance.Verbose("DATASTORE", "DB4O - LoadObjects found " + result.Count.ToString() + " objects"); 92 m_log.Info("[DATASTORE]: DB4O - LoadObjects found " + result.Count.ToString() + " objects");
95 93
96 foreach (Object obj in result) 94 foreach (Object obj in result)
97 { 95 {
@@ -103,7 +101,6 @@ namespace OpenSim.DataStore.DB4oStorage
103 101
104 public void StoreTerrain(double[,] ter) 102 public void StoreTerrain(double[,] ter)
105 { 103 {
106
107 } 104 }
108 105
109 public double[,] LoadTerrain() 106 public double[,] LoadTerrain()
@@ -113,12 +110,10 @@ namespace OpenSim.DataStore.DB4oStorage
113 110
114 public void RemoveLandObject(uint id) 111 public void RemoveLandObject(uint id)
115 { 112 {
116
117 } 113 }
118 114
119 public void StoreParcel(Land parcel) 115 public void StoreParcel(Land parcel)
120 { 116 {
121
122 } 117 }
123 118
124 public List<Land> LoadLandObjects() 119 public List<Land> LoadLandObjects()
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
index 28df4e7..6a79c8a 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
@@ -43,6 +43,8 @@ namespace OpenSim.DataStore.MSSQL
43{ 43{
44 public class MSSQLDataStore : IRegionDataStore 44 public class MSSQLDataStore : IRegionDataStore
45 { 45 {
46 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
47
46 private const string primSelect = "select * from prims"; 48 private const string primSelect = "select * from prims";
47 private const string shapeSelect = "select * from primshapes"; 49 private const string shapeSelect = "select * from primshapes";
48 private const string terrainSelect = "select * from terrain"; 50 private const string terrainSelect = "select * from terrain";
@@ -68,7 +70,7 @@ namespace OpenSim.DataStore.MSSQL
68 70
69 ds = new DataSet(); 71 ds = new DataSet();
70 72
71 MainLog.Instance.Verbose("DATASTORE", "MSSQL - connecting: " + settingInitialCatalog); 73 m_log.Info("[DATASTORE]: MSSQL - connecting: " + settingInitialCatalog);
72 SqlConnection conn = new SqlConnection(connectionString); 74 SqlConnection conn = new SqlConnection(connectionString);
73 SqlCommand primSelectCmd = new SqlCommand(primSelect, conn); 75 SqlCommand primSelectCmd = new SqlCommand(primSelect, conn);
74 primDa = new SqlDataAdapter(primSelectCmd); 76 primDa = new SqlDataAdapter(primSelectCmd);
@@ -109,7 +111,7 @@ namespace OpenSim.DataStore.MSSQL
109 } 111 }
110 catch (Exception) 112 catch (Exception)
111 { 113 {
112 MainLog.Instance.Verbose("DATASTORE", "Caught fill error on primshapes table"); 114 m_log.Info("[DATASTORE]: Caught fill error on primshapes table");
113 } 115 }
114 try 116 try
115 { 117 {
@@ -117,7 +119,7 @@ namespace OpenSim.DataStore.MSSQL
117 } 119 }
118 catch (Exception) 120 catch (Exception)
119 { 121 {
120 MainLog.Instance.Verbose("DATASTORE", "Caught fill error on terrain table"); 122 m_log.Info("[DATASTORE]: Caught fill error on terrain table");
121 } 123 }
122 return; 124 return;
123 } 125 }
@@ -129,18 +131,18 @@ namespace OpenSim.DataStore.MSSQL
129 { 131 {
130 foreach (SceneObjectPart prim in obj.Children.Values) 132 foreach (SceneObjectPart prim in obj.Children.Values)
131 { 133 {
132 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); 134 m_log.Info("[DATASTORE]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
133 addPrim(prim, obj.UUID, regionUUID); 135 addPrim(prim, obj.UUID, regionUUID);
134 } 136 }
135 } 137 }
136 138
137 Commit(); 139 Commit();
138 // MainLog.Instance.Verbose("Dump of prims:", ds.GetXml()); 140 // m_log.Info("Dump of prims:", ds.GetXml());
139 } 141 }
140 142
141 public void RemoveObject(LLUUID obj, LLUUID regionUUID) 143 public void RemoveObject(LLUUID obj, LLUUID regionUUID)
142 { 144 {
143 MainLog.Instance.Verbose("DATASTORE", "Removing obj: {0} from region: {1}", obj.UUID, regionUUID); 145 m_log.Info(String.Format("[DATASTORE]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID));
144 146
145 DataTable prims = ds.Tables["prims"]; 147 DataTable prims = ds.Tables["prims"];
146 DataTable shapes = ds.Tables["primshapes"]; 148 DataTable shapes = ds.Tables["primshapes"];
@@ -179,7 +181,7 @@ namespace OpenSim.DataStore.MSSQL
179 lock (ds) 181 lock (ds)
180 { 182 {
181 DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); 183 DataRow[] primsForRegion = prims.Select(byRegion, orderByParent);
182 MainLog.Instance.Verbose("DATASTORE", 184 m_log.Info("[DATASTORE]: " +
183 "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); 185 "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
184 186
185 foreach (DataRow primRow in primsForRegion) 187 foreach (DataRow primRow in primsForRegion)
@@ -199,7 +201,7 @@ namespace OpenSim.DataStore.MSSQL
199 } 201 }
200 else 202 else
201 { 203 {
202 MainLog.Instance.Notice( 204 m_log.Info(
203 "No shape found for prim in storage, so setting default box shape"); 205 "No shape found for prim in storage, so setting default box shape");
204 prim.Shape = PrimitiveBaseShape.Default; 206 prim.Shape = PrimitiveBaseShape.Default;
205 } 207 }
@@ -219,7 +221,7 @@ namespace OpenSim.DataStore.MSSQL
219 } 221 }
220 else 222 else
221 { 223 {
222 MainLog.Instance.Notice( 224 m_log.Info(
223 "No shape found for prim in storage, so setting default box shape"); 225 "No shape found for prim in storage, so setting default box shape");
224 prim.Shape = PrimitiveBaseShape.Default; 226 prim.Shape = PrimitiveBaseShape.Default;
225 } 227 }
@@ -228,11 +230,11 @@ namespace OpenSim.DataStore.MSSQL
228 } 230 }
229 catch (Exception e) 231 catch (Exception e)
230 { 232 {
231 MainLog.Instance.Error("DATASTORE", "Failed create prim object, exception and data follows"); 233 m_log.Error("[DATASTORE]: Failed create prim object, exception and data follows");
232 MainLog.Instance.Verbose("DATASTORE", e.ToString()); 234 m_log.Info("[DATASTORE]: " + e.ToString());
233 foreach (DataColumn col in prims.Columns) 235 foreach (DataColumn col in prims.Columns)
234 { 236 {
235 MainLog.Instance.Verbose("DATASTORE", "Col: " + col.ColumnName + " => " + primRow[col]); 237 m_log.Info("[DATASTORE]: Col: " + col.ColumnName + " => " + primRow[col]);
236 } 238 }
237 } 239 }
238 } 240 }
@@ -245,7 +247,7 @@ namespace OpenSim.DataStore.MSSQL
245 { 247 {
246 int revision = Util.UnixTimeSinceEpoch(); 248 int revision = Util.UnixTimeSinceEpoch();
247 249
248 MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); 250 m_log.Info("[DATASTORE]: Storing terrain revision r" + revision.ToString());
249 251
250 DataTable terrain = ds.Tables["terrain"]; 252 DataTable terrain = ds.Tables["terrain"];
251 lock (ds) 253 lock (ds)
@@ -288,12 +290,12 @@ namespace OpenSim.DataStore.MSSQL
288 } 290 }
289 else 291 else
290 { 292 {
291 MainLog.Instance.Verbose("DATASTORE", "No terrain found for region"); 293 m_log.Info("[DATASTORE]: No terrain found for region");
292 return null; 294 return null;
293 } 295 }
294 296
295 297
296 MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString()); 298 m_log.Info("[DATASTORE]: Loaded terrain revision r" + rev.ToString());
297 } 299 }
298 300
299 return terret; 301 return terret;
@@ -950,7 +952,7 @@ namespace OpenSim.DataStore.MSSQL
950 } 952 }
951 catch (SqlException) 953 catch (SqlException)
952 { 954 {
953 MainLog.Instance.Warn("MSSQL", "Primitives Table Already Exists"); 955 m_log.Warn("[MSSQL]: Primitives Table Already Exists");
954 } 956 }
955 957
956 try 958 try
@@ -960,7 +962,7 @@ namespace OpenSim.DataStore.MSSQL
960 } 962 }
961 catch (SqlException) 963 catch (SqlException)
962 { 964 {
963 MainLog.Instance.Warn("MSSQL", "Shapes Table Already Exists"); 965 m_log.Warn("[MSSQL]: Shapes Table Already Exists");
964 } 966 }
965 967
966 try 968 try
@@ -970,7 +972,7 @@ namespace OpenSim.DataStore.MSSQL
970 } 972 }
971 catch (SqlException) 973 catch (SqlException)
972 { 974 {
973 MainLog.Instance.Warn("MSSQL", "Terrain Table Already Exists"); 975 m_log.Warn("[MSSQL]: Terrain Table Already Exists");
974 } 976 }
975 977
976 conn.Close(); 978 conn.Close();
@@ -994,7 +996,7 @@ namespace OpenSim.DataStore.MSSQL
994 } 996 }
995 catch (SqlException) 997 catch (SqlException)
996 { 998 {
997 MainLog.Instance.Verbose("DATASTORE", "MSSQL Database doesn't exist... creating"); 999 m_log.Info("[DATASTORE]: MSSQL Database doesn't exist... creating");
998 InitDB(conn); 1000 InitDB(conn);
999 } 1001 }
1000 1002
@@ -1009,14 +1011,14 @@ namespace OpenSim.DataStore.MSSQL
1009 } 1011 }
1010 catch (SqlException e) 1012 catch (SqlException e)
1011 { 1013 {
1012 MainLog.Instance.Verbose("DATASTORE", e.ToString()); 1014 m_log.Info("[DATASTORE]: " + e.ToString());
1013 } 1015 }
1014 1016
1015 foreach (DataColumn col in createPrimTable().Columns) 1017 foreach (DataColumn col in createPrimTable().Columns)
1016 { 1018 {
1017 if (!tmpDS.Tables["prims"].Columns.Contains(col.ColumnName)) 1019 if (!tmpDS.Tables["prims"].Columns.Contains(col.ColumnName))
1018 { 1020 {
1019 MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); 1021 m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName);
1020 return false; 1022 return false;
1021 } 1023 }
1022 } 1024 }
@@ -1024,7 +1026,7 @@ namespace OpenSim.DataStore.MSSQL
1024 { 1026 {
1025 if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) 1027 if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName))
1026 { 1028 {
1027 MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); 1029 m_log.Info("[DATASTORE]: Missing required column:" + col.ColumnName);
1028 return false; 1030 return false;
1029 } 1031 }
1030 } 1032 }
@@ -1032,7 +1034,7 @@ namespace OpenSim.DataStore.MSSQL
1032 { 1034 {
1033 if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) 1035 if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName))
1034 { 1036 {
1035 MainLog.Instance.Verbose("DATASTORE", "Missing require column:" + col.ColumnName); 1037 m_log.Info("[DATASTORE]: Missing require column:" + col.ColumnName);
1036 return false; 1038 return false;
1037 } 1039 }
1038 } 1040 }