Buggy code:
@ ProcInfo ( singlePartition = false ) public class SnapshotRestore extends VoltSystemProcedure { private static final Logger LOG = Logger . getLogger ( SnapshotRestore . class ) ; private static final int DEP_restoreScan = ( ( int ) ( SysProcFragmentId . PF_restoreScan ) ) | ( HStoreConstants . MULTIPARTITION_DEPENDENCY ) ; private static final int DEP_restoreScanResults = ( ( int ) ( SysProcFragmentId . PF_restoreScanResults ) ) ; public static final int DEP_restoreDistributePartitionedTable = ( ( int ) ( SysProcFragmentId . PF_restoreDistributePartitionedTable ) ) | ( HStoreConstants . MULTIPARTITION_DEPENDENCY ) ; public static final int DEP_restoreDistributePartitionedTableResults = ( ( int ) ( SysProcFragmentId . PF_restoreDistributePartitionedTable ) ) ; private static HashSet < String > m_initializedTableSaveFiles = new HashSet < String > ( ) ; private static ArrayDeque < TableSaveFile > m_saveFiles = new ArrayDeque < TableSaveFile > ( ) ; private static synchronized void initializeTableSaveFiles ( String filePath , String fileNonce , String tableName , int [ ] originalHostIds , int [ ] relevantPartitionIds , SystemProcedureExecutionContext context ) throws IOException { } private static synchronized boolean hasMoreChunks ( ) throws IOException { } private static synchronized BBContainer getNextChunk ( ) throws IOException { } @ Override public void initImpl ( ) { } @ Override public DependencySet executePlanFragment ( Long txn_id , Map < Integer , List < VoltTable > > dependencies , int fragmentId , ParameterSet params , final SystemProcedureExecutionContext context ) { } public VoltTable [ ] run ( String path , String nonce , long allowExport ) throws VoltAbortException { } private final File [ ] retrieveRelevantFiles ( String filePath , final String fileNonce ) { } private VoltTable constructResultsTable ( ) { } private File getSaveFileForReplicatedTable ( String tableName ) { } private static File getSaveFileForPartitionedTable ( String filePath , String fileNonce , String tableName , int originalHostId , int siteId , int partitionId ) { } private static TableSaveFile getTableSaveFile ( File saveFile , int readAheadChunks , int [ ] relevantPartitionIds ) throws IOException { } private final VoltTable [ ] performRestoreScanWork ( String filePath , String fileNonce ) { } private Set < Table > getTablesToRestore ( Set < String > savedTableNames ) { } private VoltTable [ ] performTableRestoreWork ( ClusterSaveFileState savefileState ) throws VoltAbortException { Set < Table > tables_to_restore = getTablesToRestore ( savefileState . getSavedTableNames ( ) ) ; VoltTable [ ] restore_results = new VoltTable [ 1 ] ; restore_results [ 0 ] = constructResultsTable ( ) ; ArrayList < SynthesizedPlanFragment [ ] > restorePlans = new ArrayList < SynthesizedPlanFragment [ ] > ( ) ; for ( Table t : tables_to_restore ) { TableSaveFileState table_state = savefileState . getTableState ( t . getTypeName ( ) ) ; SynthesizedPlanFragment [ ] restore_plan = table_state . generateRestorePlan ( t ) ; if ( restore_plan == null ) { SnapshotRestore . LOG . error ( ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>generate<seq2seq4repair_space>restore<seq2seq4repair_space>plan<seq2seq4repair_space>for<seq2seq4repair_space>" + ( t . getTypeName ( ) ) ) + "<seq2seq4repair_space>table<seq2seq4repair_space>not<seq2seq4repair_space>restored" ) ) ; throw new VoltAbortException ( ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>generate<seq2seq4repair_space>restore<seq2seq4repair_space>plan<seq2seq4repair_space>for<seq2seq4repair_space>" + ( t . getTypeName ( ) ) ) + "<seq2seq4repair_space>table<seq2seq4repair_space>not<seq2seq4repair_space>restored" ) ) ; } restorePlans . add ( restore_plan ) ; } SnapshotRestore . LOG . trace ( this . executor . getPartitionId ( ) ) ; Iterator < Table > tableIterator = tables_to_restore . iterator ( ) ; for ( SynthesizedPlanFragment [ ] restore_plan : restorePlans ) { Table table = tableIterator . next ( ) ; TableSaveFileState table_state = savefileState . getTableState ( table . getTypeName ( ) ) ; SnapshotRestore . LOG . trace ( ( "Performing<seq2seq4repair_space>restore<seq2seq4repair_space>for<seq2seq4repair_space>table:<seq2seq4repair_space>" + ( table . getTypeName ( ) ) ) ) ; SnapshotRestore . LOG . trace ( ( "Plan<seq2seq4repair_space>has<seq2seq4repair_space>restore<seq2seq4repair_space>plan:<seq2seq4repair_space>" + restore_plan ) ) ; VoltTable [ ] results = executeSysProcPlanFragments ( restore_plan , table_state . getRootDependencyId ( ) ) ; while ( results [ 0 ] . advanceRow ( ) ) { <START_BUG> restore_results [ 0 ] . add ( results [ 330 ] ) ; <END_BUG> } } return restore_results ; } private VoltTable performDistributeReplicatedTable ( String tableName , int siteId , SystemProcedureExecutionContext context , int allowExport ) { } private VoltTable performLoadPartitionedTable ( String tableName , int [ ] originalHostIds , int [ ] relevantPartitionIds , SystemProcedureExecutionContext context , int allowExport , AbstractTransaction ts ) { } private VoltTable performDistributePartitionedTable ( String tableName , int [ ] originalHostIds , int [ ] relevantPartitionIds , SystemProcedureExecutionContext context , int allowExport ) { } private VoltTable [ ] createPartitionedTables ( String tableName , VoltTable loadedTable ) { } private Table getCatalogTable ( String tableName ) { } private int m_siteId ; private int m_hostId ; private static volatile String m_filePath ; private static volatile String m_fileNonce ; }

Fix:
restore_results [ 0 ] . add ( results [ 0 ] ) ;