RavenDB, RavenHQ and Appharbor - document size error with very first document

342 views Asked by At

I have a completely empty RavenHQ database that's linked to my Appharbor application. The amount of space the database is currently using is 1.1mb out of an available 25mb for my bronze account. The database previously had records in it, but I have deleted them using "delete collection" in the management studio.

The very first time I call session.Store(myobject), and BEFORE I call .SaveChanges(), I get the following error.

System.InvalidOperationException: Url: "/docs/Raven/Hilo/AccItems"

Raven.Database.Exceptions.OperationVetoedException: PUT vetoed by Raven.Bundles.Quotas.Triggers.DatabaseSizeQoutaForDocumetsPutTrigger because: Database size is 45,347 KB, which is over the allowed quota of 25,600 KB. No more documents are allowed in.

Now, the document is definitely not that big, so I don't know what this error can mean, especially as I don't think I've even hit the database at that point since I haven't closed the session by calling SaveChanges(). Any ideas? Here's the code itself.

    XDocument doc = XDocument.Parse(rawXml);
    var accItems = ExtractItemsFromFeed(doc);
    using (IDocumentSession session = _store.OpenSession())
    {
        var dbItems = session.Query<AccItem>().ToList();
        foreach (var item in accItems)
        {
            var existingRecord = dbItems.SingleOrDefault(x => x.Source == x.SourceId == cottage.SourceId);
            if (existingRecord == null)
            {
                session.Store(item);
                _logger.Info("Saved new item {0}.", item.ShortName);
            }
            else
            {
                existingRecord.ShortName = item.ShortName;
                _logger.Info("Updated item {0}.", item.ShortName);
            }
            session.SaveChanges();
        }
    }            

Any other comments about the style of this code would be most welcome, as I was unsure of the best way to approach the "update existing item or create if it isn't there" scenario.

1

There are 1 answers

1
centralscru On BEST ANSWER

The answer here was as follows.

RavenHQ support found that the database was indeed oversized, but it seemed that the size reported in the Appharbor-branded RavenHQ control panel was incorrect. I had filled up the database way over the limit with a previous faulty version of the code posted above, so the error message I received was actually correct.

Fixing this problem without paying to upgrade the database wasn't straightforward, as it's not possible to shrink the database. As I also wasn't able to delete my single Appharbor/RavenHQ database or create another one that left me with the choice of creating an entirely new Appharbor application, or registering directly with RavenHQ for a new account. I chose the latter. The RavenHQ-branded control panel is slightly different to the Appharbor one, in that it has the ability to create and delete databases.

So to summarize: there doesn't seem to be any benefit to using RavenHQ as an add-on to Appharbor - you might as well go and get a proper free RavenHQ account.