RBS Maintainer not cleanup files in file system (SharePoint 2010)

Sep 17, 2010 at 5:58 AM

I setup RBS according to this http://technet.microsoft.com/en-us/library/ee663474.aspx successfully. And I can see the files are storing in NTFS file system instead of database.

And then I'm configuring RBS Maintainer according to http://technet.microsoft.com/en-us/library/ff943566.aspx . But it doesn't seem working as expected. I deleted the file from SharePoint Document Library and emptied recycle bin, even in site collection recycle bin. And even I delete the whole site collection. The RBS Maintainer doesn't delete the files in file system.

I've updated the following rbs config on my content database for test:

exec mssqlrbs.rbs_sp_set_config_value 'garbage_collection_time_window', 'time 00:00:00';
exec mssqlrbs.rbs_sp_set_config_value 'delete_scan_period ', 'time 00:00:00';
exec mssqlrbs.rbs_sp_set_config_value 'orphan_scan_period', 'time 00:00:00';

Maintainer output after I deleted the file, emptied end user recycle bin and site collection recycle bin :

C:\Program Files\Microsoft SQL Remote Blob Storage 10.50\Maintainer>"C:\Program
Files\Microsoft SQL Remote Blob Storage 10.50\Maintainer\Microsoft.Data.SqlRemot
eBlobs.Maintainer.exe" -ConnectionStringName RBSMaintainerConnection -Operation
GarbageCollection ConsistencyCheck ConsistencyCheckForStores -GarbageCollectionP
hases rdo -ConsistencyCheckMode r -TimeLimit 120
Starting Maintainer tasks.
  Starting Garbage Collection.
    Starting Reference Scan.
      Reference Scan is complete for this database.
      Scanned 1 blobs. Deleted 1 blobs in the range of 0x00000000000000000
0000000(exclusive) to 0x000000000000000500000002(inclusive).
    This task has ended. Processed 1 work units total. 0 Work units were inc
omplete.
    Starting Delete Propagation.
      Starting Delete Propagation for pool <PoolId 1, BlobStoreId 1, Store
PoolId 0x01000000>.
        ..
        This pool does not have to be deleted. Reason: PoolCanStoreNewBl
obs.
      Delete Propagation complete for pool <PoolId 1, BlobStoreId 1, Store
PoolId 0x01000000>.
      1 Delete for 1 blobs attempted, 1 blobs were deleted. 0 blobs were n
ot found in the blob store. For more information, see the RBS Maintainer log.
      Delete Propagation is complete for this database.
    This task has ended. Processed 1 work units total. 0 Work units were inc
omplete. Needed to delete 1 blobs. Succeeded in deleting 1 blobs, 0 blobs were n
ot found in the blob store.
    Starting Orphan Cleanup.
      Starting Orphan Cleanup for pool <PoolId 1, BlobStoreId 1, StorePool
Id 0x01000000>.
        .
      Enumerated 0 blobs, 0 blobs are being considered for orphan cleanup.

        .
      Orphan Cleanup complete for pool <PoolId 1, BlobStoreId 1, StorePool
Id 0x01000000>.
      0 Delete for 0 blobs attempted, 0 blobs were deleted. 0 blobs were n
ot found in the blob store. For more information, see the RBS Maintainer log.
      Orphan Cleanup is complete for this database.
    This task has ended. Processed 1 work units total. 0 Work units were inc
omplete. Needed to delete 0 blobs. Succeeded in deleting 0 blobs, 0 blobs were n
ot found in the blob store. Enumerated 0 blobs, 0 blobs are being considered for
 orphan cleanup.
  This task has ended.
  Starting RBS consistency check with attempt to repair.
    The column <RbsId> in table <dbo.AllDocStreams>
     registered with RBS is invalid.
    The column <RbsId> in table <dbo.AllDocStreams>
     registered with RBS is invalid.
    The column <RbsId> in table <dbo.AllDocStreams>
     registered with RBS is invalid.
    The column <RbsId> in table <dbo.AllDocStreams>
     registered with RBS is invalid.
  Consistency check completed.
  Initializing consistency check for stores.
  Starting basic consistency check on blob store <1:FilestreamProvider_1>.
  Consistency check on blob store <FilestreamProvider_1> returned <Success>.
This task has ended.

 

The file is still in file system, not purged. And I run the maintainer again:

 

C:\Program Files\Microsoft SQL Remote Blob Storage 10.50\Maintainer>"C:\Program
Files\Microsoft SQL Remote Blob Storage 10.50\Maintainer\Microsoft.Data.SqlRemot
eBlobs.Maintainer.exe" -ConnectionStringName RBSMaintainerConnection -Operation
GarbageCollection ConsistencyCheck ConsistencyCheckForStores -GarbageCollectionP
hases rdo -ConsistencyCheckMode r -TimeLimit 120
Starting Maintainer tasks.
  Starting Garbage Collection.
    Starting Reference Scan.
      Reference Scan is complete for this database.
      Scanned 0 blobs. Deleted 0 blobs in the range of 0x(exclusive) to 0x
(inclusive).
    This task has ended. Processed 1 work units total. 0 Work units were inc
omplete.
    Starting Delete Propagation.
      Starting Delete Propagation for pool <PoolId 1, BlobStoreId 1, Store
PoolId 0x01000000>.
        .
        This pool does not have to be deleted. Reason: PoolCanStoreNewBl
obs.
      Delete Propagation complete for pool <PoolId 1, BlobStoreId 1, Store
PoolId 0x01000000>.
      0 Delete for 0 blobs attempted, 0 blobs were deleted. 0 blobs were n
ot found in the blob store. For more information, see the RBS Maintainer log.
      Delete Propagation is complete for this database.
    This task has ended. Processed 1 work units total. 0 Work units were inc
omplete. Needed to delete 0 blobs. Succeeded in deleting 0 blobs, 0 blobs were n
ot found in the blob store.
    Starting Orphan Cleanup.
      Starting Orphan Cleanup for pool <PoolId 1, BlobStoreId 1, StorePool
Id 0x01000000>.
        .
      Enumerated 0 blobs, 0 blobs are being considered for orphan cleanup.

        .
      Orphan Cleanup complete for pool <PoolId 1, BlobStoreId 1, StorePool
Id 0x01000000>.
      0 Delete for 0 blobs attempted, 0 blobs were deleted. 0 blobs were n
ot found in the blob store. For more information, see the RBS Maintainer log.
      Orphan Cleanup is complete for this database.
    This task has ended. Processed 1 work units total. 0 Work units were inc
omplete. Needed to delete 0 blobs. Succeeded in deleting 0 blobs, 0 blobs were n
ot found in the blob store. Enumerated 0 blobs, 0 blobs are being considered for
 orphan cleanup.
  This task has ended.
  Starting RBS consistency check with attempt to repair.
    The column <RbsId> in table <dbo.AllDocStreams>
     registered with RBS is invalid.
    The column <RbsId> in table <dbo.AllDocStreams>
     registered with RBS is invalid.
    The column <RbsId> in table <dbo.AllDocStreams>
     registered with RBS is invalid.
    The column <RbsId> in table <dbo.AllDocStreams>
     registered with RBS is invalid.
  Consistency check completed.
  Initializing consistency check for stores.
  Starting basic consistency check on blob store <1:FilestreamProvider_1>.
  Consistency check on blob store <FilestreamProvider_1> returned <Success>.
This task has ended.

 

It found nothing to delete, no orphan, And the file is still there.

And those "registered with RBS is invalid" messages don't look good. 

Any idea?

Thanks a lot!

 

Sep 17, 2010 at 11:01 AM

Ops. I understand now. It's actually a combination of RBS and FILESTREAM technology.

The GC of RBS maintainer just purges BLOBs in SQL Server. And FILESTREAM GC is needed to purge the files in file system.

http://www.sqlskills.com/BLOGS/PAUL/post/FILESTREAM-garbage-collection.aspx : (FILESTREAM GC)... runs as part of the database checkpoint process. This is what causes some confusion - an old FILESTREAM file will not be removed until after it is no longer needed AND a checkpoint runs. 

Yes, In Simple recovery mode, just run SQL statement:

CHECKPOINT;

In  Full recovery mode, two transaction log with CHECKPOINT are needed. Detail in the link above.

Hope it helps everyone.