Introduce a separate connection string for estates, which defaults to the one gi

ven for the region datastore. Removes the flag to store prim inventories, which are now always stored.
0.6.0-stable
Melanie Thielker 2008-07-18 20:50:47 +00:00
parent bbd076544d
commit a73d87ef16
11 changed files with 20 additions and 96 deletions

View File

@ -71,7 +71,6 @@ namespace OpenSim.Data.MSSQL
private DataTable m_landAccessListTable; private DataTable m_landAccessListTable;
/// <summary>Temporary attribute while this is experimental</summary> /// <summary>Temporary attribute while this is experimental</summary>
private bool persistPrimInventories;
/*********************************************************************** /***********************************************************************
* *
@ -83,13 +82,11 @@ namespace OpenSim.Data.MSSQL
/// see IRegionDataStore /// see IRegionDataStore
/// </summary> /// </summary>
/// <param name="connectionString"></param> /// <param name="connectionString"></param>
/// <param name="persistPrimInventories"></param> public void Initialise(string connectionString)
public void Initialise(string connectionString, bool persistPrimInventories)
{ {
// Instance.Initialise("", true); // Instance.Initialise("", true);
m_dataSet = new DataSet(); m_dataSet = new DataSet();
this.persistPrimInventories = persistPrimInventories;
m_log.Info("[REGION DB]: MSSql - connecting: " + connectionString); m_log.Info("[REGION DB]: MSSql - connecting: " + connectionString);
m_connection = new SqlConnection(connectionString); m_connection = new SqlConnection(connectionString);
@ -126,13 +123,10 @@ namespace OpenSim.Data.MSSQL
setupShapeCommands(m_shapeDataAdapter, m_connection); setupShapeCommands(m_shapeDataAdapter, m_connection);
m_shapeDataAdapter.Fill(m_shapeTable); m_shapeDataAdapter.Fill(m_shapeTable);
if (persistPrimInventories)
{
m_itemsTable = createItemsTable(); m_itemsTable = createItemsTable();
m_dataSet.Tables.Add(m_itemsTable); m_dataSet.Tables.Add(m_itemsTable);
SetupItemsCommands(m_itemsDataAdapter, m_connection); SetupItemsCommands(m_itemsDataAdapter, m_connection);
m_itemsDataAdapter.Fill(m_itemsTable); m_itemsDataAdapter.Fill(m_itemsTable);
}
m_terrainTable = createTerrainTable(); m_terrainTable = createTerrainTable();
m_dataSet.Tables.Add(m_terrainTable); m_dataSet.Tables.Add(m_terrainTable);
@ -218,10 +212,7 @@ namespace OpenSim.Data.MSSQL
shapeRow.Delete(); shapeRow.Delete();
} }
if (persistPrimInventories)
{
RemoveItems(new LLUUID((string)row["UUID"])); RemoveItems(new LLUUID((string)row["UUID"]));
}
// Remove prim row // Remove prim row
row.Delete(); row.Delete();
@ -317,11 +308,8 @@ namespace OpenSim.Data.MSSQL
createdObjects[new LLUUID(objID)].AddPart(prim); createdObjects[new LLUUID(objID)].AddPart(prim);
} }
if (persistPrimInventories)
{
LoadItems(prim); LoadItems(prim);
} }
}
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[DATASTORE]: Failed create prim object, exception and data follows"); m_log.Error("[DATASTORE]: Failed create prim object, exception and data follows");
@ -589,10 +577,7 @@ namespace OpenSim.Data.MSSQL
m_primDataAdapter.Update(m_primTable); m_primDataAdapter.Update(m_primTable);
m_shapeDataAdapter.Update(m_shapeTable); m_shapeDataAdapter.Update(m_shapeTable);
if (persistPrimInventories)
{
m_itemsDataAdapter.Update(m_itemsTable); m_itemsDataAdapter.Update(m_itemsTable);
}
m_terrainDataAdapter.Update(m_terrainTable); m_terrainDataAdapter.Update(m_terrainTable);
m_landDataAdapter.Update(m_landTable); m_landDataAdapter.Update(m_landTable);
@ -1378,9 +1363,6 @@ namespace OpenSim.Data.MSSQL
/// <param name="items"></param> /// <param name="items"></param>
public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
{ {
if (!persistPrimInventories)
return;
m_log.InfoFormat("[REGION DB]: Persisting Prim Inventory with prim ID {0}", primID); m_log.InfoFormat("[REGION DB]: Persisting Prim Inventory with prim ID {0}", primID);
// For now, we're just going to crudely remove all the previous inventory items // For now, we're just going to crudely remove all the previous inventory items
@ -1749,7 +1731,6 @@ namespace OpenSim.Data.MSSQL
pDa.Fill(tmpDS, "prims"); pDa.Fill(tmpDS, "prims");
sDa.Fill(tmpDS, "primshapes"); sDa.Fill(tmpDS, "primshapes");
if (persistPrimInventories)
iDa.Fill(tmpDS, "primitems"); iDa.Fill(tmpDS, "primitems");
tDa.Fill(tmpDS, "terrain"); tDa.Fill(tmpDS, "terrain");
@ -1765,7 +1746,6 @@ namespace OpenSim.Data.MSSQL
pDa.Fill(tmpDS, "prims"); pDa.Fill(tmpDS, "prims");
sDa.Fill(tmpDS, "primshapes"); sDa.Fill(tmpDS, "primshapes");
if (persistPrimInventories)
iDa.Fill(tmpDS, "primitems"); iDa.Fill(tmpDS, "primitems");
tDa.Fill(tmpDS, "terrain"); tDa.Fill(tmpDS, "terrain");

View File

@ -92,9 +92,6 @@ namespace OpenSim.Data.MySQL
private DataTable m_landAccessListTable; private DataTable m_landAccessListTable;
private DataTable m_regionSettingsTable; private DataTable m_regionSettingsTable;
/// <value>Temporary attribute while this is experimental</value>
private bool persistPrimInventories;
/*********************************************************************** /***********************************************************************
* *
* Public Interface Functions * Public Interface Functions
@ -105,13 +102,11 @@ namespace OpenSim.Data.MySQL
/// see IRegionDataStore /// see IRegionDataStore
/// </summary> /// </summary>
/// <param name="connectionstring"></param> /// <param name="connectionstring"></param>
/// <param name="persistPrimInventories"></param> public void Initialise(string connectionString)
public void Initialise(string connectionString, bool persistPrimInventories)
{ {
m_connectionString = connectionString; m_connectionString = connectionString;
m_dataSet = new DataSet(); m_dataSet = new DataSet();
this.persistPrimInventories = persistPrimInventories;
int passPosition = 0; int passPosition = 0;
int passEndPosition = 0; int passEndPosition = 0;
@ -184,13 +179,10 @@ namespace OpenSim.Data.MySQL
m_shapeDataAdapter.Fill(m_shapeTable); m_shapeDataAdapter.Fill(m_shapeTable);
if (persistPrimInventories)
{
m_itemsTable = createItemsTable(); m_itemsTable = createItemsTable();
m_dataSet.Tables.Add(m_itemsTable); m_dataSet.Tables.Add(m_itemsTable);
SetupItemsCommands(m_itemsDataAdapter, m_connection); SetupItemsCommands(m_itemsDataAdapter, m_connection);
m_itemsDataAdapter.Fill(m_itemsTable); m_itemsDataAdapter.Fill(m_itemsTable);
}
m_terrainTable = createTerrainTable(); m_terrainTable = createTerrainTable();
m_dataSet.Tables.Add(m_terrainTable); m_dataSet.Tables.Add(m_terrainTable);
@ -429,10 +421,7 @@ namespace OpenSim.Data.MySQL
shapeRow.Delete(); shapeRow.Delete();
} }
if (persistPrimInventories)
{
RemoveItems(uuid); RemoveItems(uuid);
}
// Remove prim row // Remove prim row
row.Delete(); row.Delete();
@ -527,11 +516,8 @@ namespace OpenSim.Data.MySQL
createdObjects[new LLUUID(objID)].AddPart(prim); createdObjects[new LLUUID(objID)].AddPart(prim);
} }
if (persistPrimInventories)
{
LoadItems(prim); LoadItems(prim);
} }
}
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); m_log.Error("[REGION DB]: Failed create prim object, exception and data follows");
@ -827,10 +813,7 @@ namespace OpenSim.Data.MySQL
m_primDataAdapter.Update(m_primTable); m_primDataAdapter.Update(m_primTable);
m_shapeDataAdapter.Update(m_shapeTable); m_shapeDataAdapter.Update(m_shapeTable);
if (persistPrimInventories)
{
m_itemsDataAdapter.Update(m_itemsTable); m_itemsDataAdapter.Update(m_itemsTable);
}
m_terrainDataAdapter.Update(m_terrainTable); m_terrainDataAdapter.Update(m_terrainTable);
m_landDataAdapter.Update(m_landTable); m_landDataAdapter.Update(m_landTable);
@ -1812,9 +1795,6 @@ namespace OpenSim.Data.MySQL
/// <param name="items"></param> /// <param name="items"></param>
public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
{ {
if (!persistPrimInventories)
return;
m_log.InfoFormat("[REGION DB]: Persisting Prim Inventory with prim ID {0}", primID); m_log.InfoFormat("[REGION DB]: Persisting Prim Inventory with prim ID {0}", primID);
// For now, we're just going to crudely remove all the previous inventory items // For now, we're just going to crudely remove all the previous inventory items
@ -2241,7 +2221,6 @@ namespace OpenSim.Data.MySQL
// pDa.Fill(tmpDS, "prims"); // pDa.Fill(tmpDS, "prims");
// sDa.Fill(tmpDS, "primshapes"); // sDa.Fill(tmpDS, "primshapes");
// if (persistPrimInventories)
// iDa.Fill(tmpDS, "primitems"); // iDa.Fill(tmpDS, "primitems");
// tDa.Fill(tmpDS, "terrain"); // tDa.Fill(tmpDS, "terrain");

View File

@ -61,7 +61,7 @@ namespace OpenSim.Data.NHibernate
// Initialise("SQLiteDialect;SqliteClientDriver;URI=file:OpenSim.db,version=3", true); // Initialise("SQLiteDialect;SqliteClientDriver;URI=file:OpenSim.db,version=3", true);
// } // }
public void Initialise(string connect, bool persistpriminventories) public void Initialise(string connect)
{ {
// Split out the dialect, driver, and connect string // Split out the dialect, driver, and connect string
char[] split = {';'}; char[] split = {';'};

View File

@ -38,7 +38,7 @@ namespace OpenSim.Data.Null
/// </summary> /// </summary>
public class NullDataStore : IRegionDataStore public class NullDataStore : IRegionDataStore
{ {
public void Initialise(string dbfile, bool persistPrimInventories) public void Initialise(string dbfile)
{ {
return; return;
} }

View File

@ -68,7 +68,6 @@ namespace OpenSim.Data.SQLite
private String m_connectionString; private String m_connectionString;
// Temporary attribute while this is experimental // Temporary attribute while this is experimental
private bool persistPrimInventories;
/*********************************************************************** /***********************************************************************
* *
@ -84,11 +83,9 @@ namespace OpenSim.Data.SQLite
/// </list> /// </list>
/// </summary> /// </summary>
/// <param name="connectionString">the connection string</param> /// <param name="connectionString">the connection string</param>
/// <param name="persistPrimInventories">?</param> public void Initialise(string connectionString)
public void Initialise(string connectionString, bool persistPrimInventories)
{ {
m_connectionString = connectionString; m_connectionString = connectionString;
this.persistPrimInventories = persistPrimInventories;
ds = new DataSet(); ds = new DataSet();
@ -137,12 +134,9 @@ namespace OpenSim.Data.SQLite
ds.Tables.Add(createShapeTable()); ds.Tables.Add(createShapeTable());
setupShapeCommands(shapeDa, m_conn); setupShapeCommands(shapeDa, m_conn);
if (persistPrimInventories)
{
ds.Tables.Add(createItemsTable()); ds.Tables.Add(createItemsTable());
setupItemsCommands(itemsDa, m_conn); setupItemsCommands(itemsDa, m_conn);
itemsDa.Fill(ds.Tables["primitems"]); itemsDa.Fill(ds.Tables["primitems"]);
}
ds.Tables.Add(createTerrainTable()); ds.Tables.Add(createTerrainTable());
setupTerrainCommands(terrainDa, m_conn); setupTerrainCommands(terrainDa, m_conn);
@ -267,10 +261,7 @@ namespace OpenSim.Data.SQLite
shapeRow.Delete(); shapeRow.Delete();
} }
if (persistPrimInventories)
{
RemoveItems(uuid); RemoveItems(uuid);
}
// Remove prim row // Remove prim row
row.Delete(); row.Delete();
@ -367,11 +358,8 @@ namespace OpenSim.Data.SQLite
createdObjects[new LLUUID(objID)].AddPart(prim); createdObjects[new LLUUID(objID)].AddPart(prim);
} }
if (persistPrimInventories)
{
LoadItems(prim); LoadItems(prim);
} }
}
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); m_log.Error("[REGION DB]: Failed create prim object, exception and data follows");
@ -615,10 +603,7 @@ namespace OpenSim.Data.SQLite
primDa.Update(ds, "prims"); primDa.Update(ds, "prims");
shapeDa.Update(ds, "primshapes"); shapeDa.Update(ds, "primshapes");
if (persistPrimInventories)
{
itemsDa.Update(ds, "primitems"); itemsDa.Update(ds, "primitems");
}
terrainDa.Update(ds, "terrain"); terrainDa.Update(ds, "terrain");
landDa.Update(ds, "land"); landDa.Update(ds, "land");
@ -1475,9 +1460,6 @@ namespace OpenSim.Data.SQLite
/// <param name="items"></param> /// <param name="items"></param>
public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
{ {
if (!persistPrimInventories)
return;
m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
DataTable dbItems = ds.Tables["primitems"]; DataTable dbItems = ds.Tables["primitems"];
@ -1779,8 +1761,6 @@ namespace OpenSim.Data.SQLite
// m_log.Warn("[REGION DB]: Shapes Table Already Exists"); // m_log.Warn("[REGION DB]: Shapes Table Already Exists");
// } // }
// if (persistPrimInventories)
// {
// try // try
// { // {
// icmd.ExecuteNonQuery(); // icmd.ExecuteNonQuery();
@ -1789,7 +1769,6 @@ namespace OpenSim.Data.SQLite
// { // {
// m_log.Warn("[REGION DB]: Primitives Inventory Table Already Exists"); // m_log.Warn("[REGION DB]: Primitives Inventory Table Already Exists");
// } // }
// }
// try // try
// { // {
@ -1851,7 +1830,6 @@ namespace OpenSim.Data.SQLite
pDa.Fill(tmpDS, "prims"); pDa.Fill(tmpDS, "prims");
sDa.Fill(tmpDS, "primshapes"); sDa.Fill(tmpDS, "primshapes");
if (persistPrimInventories)
iDa.Fill(tmpDS, "primitems"); iDa.Fill(tmpDS, "primitems");
tDa.Fill(tmpDS, "terrain"); tDa.Fill(tmpDS, "terrain");
@ -1874,7 +1852,6 @@ namespace OpenSim.Data.SQLite
// pDa.Fill(tmpDS, "prims"); // pDa.Fill(tmpDS, "prims");
// sDa.Fill(tmpDS, "primshapes"); // sDa.Fill(tmpDS, "primshapes");
// if (persistPrimInventories)
// iDa.Fill(tmpDS, "primitems"); // iDa.Fill(tmpDS, "primitems");
// tDa.Fill(tmpDS, "terrain"); // tDa.Fill(tmpDS, "terrain");

View File

@ -300,9 +300,8 @@ namespace OpenSim
} }
m_storageConnectionString m_storageConnectionString
= startupConfig.GetString("storage_connection_string", "URI=file:OpenSim.db,version=3"); = startupConfig.GetString("storage_connection_string", "URI=file:OpenSim.db,version=3");
m_storagePersistPrimInventories m_estateConnectionString
= startupConfig.GetBoolean("storage_prim_inventories", true); = startupConfig.GetString("estate_connection_string", m_storageConnectionString);
m_scriptEngine = startupConfig.GetString("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); m_scriptEngine = startupConfig.GetString("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
m_assetStorage = startupConfig.GetString("asset_database", "local"); m_assetStorage = startupConfig.GetString("asset_database", "local");
m_clientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); m_clientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
@ -555,9 +554,9 @@ namespace OpenSim
return clientServer; return clientServer;
} }
protected override StorageManager CreateStorageManager(string connectionstring) protected override StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring)
{ {
return new StorageManager(m_storageDll, connectionstring, m_storagePersistPrimInventories); return new StorageManager(m_storageDll, connectionstring, estateconnectionstring);
} }
protected override ClientStackManager CreateClientStackManager() protected override ClientStackManager CreateClientStackManager()

View File

@ -62,13 +62,10 @@ namespace OpenSim.Region.ClientStack
protected StorageManager m_storageManager; protected StorageManager m_storageManager;
protected string m_storageConnectionString; protected string m_storageConnectionString;
protected string m_estateConnectionString;
protected ClientStackManager m_clientStackManager; protected ClientStackManager m_clientStackManager;
// An attribute to indicate whether prim inventories should be persisted.
// Probably will be temporary until this stops being experimental.
protected bool m_storagePersistPrimInventories;
public SceneManager SceneManager public SceneManager SceneManager
{ {
get { return m_sceneManager; } get { return m_sceneManager; }
@ -78,7 +75,7 @@ namespace OpenSim.Region.ClientStack
{ {
base.Startup(); base.Startup();
m_storageManager = CreateStorageManager(m_storageConnectionString); m_storageManager = CreateStorageManager(m_storageConnectionString, m_estateConnectionString);
m_clientStackManager = CreateClientStackManager(); m_clientStackManager = CreateClientStackManager();
@ -101,7 +98,7 @@ namespace OpenSim.Region.ClientStack
// protected abstract ConsoleBase CreateConsole(); // protected abstract ConsoleBase CreateConsole();
protected abstract PhysicsScene GetPhysicsScene(); protected abstract PhysicsScene GetPhysicsScene();
protected abstract StorageManager CreateStorageManager(string connectionstring); protected abstract StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring);
protected abstract ClientStackManager CreateClientStackManager(); protected abstract ClientStackManager CreateClientStackManager();
protected PhysicsScene GetPhysicsScene(string engine, string meshEngine, IConfigSource config) protected PhysicsScene GetPhysicsScene(string engine, string meshEngine, IConfigSource config)

View File

@ -39,8 +39,7 @@ namespace OpenSim.Region.Environment.Interfaces
/// </summary> /// </summary>
/// <param name="filename">The file to save the database to (may not be applicable). Alternatively, /// <param name="filename">The file to save the database to (may not be applicable). Alternatively,
/// a connection string for the database</param> /// a connection string for the database</param>
/// <param name="persistPrimInventories">Temporary switch while this option is immature</param> void Initialise(string filename);
void Initialise(string filename, bool persistPrimInventories);
/// <summary> /// <summary>
/// Stores all object's details apart from inventory /// Stores all object's details apart from inventory

View File

@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment
m_dataStore = storage; m_dataStore = storage;
} }
public StorageManager(string dllName, string connectionstring, bool persistPrimInventories) public StorageManager(string dllName, string connectionstring, string estateconnectionstring)
{ {
m_log.Info("[DATASTORE]: Attempting to load " + dllName); m_log.Info("[DATASTORE]: Attempting to load " + dllName);
Assembly pluginAssembly = Assembly.LoadFrom(dllName); Assembly pluginAssembly = Assembly.LoadFrom(dllName);
@ -70,7 +70,7 @@ namespace OpenSim.Region.Environment
{ {
IRegionDataStore plug = IRegionDataStore plug =
(IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); (IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise(connectionstring, persistPrimInventories); plug.Initialise(connectionstring);
m_dataStore = plug; m_dataStore = plug;
@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment
{ {
IEstateDataStore estPlug = IEstateDataStore estPlug =
(IEstateDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); (IEstateDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
estPlug.Initialise(connectionstring); estPlug.Initialise(estateconnectionstring);
m_estateDataStore = estPlug; m_estateDataStore = estPlug;
} }

View File

@ -54,7 +54,7 @@ namespace OpenSimExport
sman = new StorageManager( sman = new StorageManager(
startup.GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll"), startup.GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll"),
startup.GetString("storage_connection_string", String.Empty), startup.GetString("storage_connection_string", String.Empty),
false startup.GetString("estate_connection_string", String.Empty)
); );
} }

View File

@ -42,16 +42,9 @@ storage_connection_string="URI=file:OpenSim.db,version=3";
; note that the supplied account needs create privilegies if you want it to auto-create needed tables. ; note that the supplied account needs create privilegies if you want it to auto-create needed tables.
; storage_plugin="OpenSim.Data.MySQL.dll" ; storage_plugin="OpenSim.Data.MySQL.dll"
; storage_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;"; ; storage_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;";
; If you want to use a different database/server for estate data, then
; turn on experimental storage of prim inventories in the region database ; uncomment and change this connect string. Defaults to the above if not set
; estate_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;";
; Prim inventory storage is now turned on by default
; However, this option remains in case it needs to be disabled
; More details of the current state of this can be found at
;
; http://opensimulator.org/wiki/OpenSim:Prim_Inventory_Persistence
;
storage_prim_inventories = true
; Select whether you want to use local or grid asset storage. ; Select whether you want to use local or grid asset storage.
; ;