public void initializeMV(MaterializedView mv) {
        logger.info("Find materialized view to setup, id:" + mv.getId() + ", schema:" + mv.getOriginalSchema() + ", name:" + mv.getName() + ", " +
                "definition: " + mv.getDefStr());
        MVContext context = initializeMVContext(mv);
        if(context == null) {
            return;
        }

        // initialized transaction.
        MVInitliazeGlobalTransaction globalTran = new MVInitliazeGlobalTransaction(mv.getId());
        GenerateMVExpressionTransaction genExprTran = new GenerateMVExpressionTransaction(this.dbCon, context);
        globalTran.join(genExprTran);
        SetupDeltaTableTransaction setupDeltaTran = new SetupDeltaTableTransaction(this.dbCon, mv.getId());
        globalTran.join(setupDeltaTran);
        TableMarkerTransaction markerTran = new TableMarkerTransaction(this.dbCon, mv.getId());
        globalTran.join(markerTran);
        // initialized done.

        globalTran.begin();
        try{
            genExprTran.generateMVExpression();
            for(BaseDeltaTable delta : context.getDeltaTableList()) {
                setupDeltaTran.setupDeltaTable(delta);
                markerTran.issueTableMarker(delta);
            }
            updateMVState(mv, MaterializedView.State.SETUP_FINISH);
            globalTran.commit();
        } catch (Exception ex) {
            globalTran.rollback();
            try {
                updateMVState(mv, MaterializedView.State.SETUP_ERROR);
            } catch (SQLException ignore) {
            }
        }
    }