Skip to content

Commit

Permalink
fix:
Browse files Browse the repository at this point in the history
1.add system config 'odc.task.dlm.session.limit.ratio', implement dynamic change of the sessionLimitRatio value.
2.The value of sessionLimitRatio is assigned in when the task is executed
  • Loading branch information
kiko-art committed Jan 3, 2025
1 parent e48fe7b commit 65bc3d5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/odc-server/src/main/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -859,4 +859,8 @@ INSERT INTO config_system_configuration(`key`, `value`, `description`) VALUES('o
INSERT INTO `config_system_configuration` (`key`, `value`, `application`, `profile`, `label`, `description`)
VALUES ('odc.session.kill-query-or-session.max-supported-ob-version', '4.2.5', 'odc', 'default', 'master',
'Max OBVersion kill session or kill query supported, only take effect when value greater than 0')
ON DUPLICATE KEY UPDATE `id`=`id`;
ON DUPLICATE KEY UPDATE `id`=`id`;

INSERT INTO config_system_configuration ( `key`, `value`, `description` ) VALUES('odc.task.dlm.session.limit.ratio', '25',
'The ratio of oracle/mysql active sessions to the maximum number of connections allowed' )
ON DUPLICATE KEY UPDATE `id` = `id`;
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public class DLMConfiguration {
@Value("${odc.task.dlm.default-scan-batch-size:10000}")
private int defaultScanBatchSize;

@Value("${odc.task.dlm.session.limit.ratio:25}")
private int sessionLimitRatio;

@Bean
public DLMJobFactory dlmJobFactory(IJobStore jobStore) {
return new DLMJobFactory(jobStore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.oceanbase.odc.service.connection.database.DatabaseService;
import com.oceanbase.odc.service.connection.database.model.Database;
import com.oceanbase.odc.service.connection.model.ConnectionConfig;
import com.oceanbase.odc.service.dlm.DLMConfiguration;
import com.oceanbase.odc.service.dlm.DataSourceInfoMapper;
import com.oceanbase.odc.service.dlm.DlmLimiterService;
import com.oceanbase.odc.service.quartz.util.ScheduleTaskUtils;
Expand Down Expand Up @@ -65,6 +66,8 @@ public abstract class AbstractDlmJob implements OdcJob {

public final TaskFrameworkService taskFrameworkService;

public final DLMConfiguration dlmConfiguration;


public AbstractDlmJob() {
scheduleTaskRepository = SpringContextUtil.getBean(ScheduleTaskRepository.class);
Expand All @@ -76,13 +79,15 @@ public AbstractDlmJob() {
if (taskFrameworkProperties.isEnabled()) {
jobScheduler = SpringContextUtil.getBean(JobScheduler.class);
}
dlmConfiguration = SpringContextUtil.getBean(DLMConfiguration.class);
}

public DataSourceInfo getDataSourceInfo(Long databaseId) {
Database db = databaseService.detail(databaseId);
ConnectionConfig config = databaseService.findDataSourceForTaskById(databaseId);
DataSourceInfo dataSourceInfo = DataSourceInfoMapper.toDataSourceInfo(config, db.getName());
dataSourceInfo.setDatabaseName(db.getName());
dataSourceInfo.setSessionLimitRatio(dlmConfiguration.getSessionLimitRatio());
return dataSourceInfo;
}

Expand Down

0 comments on commit 65bc3d5

Please sign in to comment.