Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | 8x 8x 8x 8x 8x 8x 8x 1x 1x 8x 1x 1x 1x 8x 2x 2x 2x 8x | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Button, Classes, Dialog, Intent } from '@blueprintjs/core';
import React from 'react';
import { AutoForm, ExternalLink } from '../../components';
import { DRUID_DOCS_VERSION } from '../../variables';
import './compaction-dialog.scss';
export interface CompactionDialogProps {
onClose: () => void;
onSave: (config: Record<string, any>) => void;
onDelete: () => void;
datasource: string;
compactionConfig?: Record<string, any>;
}
export interface CompactionDialogState {
currentConfig?: Record<string, any>;
}
export class CompactionDialog extends React.PureComponent<
CompactionDialogProps,
CompactionDialogState
> {
static DEFAULT_MAX_ROWS_PER_SEGMENT = 5000000;
constructor(props: CompactionDialogProps) {
super(props);
this.state = {};
}
componentDidMount(): void {
const { datasource, compactionConfig } = this.props;
this.setState({
currentConfig: compactionConfig || {
dataSource: datasource,
},
});
}
private handleSubmit = () => {
const { onSave } = this.props;
const { currentConfig } = this.state;
if (!currentConfig) return;
onSave(currentConfig);
};
render(): JSX.Element {
const { onClose, onDelete, datasource, compactionConfig } = this.props;
const { currentConfig } = this.state;
return (
<Dialog
className="compaction-dialog"
isOpen
onClose={onClose}
canOutsideClickClose={false}
title={`Compaction config: ${datasource}`}
>
<AutoForm
fields={[
{
name: 'inputSegmentSizeBytes',
type: 'number',
defaultValue: 419430400,
info: (
<p>
Maximum number of total segment bytes processed per compaction task. Since a time
chunk must be processed in its entirety, if the segments for a particular time
chunk have a total size in bytes greater than this parameter, compaction will not
run for that time chunk. Because each compaction task runs with a single thread,
setting this value too far above 1–2GB will result in compaction tasks taking an
excessive amount of time.
</p>
),
},
{
name: 'skipOffsetFromLatest',
type: 'string',
defaultValue: 'P1D',
info: (
<p>
The offset for searching segments to be compacted. Strongly recommended to set for
realtime dataSources.
</p>
),
},
{
name: 'maxRowsPerSegment',
type: 'number',
defaultValue: CompactionDialog.DEFAULT_MAX_ROWS_PER_SEGMENT,
info: (
<p>
The target segment size, for each segment, after compaction. The actual sizes of
compacted segments might be slightly larger or smaller than this value. Each
compaction task may generate more than one output segment, and it will try to keep
each output segment close to this configured size.
</p>
),
},
{
name: 'taskContext',
type: 'json',
info: (
<p>
<ExternalLink
href={`https://druid.apache.org/docs/${DRUID_DOCS_VERSION}/ingestion/tasks.html#task-context`}
>
Task context
</ExternalLink>{' '}
for compaction tasks.
</p>
),
},
{
name: 'taskPriority',
type: 'number',
defaultValue: 25,
info: <p>Priority of the compaction task.</p>,
},
{
name: 'tuningConfig',
type: 'json',
info: (
<p>
<ExternalLink
href={`https://druid.apache.org/docs/${DRUID_DOCS_VERSION}/configuration/index.html#compact-task-tuningconfig`}
>
Tuning config
</ExternalLink>{' '}
for compaction tasks.
</p>
),
},
]}
model={currentConfig}
onChange={m => this.setState({ currentConfig: m })}
/>
<div className={Classes.DIALOG_FOOTER}>
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
<Button
text="Delete"
intent={Intent.DANGER}
onClick={onDelete}
disabled={!compactionConfig}
/>
<Button text="Close" onClick={onClose} />
<Button
text="Submit"
intent={Intent.PRIMARY}
onClick={this.handleSubmit}
disabled={!currentConfig}
/>
</div>
</div>
</Dialog>
);
}
}
|