Source:
<code>public static void SYSCS_RESTORE_DATABASE_ASYNC(String directory, long backupId, boolean validate, ResultSet[] resultSets) throws StandardException, SQLException { IteratorNoPutResultSet inprs = null; Connection conn = SpliceAdmin.getDefaultConn(); LanguageConnectionContext lcc = conn.unwrap(EmbedConnection.class).getLanguageConnection(); try { BackupManager backupManager = EngineDriver.driver().manager().getBackupManager(); long runningBackupId = 0; if ( backupManager.getRunningBackups().length != 0) { <START> throw StandardException.newException(SQLState.NO_RESTORE_DURING_BACKUP, runningBackupId); <END> } backupManager.restoreDatabase(directory,backupId, false, validate); ResultColumnDescriptor[] rcds = { new GenericColumnDescriptor("Status", DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, 200)) }; ExecRow template = new ValueRow(1); template.setRowArray(new DataValueDescriptor[]{new SQLVarchar()}); List<ExecRow> rows = Lists.newArrayList(); String message = String.format("Launched restore job for backup %d from %s", backupId, directory); template.getColumn(1).setValue(message); rows.add(template.getClone()); inprs = new IteratorNoPutResultSet(rows,rcds,lcc.getLastActivation()); inprs.openCore(); LOG.info(message); } catch (Throwable t) { ResultColumnDescriptor[] rcds = { new GenericColumnDescriptor("Error", DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, t.getMessage().length()))}; ExecRow template = new ValueRow(1); template.setRowArray(new DataValueDescriptor[]{new SQLVarchar()}); List<ExecRow> rows = Lists.newArrayList(); template.getColumn(1).setValue(t.getMessage()); rows.add(template.getClone()); inprs = new IteratorNoPutResultSet(rows,rcds,lcc.getLastActivation()); inprs.openCore(); SpliceLogUtils.error(LOG, "Error recovering backup", t); } finally { resultSets[0] = new EmbedResultSet40(conn.unwrap(EmbedConnection.class),inprs,false,null,true); } }</code><technical_language>runningBackupId is set, 0, is this intended behavior</technical_language>

Target:
public static void SYSCS_RESTORE_DATABASE_ASYNC(String directory, long backupId, boolean validate, ResultSet[] resultSets) throws StandardException, SQLException { IteratorNoPutResultSet inprs = null; Connection conn = SpliceAdmin.getDefaultConn(); LanguageConnectionContext lcc = conn.unwrap(EmbedConnection.class).getLanguageConnection(); try { BackupManager backupManager = EngineDriver.driver().manager().getBackupManager(); BackupJobStatus[] backupJobStatuses = backupManager.getRunningBackups(); if ( backupJobStatuses.length > 0) { long runningBackupId = backupJobStatuses[0].getBackupId(); throw StandardException.newException(SQLState.NO_RESTORE_DURING_BACKUP, runningBackupId); } backupManager.restoreDatabase(directory,backupId, false, validate); ResultColumnDescriptor[] rcds = { new GenericColumnDescriptor("Status", DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, 200)) }; ExecRow template = new ValueRow(1); template.setRowArray(new DataValueDescriptor[]{new SQLVarchar()}); List<ExecRow> rows = Lists.newArrayList(); String message = String.format("Launched restore job for backup %d from %s", backupId, directory); template.getColumn(1).setValue(message); rows.add(template.getClone()); inprs = new IteratorNoPutResultSet(rows,rcds,lcc.getLastActivation()); inprs.openCore(); LOG.info(message); } catch (Throwable t) { ResultColumnDescriptor[] rcds = { new GenericColumnDescriptor("Error", DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.VARCHAR, t.getMessage().length()))}; ExecRow template = new ValueRow(1); template.setRowArray(new DataValueDescriptor[]{new SQLVarchar()}); List<ExecRow> rows = Lists.newArrayList(); template.getColumn(1).setValue(t.getMessage()); rows.add(template.getClone()); inprs = new IteratorNoPutResultSet(rows,rcds,lcc.getLastActivation()); inprs.openCore(); SpliceLogUtils.error(LOG, "Error recovering backup", t); } finally { resultSets[0] = new EmbedResultSet40(conn.unwrap(EmbedConnection.class),inprs,false,null,true); } }