SharePoint error: Unable to read full interval from database in ULS Logs

We have just implemented Remote Blob Storage using Stepwise and had a .Migrate() crash with the following error:

Exception calling “Migrate” with “0” argument(s): “A new blob could not be created Pool <GUID> ”

Over 20,000 documents had already been migrated, and general Remote Blob Storage entries were successful. Further examination of ULS log files showed the following:

Unable to read full interval from database

Background file fill operation caught exception: System.InvalidOperationException: Operation is not valid due to the current state of the object.     at Microsoft.SharePoint.CoordinatedStreamBuffer.SPBackgroundSqlFileFiller.OnReadComplete(IAsyncResult result)

The file fill it is referring to is document chunking that occurs from SQL when it is extracting data from the AllDocStreams table and trying to push this into Remote Blob Storage.

It turned out that we had a mismatch in the AllDocVersions table to the AllDocStreams table in relation to the number of bytes stored. For example, AllDocVersions said “size = 10,020 kb” but the actual binary content stored in AllDocStreams was “10,003 kb”. The Remote Blob Storage components were expecting 10,020, but only received 10,003.

I fixed this error by *gasp* very carefully modifying the  AllDocVersions entry for “Size” to match the AllDocStreams entry. You MUST BE VERY CAUTIOUS WHEN DOING THIS! In our case there were three documents out of 50,000 that had this issue, and that was also stopping content export from working as well (I assume for the same reason – mismatched size).

After running .Migrate() again, everything worked perfectly and the migration completed.

In this case I could have delete the file from SharePoint as well as from the two-stage recycle bin, but that would have meant potentially losing the versions for the files as well as the problem file. I chose this more dangerous path instead. I don’t know how the mismatch occurred in the first place but will keep an eye on it using this script to identity mismatched documents:

, docstreams.InternalVersion  
, LEN(docstreams.content) as StreamLength  
, docversions.size 
from dbo.AllDocStreams docstreams 
 inner join dbo.AllDocVersions docversions  
on docstreams.Id=docversions.Id  
and docstreams.InternalVersion=docversions.InternalVersion  
where docstreams.RbsId is null  
and LEN(docstreams.content) <> docversions.Size

2 Responses to “SharePoint error: Unable to read full interval from database in ULS Logs”

  1. Leif Hansen Says:

    We are experiencing practically the same problem as you. Care to share the SQL statement you used to update the database?

    • gavinmckay Says:

      Hi Leif,

      I was very cautious with this, so I actually ended up using Management Studio and updating directly in the record editor. That way I could update each document individually, test the results for each one, and continue on that way. Not the best method, but I wanted to make sure I could fix it very slowly! 🙂



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: