Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Garbage Collection Expand / Collapse
Author
Message
Posted Thursday, September 05, 2013 7:24 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 7:08 AM
Points: 1,726, Visits: 1,253
Thomas Abraham (9/5/2013)
raulggonzalez (9/5/2013)
Thanks for the question, but it would have been useful if it was specified that is a SQL Server 2012 environment as in previous versions this didn't exist.



+1 as I don't use 2012, I responded based on what I knew from 2008. I could have looked up "sp_filestream_force_garbage_collection ", but as another poster said, that just seemed like a made up procedure name. At least I learned something.

Thanks Steve for the question.

+ 1 I definitely learned something today.




Yeah, uh huh, you know what it is. Everything I do, I do it big

Post #1491781
Posted Thursday, September 05, 2013 8:19 AM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Friday, April 04, 2014 6:01 PM
Points: 642, Visits: 376
Note that sp_filestream_force_garbage_collection is only available with SQL Server 2012. In previous editions there is not way to force garbage collection
Post #1491813
Posted Thursday, September 05, 2013 11:11 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 1:37 PM
Points: 20,483, Visits: 14,133
Thomas Abraham (9/5/2013)
raulggonzalez (9/5/2013)
Thanks for the question, but it would have been useful if it was specified that is a SQL Server 2012 environment as in previous versions this didn't exist.



+1 as I don't use 2012, I responded based on what I knew from 2008. I could have looked up "sp_filestream_force_garbage_collection ", but as another poster said, that just seemed like a made up procedure name. At least I learned something.

Thanks Steve for the question.


Looks like that may have been fixed. When I answered the question, 2012 was specified.

Glad to see that this has been added in 2012 to force GC




Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1491889
Posted Thursday, September 05, 2013 11:26 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 10:28 AM
Points: 8,295, Visits: 8,746
This question is somewhat confused and the answer is wrong.

It says the files "not be removed immediately" and asks how to force this garbage collection to occur. The word "this" means something, and the only thing "this garbage collection" can be using as a referent for "this" is removing the files. As the garbage collector will do nothing with the files unless both the current checkpoint LSN and the last backup LSN are both beyond the LSN of the delete operation, and the files will only be removed when the garbage collector has processed them twice, causing the garbage collector to run will do nothing at all unless there has been both a checkpoint and a log backup since the delete operation, and even if this forced run occurs when the backup and checkpoint LSNs are both high enough it will not remove the files if it is the first such run, just mark their tombstones so that the next GC run will remove them.

So the correct answer is that there is nothing you can do (short of issuing a checkpoint , starting a log backup and waiting for it to complete, and then calling the SP twice to force two GC runs) to cause "this garbage collection" (which in context, because of the use of "this", can only mean removal of the files) to occur.

This is fairly clear from the BoL page referenced in the explanation. The result set returned by the SP tells you how many files were marked for collection and how many were not processed at all. Why should either of these numbers be non-zero? Because when the garbage collector runs, it may not remove the files (it won't if it has not marked for collection during a previous run), and it may not even mark them for collection (it won't if the checkpoint and backup LSNs are not both later than the LSN of the delete operation).


Tom
Post #1491892
Posted Thursday, September 05, 2013 10:58 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 1:06 AM
Points: 1,577, Visits: 694
Good question -

Hope this helps...

Ford Fairlane
Rock and Roll Detective





Post #1492035
Posted Friday, September 06, 2013 9:22 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 3:32 AM
Points: 524, Visits: 771
SQLRNNR (9/5/2013)
Thomas Abraham (9/5/2013)
raulggonzalez (9/5/2013)
Thanks for the question, but it would have been useful if it was specified that is a SQL Server 2012 environment as in previous versions this didn't exist.



+1 as I don't use 2012, I responded based on what I knew from 2008. I could have looked up "sp_filestream_force_garbage_collection ", but as another poster said, that just seemed like a made up procedure name. At least I learned something.

Thanks Steve for the question.


Looks like that may have been fixed. When I answered the question, 2012 was specified.

Glad to see that this has been added in 2012 to force GC



Oh that's so cheeky... I want my points back
Post #1492298
Posted Saturday, September 07, 2013 5:38 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, September 09, 2013 7:57 AM
Points: 267, Visits: 93
nice question
Post #1492505
Posted Wednesday, September 11, 2013 1:35 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 6:04 AM
Points: 3,517, Visits: 2,606
Not worked on SQL 2012 yet. So this question made me dig for the informaiton and I'm glad to get it correct and earn some knowledge as well.
Post #1493479
Posted Wednesday, September 11, 2013 9:45 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 11:28 AM
Points: 32,818, Visits: 14,963
L' Eomot Inversé (9/5/2013)
This question is somewhat confused and the answer is wrong.

It says the files "not be removed immediately" and asks how to force this garbage collection to occur. The word "this" means something, and the only thing "this garbage collection" can be using as a referent for "this" is removing the files. As the garbage collector will do nothing with the files unless both the current checkpoint LSN and the last backup LSN are both beyond the LSN of the delete operation, and the files will only be removed when the garbage collector has processed them twice, causing the garbage collector to run will do nothing at all unless there has been both a checkpoint and a log backup since the delete operation, and even if this forced run occurs when the backup and checkpoint LSNs are both high enough it will not remove the files if it is the first such run, just mark their tombstones so that the next GC run will remove them.



I disagree, Tom, and think you're being a little pedantic here. The question asked how can you force the garbage collection to run, not force it to delete files. The way SQL Server operates is not compromised by your forcing the GC process to run, which is what the questions asks.

I have awarded back points because the original question did not mention SQL Server 2012.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1493771
Posted Wednesday, September 11, 2013 3:36 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 10:28 AM
Points: 8,295, Visits: 8,746
Steve Jones - SSC Editor (9/11/2013)
L' Eomot Inversé (9/5/2013)
This question is somewhat confused and the answer is wrong.

It says the files "not be removed immediately" and asks how to force this garbage collection to occur. The word "this" means something, and the only thing "this garbage collection" can be using as a referent for "this" is removing the files. As the garbage collector will do nothing with the files unless both the current checkpoint LSN and the last backup LSN are both beyond the LSN of the delete operation, and the files will only be removed when the garbage collector has processed them twice, causing the garbage collector to run will do nothing at all unless there has been both a checkpoint and a log backup since the delete operation, and even if this forced run occurs when the backup and checkpoint LSNs are both high enough it will not remove the files if it is the first such run, just mark their tombstones so that the next GC run will remove them.



I disagree, Tom, and think you're being a little pedantic here. The question asked how can you force the garbage collection to run, not force it to delete files. The way SQL Server operates is not compromised by your forcing the GC process to run, which is what the questions asks.

I have awarded back points because the original question did not mention SQL Server 2012.

So you think the word "this" in your question is meaningless, has no referent? Surely "this garbage collection" is the stuff you have just mentioned, not something you have not mentioned; that's what that little word "this" means, isn't it?

It would be a good idea to alter the wording a bit so that it has to be understood your way - make it say "how can you force the garbage collector run right away" instead of saying "how can you force this garbage collection to occur right away"; no need to award points back for a change like that, the important thing is to eliminate as far as possible the risk of people it reading it the way I read it (which I believe is the way most people would read it) and taking away the wrong lesson.


Tom
Post #1493928
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse