More in this section

Forums / Developing with Sitefinity / Database allways growing never slim with images Libraries

Database allways growing never slim with images Libraries

9 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    13 Nov 2009
    Link to this post
    Hi,
    I´m working about Libraries and providers but have one not logical issue. I working with no versioning for Libraries. If i add some images to my library the DB is growing but after delete the complete library the size of database is not returning to initial size.
    I have seen in internals tables. Added one custom providers and images and get inside. After add the Images the tables are updates with binaries and db is growing, but after delete the Db is not returned to initial size but keep the max size of this last added.
     
    Adding
    Cms_BinaryContent added binary
    Cms_ContentThumbnails added binary
    Cms_VrsBinData added 3 binaries (why declared no versioning?)

    Deleting
    Cms_BinaryContent OK deleted
    Cms_ContentThumbnails OK deleted
    Cms_VrsBinData NOT always here growing

    My db solutions are always growing never slim. I have stopped the solutions and moved the databases to other places to see if some external win issue but nothing. The db is big and identical to original. So big!
    Where is the mistery?

    Regards
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    13 Nov 2009
    Link to this post
    Hello Pierre,

    We do not recommend using versioning for Images and Documents module due to the binary objects that are saved to the database which will cause significant growing of your database for a short period of time. This is why versioning for Libraries provider is disabled and by default there is no History view by default.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    13 Nov 2009
    Link to this post
    Hi,
    I´m not using versioning! My database is always growing. I have seen that searching in all tables to understand why my table growing adding images but not return to initial state after delete these images or complete libraries.

    Normal configuration for Libraries
    applicationName="/Libraries" allowVersioning="False" allowLocalization="False" localizationProviderName="" allowWorkflow="False"

    may bee you store one version as default? but need to fix this problem

    Regards

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    13 Nov 2009
    Link to this post
    Hello Pierre,

    There is only one version that we store in the database. After the image is deleted Cms_VrsBinData table data should decrease.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    13 Nov 2009
    Link to this post
    Hi Ivan,

    I have tested, 2 images added generating 2 x 3 binary items in this table. After deleting the items are deleted from table this time but my database is always growing . Could you make one local test adding and deleting images.
    Thanks.
    Regards


  6. Jason Green
    Jason Green avatar
    53 posts
    Registered:
    18 Sep 2009
    16 Nov 2009
    Link to this post
    Could it be a configuration issue with the database not auto-shrinking and not a problem with sitefinity?
  7. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    16 Nov 2009
    Link to this post
    Hi,

    Do you take the transaction log into an account? When you delete something from the database, it doesn't mean that it is physically deleted. SQL Server supports rollback, so the changes are saved into the transaction log. Jason is right as well.

    Sincerely yours,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    16 Nov 2009
    Link to this post
    Hi,

    Thanks I'm in this direction now. I use SMO in one UserControl to manage this issue and get my slim database but i need some help using. I have use the Default configuration of sf to get the server and databases like .

     string connString = ConfigurationManager.ConnectionStrings["Sitefinity"].ConnectionString; 
                SqlConnection sqlconnection = new SqlConnection(connString); 
                ServerConnection connection = new ServerConnection(sqlconnection); 
                Server myServer = new Server(connection); 
     
                this.Combo1Data.Items.Clear(); 
                this.Combo1Data.AutoPostBack = true
                this.Combo1Data.Items.Add(new RadComboBoxItem("Select your Database")); 
                foreach (Database dbServer in myServer.Databases) 
                { 
                    // Add database to combobox 
                    RadComboBoxItem item = new RadComboBoxItem(dbServer.Name, dbServer.Name); 
                    this.Combo1Data.Items.Add(item); 
                } 

    I have one problem passing the dbServer.Name (is my database Sitefinity.mdf with full path) to the constructor of SMO to make one Backup or shrink the Database. I pass the dbServer.Name as Selecteditem from RadComboBox in one var DatabaseName. My problem is that only works if i use full path like @"F:......MDF" but not passing my variable.
    Databasename=this.Combo1Data.SelectedItem.ToString();  <-- Full path to my Database F:....mdf.

    Backup bkpDBFull = new Backup();
    bkpDBFull.Action = BackupActionType.Database;
    bkpDBFull.Database = DatabaseName;  // @"F:\.........\ V37\PROJECT\APP_DATA\SITEFINITY.MDF";

    Exist some experiences in Sf with BackUps or Shrink using SMO?. It's possible to use solutions implementing SMO in production mode or only for dedied servers?

    Regards
  9. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    10 Dec 2009
    Link to this post
    Hi Team,

    After implementing one PhysicalStorageProvider using the solution preconized by Dido and sampled by Gabe Sumner and remplacing Content and Thumbnails by new byte[0] or Null and storing files and thumb. in disk the database is always growing. I have searched in tables and i can't get why is always biggest. I have tested using 8MB/img. What and where is the explain of this continual growing database and how to stop quickly.

    Regards Romi.

    http://www.sitefinity.com/support/forums/sitefinity-3-x/developing-with-sitefinity/physical-upload-of-files-in-images-and-documents.aspx
    using System;   
    using System.Web;   
    using System.IO;   
    using Telerik.Cms.Engine;   
    using Telerik.Cms.Engine.Data;   
      
    namespace SitefinityWatch   
    {   
        public class LibraryProvider : Telerik.Libraries.Data.DefaultProvider   
        {   
            private const string fileExtension = "dat";   
            private const string filePath = "~/Images";   
      
            private CmsContentBase SetContentBase(IContent content)   
            {   
                IContent content2 = this.GetContent(content.ID);   
                if (content2 == null)   
                {   
                    content2 = this.CreateContent(content.MimeType);   
                }   
                contentcontent2.Content = content.Content;   
                foreach (string str in this.MetaKeys.Keys)   
                {   
                    content2.SetMetaData(str, content.GetMetaData(str));   
                }   
                return (CmsContentBase)content2;   
            }   
      
            private string GetFilePath(Guid id)   
            {   
                return HttpContext.Current.Server.MapPath(filePath + "/" + id + "." + fileExtension);   
            }   
      
            public override void SaveContent(IContent content, bool fireEvents)   
            {   
                CmsContentBase contentBase = null;   
                if (content is CmsContentBase)   
                {   
                    contentBase = (CmsContentBase)content;   
                }   
                else  
                {   
                    contentBase = this.SetContentBase(content);   
                }   
      
                File.WriteAllBytes(GetFilePath(contentBase.ID), contentBase.Content as byte[]);   
                contentBase.Content = new byte[0];   
                base.SaveContent(contentBase as IContent, fireEvents);   
            }   
      
            private IContent GetContent(IContent content)   
            {   
                try  
                {   
                    if (File.Exists(GetFilePath(content.ID)) == true)   
                    {   
                        content.Content = File.ReadAllBytes(GetFilePath(content.ID));   
                    }   
                }   
                catch  
                {   
      
                }   
                return content as IContent;   
            }   
      
            public override IContent GetContent(Guid id)   
            {   
                CmsContentBase content = base.GetContent(id) as CmsContentBase;   
                return GetContent(content);   
            }   
      
            public override IContent GetContent(string url)   
            {   
                CmsContentBase content = base.GetContent(url) as CmsContentBase;   
                return GetContent(content);   
            }   
        }   
    }  //SaveThumbnail and AddThumbnails same logical

Register for webinar
9 posts, 0 answered