Project

General

Profile

Feature #8556

Updated by Tom Clegg about 8 years ago

h2. Implementation 

 # Trash &rarr; set @<ExpiresAt>123</ExpiresAt>@ *and* create a marker (just an empty blob) named @trash/000000000123/hash@ 
 # Untrash &rarr; unset @ExpiresAt@ *and* delete trash/000000000123/hash 
 # EmptyTrash &rarr; index @trash/*@ in order. For each trash marker with @deadline <= now@: 
 #* Look up the modtime and ExpiresAt for the data block itself. 
 #* If the data is _still_ old and ExpiresAt is _still_ set, delete the data block (otherwise do nothing). 
 #* Delete the trash marker (regardless of whether the data block was deleted). 
 # Get, Mtime, Touch, IndexTo &rarr; check @ExpiresAt@ metadata. If present, return/skip as if the block was not found at all. 

 h2. Tests / Acceptance Criteria 

 Ensure {Put; Trash; Put} results in ExpiresAt being cleared. This might happen by itself, or we might need to use SetBlobMetadata to clear the metadata explicitly after writing each block. (The test for this _should_ already be in place, in the generic volume test: {Put; Backdate; Trash; Put; Backdate; empty trash}.) 

 Ensure the Azure server stub behaves the same as the real Azure server wrt any feature we're relying on for this. E.g., it's not enough to know that our _stub_ clears the metadata when overwriting a block. We need to know that the real Azure service is documented to behave that way, _and_ actually does behave that way (e.g., via manual testing with real Azure containers). 

 h2. Acceptance Criteria 

 * All existing tests in volume_generic_test must pass, even when "Trash with trashLifetime>0" pass 
 ** Put, Get, Trash, Get err, Put, Get sequence (which we specifically want to test for Azure) is implemented. already covered in this test. So, we just need to verify that it passes, than adding an additional test. 

 In the first set of testTrashEmptyTrashUntrash, with trashLifetime>0, after the "Get() returns notfound", check: * Add new test in volume_generic_test: 
 * ** put block and get -> ok 
 ** With trashLifetime > 0:  
 *** 	 trash -> ok 
 *** 	 get -> err  
 *** 	 Mtime → notfound -> err  
 *** 	 Touch -> err 
 * *** 	 Compare → notfound -> err 
 * *** 	 IndexTo -> does not include the trashed block 
 * Touch → notfound 

 In the first set of testTrashEmptyTrashUntrash, with trashLifetime>0, after the "Get() returns data after Untrash()", check: ***  
 *** 	 untrash -> ok 
 * *** 	 get -> ok 
 *** 	 Mtime  -> ok 
 * *** 	 Touch -> ok 
 *** 	 Compare  -> ok 
 * *** 	 IndexTo -> includes the block 
 * Touch → ** With trashLifetime = 0:    (Block is deleted in this case and can’t be untrashed anymore. We do not actually have test/s that check all methods on a trashed block) 
 *** 	 trash -> ok 

 In testDeleteOldBlock(), after checking v.Get(TestHash), check: 
 * *** 	 get -> err  
 *** 	 Mtime → notfound -> err  
 *** 	 Touch -> err 
 * *** 	 Compare → notfound -> err 
 * *** 	 IndexTo -> does not include the trashed block 
 

 * Touch → notfound Any specific verifications to be done for “Ensure the Azure server stub behaves the same as the real Azure server wrt any feature we're relying on for this”? How? 

 h2. Future work (defer) 

 When doing a full index (prefix=""), build two trash lists: a list of blocks whose metadata indicates that they are trash, and a list of trash markers. After sending the index response and closing the connection, delete any trash markers whose block metadata indicates that they are not trash. 

Back