You can view the minor compaction details from system tables.
Based on the timestamps, triggering conditions, and number of minor compactions, you can learn of the memory usage of the cluster and thereby resize the tenant memory and configure the number of minor compactions to cope with your business needs.
The following are example statements for viewing minor compactions:
View details about the latest 10 minor compactions as the system tenant from the perspective of RootService.
obclient> SELECT * FROM __all_rootservice_event_history WHERE event LIKE '%minor%' ORDER BY gmt_create LIMIT 10;View the minor compactions on a specific OBServer as the system tenant.
obclient> SELECT * FROM __all_server_event_history WHERE svr_ip='xx.xx.xx.xx' AND module IN ('freeze', 'minor_merge') ORDER BY gmt_create DESC LIMIT 10;Check, as the system tenant, whether the active MemStore of a tenant is released after the minor compaction and check the value of
freeze_cnt.obclient> SELECT * FROM __all_virtual_tenant_memstore_info;The following table describes the fields in the returned results in the preceding examples.
Field Description tenant_id The ID of the tenant. svr_ip The IP address of the server on which the tenant is located. svr_port The RPC port. active_memstore_used The size of the active memstore of the tenant on a server. total_memstore_used The total size of the memstore used by the tenant on a server. major_freeze_trigger The usage threshold of the active memstore that triggers a minor compaction or a major compaction. memstore_limit The maximum size of the memstore available to the tenant on a server. freeze_cnt The number of times that minor compactions are triggered because the active memstore reaches the specified usage.
Note:
The
__all_rootservice_event_historytable retains data in the last seven days. The__all_server_event_historytable retains data in the last two days.A minor compaction needs to be performed before each major compaction. Therefore, a minor compaction is performed at the duty time (2:00 AM by default) of a major compaction every day.
The
major_freeze_triggerparameter in the__all_virtual_tenant_memstore_infotable indicates the threshold for triggering a minor compaction and a major compaction.If the value of
minor_freeze_timesis0, a major compaction is triggered whenactive_memstore_usedreaches the specified threshold.If the value of
minor_freeze_timesis not0, whenactive_memstore_usedreaches the specified threshold, whether a minor compaction or a major compaction is triggered depends on the number of minor compactions performed since the last major compaction.freeze_cntin__all_virtual_tenant_memstore_infocorresponds to the value of theminor_freeze_timesparameter.When
freeze_cntreaches the value ofminor_freeze_times, a major compaction, rather than a minor compaction, will be triggered when the memory usage of the tenant reaches the specified threshold next time.freeze_cntdoes not increase when a manually triggered minor compaction is performed. Each time a major compaction is performed,freeze_cntis reset to zero.