com.bigdata.bfs
Class FileVersionDeleter

java.lang.Object
  extended by cutthecrap.utils.striterators.FilterBase
      extended by com.bigdata.btree.filter.TupleFilter<E>
          extended by com.bigdata.btree.filter.TupleUpdater<TPS.TPV>
              extended by com.bigdata.bfs.FileVersionDeleter
All Implemented Interfaces:
ITupleFilter<TPS.TPV>, IFilter, IPropertySet, Serializable, Cloneable

public class FileVersionDeleter
extends TupleUpdater<TPS.TPV>

A procedure that performs a key range scan, marking all non-deleted versions within the key range as deleted (by storing a null property value for the FileMetadataSchema.VERSION).

Version:
$Id: FileVersionDeleter.java 4548 2011-05-25 19:36:34Z thompsonbry $
Author:
Bryan Thompson
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bigdata.btree.filter.TupleUpdater
TupleUpdater.Updaterator
 
Nested classes/interfaces inherited from class com.bigdata.btree.filter.TupleFilter
TupleFilter.TupleFilterator<E>
 
Constructor Summary
FileVersionDeleter(long timestamp)
           
 
Method Summary
protected  boolean isValid(ITuple<TPS.TPV> tuple)
          Only visits the FileMetadataSchema.VERSION columns.
protected  void update(IIndex ndx, ITuple<TPS.TPV> tuple)
          Appends a new tuple into the index whose key uses the choosenTimestamp and whose value is an encoded null.
 
Methods inherited from class com.bigdata.btree.filter.TupleUpdater
filterOnce
 
Methods inherited from class cutthecrap.utils.striterators.FilterBase
addFilter, filter, getProperty, getRequiredProperty, setProperty, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cutthecrap.utils.striterators.IFilter
filter
 
Methods inherited from interface cutthecrap.utils.striterators.IPropertySet
getProperty
 

Constructor Detail

FileVersionDeleter

public FileVersionDeleter(long timestamp)
Parameters:
timestamp - A valid timestamp or IRowStoreConstants.AUTO_TIMESTAMP or IRowStoreConstants.AUTO_TIMESTAMP_UNIQUE.
Method Detail

isValid

protected boolean isValid(ITuple<TPS.TPV> tuple)
Only visits the FileMetadataSchema.VERSION columns.

Specified by:
isValid in class TupleFilter<TPS.TPV>

update

protected void update(IIndex ndx,
                      ITuple<TPS.TPV> tuple)
Appends a new tuple into the index whose key uses the choosenTimestamp and whose value is an encoded null. This is interepreted as a "deleted" file version tuple.

Note: The old tuple is not removed so you can continue to access the historical version explicitly.

Specified by:
update in class TupleUpdater<TPS.TPV>
Parameters:
ndx - The index on which the ITupleCursor is reading.
tuple - The tuple that is being visited.
TODO:
unit tests to verify that old versions are left behind on overflow (per the appropriate policy)., unit test to verify continued access to the historical version. FIXME Unit test to verify that the iterator correctly visits all file versions in the range. In particular, we will be seeing each file version tuple in the key range. There may be more than one of these, right? Therefore we need to use the Advancer pattern to skip beyond the last possible such tuple (which will in fact be the one that we write on here!).

One way to approach this is a logical row scan with a column name filter that only visits the "version" column and an TupleUpdater and writes a new tuple per the code below. We just need to make sure that we either do not then visit the new tuple or that we ignore a "version" row whose value is [null].



Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.