Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference Level MigrationStep Logic #12630

Closed
iJIAJIA opened this issue Jun 30, 2023 · 3 comments
Closed

Reference Level MigrationStep Logic #12630

iJIAJIA opened this issue Jun 30, 2023 · 3 comments
Labels
type/discussion Everything related with code discussion or question

Comments

@iJIAJIA
Copy link

iJIAJIA commented Jun 30, 2023

官方文档来看, 是支持Reference级别的MigrationStep配置的.
image

但MigrationRule会缓存首次从ConsumerURL里解析出来的migration.step. 第二个ConsumerURL进来时, 支持取的上次的解析结果. 这块有点疑惑, 是逻辑BUG 还是设计如此.

public MigrationStep getStep(URL consumerURL) {
        MigrationStep value = getValue(consumerURL, SubMigrationRule::getStep);
        if (value != null) {
            return value;
        }

        /**
         * FIXME, it's really hard to follow setting default values here.
         */
        if (step == null) {
            // initial step : APPLICATION_FIRST
            step = MigrationStep.APPLICATION_FIRST;
           // 这里会缓存上次解析结果
            step = Enum.valueOf(MigrationStep.class,
                consumerURL.getParameter(MIGRATION_STEP_KEY, getDefaultStep(consumerURL, step.name())));
        }

        return step;
    }
@iJIAJIA iJIAJIA added the type/discussion Everything related with code discussion or question label Jun 30, 2023
@AlbumenJ
Copy link
Member

AlbumenJ commented Jul 3, 2023

下面这块是为了设置一个默认值呀

@iJIAJIA
Copy link
Author

iJIAJIA commented Jul 5, 2023

step = Enum.valueOf(MigrationStep.class,
consumerURL.getParameter(MIGRATION_STEP_KEY, getDefaultStep(consumerURL, step.name())));
看逻辑这里才会去ReferenceConfig里获取migration.step这个参数值, 缓存之后下一个ReferenceConfig里获取的就是上个ReferenceConfig里的值了. 目前这边有个场景是部分Reference需要声明FORCE_APPLICATION, 不使用默认的APPLICATION_FIRST.

@AlbumenJ
Copy link
Member

Fix in #13237

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/discussion Everything related with code discussion or question
Projects
Archived in project
Development

No branches or pull requests

2 participants