This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 468dfc97db [fix](meta) set broadcast_right_table_scale_factor when 
upgrading from 1.2 to 2.x (#23423)
468dfc97db is described below

commit 468dfc97dbf54b31f14ba2978276a268158b1b1a
Author: xzj7019 <[email protected]>
AuthorDate: Fri Aug 25 21:26:19 2023 +0800

    [fix](meta) set broadcast_right_table_scale_factor when upgrading from 1.2 
to 2.x (#23423)
    
    When upgrading from 1.2 to 2.x(future version higher than 2.0), the default 
value of parameter broadcast_right_table_scale_factor may not be upgraded from 
old default value 10.0 to new default 0.0, which will cause the broadcast join 
behavior unexpected and may have a big performance impact. This pr will force 
to reset the value to new default value 0.0, to make sure the behavior correct.
---
 .../src/main/java/org/apache/doris/catalog/Env.java  |  7 +++++++
 .../main/java/org/apache/doris/qe/VariableMgr.java   | 20 ++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index f25386a83b..1adc464d70 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -1381,6 +1381,13 @@ public class Env {
                 VariableMgr.setGlobalPipelineTask(newVal);
                 LOG.info("upgrade FE from 1.x to 2.0, set 
parallel_pipeline_task_num "
                         + "to parallel_fragment_exec_instance_num: {}", 
newVal);
+
+                // similar reason as above, need to upgrade broadcast scale 
factor during 1.2 to 2.x
+                // if the default value has been upgraded
+                double newBcFactorVal = 
VariableMgr.newSessionVariable().getBroadcastRightTableScaleFactor();
+                VariableMgr.setGlobalBroadcastScaleFactor(newBcFactorVal);
+                LOG.info("upgrade FE from 1.x to 2.x, set 
broadcast_right_table_scale_factor "
+                        + "to new default value: {}", newBcFactorVal);
             }
         }
 
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
index 53caa3ec39..1d1edbb213 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
@@ -392,6 +392,26 @@ public class VariableMgr {
         }
     }
 
+    public static void setGlobalBroadcastScaleFactor(double factor) {
+        wlock.lock();
+        try {
+            VarContext ctx = 
ctxByVarName.get(SessionVariable.BROADCAST_RIGHT_TABLE_SCALE_FACTOR);
+            try {
+                setValue(ctx.getObj(), ctx.getField(), String.valueOf(factor));
+            } catch (DdlException e) {
+                LOG.warn("failed to set global variable: {}", 
SessionVariable.BROADCAST_RIGHT_TABLE_SCALE_FACTOR, e);
+                return;
+            }
+
+            // write edit log
+            GlobalVarPersistInfo info = new 
GlobalVarPersistInfo(defaultSessionVariable,
+                    
Lists.newArrayList(SessionVariable.BROADCAST_RIGHT_TABLE_SCALE_FACTOR));
+            Env.getCurrentEnv().getEditLog().logGlobalVariableV2(info);
+        } finally {
+            wlock.unlock();
+        }
+    }
+
     public static void setLowerCaseTableNames(int mode) throws DdlException {
         VarContext ctx = 
ctxByVarName.get(GlobalVariable.LOWER_CASE_TABLE_NAMES);
         setGlobalVarAndWriteEditLog(ctx, 
GlobalVariable.LOWER_CASE_TABLE_NAMES, "" + mode);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to