public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
    meta = (SynchronizeAfterMergeMeta) smi;
    data = (SynchronizeAfterMergeData) sdi;

    if ( super.init( smi, sdi ) ) {
      meta.normalizeAllocationFields();
      data.realSchemaName = environmentSubstitute( meta.getSchemaName() );
      if ( meta.istablenameInField() ) {
        if ( Utils.isEmpty( meta.gettablenameField() ) ) {
          logError( BaseMessages.getString( PKG, "SynchronizeAfterMerge.Log.Error.TableFieldnameEmpty" ) );
          return false;
        }
      }
      data.databaseMeta = meta.getDatabaseMeta();

      // if we are using Oracle then set releaseSavepoint to false
      if ( data.databaseMeta.getDatabaseInterface() instanceof OracleDatabaseMeta ) {
        data.releaseSavepoint = false;
      }
      data.commitSize = Integer.parseInt( environmentSubstitute( meta.getCommitSize() ) );
      data.batchMode = data.commitSize > 0 && meta.useBatchUpdate();

      // Batch updates are not supported on PostgreSQL (and look-a-likes) together with error handling (PDI-366)
      data.specialErrorHandling =
        getStepMeta().isDoingErrorHandling() && meta.getDatabaseMeta().supportsErrorHandlingOnBatchUpdates();

      data.supportsSavepoints = meta.getDatabaseMeta().getDatabaseInterface().useSafePoints();

      if ( data.batchMode && data.specialErrorHandling ) {
        data.batchMode = false;
        if ( log.isBasic() ) {
          logBasic( BaseMessages.getString( PKG, "SynchronizeAfterMerge.Log.BatchModeDisabled" ) );
        }
      }
      data.db.setCommitSize( data.commitSize );

      return true;
    }
    return false;
  }
@Test
  public void initWithCommitSizeVariable() throws KettleDatabaseException {
    StepMeta stepMeta = mock( StepMeta.class );
    doReturn( STEP_NAME ).when( stepMeta ).getName();
    doReturn( 1 ).when( stepMeta ).getCopies();

    SynchronizeAfterMergeMeta smi = mock( SynchronizeAfterMergeMeta.class );
    SynchronizeAfterMergeData sdi = mock( SynchronizeAfterMergeData.class );

    DatabaseMeta dbMeta = mock( DatabaseMeta.class );
    doReturn( mock( MySQLDatabaseMeta.class ) ).when( dbMeta ).getDatabaseInterface();

    doReturn( dbMeta ).when( smi ).getDatabaseMeta();
    doReturn( "${commit.size}" ).when( smi ).getCommitSize();

    TransMeta transMeta = mock( TransMeta.class );
    doReturn( "1" ).when( transMeta ).getVariable( Const.INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER );
    doReturn( "2" ).when( transMeta ).getVariable( Const.INTERNAL_VARIABLE_CLUSTER_SIZE );
    doReturn( "Y" ).when( transMeta ).getVariable( Const.INTERNAL_VARIABLE_CLUSTER_MASTER );
    doReturn( stepMeta ).when( transMeta ).findStep( STEP_NAME );

    SynchronizeAfterMerge step = mock( SynchronizeAfterMerge.class );
    doCallRealMethod().when( step ).setTransMeta( any( TransMeta.class ) );
    doCallRealMethod().when( step ).setStepMeta( any( StepMeta.class ) );
    doCallRealMethod().when( step ).init( any( StepMetaInterface.class ), any( StepDataInterface.class ) );
    doCallRealMethod().when( step ).connectToDatabaseOrInitDataSource(  any(), any()  );
    doReturn( stepMeta ).when( step ).getStepMeta();
    doReturn( transMeta ).when( step ).getTransMeta();
    doReturn( "1" ).when( step ).getStepExecutionId();
    doReturn( "120" ).when( step ).environmentSubstitute( "${commit.size}" );

    step.setTransMeta( transMeta );
    step.setStepMeta( stepMeta );
    step.init( smi, sdi );

    assertEquals( 120, sdi.commitSize );
  }