|
36 | 36 | import com.google.common.collect.Maps;
|
37 | 37 | import com.google.common.collect.Sets;
|
38 | 38 | import org.apache.commons.lang3.StringUtils;
|
| 39 | +import org.apache.logging.log4j.LogManager; |
| 40 | +import org.apache.logging.log4j.Logger; |
39 | 41 |
|
40 | 42 | import java.io.DataInput;
|
41 | 43 | import java.io.DataOutput;
|
|
50 | 52 | /*
|
51 | 53 | * UserProperty contains properties set for a user
|
52 | 54 | * This user is just qualified by cluster name, not host which it connected from.
|
| 55 | + * |
| 56 | + * If UserProperty and SessionVeriable have the same name, UserProperty has a higher priority than SessionVeriable. |
| 57 | + * This usually means that the cluster administrator force user restrictions. |
| 58 | + * Users cannot modify these SessionVeriables with the same name. |
53 | 59 | */
|
54 | 60 | public class UserProperty implements Writable {
|
| 61 | + private static final Logger LOG = LogManager.getLogger(UserProperty.class); |
55 | 62 | // advanced properties
|
56 | 63 | private static final String PROP_MAX_USER_CONNECTIONS = "max_user_connections";
|
57 | 64 | private static final String PROP_MAX_QUERY_INSTANCES = "max_query_instances";
|
@@ -172,6 +179,10 @@ public long getExecMemLimit() {
|
172 | 179 | }
|
173 | 180 |
|
174 | 181 | public void update(List<Pair<String, String>> properties) throws UserException {
|
| 182 | + update(properties, false); |
| 183 | + } |
| 184 | + |
| 185 | + public void update(List<Pair<String, String>> properties, boolean isReplay) throws UserException { |
175 | 186 | // copy
|
176 | 187 | long newMaxConn = this.commonProperties.getMaxConn();
|
177 | 188 | long newMaxQueryInstances = this.commonProperties.getMaxQueryInstances();
|
@@ -311,7 +322,14 @@ public void update(List<Pair<String, String>> properties) throws UserException {
|
311 | 322 | }
|
312 | 323 | workloadGroup = value;
|
313 | 324 | } else {
|
314 |
| - throw new DdlException("Unknown user property(" + key + ")"); |
| 325 | + if (isReplay) { |
| 326 | + // After using SET PROPERTY to modify the user property, if FE rolls back to a version without |
| 327 | + // this property, `Unknown user property` error will be reported when replay EditLog, |
| 328 | + // just ignore it. |
| 329 | + LOG.warn("Unknown user property(" + key + "), maybe FE rolled back version, Ignore it"); |
| 330 | + } else { |
| 331 | + throw new DdlException("Unknown user property(" + key + ")"); |
| 332 | + } |
315 | 333 | }
|
316 | 334 | }
|
317 | 335 |
|
|
0 commit comments