This should have a strong effect on the Unknown User issue mantis #6625

cpu-performance
Diva Canto 2013-07-02 14:31:39 -07:00
parent ccca005969
commit e984bfb4c6
6 changed files with 50 additions and 6 deletions

View File

@ -50,6 +50,7 @@ namespace OpenSim.Data
public interface IGridUserData
{
GridUserData Get(string userID);
GridUserData[] GetAll(string query);
bool Store(GridUserData data);
}
}

View File

@ -50,7 +50,7 @@ namespace OpenSim.Data.MSSQL
{
}
public GridUserData Get(string userID)
public new GridUserData Get(string userID)
{
GridUserData[] ret = Get("UserID", userID);
@ -60,5 +60,10 @@ namespace OpenSim.Data.MSSQL
return ret[0];
}
public GridUserData[] GetAll(string userID)
{
return base.Get("UserID LIKE {0}%", userID);
}
}
}

View File

@ -46,7 +46,7 @@ namespace OpenSim.Data.MySQL
public MySQLGridUserData(string connectionString, string realm) : base(connectionString, realm, "GridUserStore") {}
public GridUserData Get(string userID)
public new GridUserData Get(string userID)
{
GridUserData[] ret = Get("UserID", userID);
@ -56,6 +56,9 @@ namespace OpenSim.Data.MySQL
return ret[0];
}
public GridUserData[] GetAll(string userID)
{
return base.Get("UserID LIKE {0}%", userID);
}
}
}

View File

@ -56,6 +56,10 @@ namespace OpenSim.Data.SQLite
return ret[0];
}
public GridUserData[] GetAll(string userID)
{
return base.Get("UserID LIKE {0}%", userID);
}
}
}

View File

@ -319,8 +319,25 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
}
else
{
// Let's try the GridUser service
GridUserInfo uInfo = m_Scenes[0].GridUserService.GetGridUserInfo(uuid.ToString());
if (uInfo != null)
{
string url, first, last, tmp;
UUID u;
if (Util.ParseUniversalUserIdentifier(uInfo.UserID, out u, out url, out first, out last, out tmp))
{
AddUser(uuid, first, last, url);
names[0] = m_UserCache[uuid].FirstName;
names[1] = m_UserCache[uuid].LastName;
return true;
}
}
names[0] = "Unknown";
names[1] = "UserUMMTGUN4";
names[1] = "UserUMMTGUN5";
return false;
}
@ -474,7 +491,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
//m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
UserData oldUser;
//lock the whole block - prevent concurrent update
lock (m_UserCache)
m_UserCache.TryGetValue(id, out oldUser);

View File

@ -51,7 +51,22 @@ namespace OpenSim.Services.UserAccountService
public virtual GridUserInfo GetGridUserInfo(string userID)
{
GridUserData d = m_Database.Get(userID);
GridUserData d = null;
if (userID.Length > 36) // it's a UUI
d = m_Database.Get(userID);
else // it's a UUID
{
GridUserData[] ds = m_Database.GetAll(userID);
if (ds == null)
return null;
if (ds.Length > 0)
{
d = ds[0];
foreach (GridUserData dd in ds)
if (dd.UserID.Length > d.UserID.Length) // find the longest
d = dd;
}
}
if (d == null)
return null;