Class AddUpdateTableIterator


  • public final class AddUpdateTableIterator
    extends Object
    This class is designed to update iterator settings for iterators set on a table.

    This class also has an executable main method that can be used to either re-add or update the aggregator iterators that is set on a table. It should be run on an accumulo cluster. The main method takes 4 arguments: a graphId, a comma separated list of paths to schemas, a path to a store properties file and the type of operation to perform on the table iterators - add, update or remove.

    The add option will set new iterators on the table given in the store properties file (For example if the iterator was removed in the accumulo shell) The update option will update the existing aggregator iterator with options for the store and data schemas provided previously to the main method. The remove option allows an iterator to be removed.

    This is useful if you wish to change your schema or upgrade to a newer version of Gaffer. See the Accumulo Store README for more information on what changes to your schema you are allowed to make.

    • Method Detail

      • updateIterator

        public static void updateIterator​(AccumuloStore store,
                                          String iteratorName)
                                   throws StoreException
        This method takes a store and the name of an iterator to be updated. The store's configured IteratorSettingFactory factory will be used to create the new iterator in the removed one's place
        Parameters:
        store - the accumulo store
        iteratorName - the name of the iterator update
        Throws:
        StoreException - if any issues occur when updating the iterator
      • updateIterator

        public static void updateIterator​(AccumuloStore store,
                                          String iteratorName,
                                          org.apache.accumulo.core.client.IteratorSetting iteratorSetting)
                                   throws StoreException
        This method takes a store and the name of an iterator to be removed. The provided IteratorSetting will be used to create an iterator in the removed ones place.
        Parameters:
        store - the accumulo store
        iteratorName - the name of the iterator update
        iteratorSetting - the iterator setting to add
        Throws:
        StoreException - if any issues occur when removing the given iterator name
      • removeIterator

        public static void removeIterator​(AccumuloStore store,
                                          String iteratorName)
                                   throws StoreException
        This method takes a store and the name of an iterator to be removed.
        Parameters:
        store - the accumulo store
        iteratorName - the name of the iterator update
        Throws:
        StoreException - if any issues occur when updating the iterator
      • addIterator

        public static void addIterator​(AccumuloStore store,
                                       String iteratorName)
                                throws StoreException
        This should be used if a gaffer version upgrade causes the aggregator iterator to be removed from a table
        Parameters:
        store - the accumulo store
        iteratorName - the iterator name
        Throws:
        StoreException - if any issues occur adding an aggregator iterator
      • addIterator

        public static void addIterator​(AccumuloStore store,
                                       org.apache.accumulo.core.client.IteratorSetting iteratorSetting)
                                throws StoreException
        This method can be used to attach an iterator to the table in use by the store instance.
        Parameters:
        store - the accumulo store
        iteratorSetting - the iterator setting to add.
        Throws:
        StoreException - if any issues occur adding an iterator setting
      • main

        public static void main​(String[] args)
                         throws Exception
        Utility for creating and updating an Accumulo table. Accumulo tables are automatically created when the Gaffer Accumulo store is initialised when an instance of Graph is created.

        Running this with an existing table will remove the existing iterators and recreate them with the provided schema.

        A FileGraphLibrary path must be specified as an argument. If no path is set NoGraphLibrary will be used.

        Usage: java -cp accumulo-store-[version]-utility.jar uk.gov.gchq.gaffer.accumulostore.utils.AddUpdateTableIterator [graphId] [pathToSchemaDirectory] [pathToStoreProperties] [pathToFileGraphLibrary]

        Parameters:
        args - [graphId] [schema directory path] [store properties path] [ file graph library path]
        Throws:
        Exception - if the tables fails to be created/updated