Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(diagnostics): render bloom filter better #1165

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Text} from '@gravity-ui/uikit';
import omit from 'lodash/omit';

import {toFormattedSize} from '../../../../../components/FormattedBytes/utils';
import type {InfoViewerItem} from '../../../../../components/InfoViewer';
import {formatObject} from '../../../../../components/InfoViewer';
import {
Expand All @@ -17,8 +18,10 @@ import type {
TTTLSettings,
} from '../../../../../types/api/schema';
import {EPathType} from '../../../../../types/api/schema';
import {valueIsDefined} from '../../../../../utils';
import {formatBytes, formatNumber} from '../../../../../utils/dataFormatters/dataFormatters';
import {formatDurationToShortTimeFormat} from '../../../../../utils/timeParsers';
import {isNumeric} from '../../../../../utils/utils';

import i18n from './i18n';

Expand Down Expand Up @@ -126,10 +129,12 @@ const prepareTableGeneralInfo = (PartitionConfig: TPartitionConfig, TTLSettings?
}
}

generalTableInfo.push({
label: i18n('label.bloom-filter'),
value: EnableFilterByKey ? i18n('enabled') : i18n('disabled'),
});
if (valueIsDefined(EnableFilterByKey)) {
generalTableInfo.push({
label: i18n('label.bloom-filter'),
value: EnableFilterByKey ? i18n('enabled') : i18n('disabled'),
});
}

return generalTableInfo;
};
Expand All @@ -154,6 +159,7 @@ export const prepareTableInfo = (data?: TEvDescribeSchemeResult, type?: EPathTyp
RowCount,
DataSize,
IndexSize,
ByKeyFilterSize,

LastAccessTime,
LastUpdateTime,
Expand Down Expand Up @@ -187,13 +193,22 @@ export const prepareTableInfo = (data?: TEvDescribeSchemeResult, type?: EPathTyp
}
}

const generalStats = formatObject(formatTableStatsItem, {
PartCount,
RowCount,
DataSize,
IndexSize,
});

if (
isNumeric(ByKeyFilterSize) &&
(PartitionConfig.EnableFilterByKey || Number(ByKeyFilterSize) > 0)
) {
generalStats.push({label: 'BloomFilterSize', value: toFormattedSize(ByKeyFilterSize)});
}

const tableStatsInfo = [
formatObject(formatTableStatsItem, {
PartCount,
RowCount,
DataSize,
IndexSize,
}),
generalStats,
formatObject(formatTableStatsItem, {
LastAccessTime,
LastUpdateTime,
Expand Down
11 changes: 6 additions & 5 deletions src/containers/Tenant/utils/queryTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ WITH (
AUTO_PARTITIONING_PARTITION_SIZE_MB = 2048,
AUTO_PARTITIONING_BY_LOAD = ENABLED,
AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 4,
AUTO_PARTITIONING_MAX_PARTITIONS_COUNT = 1024,
AUTO_PARTITIONING_MAX_PARTITIONS_COUNT = 1024
-- uncomment to create a table with predefined partitions
-- UNIFORM_PARTITIONS = 4, -- The number of partitions for uniform initial table partitioning.
-- , UNIFORM_PARTITIONS = 4 -- The number of partitions for uniform initial table partitioning.
-- The primary key's first column must have type Uint64 or Uint32.
-- A created table is immediately divided into the specified number of partitions
-- uncomment to launch read only replicas in every AZ
-- READ_REPLICAS_SETTINGS = 'PER_AZ:1', -- Enable read replicas for stale read, launch one replica in every availability zone
-- , READ_REPLICAS_SETTINGS = 'PER_AZ:1' -- Enable read replicas for stale read, launch one replica in every availability zone
-- uncomment to enable ttl
-- TTL = Interval("PT1H") ON expire_at, -- Enable background deletion of expired rows https://ydb.tech/en/docs/concepts/ttl
KEY_BLOOM_FILTER = ENABLED -- With a Bloom filter, you can more efficiently determine
-- , TTL = Interval("PT1H") ON expire_at -- Enable background deletion of expired rows https://ydb.tech/en/docs/concepts/ttl
-- uncomment to create a table with a bloom filter
-- , KEY_BLOOM_FILTER = ENABLED -- With a Bloom filter, you can more efficiently determine
-- if some keys are missing in a table when making multiple single queries by the primary key.
)`;
};
Expand Down
2 changes: 2 additions & 0 deletions src/types/api/schema/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ export interface TTableStats {
/** uint64 */
IndexSize?: string;
/** uint64 */
ByKeyFilterSize?: string;
/** uint64 */
InMemSize?: string;

/**
Expand Down
Loading