aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorOren Hurvitz2015-07-22 20:13:53 +0300
committerOren Hurvitz2015-07-22 20:13:53 +0300
commit3a2d4c8b055d906b4a790bf1bf9fb1f09f9781ea (patch)
treefd52b3f754d0e079ff8d7698cb6812eea734613d
parentAdded the thread name to the logs (diff)
downloadopensim-SC_OLD-3a2d4c8b055d906b4a790bf1bf9fb1f09f9781ea.zip
opensim-SC_OLD-3a2d4c8b055d906b4a790bf1bf9fb1f09f9781ea.tar.gz
opensim-SC_OLD-3a2d4c8b055d906b4a790bf1bf9fb1f09f9781ea.tar.bz2
opensim-SC_OLD-3a2d4c8b055d906b4a790bf1bf9fb1f09f9781ea.tar.xz
Added logging in places where regions are searched for by their location
This commit also fixes the log message "Region already exists in coordinates <{0},{1}>": it was actually showing the *requested* coordinates, instead of the coordinates of the previously-existing link.
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs27
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs21
-rw-r--r--OpenSim/Services/GridService/GridService.cs19
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs11
5 files changed, 60 insertions, 20 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 089bd4f..8a1bf20 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -2196,7 +2196,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2196 public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, 2196 public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID,
2197 double px, double py, uint pSizeHint) 2197 double px, double py, uint pSizeHint)
2198 { 2198 {
2199 m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py); 2199 m_log.DebugFormat("{0} GetRegionContainingWorldLocation: query, loc=<{1},{2}>", LogHeader, px, py);
2200 GridRegion ret = null; 2200 GridRegion ret = null;
2201 const double fudge = 2.0; 2201 const double fudge = 2.0;
2202 2202
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 4661c21..664aba9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -198,8 +198,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
198 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 198 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
199 { 199 {
200 GridRegion region = null; 200 GridRegion region = null;
201// uint regionX = Util.WorldToRegionLoc((uint)x); 201 uint regionX = Util.WorldToRegionLoc((uint)x);
202// uint regionY = Util.WorldToRegionLoc((uint)y); 202 uint regionY = Util.WorldToRegionLoc((uint)y);
203
204 // Sanity check
205 if ((Util.RegionToWorldLoc(regionX) != (uint)x) || (Util.RegionToWorldLoc(regionY) != (uint)y))
206 {
207 m_log.WarnFormat("{0} GetRegionByPosition. Bad position requested: not the base of the region. Requested Pos=<{1},{2}>, Should Be=<{3},{4}>",
208 LogHeader, x, y, Util.RegionToWorldLoc(regionX), Util.RegionToWorldLoc(regionY));
209 }
203 210
204 // First see if it's a neighbour, even if it isn't on this sim. 211 // First see if it's a neighbour, even if it isn't on this sim.
205 // Neighbour data is cached in memory, so this is fast 212 // Neighbour data is cached in memory, so this is fast
@@ -211,8 +218,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
211 region = rcache.GetRegionByPosition(x, y); 218 region = rcache.GetRegionByPosition(x, y);
212 if (region != null) 219 if (region != null)
213 { 220 {
214 // m_log.DebugFormat("{0} GetRegionByPosition. Found region {1} in cache. Pos=<{2},{3}>", 221 m_log.DebugFormat("{0} GetRegionByPosition. Found region {1} in cache (of region {2}). Pos=<{3},{4}>",
215 // LogHeader, region.RegionName, x, y); 222 LogHeader, region.RegionName,
223 Util.WorldToRegionLoc((uint)region.RegionLocX), Util.WorldToRegionLoc((uint)region.RegionLocY));
216 break; 224 break;
217 } 225 }
218 } 226 }
@@ -222,19 +230,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
222 if (region == null) 230 if (region == null)
223 { 231 {
224 region = m_GridService.GetRegionByPosition(scopeID, x, y); 232 region = m_GridService.GetRegionByPosition(scopeID, x, y);
225 /* 233
226 if (region == null) 234 if (region == null)
227 { 235 {
228 m_log.DebugFormat("{0} GetRegionByPosition. Region not found by grid service. Pos=<{1},{2}>", 236 m_log.DebugFormat("{0} GetRegionByPosition. Region not found by grid service. Pos=<{1},{2}>",
229 LogHeader, regionX, regionY); 237 LogHeader, regionX, regionY);
230 } 238 }
231 else 239 else
232 { 240 {
233 m_log.DebugFormat("{0} GetRegionByPosition. Requested region {1} from grid service. Pos=<{2},{3}>", 241 m_log.DebugFormat("{0} GetRegionByPosition. Got region {1} from grid service. Pos=<{2},{3}>",
234 LogHeader, region.RegionName, regionX, regionY); 242 LogHeader, region.RegionName,
243 Util.WorldToRegionLoc((uint)region.RegionLocX), Util.WorldToRegionLoc((uint)region.RegionLocY));
235 } 244 }
236 */
237 } 245 }
246
238 return region; 247 return region;
239 } 248 }
240 249
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index f0c4926..68ae4fa 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -193,16 +193,35 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
193 // The coordinates are world coords (meters), NOT region units. 193 // The coordinates are world coords (meters), NOT region units.
194 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 194 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
195 { 195 {
196 ulong regionHandle = Util.RegionWorldLocToHandle((uint)x, (uint)y);
197 uint regionX = Util.WorldToRegionLoc((uint)x);
198 uint regionY = Util.WorldToRegionLoc((uint)y);
199
200 // Sanity check
201 if ((Util.RegionToWorldLoc(regionX) != (uint)x) || (Util.RegionToWorldLoc(regionY) != (uint)y))
202 {
203 m_log.WarnFormat("[REMOTE GRID CONNECTOR]: GetRegionByPosition. Bad position requested: not the base of the region. Requested Pos=<{0},{1}>, Should Be=<{2},{3}>",
204 x, y, Util.RegionToWorldLoc(regionX), Util.RegionToWorldLoc(regionY));
205 }
206
196 bool inCache = false; 207 bool inCache = false;
197 GridRegion rinfo = m_RegionInfoCache.Get(scopeID, Util.RegionWorldLocToHandle((uint)x, (uint)y), out inCache); 208 GridRegion rinfo = m_RegionInfoCache.Get(scopeID, regionHandle, out inCache);
198 if (inCache) 209 if (inCache)
210 {
211 m_log.DebugFormat("[REMOTE GRID CONNECTOR]: GetRegionByPosition. Found region {0} in cache. Pos=<{1},{2}>, RegionHandle={3}",
212 (rinfo == null) ? "<missing>" : rinfo.RegionName, regionX, regionY, (rinfo == null) ? regionHandle : rinfo.RegionHandle);
199 return rinfo; 213 return rinfo;
214 }
200 215
201 rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); 216 rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y);
202 if (rinfo == null) 217 if (rinfo == null)
203 rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y); 218 rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y);
204 219
205 m_RegionInfoCache.Cache(rinfo); 220 m_RegionInfoCache.Cache(rinfo);
221
222 m_log.DebugFormat("[REMOTE GRID CONNECTOR]: GetRegionByPosition. Added region {0} to the cache. Pos=<{1},{2}>, RegionHandle={3}",
223 (rinfo == null) ? "<missing>" : rinfo.RegionName, regionX, regionY, (rinfo == null) ? regionHandle : rinfo.RegionHandle);
224
206 return rinfo; 225 return rinfo;
207 } 226 }
208 227
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index af7a511..8807397 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -539,13 +539,24 @@ namespace OpenSim.Services.GridService
539 // multiples of the legacy region size (256). 539 // multiples of the legacy region size (256).
540 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 540 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
541 { 541 {
542 int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; 542 uint regionX = Util.WorldToRegionLoc((uint)x);
543 int snapY = (int)(y / Constants.RegionSize) * (int)Constants.RegionSize; 543 uint regionY = Util.WorldToRegionLoc((uint)y);
544 int snapX = (int)Util.RegionToWorldLoc(regionX);
545 int snapY = (int)Util.RegionToWorldLoc(regionY);
546
544 RegionData rdata = m_Database.Get(snapX, snapY, scopeID); 547 RegionData rdata = m_Database.Get(snapX, snapY, scopeID);
545 if (rdata != null) 548 if (rdata != null)
549 {
550 m_log.DebugFormat("{0} GetRegionByPosition. Found region {1} in database. Pos=<{2},{3}>",
551 LogHeader, rdata.RegionName, regionX, regionY);
546 return RegionData2RegionInfo(rdata); 552 return RegionData2RegionInfo(rdata);
547 553 }
548 return null; 554 else
555 {
556 m_log.DebugFormat("{0} GetRegionByPosition. Did not find region in database. Pos=<{1},{2}>",
557 LogHeader, regionX, regionY);
558 return null;
559 }
549 } 560 }
550 561
551 public GridRegion GetRegionByName(UUID scopeID, string name) 562 public GridRegion GetRegionByName(UUID scopeID, string name)
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 09c7938..0fd059f 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -282,7 +282,7 @@ namespace OpenSim.Services.GridService
282 282
283 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) 283 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
284 { 284 {
285 m_log.InfoFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", 285 m_log.InfoFormat("[HYPERGRID LINKER]: Link to {0} {1}, in <{2},{3}>",
286 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), 286 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
287 remoteRegionName, Util.WorldToRegionLoc((uint)xloc), Util.WorldToRegionLoc((uint)yloc)); 287 remoteRegionName, Util.WorldToRegionLoc((uint)xloc), Util.WorldToRegionLoc((uint)yloc));
288 288
@@ -335,7 +335,7 @@ namespace OpenSim.Services.GridService
335 GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); 335 GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);
336 if (region != null) 336 if (region != null)
337 { 337 {
338 m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", 338 m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates <{0},{1}> are already occupied by region {2} with uuid {3}",
339 Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY), 339 Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY),
340 region.RegionName, region.RegionID); 340 region.RegionName, region.RegionID);
341 reason = "Coordinates are already in use"; 341 reason = "Coordinates are already in use";
@@ -371,8 +371,8 @@ namespace OpenSim.Services.GridService
371 region = m_GridService.GetRegionByUUID(scopeID, regionID); 371 region = m_GridService.GetRegionByUUID(scopeID, regionID);
372 if (region != null) 372 if (region != null)
373 { 373 {
374 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", 374 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates <{0},{1}>",
375 Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY)); 375 Util.WorldToRegionLoc((uint)region.RegionLocX), Util.WorldToRegionLoc((uint)region.RegionLocY));
376 regInfo = region; 376 regInfo = region;
377 return true; 377 return true;
378 } 378 }
@@ -406,7 +406,8 @@ namespace OpenSim.Services.GridService
406 regInfo.RegionSecret = handle.ToString(); 406 regInfo.RegionSecret = handle.ToString();
407 407
408 AddHyperlinkRegion(regInfo, handle); 408 AddHyperlinkRegion(regInfo, handle);
409 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); 409 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} at <{1},{2}> with image {3}",
410 regInfo.RegionName, Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY), regInfo.TerrainImage);
410 return true; 411 return true;
411 } 412 }
412 413