Skip to content

Commit

Permalink
feat(diagnostics): render bloom filter better
Browse files Browse the repository at this point in the history
  • Loading branch information
kunga authored and artemmufazalov committed Aug 16, 2024
1 parent c10bee7 commit da528ba
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
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

0 comments on commit da528ba

Please sign in to comment.