Skip to content

Commit

Permalink
Merge branch 'dev-4.2.2' of code.alipay.com:oceanbase/oceanbase-devel…
Browse files Browse the repository at this point in the history
…oper-center into dev-4.2.2
  • Loading branch information
HSunboy committed Oct 27, 2023
2 parents 7e99bba + 6b92f6d commit c14d1d2
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/common/network/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ export async function updateLimiterConfig(
dataSizeLimit?: number;
},
): Promise<boolean> {
const res = await request.put(`/api/v2/schedule/${taskId}/jobs/dlm/limiterConfig`, {
const res = await request.put(`/api/v2/schedule/schedules/${taskId}/dlmRateLimitConfiguration`, {
data,
});
return !!res?.data;
Expand Down
15 changes: 10 additions & 5 deletions src/component/Task/DataArchiveTask/CreateModal/VariableConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,26 @@ const VariableConfig: React.FC<IProps> = (props) => {
<Form.Item {...restField} name={[name, 'operator']}>
<Select
placeholder={formatMessage({
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.PleaseSelect',
id:
'odc.DataArchiveTask.CreateModal.VariableConfig.PleaseSelect',
})} /*请选择*/
options={operatorOptions}
/>
</Form.Item>
<Form.Item {...restField} name={[name, 'step']}>
<InputNumber
placeholder={formatMessage({
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.PleaseEnter',
id:
'odc.DataArchiveTask.CreateModal.VariableConfig.PleaseEnter',
})}
/*请输入*/ min={1}
/>
</Form.Item>
<Form.Item {...restField} name={[name, 'unit']}>
<Select
placeholder={formatMessage({
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.PleaseSelect',
id:
'odc.DataArchiveTask.CreateModal.VariableConfig.PleaseSelect',
})} /*请选择*/
options={timeUnitOptions}
/>
Expand All @@ -169,7 +172,8 @@ const VariableConfig: React.FC<IProps> = (props) => {
<>
<Tooltip
title={formatMessage({
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.AddTimeOperation',
id:
'odc.DataArchiveTask.CreateModal.VariableConfig.AddTimeOperation',
})} /*添加时间运算*/
>
<Button type="text" disabled={disabledAdd}>
Expand All @@ -178,7 +182,8 @@ const VariableConfig: React.FC<IProps> = (props) => {
</Tooltip>
<Tooltip
title={formatMessage({
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.DeleteTimeOperation',
id:
'odc.DataArchiveTask.CreateModal.VariableConfig.DeleteTimeOperation',
})} /*删除时间运算*/
>
<Button type="text">
Expand Down
2 changes: 1 addition & 1 deletion src/component/Task/DataArchiveTask/CreateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ const CreateModal: React.FC<IProps> = (props) => {
: _tables,
deleteAfterMigration,
migrationInsertAction,
limiterConfig: {
rateLimit: {
rowLimit,
dataSizeLimit: mbToKb(dataSizeLimit),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import DisplayTable from '@/component/DisplayTable';
import { formatMessage } from '@/util/intl';
import { Tooltip } from 'antd';
import React from 'react';

const columns = [
Expand All @@ -30,6 +31,9 @@ const columns = [
title: formatMessage({ id: 'odc.DataArchiveTask.DetailContent.ArchiveRange.FilterConditions' }), //过滤条件
ellipsis: true,
width: 150,
render: (value) => {
return <Tooltip title={value}>{value ?? '-'}</Tooltip>;
},
},
];

Expand Down
9 changes: 7 additions & 2 deletions src/component/Task/DataArchiveTask/DetailContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { updateLimiterConfig } from '@/common/network/task';
import { SimpleTextItem } from '@/component/Task/component/SimpleTextItem';
import VariableConfigTable from '@/component/Task/component/VariableConfigTable';
import { isCycleTriggerStrategy } from '@/component/Task/helper';
import setting from '@/store/setting';
import type { CycleTaskDetail, IDataArchiveJobParameters, TaskOperationType } from '@/d.ts';
import { formatMessage } from '@/util/intl';
import { getFormatDateTime, kbToMb } from '@/util/utils';
Expand Down Expand Up @@ -224,14 +225,18 @@ const DataArchiveTaskContent: React.FC<IProps> = (props) => {
<Descriptions.Item label="行限流">
<ThrottleEditableCell
suffix="Rows/s"
defaultValue={jobParameters?.limiterConfig?.rowLimit}
min={0}
max={setting.maxSingleTaskRowLimit}
defaultValue={jobParameters?.rateLimit?.rowLimit}
onOk={handleRowLimit}
/>
</Descriptions.Item>
<Descriptions.Item label={'数据大小限流'}>
<ThrottleEditableCell
suffix="MB/s"
defaultValue={kbToMb(jobParameters?.limiterConfig?.dataSizeLimit)}
min={1}
max={setting.maxSingleTaskDataSizeLimit}
defaultValue={kbToMb(jobParameters?.rateLimit?.dataSizeLimit)}
onOk={handleDataSizeLimit}
/>
</Descriptions.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ const VariableConfig: React.FC<IProps> = (props) => {
<HelpDoc leftText isTip doc="dataArchiveVariablesDoc">
{
formatMessage({
id: 'odc.DataClearTask.CreateModal.VariableConfig.VariablesCanBeReferencedIn.1',
}) /*变量可在清理范围的过滤条件中引用*/
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.VariablesCanBeReferencedIn.1',
}) /*变量可在归档配置的过滤条件中引用 (可选)*/
}
</HelpDoc>
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/component/Task/DataClearTask/CreateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ const CreateModal: React.FC<IProps> = (props) => {
};
})
: _tables,
limiterConfig: {
rateLimit: {
rowLimit,
dataSizeLimit: mbToKb(dataSizeLimit),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import DisplayTable from '@/component/DisplayTable';
import { formatMessage } from '@/util/intl';
import { Tooltip } from 'antd';
import React from 'react';

const columns = [
Expand All @@ -30,6 +31,9 @@ const columns = [
title: formatMessage({ id: 'odc.DataClearTask.DetailContent.ArchiveRange.FilterConditions' }), //过滤条件
ellipsis: true,
width: 150,
render: (value) => {
return <Tooltip title={value}>{value || '-'}</Tooltip>;
},
},
];

Expand Down
9 changes: 7 additions & 2 deletions src/component/Task/DataClearTask/DetailContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { SimpleTextItem } from '@/component/Task/component/SimpleTextItem';
import VariableConfigTable from '@/component/Task/component/VariableConfigTable';
import { isCycleTriggerStrategy } from '@/component/Task/helper';
import { updateLimiterConfig } from '@/common/network/task';
import setting from '@/store/setting';
import type { CycleTaskDetail, IDataArchiveJobParameters, TaskOperationType } from '@/d.ts';
import { formatMessage } from '@/util/intl';
import { getFormatDateTime, kbToMb } from '@/util/utils';
Expand Down Expand Up @@ -156,14 +157,18 @@ const DataClearTaskContent: React.FC<IProps> = (props) => {
<Descriptions.Item label="行限流">
<ThrottleEditableCell
suffix="Rows/s"
defaultValue={jobParameters?.limiterConfig?.rowLimit}
min={0}
max={setting.maxSingleTaskRowLimit}
defaultValue={jobParameters?.rateLimit?.rowLimit}
onOk={handleRowLimit}
/>
</Descriptions.Item>
<Descriptions.Item label={'数据大小限流'}>
<ThrottleEditableCell
suffix="MB/s"
defaultValue={kbToMb(jobParameters?.limiterConfig?.dataSizeLimit)}
min={1}
max={setting.maxSingleTaskDataSizeLimit}
defaultValue={kbToMb(jobParameters?.rateLimit?.dataSizeLimit)}
onOk={handleDataSizeLimit}
/>
</Descriptions.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { getExportObjects } from '@/common/network';
import ExportCard from '@/component/ExportCard';
import { DbObjectType } from '@/d.ts';
import { DbObjectType, ConnectionMode } from '@/d.ts';
import { formatMessage } from '@/util/intl';
import Icon, { DeleteOutlined } from '@ant-design/icons';
import { Empty, Popconfirm, Spin, Tree } from 'antd';
Expand All @@ -35,6 +35,7 @@ interface IProps {
connectionId: number;
onlyTable?: boolean;
value?: any[];
dialectType: ConnectionMode;
onChange?: (newValue: any[]) => void;
}

Expand All @@ -47,6 +48,7 @@ const ExportSelecter: React.FC<IProps> = function ({
connectionId,
onlyTable,
value,
dialectType,
onChange,
}) {
const [objsLoading, setObjsLoading] = useState(false);
Expand Down Expand Up @@ -94,20 +96,23 @@ const ExportSelecter: React.FC<IProps> = function ({
}, [value]);

function getObjTypeList() {
return onlyTable
const typeList = onlyTable
? [DbObjectType.table]
: [
DbObjectType.table,
DbObjectType.view,
DbObjectType.function,
DbObjectType.procedure,
DbObjectType.sequence,
DbObjectType.package,
DbObjectType.trigger,
DbObjectType.synonym,
DbObjectType.public_synonym,
DbObjectType.type,
];
if (!onlyTable && dialectType !== ConnectionMode.MYSQL) {
typeList.push(DbObjectType.sequence);
}
return typeList;
}

const loadExportObjects = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const ObjSelecterPanel: React.FC<IProps> = function ({ form, projectId, onConnec
onlyTable={exportContent === EXPORT_CONTENT.DATA}
databaseId={databaseId}
connectionId={connectionId}
dialectType={connection?.dialectType}
/>
</FormItem>
</>
Expand Down
8 changes: 5 additions & 3 deletions src/component/Task/component/ThrottleEditableCell/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ import Action from '@/component/Action';
interface IProps {
defaultValue: number | string;
suffix: React.ReactNode;
min: number;
max: number;
onOk: (value: number, onClose: () => void) => void;
}

const ThrottleEditableCell: React.FC<IProps> = (props) => {
const { defaultValue = 10, suffix, onOk } = props;
const { defaultValue = 10, min, max, suffix, onOk } = props;
const [isLmitRowEdit, setIsLmitRowEdit] = useState(false);
const [lmitValue, setLmitValue] = useState(Number(defaultValue));
const [value, setValue] = useState(Number(defaultValue));
Expand Down Expand Up @@ -56,8 +58,8 @@ const ThrottleEditableCell: React.FC<IProps> = (props) => {
<Space>
<InputNumber
status={status}
min={1}
max={1000}
min={min}
max={max}
value={lmitValue}
onChange={handleChange}
/>
Expand Down
5 changes: 3 additions & 2 deletions src/component/Task/component/ThrottleFormItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import { Form, InputNumber, Space } from 'antd';
import React from 'react';
import HelpDoc from '@/component/helpDoc';
import setting from '@/store/setting';

interface IProps {}

Expand Down Expand Up @@ -44,7 +45,7 @@ const ThrottleFormItem: React.FC<IProps> = (props) => {
},
]}
>
<InputNumber min={0} precision={1} />
<InputNumber min={0} precision={1} max={setting.maxSingleTaskRowLimit} />
</Form.Item>
<span>Rows/s</span>
</Space>
Expand All @@ -69,7 +70,7 @@ const ThrottleFormItem: React.FC<IProps> = (props) => {
},
]}
>
<InputNumber min={0} precision={1} />
<InputNumber min={1} max={setting.maxSingleTaskDataSizeLimit} precision={1} />
</Form.Item>
<span>MB/s</span>
</Space>
Expand Down
8 changes: 4 additions & 4 deletions src/component/helpDoc/doc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import { formatMessage } from '@/util/intl';
import { FormattedMessage } from '@umijs/max';

const dataArchiveFilterDoc = formatMessage({ id: 'odc.component.helpDoc.doc.YouCanUseSqlWhere' });
const dataArchiveFilterDoc =
"可使用常量或引用上文中定义的变量来配置过滤条件。样例1:gmt_create <= '2023-01-01' ,样例2:gmt_create <= '${bizdate}',其中 bizdate 为变量配置中的变量名,gmt_create 为归档表中的字段。";

const dataArchiveVariablesDoc = '定义变量、设置时间偏移量并在下文的过滤条件中引用';

const dataArchiveVariablesDoc = formatMessage({
id: 'odc.component.helpDoc.doc.FilterConditionsSuchAsGmt',
}); //`过滤条件,如 gmt_create <= \${bizdate}`
export default {
sysTransfer: () => (
<p>
Expand Down
4 changes: 2 additions & 2 deletions src/d.ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ export interface IDataArchiveJobParameters {
targetDatabaseName?: string;
targetDataSourceName?: string;
migrationInsertAction?: MigrationInsertAction;
limiterConfig?: {
rateLimit?: {
rowLimit?: number;
dataSizeLimit?: number;
};
Expand All @@ -2198,7 +2198,7 @@ export interface IDataClearJobParameters {
sourceDatabaseName?: string;
targetDataBaseId: number;
targetDatabaseName?: string;
limiterConfig?: {
rateLimit?: {
rowLimit?: number;
dataSizeLimit?: number;
};
Expand Down
2 changes: 1 addition & 1 deletion src/layout/SpaceContainer/Sider/MineItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const MineItem: React.FC<IProps> = function ({
}),
);
}
setChangePasswordLoading(true);
setChangePasswordLoading(false);
};

const handleLogout = async () => {
Expand Down
16 changes: 16 additions & 0 deletions src/store/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ export class SettingStore {
@observable
public maxResultSetRows: number = Number.MAX_SAFE_INTEGER;

/**
* 工单(数据归档 & 数据清理)行限流最大值
*/
@observable
public maxSingleTaskRowLimit: number = Number.MAX_SAFE_INTEGER;

/**
* 工单(数据归档 & 数据清理)数据限流最大值
*/
@observable
public maxSingleTaskDataSizeLimit: number = Number.MAX_SAFE_INTEGER;

/**
* 独立session最大数量
*/
Expand Down Expand Up @@ -238,6 +250,10 @@ export class SettingStore {
this.enableOSC = res?.['odc.features.task.osc.individual.space.enabled'] === 'true';
}
this.isUploadCloudStore = res?.['odc.file.interaction-mode'] === 'CLOUD_STORAGE';
this.maxSingleTaskRowLimit =
parseInt(res?.['odc.task.dlm.max-single-task-row-limit']) || Number.MAX_SAFE_INTEGER;
this.maxSingleTaskDataSizeLimit =
parseInt(res?.['odc.task.dlm.max-single-task-data-size-limit']) || Number.MAX_SAFE_INTEGER;
}

@action
Expand Down

0 comments on commit c14d1d2

Please sign in to comment.