已合并
fix:去掉水线淘汰写ssd逻辑 #481
dajiang创建于 8月12日
fix:去掉水线淘汰写ssd逻辑 #481
已合并
共 39 个文件变更+294-606
| @@ -1 +1 @@ | |||
| 1 | -Subproject commit 734b293103ec670a963ff41d76b506445015de88 | 1 | +Subproject commit 9a832dee6a6ac95a95e6e5aabc117362c1cdd898 |
| @@ -130,14 +130,14 @@ if (BUILD_GIT_COMMIT STREQUAL "ON") | |||
| 130 | if (${GIT_COMMIT_RESULT} EQUAL 1) | 130 | if (${GIT_COMMIT_RESULT} EQUAL 1) |
| 131 | set(GIT_LAST_COMMIT "empty") | 131 | set(GIT_LAST_COMMIT "empty") |
| 132 | endif () | 132 | endif () |
| 133 | - add_definitions(-DGIT_LAST_COMMIT=${GIT_LAST_COMMIT}) | 133 | + set(MMC_GIT_COMMIT_HASH "${GIT_LAST_COMMIT}" CACHE INTERNAL "memcache git commit hash") |
| 134 | message(STATUS "add definition for last commit: ${GIT_LAST_COMMIT}") | 134 | message(STATUS "add definition for last commit: ${GIT_LAST_COMMIT}") |
| 135 | else () | 135 | else () |
| 136 | - add_definitions(-DGIT_LAST_COMMIT=empty) | 136 | + set(MMC_GIT_COMMIT_HASH "empty" CACHE INTERNAL "memcache git commit hash") |
| 137 | message(STATUS "Failed to find git command, not GIT_LAST_COMMIT will be set") | 137 | message(STATUS "Failed to find git command, not GIT_LAST_COMMIT will be set") |
| 138 | endif () | 138 | endif () |
| 139 | else () | 139 | else () |
| 140 | - add_definitions(-DGIT_LAST_COMMIT=empty) | 140 | + set(MMC_GIT_COMMIT_HASH "empty" CACHE INTERNAL "memcache git commit hash") |
| 141 | message(STATUS "add definition for last commit: empty") | 141 | message(STATUS "add definition for last commit: empty") |
| 142 | endif () | 142 | endif () |
| 143 | 143 | ||
| @@ -8,7 +8,6 @@ | |||
| 8 | | ock.mmc.meta_service.config_store_url | string | optional | tcp://127.0.0.1:6000 | tcp://\<host>\<port> | host supports ip and domain, port in [1025, 65535] | | 8 | | ock.mmc.meta_service.config_store_url | string | optional | tcp://127.0.0.1:6000 | tcp://\<host>\<port> | host supports ip and domain, port in [1025, 65535] | |
| 9 | | ock.mmc.meta_service.metrics_url | string | optional | http://127.0.0.1:8000 | \<protocol>://\<host>:\<port>| protocol is http or https, host supports ip and domain, port in [1025, 65535] | | 9 | | ock.mmc.meta_service.metrics_url | string | optional | http://127.0.0.1:8000 | \<protocol>://\<host>:\<port>| protocol is http or https, host supports ip and domain, port in [1025, 65535] | |
| 10 | | ock.mmc.meta.ha.enable | bool | optional | false | true/false | enable meta service master/backup HA in k8s cluster | | 10 | | ock.mmc.meta.ha.enable | bool | optional | false | true/false | enable meta service master/backup HA in k8s cluster | |
| 11 | -| ock.mmc.meta.backup.enable | bool | optional | false | true/false | enable meta service backup | | ||
| 12 | | ock.mmc.meta_service.metrics_report_interval_seconds | integer | optional | 30 | [0, 86400] | metrics summary printing interval in seconds, 0 disables periodic metrics printing | | 11 | | ock.mmc.meta_service.metrics_report_interval_seconds | integer | optional | 30 | [0, 86400] | metrics summary printing interval in seconds, 0 disables periodic metrics printing | |
| 13 | | ock.mmc.meta.lease_ttl_ms | integer | optional | 10000 | [1, 2147483647] | default read lease TTL in milliseconds used when meta service grants read leases; MetaService-only, dynamically reloadable when `ock.mmc.dynamic_config.enable` is true | | 12 | | ock.mmc.meta.lease_ttl_ms | integer | optional | 10000 | [1, 2147483647] | default read lease TTL in milliseconds used when meta service grants read leases; MetaService-only, dynamically reloadable when `ock.mmc.dynamic_config.enable` is true | |
| 14 | | ock.mmc.log_level | string | optional | info | debug/info/warn/error | log level; shared by MetaService and LocalService, dynamically reloadable when `ock.mmc.dynamic_config.enable` is true | | 13 | | ock.mmc.log_level | string | optional | info | debug/info/warn/error | log level; shared by MetaService and LocalService, dynamically reloadable when `ock.mmc.dynamic_config.enable` is true | |
| @@ -23,7 +22,6 @@ | |||
| 23 | | ock.mmc.evict_yield_interval | int | optional | 0 | [0, 100000] | number of evicted objects between yields in GC loop, 0 disables yield (backward compatible) | | 22 | | ock.mmc.evict_yield_interval | int | optional | 0 | [0, 100000] | number of evicted objects between yields in GC loop, 0 disables yield (backward compatible) | |
| 24 | | ock.mmc.evict_yield_duration_us | int | optional | 100 | [0, 10000] | sleep duration in microseconds during each yield, extends the lock-free window to allow blocked requests to acquire the lock | | 23 | | ock.mmc.evict_yield_duration_us | int | optional | 100 | [0, 10000] | sleep duration in microseconds during each yield, extends the lock-free window to allow blocked requests to acquire the lock | |
| 25 | | ock.mmc.evict_check_interval_seconds | integer | optional | 5 | [0, 86400] | periodic eviction usage check interval in seconds; 0 disables periodic checks while request-triggered checks remain active; in HA mode, only the elected leader/Master runs periodic checks, while standby and unknown-role nodes do not | | 24 | | ock.mmc.evict_check_interval_seconds | integer | optional | 5 | [0, 86400] | periodic eviction usage check interval in seconds; 0 disables periodic checks while request-triggered checks remain active; in HA mode, only the elected leader/Master runs periodic checks, while standby and unknown-role nodes do not | |
| 26 | -| ock.mmc.rewarm.dram_watermark | int | optional | 95 | [0, 100] | rewarm DRAM watermark percentage, rewarm is triggered when DRAM usage exceeds this threshold | | ||
| 27 | | ock.mmc.storage.prefetch.enabled | bool | optional | false | true/false | enable SSD to DRAM prefetch on read | | 25 | | ock.mmc.storage.prefetch.enabled | bool | optional | false | true/false | enable SSD to DRAM prefetch on read | |
| 28 | | | | | | | | | 26 | | | | | | | | |
| 29 | | ock.mmc.tls.enable | bool | optional | false | true/false | metaservice TLS switch | | 27 | | ock.mmc.tls.enable | bool | optional | false | true/false | metaservice TLS switch | |
| @@ -286,15 +286,6 @@ memcache_get_not_found_total 0 | |||
| 286 | # HELP memcache_evict_operations_total Total number of eviction operations | 286 | # HELP memcache_evict_operations_total Total number of eviction operations |
| 287 | # TYPE memcache_evict_operations_total counter | 287 | # TYPE memcache_evict_operations_total counter |
| 288 | memcache_evict_operations_total 0 | 288 | memcache_evict_operations_total 0 |
| 289 | -# HELP memcache_evict_to_ssd_total Total number of eviction to SSD operations | ||
| 290 | -# TYPE memcache_evict_to_ssd_total counter | ||
| 291 | -memcache_evict_to_ssd_total 0 | ||
| 292 | -# HELP memcache_evict_ssd_delete_total Total number of SSD eviction delete operations | ||
| 293 | -# TYPE memcache_evict_ssd_delete_total counter | ||
| 294 | -memcache_evict_ssd_delete_total 0 | ||
| 295 | -# HELP memcache_evict_mem_delete_total Total number of memory tier eviction delete operations | ||
| 296 | -# TYPE memcache_evict_mem_delete_total counter | ||
| 297 | -memcache_evict_mem_delete_total 0 | ||
| 298 | # HELP memcache_evict_running Whether eviction (GC) is currently running (1=yes, 0=no) | 289 | # HELP memcache_evict_running Whether eviction (GC) is currently running (1=yes, 0=no) |
| 299 | # TYPE memcache_evict_running gauge | 290 | # TYPE memcache_evict_running gauge |
| 300 | memcache_evict_running 0 | 291 | memcache_evict_running 0 |
| @@ -430,9 +421,6 @@ memcache_ubs_io_disk_total_bandwidth_bytes_per_sec{rank="0",disk_path="/data/dis | |||
| 430 | | `memcache_<op>_failures_total` | counter | — | `MmcMetaMetricSnapshot::<op>FailureCount` | `<op>` 失败次数(真实错误,含 `MMC_DUPLICATED_OBJECT`);支持 per-rank | | 421 | | `memcache_<op>_failures_total` | counter | — | `MmcMetaMetricSnapshot::<op>FailureCount` | `<op>` 失败次数(真实错误,含 `MMC_DUPLICATED_OBJECT`);支持 per-rank | |
| 431 | | `memcache_<op>_not_found_total` | counter | — | `MmcMetaMetricSnapshot::<op>NotFoundCount` | `<op>` 未命中次数(`MMC_UNMATCHED_KEY`),不计入 failure;仅 `get`/`batch_get`/`remove`/`batch_remove`/`update_state`/`batch_update_state`/`query`/`batch_query`/`exist_key`/`batch_exist_key` 输出;支持 per-rank | | 422 | | `memcache_<op>_not_found_total` | counter | — | `MmcMetaMetricSnapshot::<op>NotFoundCount` | `<op>` 未命中次数(`MMC_UNMATCHED_KEY`),不计入 failure;仅 `get`/`batch_get`/`remove`/`batch_remove`/`update_state`/`batch_update_state`/`query`/`batch_query`/`exist_key`/`batch_exist_key` 输出;支持 per-rank | |
| 432 | | `memcache_evict_operations_total` | counter | — | `MmcMetaMetricSnapshot::evictCount` | 驱逐操作总数;支持 per-rank | | 423 | | `memcache_evict_operations_total` | counter | — | `MmcMetaMetricSnapshot::evictCount` | 驱逐操作总数;支持 per-rank | |
| 433 | -| `memcache_evict_to_ssd_total` | counter | — | `MmcMetaMetricSnapshot::evictToSsdCount` | 迁移到 SSD 的驱逐次数;支持 per-rank | | ||
| 434 | -| `memcache_evict_ssd_delete_total` | counter | — | `MmcMetaMetricSnapshot::evictSsdDeleteCount` | 驱逐时 SSD blob 删除数;支持 per-rank | | ||
| 435 | -| `memcache_evict_mem_delete_total` | counter | — | `MmcMetaMetricSnapshot::evictMemDeleteCount` | 驱逐时内存层 blob 删除数;支持 per-rank | | ||
| 436 | | `memcache_evict_running` | gauge | — | `MmcMetaManager::evictCheck_` | 是否正在执行淘汰(GC)(1=是,0=否) | | 424 | | `memcache_evict_running` | gauge | — | `MmcMetaManager::evictCheck_` | 是否正在执行淘汰(GC)(1=是,0=否) | |
| 437 | | `memcache_get_hits_dram_total` | counter | — | `MmcMetaMetricSnapshot::getHitDramCount` | 命中 DRAM 的 Get 次数;支持 per-rank | | 425 | | `memcache_get_hits_dram_total` | counter | — | `MmcMetaMetricSnapshot::getHitDramCount` | 命中 DRAM 的 Get 次数;支持 per-rank | |
| 438 | | `memcache_get_hits_ssd_total` | counter | — | `MmcMetaMetricSnapshot::getHitSsdCount` | 命中 SSD(触发回温)的 Get 次数;支持 per-rank | | 426 | | `memcache_get_hits_ssd_total` | counter | — | `MmcMetaMetricSnapshot::getHitSsdCount` | 命中 SSD(触发回温)的 Get 次数;支持 per-rank | |
| @@ -513,7 +501,7 @@ curl "http://127.0.0.1:8000/metrics/summary" | |||
| 513 | `text/plain; charset=utf-8`: | 501 | `text/plain; charset=utf-8`: |
| 514 | 502 | ||
| 515 | ```text | 503 | ```text |
| 516 | -keys=2 evict=0 evict_to_ssd=0 evict_ssd_delete=0 evict_mem_delete=0 rewarm=0 rewarm_fail=0 rewarm_bytes_total=0 rewarm_bytes_current=0 get_hit_dram=0 get_hit_ssd=0 hbm_used=368640/5368709120 dram_used=0/5368709120 ssd_used=0/0 alloc_req=68 alloc_success=68 alloc_fail=0 batch_alloc_req=0 batch_alloc_success=0 batch_alloc_fail=0 get_req=68 get_success=68 get_fail=0 get_not_found=0 batch_get_req=0 batch_get_success=0 batch_get_fail=0 batch_get_not_found=0 remove_req=0 remove_success=0 remove_fail=0 remove_not_found=0 batch_remove_req=0 batch_remove_success=0 batch_remove_fail=0 batch_remove_not_found=0 remove_all_req=0 remove_all_success=0 remove_all_fail=0 update_state_req=0 update_state_success=0 update_state_fail=0 update_state_not_found=0 batch_update_state_req=0 batch_update_state_success=0 batch_update_state_fail=0 batch_update_state_not_found=0 query_req=12 query_success=11 query_fail=0 query_not_found=1 batch_query_req=3 batch_query_success=3 batch_query_fail=0 batch_query_not_found=1 get_all_keys_req=4 get_all_keys_success=4 get_all_keys_fail=0 exist_key_req=0 exist_key_success=0 exist_key_fail=0 exist_key_not_found=0 batch_exist_key_req=0 batch_exist_key_success=0 batch_exist_key_fail=0 batch_exist_key_not_found=0 mount_req=0 mount_success=0 mount_fail=0 unmount_req=0 unmount_success=0 unmount_fail=0 | 504 | +keys=2 evict=0 rewarm=0 rewarm_fail=0 rewarm_bytes_total=0 rewarm_bytes_current=0 get_hit_dram=0 get_hit_ssd=0 hbm_used=368640/5368709120 dram_used=0/5368709120 ssd_used=0/0 alloc_req=68 alloc_success=68 alloc_fail=0 batch_alloc_req=0 batch_alloc_success=0 batch_alloc_fail=0 get_req=68 get_success=68 get_fail=0 get_not_found=0 batch_get_req=0 batch_get_success=0 batch_get_fail=0 batch_get_not_found=0 remove_req=0 remove_success=0 remove_fail=0 remove_not_found=0 batch_remove_req=0 batch_remove_success=0 batch_remove_fail=0 batch_remove_not_found=0 remove_all_req=0 remove_all_success=0 remove_all_fail=0 update_state_req=0 update_state_success=0 update_state_fail=0 update_state_not_found=0 batch_update_state_req=0 batch_update_state_success=0 batch_update_state_fail=0 batch_update_state_not_found=0 query_req=12 query_success=11 query_fail=0 query_not_found=1 batch_query_req=3 batch_query_success=3 batch_query_fail=0 batch_query_not_found=1 get_all_keys_req=4 get_all_keys_success=4 get_all_keys_fail=0 exist_key_req=0 exist_key_success=0 exist_key_fail=0 exist_key_not_found=0 batch_exist_key_req=0 batch_exist_key_success=0 batch_exist_key_fail=0 batch_exist_key_not_found=0 mount_req=0 mount_success=0 mount_fail=0 unmount_req=0 unmount_success=0 unmount_fail=0 |
| 517 | ``` | 505 | ``` |
| 518 | 506 | ||
| 519 | **解释** | 507 | **解释** |
| @@ -523,9 +511,9 @@ keys=2 evict=0 evict_to_ssd=0 evict_ssd_delete=0 evict_mem_delete=0 rewarm=0 rew | |||
| 523 | | 单行文本 | 成功时必须为单行,不能换行拆分 | 接口成功返回约定 | | 511 | | 单行文本 | 成功时必须为单行,不能换行拆分 | 接口成功返回约定 | |
| 524 | | 格式 | 以空格分隔的 `key=value` 串,字段顺序固定 | 统计摘要接口契约 | | 512 | | 格式 | 以空格分隔的 `key=value` 串,字段顺序固定 | 统计摘要接口契约 | |
| 525 | | 成功示例字段 | 成功示例应包含当前约定的全部字段 | 统计摘要接口契约 | | 513 | | 成功示例字段 | 成功示例应包含当前约定的全部字段 | 统计摘要接口契约 | |
| 526 | -| 字段顺序固定 | 依次为 `keys`、`evict`、`evict_to_ssd`、`evict_ssd_delete`、`evict_mem_delete`、`rewarm`、`rewarm_fail`、`rewarm_bytes_total`、`rewarm_bytes_current`、`get_hit_dram`、`get_hit_ssd`、`hbm_used`、`dram_used`、`ssd_used`、`alloc_req`、`alloc_success`、`alloc_fail`、`batch_alloc_req`、`batch_alloc_success`、`batch_alloc_fail`、`get_req`、`get_success`、`get_fail`、`get_not_found`、`batch_get_req`、`batch_get_success`、`batch_get_fail`、`batch_get_not_found`、`remove_req`、`remove_success`、`remove_fail`、`remove_not_found`、`batch_remove_req`、`batch_remove_success`、`batch_remove_fail`、`batch_remove_not_found`、`remove_all_req`、`remove_all_success`、`remove_all_fail`、`update_state_req`、`update_state_success`、`update_state_fail`、`update_state_not_found`、`batch_update_state_req`、`batch_update_state_success`、`batch_update_state_fail`、`batch_update_state_not_found`、`query_req`、`query_success`、`query_fail`、`query_not_found`、`batch_query_req`、`batch_query_success`、`batch_query_fail`、`batch_query_not_found`、`get_all_keys_req`、`get_all_keys_success`、`get_all_keys_fail`、`exist_key_req`、`exist_key_success`、`exist_key_fail`、`exist_key_not_found`、`batch_exist_key_req`、`batch_exist_key_success`、`batch_exist_key_fail`、`batch_exist_key_not_found`、`mount_req`、`mount_success`、`mount_fail`、`unmount_req`、`unmount_success`、`unmount_fail` | 统计摘要接口契约 | | 514 | +| 字段顺序固定 | 依次为 `keys`、`evict`、`rewarm`、`rewarm_fail`、`rewarm_bytes_total`、`rewarm_bytes_current`、`get_hit_dram`、`get_hit_ssd`、`hbm_used`、`dram_used`、`ssd_used`、`alloc_req`、`alloc_success`、`alloc_fail`、`batch_alloc_req`、`batch_alloc_success`、`batch_alloc_fail`、`get_req`、`get_success`、`get_fail`、`get_not_found`、`batch_get_req`、`batch_get_success`、`batch_get_fail`、`batch_get_not_found`、`remove_req`、`remove_success`、`remove_fail`、`remove_not_found`、`batch_remove_req`、`batch_remove_success`、`batch_remove_fail`、`batch_remove_not_found`、`remove_all_req`、`remove_all_success`、`remove_all_fail`、`update_state_req`、`update_state_success`、`update_state_fail`、`update_state_not_found`、`batch_update_state_req`、`batch_update_state_success`、`batch_update_state_fail`、`batch_update_state_not_found`、`query_req`、`query_success`、`query_fail`、`query_not_found`、`batch_query_req`、`batch_query_success`、`batch_query_fail`、`batch_query_not_found`、`get_all_keys_req`、`get_all_keys_success`、`get_all_keys_fail`、`exist_key_req`、`exist_key_success`、`exist_key_fail`、`exist_key_not_found`、`batch_exist_key_req`、`batch_exist_key_success`、`batch_exist_key_fail`、`batch_exist_key_not_found`、`mount_req`、`mount_success`、`mount_fail`、`unmount_req`、`unmount_success`、`unmount_fail` | 统计摘要接口契约 | |
| 527 | | 容量字段 | `hbm_used` / `dram_used` / `ssd_used` 格式为 `used/total`;未配置 SSD 时 `ssd_used` 为 `0/0` | 统计摘要接口契约 | | 515 | | 容量字段 | `hbm_used` / `dram_used` / `ssd_used` 格式为 `used/total`;未配置 SSD 时 `ssd_used` 为 `0/0` | 统计摘要接口契约 | |
| 528 | -| per-rank 字段 | 开启 `MmcMetaMetricManager::IsPerRankEnabled()` 时,在上述固定字段后以 `<base>_by_rank_<rank>=<val>` 形式追加 per-rank 字段(每个 rank 一项),覆盖驱逐/回温/命中 10 项:`evict_by_rank`、`evict_to_ssd_by_rank`、`evict_ssd_delete_by_rank`、`evict_mem_delete_by_rank`、`get_hit_dram_by_rank`、`get_hit_ssd_by_rank`、`rewarm_by_rank`、`rewarm_fail_by_rank`、`rewarm_bytes_by_rank`、`rewarm_bytes_current_by_rank`;业务调用、容量、`keys` 等不输出 per-rank 字段 | per-rank 统计契约 | | 516 | +| per-rank 字段 | 开启 `MmcMetaMetricManager::IsPerRankEnabled()` 时,在上述固定字段后以 `<base>_by_rank_<rank>=<val>` 形式追加 per-rank 字段(每个 rank 一项),覆盖驱逐/回温/命中 7 项:`evict_by_rank`、`get_hit_dram_by_rank`、`get_hit_ssd_by_rank`、`rewarm_by_rank`、`rewarm_fail_by_rank`、`rewarm_bytes_by_rank`、`rewarm_bytes_current_by_rank`;业务调用、容量、`keys` 等不输出 per-rank 字段 | per-rank 统计契约 | |
| 529 | | 结果口径 | `*_success` 表示 `MMC_OK`;`*_fail` 表示真实错误(包括 `MMC_DUPLICATED_OBJECT`);`*_not_found` 表示 `MMC_UNMATCHED_KEY`,不计入 fail;Batch 字段为接口调用级统计,Batch 子项同时累计到对应非 Batch 字段;Batch 调用级统计中真实错误优先,只有无真实错误且存在子项 `MMC_UNMATCHED_KEY` 时才增加 Batch `*_not_found` | 统计摘要接口契约 | | 517 | | 结果口径 | `*_success` 表示 `MMC_OK`;`*_fail` 表示真实错误(包括 `MMC_DUPLICATED_OBJECT`);`*_not_found` 表示 `MMC_UNMATCHED_KEY`,不计入 fail;Batch 字段为接口调用级统计,Batch 子项同时累计到对应非 Batch 字段;Batch 调用级统计中真实错误优先,只有无真实错误且存在子项 `MMC_UNMATCHED_KEY` 时才增加 Batch `*_not_found` | 统计摘要接口契约 | |
| 530 | | 占位值策略 | 当前无法提供真实值的字段仍保留在成功体中,可使用 `0`、`0/0` 或空值占位 | 降级规则 | | 518 | | 占位值策略 | 当前无法提供真实值的字段仍保留在成功体中,可使用 `0`、`0/0` 或空值占位 | 降级规则 | |
| 531 | 519 | ||
| @@ -537,9 +525,6 @@ keys=2 evict=0 evict_to_ssd=0 evict_ssd_delete=0 evict_mem_delete=0 rewarm=0 rew | |||
| 537 | |---|---|---|---| | 525 | |---|---|---|---| |
| 538 | | `keys` | uint | `MmcMetaMetricSnapshot::keyCount` | 当前已存储 key 数量 | | 526 | | `keys` | uint | `MmcMetaMetricSnapshot::keyCount` | 当前已存储 key 数量 | |
| 539 | | `evict` | uint | `MmcMetaMetricSnapshot::evictCount` | 驱逐操作总数 | | 527 | | `evict` | uint | `MmcMetaMetricSnapshot::evictCount` | 驱逐操作总数 | |
| 540 | -| `evict_to_ssd` | uint | `MmcMetaMetricSnapshot::evictToSsdCount` | 迁移到 SSD 的驱逐次数 | | ||
| 541 | -| `evict_ssd_delete` | uint | `MmcMetaMetricSnapshot::evictSsdDeleteCount` | 驱逐时 SSD blob 删除数 | | ||
| 542 | -| `evict_mem_delete` | uint | `MmcMetaMetricSnapshot::evictMemDeleteCount` | 驱逐时内存层 blob 删除数 | | ||
| 543 | | `rewarm` | uint | `MmcMetaMetricSnapshot::rewarmCount` | SSD→DRAM 回温操作总数 | | 528 | | `rewarm` | uint | `MmcMetaMetricSnapshot::rewarmCount` | SSD→DRAM 回温操作总数 | |
| 544 | | `rewarm_fail` | uint | `MmcMetaMetricSnapshot::rewarmFailCount` | 失败的回温操作数 | | 529 | | `rewarm_fail` | uint | `MmcMetaMetricSnapshot::rewarmFailCount` | 失败的回温操作数 | |
| 545 | | `rewarm_bytes_total` | uint (bytes) | `MmcMetaMetricSnapshot::rewarmBytesCount` | 累计回温字节数 | | 530 | | `rewarm_bytes_total` | uint (bytes) | `MmcMetaMetricSnapshot::rewarmBytesCount` | 累计回温字节数 | |
| @@ -125,6 +125,7 @@ add_library(mmc_objects OBJECT ${PLATFORM_SRC}) | |||
| 125 | target_include_directories(mmc_objects BEFORE PUBLIC ${PROJECT_MMC_SRC_BASE}/csrc/under_api/mf_smem) | 125 | target_include_directories(mmc_objects BEFORE PUBLIC ${PROJECT_MMC_SRC_BASE}/csrc/under_api/mf_smem) |
| 126 | target_link_libraries(mmc_objects PUBLIC config_store_object) | 126 | target_link_libraries(mmc_objects PUBLIC config_store_object) |
| 127 | target_compile_options(mmc_objects PRIVATE -fPIC -Wno-float-equal) | 127 | target_compile_options(mmc_objects PRIVATE -fPIC -Wno-float-equal) |
| 128 | +target_compile_definitions(mmc_objects PRIVATE GIT_LAST_COMMIT=${MMC_GIT_COMMIT_HASH}) | ||
| 128 | if (MMC_ENABLE_KV_EVENTS) | 129 | if (MMC_ENABLE_KV_EVENTS) |
| 129 | target_compile_definitions(mmc_objects PRIVATE ZMQ_STATIC) | 130 | target_compile_definitions(mmc_objects PRIVATE ZMQ_STATIC) |
| 130 | endif () | 131 | endif () |
| @@ -200,7 +200,7 @@ Result MetaNetClient::HandleMetaReplicate(const NetContextPtr &context) | |||
| 200 | ctx->GetRequest<MetaReplicateRequest>(req); | 200 | ctx->GetRequest<MetaReplicateRequest>(req); |
| 201 | if (replicateHandler_ != nullptr) { | 201 | if (replicateHandler_ != nullptr) { |
| 202 | std::vector<Result> keyResults; | 202 | std::vector<Result> keyResults; |
| 203 | - resp.ret_ = replicateHandler_(req.ops_, req.keys_, req.blobs_, req.asyncFlush_, keyResults); | 203 | + resp.ret_ = replicateHandler_(req.ops_, req.keys_, req.blobs_, keyResults); |
| 204 | resp.keyResults_ = std::move(keyResults); | 204 | resp.keyResults_ = std::move(keyResults); |
| 205 | } else { | 205 | } else { |
| 206 | MMC_LOG_ERROR("replicateHandler_ is nullptr"); | 206 | MMC_LOG_ERROR("replicateHandler_ is nullptr"); |
| @@ -33,7 +33,7 @@ constexpr int RETRY_LOG_INTERVAL = 10; | |||
| 33 | using ClientRetryHandler = std::function<int32_t(void)>; | 33 | using ClientRetryHandler = std::function<int32_t(void)>; |
| 34 | using ClientReplicateHandler = | 34 | using ClientReplicateHandler = |
| 35 | std::function<int32_t(const std::vector<uint32_t> &ops, const std::vector<std::string> &keys, | 35 | std::function<int32_t(const std::vector<uint32_t> &ops, const std::vector<std::string> &keys, |
| 36 | - const std::vector<MmcMemBlobDesc> &blobs, bool asyncFlush, std::vector<Result> &keyResults)>; | 36 | + const std::vector<MmcMemBlobDesc> &blobs, std::vector<Result> &keyResults)>; |
| 37 | using ClientBlobCopyHandler = | 37 | using ClientBlobCopyHandler = |
| 38 | std::function<int32_t(const std::string &key, const MmcMemBlobDesc &src, const MmcMemBlobDesc &dst)>; | 38 | std::function<int32_t(const std::string &key, const MmcMemBlobDesc &src, const MmcMemBlobDesc &dst)>; |
| 39 | using ClientBlobDeleteHandler = std::function<int32_t(const std::string &key, const MmcMemBlobDesc &blob)>; | 39 | using ClientBlobDeleteHandler = std::function<int32_t(const std::string &key, const MmcMemBlobDesc &blob)>; |
| @@ -173,7 +173,6 @@ enum TP_MMC_MOD { | |||
| 173 | TP_MMC_META_GET_WAIT_REWARM, | 173 | TP_MMC_META_GET_WAIT_REWARM, |
| 174 | TP_MMC_META_GET_FILL_METAOBJ, | 174 | TP_MMC_META_GET_FILL_METAOBJ, |
| 175 | TP_MMC_META_EVICT, | 175 | TP_MMC_META_EVICT, |
| 176 | - TP_MMC_META_EVICT_SSD_WRITE, | ||
| 177 | TP_MMC_META_EVICT_DELETE_COUNT, | 176 | TP_MMC_META_EVICT_DELETE_COUNT, |
| 178 | TP_MMC_META_FREE_BLOB_UPDATE_STATE, | 177 | TP_MMC_META_FREE_BLOB_UPDATE_STATE, |
| 179 | TP_MMC_META_MOVEBLOB, | 178 | TP_MMC_META_MOVEBLOB, |
| @@ -29,7 +29,6 @@ constexpr auto OCK_MMC_META_SERVICE_HTTP_URL = | |||
| 29 | constexpr auto OCK_MMC_METRICS_REPORT_INTERVAL_SECONDS = | 29 | constexpr auto OCK_MMC_METRICS_REPORT_INTERVAL_SECONDS = |
| 30 | std::make_pair("ock.mmc.meta_service.metrics_report_interval_seconds", 30UL); | 30 | std::make_pair("ock.mmc.meta_service.metrics_report_interval_seconds", 30UL); |
| 31 | constexpr auto OCK_MMC_META_HA_ENABLE = std::make_pair("ock.mmc.meta.ha.enable", false); | 31 | constexpr auto OCK_MMC_META_HA_ENABLE = std::make_pair("ock.mmc.meta.ha.enable", false); |
| 32 | -constexpr auto OCK_MMC_META_BACKUP_ENABLE = std::make_pair("ock.mmc.meta.backup.enable", false); | ||
| 33 | constexpr auto OKC_MMC_EVICT_THRESHOLD_HIGH = std::make_pair("ock.mmc.evict_threshold_high", 90); | 32 | constexpr auto OKC_MMC_EVICT_THRESHOLD_HIGH = std::make_pair("ock.mmc.evict_threshold_high", 90); |
| 34 | constexpr auto OKC_MMC_EVICT_THRESHOLD_LOW = std::make_pair("ock.mmc.evict_threshold_low", 80); | 33 | constexpr auto OKC_MMC_EVICT_THRESHOLD_LOW = std::make_pair("ock.mmc.evict_threshold_low", 80); |
| 35 | constexpr auto OCK_MMC_EVICT_CHECK_INTERVAL_SECONDS = std::make_pair("ock.mmc.evict_check_interval_seconds", 5); | 34 | constexpr auto OCK_MMC_EVICT_CHECK_INTERVAL_SECONDS = std::make_pair("ock.mmc.evict_check_interval_seconds", 5); |
| @@ -119,13 +118,9 @@ constexpr size_t CURVE_KEY_Z85_LEN = 40; | |||
| 119 | constexpr auto OCK_MMC_ZMQ_ENABLE_CURVE = std::make_pair("ock.mmc.zmq.enable_curve", false); | 118 | constexpr auto OCK_MMC_ZMQ_ENABLE_CURVE = std::make_pair("ock.mmc.zmq.enable_curve", false); |
| 120 | constexpr auto OCK_MMC_ZMQ_PUBLIC_KEY = std::make_pair("ock.mmc.zmq.public_key", ""); | 119 | constexpr auto OCK_MMC_ZMQ_PUBLIC_KEY = std::make_pair("ock.mmc.zmq.public_key", ""); |
| 121 | constexpr auto OCK_MMC_ZMQ_SECRET_KEY = std::make_pair("ock.mmc.zmq.private_key", ""); | 120 | constexpr auto OCK_MMC_ZMQ_SECRET_KEY = std::make_pair("ock.mmc.zmq.private_key", ""); |
| 122 | -constexpr uint16_t DEFAULT_REWARM_WATERMARK_VAL = 95U; | ||
| 123 | -constexpr auto OCK_MMC_REWARM_DRAM_WATERMARK = | ||
| 124 | - std::make_pair("ock.mmc.rewarm.dram_watermark", DEFAULT_REWARM_WATERMARK_VAL); | ||
| 125 | constexpr auto OCK_MMC_PREFETCH_ENABLED = std::make_pair("ock.mmc.storage.prefetch.enabled", false); | 121 | constexpr auto OCK_MMC_PREFETCH_ENABLED = std::make_pair("ock.mmc.storage.prefetch.enabled", false); |
| 126 | constexpr auto OCK_MMC_PENDING_WAIT_TIMEOUT_MS = std::make_pair("ock.mmc.storage.pending_wait.timeout", 300U); | 122 | constexpr auto OCK_MMC_PENDING_WAIT_TIMEOUT_MS = std::make_pair("ock.mmc.storage.pending_wait.timeout", 300U); |
| 127 | constexpr auto OCK_MMC_LOCAL_SERVICE_STORAGE_ENABLED = std::make_pair("ock.mmc.local_service.storage.enabled", false); | 123 | constexpr auto OCK_MMC_LOCAL_SERVICE_STORAGE_ENABLED = std::make_pair("ock.mmc.local_service.storage.enabled", false); |
| 128 | -constexpr auto OCK_MMC_ASYNC_FLUSH_ENABLED = std::make_pair("ock.mmc.storage.async_flush.enabled", false); | ||
| 129 | constexpr auto OCK_MMC_ASYNC_FLUSH_INTERVAL_MS = std::make_pair("ock.mmc.storage.async_flush.interval_ms", 200); | 124 | constexpr auto OCK_MMC_ASYNC_FLUSH_INTERVAL_MS = std::make_pair("ock.mmc.storage.async_flush.interval_ms", 200); |
| 130 | constexpr auto OCK_MMC_ASYNC_FLUSH_BATCH_LIMIT = std::make_pair("ock.mmc.storage.async_flush.batch_limit", 20); | 125 | constexpr auto OCK_MMC_ASYNC_FLUSH_BATCH_LIMIT = std::make_pair("ock.mmc.storage.async_flush.batch_limit", 20); |
| 131 | constexpr auto OCK_MMC_LOCAL_SERVICE_DRAM_BEST_EFFORT = | 126 | constexpr auto OCK_MMC_LOCAL_SERVICE_DRAM_BEST_EFFORT = |
| @@ -150,8 +145,6 @@ constexpr int MAX_WORLD_SIZE = 1024; | |||
| 150 | 145 | ||
| 151 | constexpr int MIN_EVICT_THRESHOLD = 1; | 146 | constexpr int MIN_EVICT_THRESHOLD = 1; |
| 152 | constexpr int MAX_EVICT_THRESHOLD = 99; | 147 | constexpr int MAX_EVICT_THRESHOLD = 99; |
| 153 | -constexpr int MIN_DRAM_WATERMARK = 5; | ||
| 154 | -constexpr int MAX_DRAM_WATERMARK = 95; | ||
| 155 | constexpr int MIN_LEASE_TTL_MS = 1; | 148 | constexpr int MIN_LEASE_TTL_MS = 1; |
| 156 | constexpr int MAX_LEASE_TTL_MS = 2147483647; | 149 | constexpr int MAX_LEASE_TTL_MS = 2147483647; |
| 157 | 150 | ||
| @@ -195,10 +188,10 @@ constexpr uint64_t DEFAULT_BATCH_CHUNK_SIZE = 8 * MB_MEM_BYTES; | |||
| 195 | constexpr uint64_t MIN_INTERVAL_SECONDS = 0; | 188 | constexpr uint64_t MIN_INTERVAL_SECONDS = 0; |
| 196 | constexpr uint64_t MAX_INTERVAL_SECONDS = 86400; | 189 | constexpr uint64_t MAX_INTERVAL_SECONDS = 86400; |
| 197 | 190 | ||
| 198 | -constexpr int MIN_FLUSH_INTERVAL_MS = 1; | 191 | +constexpr int MIN_FLUSH_INTERVAL_MS = 200; |
| 199 | -constexpr int MAX_FLUSH_INTERVAL_MS = 60000; | 192 | +constexpr int MAX_FLUSH_INTERVAL_MS = 1000; |
| 200 | -constexpr int MIN_FLUSH_BATCH_LIMIT = 1; | 193 | +constexpr int MIN_FLUSH_BATCH_LIMIT = 8; |
| 201 | -constexpr int MAX_FLUSH_BATCH_LIMIT = 65536; | 194 | +constexpr int MAX_FLUSH_BATCH_LIMIT = 1024; |
| 202 | 195 | ||
| 203 | constexpr int MIN_PENDING_WAIT_TIMEOUT_MS = 1; | 196 | constexpr int MIN_PENDING_WAIT_TIMEOUT_MS = 1; |
| 204 | constexpr int MAX_PENDING_WAIT_TIMEOUT_MS = 60000; | 197 | constexpr int MAX_PENDING_WAIT_TIMEOUT_MS = 60000; |
| @@ -206,7 +206,6 @@ public: | |||
| 206 | MAX_INTERVAL_SECONDS), | 206 | MAX_INTERVAL_SECONDS), |
| 207 | 0); | 207 | 0); |
| 208 | AddBoolConf(OCK_MMC_META_HA_ENABLE, VStrEnum::Create(OCK_MMC_META_HA_ENABLE.first, BOOL_ENUM_STR), 0); | 208 | AddBoolConf(OCK_MMC_META_HA_ENABLE, VStrEnum::Create(OCK_MMC_META_HA_ENABLE.first, BOOL_ENUM_STR), 0); |
| 209 | - AddBoolConf(OCK_MMC_META_BACKUP_ENABLE, VStrEnum::Create(OCK_MMC_META_BACKUP_ENABLE.first, BOOL_ENUM_STR), 0); | ||
| 210 | AddStrConf(OCK_MMC_LOG_LEVEL, VStrEnum::Create(OCK_MMC_LOG_LEVEL.first, LOG_LEVEL_ENUM_STR), 0); | 209 | AddStrConf(OCK_MMC_LOG_LEVEL, VStrEnum::Create(OCK_MMC_LOG_LEVEL.first, LOG_LEVEL_ENUM_STR), 0); |
| 211 | AddStrConf(OCK_MMC_LOG_PATH, VStrLength::Create(OCK_MMC_LOG_PATH.first, PATH_MAX_LEN), 0); | 210 | AddStrConf(OCK_MMC_LOG_PATH, VStrLength::Create(OCK_MMC_LOG_PATH.first, PATH_MAX_LEN), 0); |
| 212 | AddIntConf(OCK_MMC_LOG_ROTATION_FILE_SIZE, | 211 | AddIntConf(OCK_MMC_LOG_ROTATION_FILE_SIZE, |
| @@ -224,10 +223,7 @@ public: | |||
| 224 | AddIntConf(OKC_MMC_EVICT_THRESHOLD_LOW, | 223 | AddIntConf(OKC_MMC_EVICT_THRESHOLD_LOW, |
| 225 | VIntRange::Create(OKC_MMC_EVICT_THRESHOLD_LOW.first, MIN_EVICT_THRESHOLD, MAX_EVICT_THRESHOLD - 1), | 224 | VIntRange::Create(OKC_MMC_EVICT_THRESHOLD_LOW.first, MIN_EVICT_THRESHOLD, MAX_EVICT_THRESHOLD - 1), |
| 226 | 0); | 225 | 0); |
| 227 | - AddIntConf(OCK_MMC_REWARM_DRAM_WATERMARK, | ||
| 228 | - VIntRange::Create(OCK_MMC_REWARM_DRAM_WATERMARK.first, MIN_DRAM_WATERMARK, MAX_DRAM_WATERMARK), 0); | ||
| 229 | AddBoolConf(OCK_MMC_PREFETCH_ENABLED, VStrEnum::Create(OCK_MMC_PREFETCH_ENABLED.first, BOOL_ENUM_STR), 0); | 226 | AddBoolConf(OCK_MMC_PREFETCH_ENABLED, VStrEnum::Create(OCK_MMC_PREFETCH_ENABLED.first, BOOL_ENUM_STR), 0); |
| 230 | - AddBoolConf(OCK_MMC_ASYNC_FLUSH_ENABLED, VStrEnum::Create(OCK_MMC_ASYNC_FLUSH_ENABLED.first, BOOL_ENUM_STR), 0); | ||
| 231 | AddIntConf( | 227 | AddIntConf( |
| 232 | OCK_MMC_ASYNC_FLUSH_INTERVAL_MS, | 228 | OCK_MMC_ASYNC_FLUSH_INTERVAL_MS, |
| 233 | VIntRange::Create(OCK_MMC_ASYNC_FLUSH_INTERVAL_MS.first, MIN_FLUSH_INTERVAL_MS, MAX_FLUSH_INTERVAL_MS), 0); | 229 | VIntRange::Create(OCK_MMC_ASYNC_FLUSH_INTERVAL_MS.first, MIN_FLUSH_INTERVAL_MS, MAX_FLUSH_INTERVAL_MS), 0); |
| @@ -316,7 +312,6 @@ public: | |||
| 316 | SafeCopy(GetString(ConfConstant::OCK_MMC_META_SERVICE_HTTP_URL), config.httpURL, DISCOVERY_URL_SIZE); | 312 | SafeCopy(GetString(ConfConstant::OCK_MMC_META_SERVICE_HTTP_URL), config.httpURL, DISCOVERY_URL_SIZE); |
| 317 | 313 | ||
| 318 | config.haEnable = GetBool(ConfConstant::OCK_MMC_META_HA_ENABLE); | 314 | config.haEnable = GetBool(ConfConstant::OCK_MMC_META_HA_ENABLE); |
| 319 | - config.backupEnable = GetBool(ConfConstant::OCK_MMC_META_BACKUP_ENABLE); | ||
| 320 | std::string logLevelStr = GetString(ConfConstant::OCK_MMC_LOG_LEVEL); | 315 | std::string logLevelStr = GetString(ConfConstant::OCK_MMC_LOG_LEVEL); |
| 321 | StringToUpper(logLevelStr); | 316 | StringToUpper(logLevelStr); |
| 322 | config.logLevel = MmcOutLogger::Instance().GetLogLevel(logLevelStr); | 317 | config.logLevel = MmcOutLogger::Instance().GetLogLevel(logLevelStr); |
| @@ -325,9 +320,7 @@ public: | |||
| 325 | 320 | ||
| 326 | config.evictThresholdHigh = GetInt(ConfConstant::OKC_MMC_EVICT_THRESHOLD_HIGH); | 321 | config.evictThresholdHigh = GetInt(ConfConstant::OKC_MMC_EVICT_THRESHOLD_HIGH); |
| 327 | config.evictThresholdLow = GetInt(ConfConstant::OKC_MMC_EVICT_THRESHOLD_LOW); | 322 | config.evictThresholdLow = GetInt(ConfConstant::OKC_MMC_EVICT_THRESHOLD_LOW); |
| 328 | - config.rewarmDramWatermark = GetInt(ConfConstant::OCK_MMC_REWARM_DRAM_WATERMARK); | ||
| 329 | config.prefetchEnabled = GetBool(ConfConstant::OCK_MMC_PREFETCH_ENABLED); | 323 | config.prefetchEnabled = GetBool(ConfConstant::OCK_MMC_PREFETCH_ENABLED); |
| 330 | - config.asyncFlushEnabled = GetBool(ConfConstant::OCK_MMC_ASYNC_FLUSH_ENABLED); | ||
| 331 | config.asyncFlushIntervalMs = static_cast<uint32_t>(GetInt(ConfConstant::OCK_MMC_ASYNC_FLUSH_INTERVAL_MS)); | 324 | config.asyncFlushIntervalMs = static_cast<uint32_t>(GetInt(ConfConstant::OCK_MMC_ASYNC_FLUSH_INTERVAL_MS)); |
| 332 | config.asyncFlushBatchLimit = static_cast<uint32_t>(GetInt(ConfConstant::OCK_MMC_ASYNC_FLUSH_BATCH_LIMIT)); | 325 | config.asyncFlushBatchLimit = static_cast<uint32_t>(GetInt(ConfConstant::OCK_MMC_ASYNC_FLUSH_BATCH_LIMIT)); |
| 333 | config.pendingWaitTimeoutMs = static_cast<uint64_t>(GetInt(ConfConstant::OCK_MMC_PENDING_WAIT_TIMEOUT_MS)); | 326 | config.pendingWaitTimeoutMs = static_cast<uint64_t>(GetInt(ConfConstant::OCK_MMC_PENDING_WAIT_TIMEOUT_MS)); |
| @@ -439,7 +432,6 @@ public: | |||
| 439 | VStrEnum::Create(OCK_MMC_LOCAL_SERVICE_STORAGE_ENABLED.first, BOOL_ENUM_STR), 0); | 432 | VStrEnum::Create(OCK_MMC_LOCAL_SERVICE_STORAGE_ENABLED.first, BOOL_ENUM_STR), 0); |
| 440 | AddBoolConf(OCK_MMC_LOCAL_SERVICE_DRAM_BEST_EFFORT, | 433 | AddBoolConf(OCK_MMC_LOCAL_SERVICE_DRAM_BEST_EFFORT, |
| 441 | VStrEnum::Create(OCK_MMC_LOCAL_SERVICE_DRAM_BEST_EFFORT.first, BOOL_ENUM_STR), 0); | 434 | VStrEnum::Create(OCK_MMC_LOCAL_SERVICE_DRAM_BEST_EFFORT.first, BOOL_ENUM_STR), 0); |
| 442 | - AddBoolConf(OCK_MMC_ASYNC_FLUSH_ENABLED, VStrEnum::Create(OCK_MMC_ASYNC_FLUSH_ENABLED.first, BOOL_ENUM_STR), 0); | ||
| 443 | AddIntConf(OCK_MMC_CLIENT_AGGREGATE_NUM, | 435 | AddIntConf(OCK_MMC_CLIENT_AGGREGATE_NUM, |
| 444 | VIntRange::Create(OCK_MMC_CLIENT_AGGREGATE_NUM.first, 1, MAX_AGGREGATE_NUM), 0); | 436 | VIntRange::Create(OCK_MMC_CLIENT_AGGREGATE_NUM.first, 1, MAX_AGGREGATE_NUM), 0); |
| 445 | AddStrConf(OCK_MMC_CLIENT_BATCH_CHUNK_SIZE, VNoCheck::Create(), 0); | 437 | AddStrConf(OCK_MMC_CLIENT_BATCH_CHUNK_SIZE, VNoCheck::Create(), 0); |
| @@ -127,7 +127,7 @@ Result MmcLocalServiceDefault::Start(const mmc_local_service_config_t &config) | |||
| 127 | metaNetClient_->RegisterRetryHandler( | 127 | metaNetClient_->RegisterRetryHandler( |
| 128 | std::bind(&MmcLocalServiceDefault::RegisterBm, this), | 128 | std::bind(&MmcLocalServiceDefault::RegisterBm, this), |
| 129 | std::bind(&MmcLocalServiceDefault::UpdateMetaBackup, this, std::placeholders::_1, std::placeholders::_2, | 129 | std::bind(&MmcLocalServiceDefault::UpdateMetaBackup, this, std::placeholders::_1, std::placeholders::_2, |
| 130 | - std::placeholders::_3, std::placeholders::_4, std::placeholders::_5), | 130 | + std::placeholders::_3, std::placeholders::_4), |
| 131 | std::bind(&MmcLocalServiceDefault::CopyBlob, this, std::placeholders::_1, std::placeholders::_2, | 131 | std::bind(&MmcLocalServiceDefault::CopyBlob, this, std::placeholders::_1, std::placeholders::_2, |
| 132 | std::placeholders::_3), | 132 | std::placeholders::_3), |
| 133 | std::bind(&MmcLocalServiceDefault::BlobDelete, this, std::placeholders::_1, std::placeholders::_2), | 133 | std::bind(&MmcLocalServiceDefault::BlobDelete, this, std::placeholders::_1, std::placeholders::_2), |
| @@ -362,7 +362,7 @@ Result MmcLocalServiceDefault::InitUbsIo(int32_t deviceId, const std::string &co | |||
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | Result MmcLocalServiceDefault::UpdateMetaBackup(const std::vector<uint32_t> &ops, const std::vector<std::string> &keys, | 364 | Result MmcLocalServiceDefault::UpdateMetaBackup(const std::vector<uint32_t> &ops, const std::vector<std::string> &keys, |
| 365 | - const std::vector<MmcMemBlobDesc> &blobs, bool asyncFlush, | 365 | + const std::vector<MmcMemBlobDesc> &blobs, |
| 366 | std::vector<Result> &keyResults) | 366 | std::vector<Result> &keyResults) |
| 367 | { | 367 | { |
| 368 | const auto opCount = ops.size(); | 368 | const auto opCount = ops.size(); |
| @@ -375,8 +375,8 @@ Result MmcLocalServiceDefault::UpdateMetaBackup(const std::vector<uint32_t> &ops | |||
| 375 | return MMC_INVALID_PARAM; | 375 | return MMC_INVALID_PARAM; |
| 376 | } | 376 | } |
| 377 | 377 | ||
| 378 | - std::vector<size_t> flushTasks = ProcessBackupMetadata(ops, keys, blobs, asyncFlush, length, keyResults); | 378 | + std::vector<size_t> flushTasks = ProcessBackupMetadata(ops, keys, blobs, length, keyResults); |
| 379 | - MMC_LOG_DEBUG("ProcessBackupMetadata done, asyncFlush=" << asyncFlush << ", flushTasks=" << flushTasks.size()); | 379 | + MMC_LOG_DEBUG("ProcessBackupMetadata done, flushTasks=" << flushTasks.size()); |
| 380 | 380 | ||
| 381 | BatchFlushToSsd(flushTasks, keys, blobs, keyResults); | 381 | BatchFlushToSsd(flushTasks, keys, blobs, keyResults); |
| 382 | 382 | ||
| @@ -424,8 +424,7 @@ static bool EraseDesc(std::map<std::string, std::vector<MmcMemBlobDesc>> &blobMa | |||
| 424 | std::vector<size_t> MmcLocalServiceDefault::ProcessBackupMetadata(const std::vector<uint32_t> &ops, | 424 | std::vector<size_t> MmcLocalServiceDefault::ProcessBackupMetadata(const std::vector<uint32_t> &ops, |
| 425 | const std::vector<std::string> &keys, | 425 | const std::vector<std::string> &keys, |
| 426 | const std::vector<MmcMemBlobDesc> &blobs, | 426 | const std::vector<MmcMemBlobDesc> &blobs, |
| 427 | - bool asyncFlush, size_t length, | 427 | + size_t length, std::vector<Result> &keyResults) |
| 428 | - std::vector<Result> &keyResults) | ||
| 429 | { | 428 | { |
| 430 | keyResults.resize(length, MMC_ERROR); | 429 | keyResults.resize(length, MMC_ERROR); |
| 431 | std::vector<size_t> flushTasks; | 430 | std::vector<size_t> flushTasks; |
| @@ -438,10 +437,9 @@ std::vector<size_t> MmcLocalServiceDefault::ProcessBackupMetadata(const std::vec | |||
| 438 | keyResults[i] = MMC_DUPLICATED_OBJECT; | 437 | keyResults[i] = MMC_DUPLICATED_OBJECT; |
| 439 | continue; | 438 | continue; |
| 440 | } | 439 | } |
| 441 | - if (asyncFlush && blobs[i].mediaType_ == MEDIA_DRAM && ubsIoProxyPtr_ != nullptr && | 440 | + if (blobs[i].mediaType_ == MEDIA_DRAM && ubsIoProxyPtr_ != nullptr && bmProxyPtr_ != nullptr) { |
| 442 | - bmProxyPtr_ != nullptr) { | ||
| 443 | flushTasks.push_back(i); | 441 | flushTasks.push_back(i); |
| 444 | - } else if (asyncFlush && blobs[i].mediaType_ == MEDIA_DRAM) { | 442 | + } else if (blobs[i].mediaType_ == MEDIA_DRAM) { |
| 445 | MMC_LOG_WARN("async flush skipped, ubs or bm not available, key=" << keys[i]); | 443 | MMC_LOG_WARN("async flush skipped, ubs or bm not available, key=" << keys[i]); |
| 446 | } else { | 444 | } else { |
| 447 | keyResults[i] = MMC_OK; | 445 | keyResults[i] = MMC_OK; |
| @@ -803,7 +801,7 @@ void MmcLocalServiceDefault::HandleUbsIoMetaEvents(int type, const std::vector<s | |||
| 803 | MMC_LOG_WARN("UBS IO meta DELETE RPC failed, ret=" << ret << ", resp=" << response.ret_ | 801 | MMC_LOG_WARN("UBS IO meta DELETE RPC failed, ret=" << ret << ", resp=" << response.ret_ |
| 804 | << ", keyCount=" << keys.size()); | 802 | << ", keyCount=" << keys.size()); |
| 805 | } else { | 803 | } else { |
| 806 | - MMC_LOG_INFO("UBS IO meta DELETE RPC success, keyCount=" << keys.size()); | 804 | + MMC_LOG_DEBUG("UBS IO meta DELETE RPC success, keyCount=" << keys.size()); |
| 807 | } | 805 | } |
| 808 | } else { | 806 | } else { |
| 809 | MMC_LOG_ERROR("unknown UBS IO meta event type=" << type << ", keyCount=" << keys.size()); | 807 | MMC_LOG_ERROR("unknown UBS IO meta event type=" << type << ", keyCount=" << keys.size()); |
| @@ -51,7 +51,7 @@ public: | |||
| 51 | Result DestroyBm(); | 51 | Result DestroyBm(); |
| 52 | 52 | ||
| 53 | Result UpdateMetaBackup(const std::vector<uint32_t> &ops, const std::vector<std::string> &keys, | 53 | Result UpdateMetaBackup(const std::vector<uint32_t> &ops, const std::vector<std::string> &keys, |
| 54 | - const std::vector<MmcMemBlobDesc> &blobs, bool asyncFlush, std::vector<Result> &keyResults); | 54 | + const std::vector<MmcMemBlobDesc> &blobs, std::vector<Result> &keyResults); |
| 55 | 55 | ||
| 56 | Result CopyBlob(const std::string &key, const MmcMemBlobDesc &src, const MmcMemBlobDesc &dst); | 56 | Result CopyBlob(const std::string &key, const MmcMemBlobDesc &src, const MmcMemBlobDesc &dst); |
| 57 | 57 | ||
| @@ -89,7 +89,7 @@ private: | |||
| 89 | void HandleUbsIoMetaEvents(int type, const std::vector<std::string> &keys); | 89 | void HandleUbsIoMetaEvents(int type, const std::vector<std::string> &keys); |
| 90 | 90 | ||
| 91 | std::vector<size_t> ProcessBackupMetadata(const std::vector<uint32_t> &ops, const std::vector<std::string> &keys, | 91 | std::vector<size_t> ProcessBackupMetadata(const std::vector<uint32_t> &ops, const std::vector<std::string> &keys, |
| 92 | - const std::vector<MmcMemBlobDesc> &blobs, bool asyncFlush, size_t length, | 92 | + const std::vector<MmcMemBlobDesc> &blobs, size_t length, |
| 93 | std::vector<Result> &keyResults); | 93 | std::vector<Result> &keyResults); |
| 94 | 94 | ||
| 95 | void CollectFlushParams(const std::vector<size_t> &indices, const std::vector<std::string> &keys, | 95 | void CollectFlushParams(const std::vector<size_t> &indices, const std::vector<std::string> &keys, |
| @@ -26,7 +26,6 @@ | |||
| 26 | 26 | ||
| 27 | namespace ock { | 27 | namespace ock { |
| 28 | namespace mmc { | 28 | namespace mmc { |
| 29 | - | ||
| 30 | 29 | ||
| 31 | enum AllocFlags { | 30 | enum AllocFlags { |
| 32 | ALLOC_FORCE_BY_RANK = 1 << 0, // 按照rank强制分配 | 31 | ALLOC_FORCE_BY_RANK = 1 << 0, // 按照rank强制分配 |
| @@ -53,9 +53,10 @@ void MMCMetaBackUpMgrDefault::SendBackup2Local() | |||
| 53 | std::lock_guard<std::mutex> lg(backupThreadLock_); | 53 | std::lock_guard<std::mutex> lg(backupThreadLock_); |
| 54 | drained.splice(drained.begin(), backupList_); | 54 | drained.splice(drained.begin(), backupList_); |
| 55 | } | 55 | } |
| 56 | + const size_t batchLimit = asyncFlushBatchLimit_; | ||
| 56 | for (auto it = drained.begin(); it != drained.end();) { | 57 | for (auto it = drained.begin(); it != drained.end();) { |
| 57 | auto &group = rankGroups[it->desc_.rank_]; | 58 | auto &group = rankGroups[it->desc_.rank_]; |
| 58 | - if (!asyncFlushEnabled_ || group.size() < asyncFlushBatchLimit_) { | 59 | + if (group.size() < batchLimit) { |
| 59 | group.push_back(std::move(*it)); | 60 | group.push_back(std::move(*it)); |
| 60 | it = drained.erase(it); | 61 | it = drained.erase(it); |
| 61 | } else { | 62 | } else { |
| @@ -71,7 +72,7 @@ void MMCMetaBackUpMgrDefault::SendBackup2Local() | |||
| 71 | return; | 72 | return; |
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | - MMC_LOG_DEBUG("Backup sending " << rankGroups.size() << " rank groups, async=" << asyncFlushEnabled_); | 75 | + MMC_LOG_DEBUG("Backup sending " << rankGroups.size() << " rank groups"); |
| 75 | if (rewarmPool_ != nullptr) { | 76 | if (rewarmPool_ != nullptr) { |
| 76 | std::vector<std::future<void>> futures; | 77 | std::vector<std::future<void>> futures; |
| 77 | for (auto &[rank, entries] : rankGroups) { | 78 | for (auto &[rank, entries] : rankGroups) { |
| @@ -106,12 +107,7 @@ void MMCMetaBackUpMgrDefault::SendBackupForRank(uint32_t rank, std::vector<MetaB | |||
| 106 | request.blobs_.push_back(e.desc_); | 107 | request.blobs_.push_back(e.desc_); |
| 107 | } | 108 | } |
| 108 | 109 | ||
| 109 | - if (asyncFlushEnabled_ && isSsdAvailableFunc_) { | 110 | + MMC_LOG_DEBUG("Backup flush rank=" << rank << " keys=" << request.keys_.size()); |
| 110 | - request.asyncFlush_ = isSsdAvailableFunc_(rank); | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - MMC_LOG_DEBUG("Backup flush rank=" << rank << " keys=" << request.keys_.size() | ||
| 114 | - << " asyncFlush=" << request.asyncFlush_); | ||
| 115 | 111 | ||
| 116 | Response response; | 112 | Response response; |
| 117 | TP_TRACE_BEGIN(TP_MMC_META_ASYNC_FLUSH_RPC); | 113 | TP_TRACE_BEGIN(TP_MMC_META_ASYNC_FLUSH_RPC); |
| @@ -136,7 +132,7 @@ void MMCMetaBackUpMgrDefault::SendBackupForRank(uint32_t rank, std::vector<MetaB | |||
| 136 | std::vector<std::pair<std::string, MmcMemBlobDesc>> flushedBlobs; | 132 | std::vector<std::pair<std::string, MmcMemBlobDesc>> flushedBlobs; |
| 137 | for (size_t i = 0; i < response.keyResults_.size(); ++i) { | 133 | for (size_t i = 0; i < response.keyResults_.size(); ++i) { |
| 138 | if (request.ops_[i] == META_BACKUP_ADD) { | 134 | if (request.ops_[i] == META_BACKUP_ADD) { |
| 139 | - if (!request.asyncFlush_) { | 135 | + if (isSsdAvailableFunc_ == nullptr || !isSsdAvailableFunc_(rank)) { |
| 140 | // 非刷盘模式:ADD 成功仅表示元数据已记录,不构造 SSD 副本 | 136 | // 非刷盘模式:ADD 成功仅表示元数据已记录,不构造 SSD 副本 |
| 141 | if (response.keyResults_[i] != MMC_OK) { | 137 | if (response.keyResults_[i] != MMC_OK) { |
| 142 | MMC_LOG_WARN("backup add failed for key=" << request.keys_[i] | 138 | MMC_LOG_WARN("backup add failed for key=" << request.keys_[i] |
| @@ -42,8 +42,7 @@ struct MetaBackUpOperate { | |||
| 42 | struct MMCMetaBackUpConfDefault : public MMCMetaBackUpConf { | 42 | struct MMCMetaBackUpConfDefault : public MMCMetaBackUpConf { |
| 43 | MetaNetServerPtr serverPtr_; | 43 | MetaNetServerPtr serverPtr_; |
| 44 | uint32_t asyncFlushIntervalMs = 0; | 44 | uint32_t asyncFlushIntervalMs = 0; |
| 45 | - uint32_t asyncFlushBatchLimit = 0; | 45 | + uint32_t asyncFlushBatchLimit = 8; |
| 46 | - bool asyncFlushEnabled = false; | ||
| 47 | MmcThreadPoolPtr rewarmPool_; | 46 | MmcThreadPoolPtr rewarmPool_; |
| 48 | std::function<bool(uint32_t)> isSsdAvailableFunc_; | 47 | std::function<bool(uint32_t)> isSsdAvailableFunc_; |
| 49 | std::function<void(uint32_t, const std::vector<std::pair<std::string, MmcMemBlobDesc>> &)> onAsyncFlushComplete_; | 48 | std::function<void(uint32_t, const std::vector<std::pair<std::string, MmcMemBlobDesc>> &)> onAsyncFlushComplete_; |
| @@ -51,12 +50,11 @@ struct MMCMetaBackUpConfDefault : public MMCMetaBackUpConf { | |||
| 51 | explicit MMCMetaBackUpConfDefault(MetaNetServerPtr serverPtr) : serverPtr_(serverPtr) {} | 50 | explicit MMCMetaBackUpConfDefault(MetaNetServerPtr serverPtr) : serverPtr_(serverPtr) {} |
| 52 | 51 | ||
| 53 | void Setup( | 52 | void Setup( |
| 54 | - uint32_t intervalMs, uint32_t batchLimit, bool enabled, std::function<bool(uint32_t)> isSsdAvailableFunc, | 53 | + uint32_t intervalMs, uint32_t batchLimit, std::function<bool(uint32_t)> isSsdAvailableFunc, |
| 55 | std::function<void(uint32_t, const std::vector<std::pair<std::string, MmcMemBlobDesc>> &)> onAsyncFlushComplete) | 54 | std::function<void(uint32_t, const std::vector<std::pair<std::string, MmcMemBlobDesc>> &)> onAsyncFlushComplete) |
| 56 | { | 55 | { |
| 57 | asyncFlushIntervalMs = intervalMs; | 56 | asyncFlushIntervalMs = intervalMs; |
| 58 | asyncFlushBatchLimit = batchLimit; | 57 | asyncFlushBatchLimit = batchLimit; |
| 59 | - asyncFlushEnabled = enabled; | ||
| 60 | isSsdAvailableFunc_ = std::move(isSsdAvailableFunc); | 58 | isSsdAvailableFunc_ = std::move(isSsdAvailableFunc); |
| 61 | onAsyncFlushComplete_ = std::move(onAsyncFlushComplete); | 59 | onAsyncFlushComplete_ = std::move(onAsyncFlushComplete); |
| 62 | } | 60 | } |
| @@ -87,7 +85,6 @@ public: | |||
| 87 | metaNetServer_ = defaultPtr->serverPtr_; | 85 | metaNetServer_ = defaultPtr->serverPtr_; |
| 88 | asyncFlushIntervalMs_ = defaultPtr->asyncFlushIntervalMs; | 86 | asyncFlushIntervalMs_ = defaultPtr->asyncFlushIntervalMs; |
| 89 | asyncFlushBatchLimit_ = defaultPtr->asyncFlushBatchLimit; | 87 | asyncFlushBatchLimit_ = defaultPtr->asyncFlushBatchLimit; |
| 90 | - asyncFlushEnabled_ = defaultPtr->asyncFlushEnabled; | ||
| 91 | rewarmPool_ = defaultPtr->rewarmPool_; | 88 | rewarmPool_ = defaultPtr->rewarmPool_; |
| 92 | isSsdAvailableFunc_ = defaultPtr->isSsdAvailableFunc_; | 89 | isSsdAvailableFunc_ = defaultPtr->isSsdAvailableFunc_; |
| 93 | onAsyncFlushComplete_ = defaultPtr->onAsyncFlushComplete_; | 90 | onAsyncFlushComplete_ = defaultPtr->onAsyncFlushComplete_; |
| @@ -156,7 +153,7 @@ public: | |||
| 156 | 153 | ||
| 157 | bool ShouldNotify(size_t queueSize) const | 154 | bool ShouldNotify(size_t queueSize) const |
| 158 | { | 155 | { |
| 159 | - return !asyncFlushEnabled_ || queueSize >= asyncFlushBatchLimit_; | 156 | + return queueSize >= asyncFlushBatchLimit_; |
| 160 | } | 157 | } |
| 161 | 158 | ||
| 162 | private: | 159 | private: |
| @@ -171,8 +168,7 @@ private: | |||
| 171 | std::condition_variable backupThreadCv_; | 168 | std::condition_variable backupThreadCv_; |
| 172 | std::list<MetaBackUpOperate> backupList_; | 169 | std::list<MetaBackUpOperate> backupList_; |
| 173 | uint32_t asyncFlushIntervalMs_ = 0; | 170 | uint32_t asyncFlushIntervalMs_ = 0; |
| 174 | - uint32_t asyncFlushBatchLimit_ = 0; | 171 | + uint32_t asyncFlushBatchLimit_ = 8; |
| 175 | - bool asyncFlushEnabled_ = false; | ||
| 176 | MmcThreadPoolPtr rewarmPool_; | 172 | MmcThreadPoolPtr rewarmPool_; |
| 177 | std::function<bool(uint32_t)> isSsdAvailableFunc_; | 173 | std::function<bool(uint32_t)> isSsdAvailableFunc_; |
| 178 | std::function<void(uint32_t, const std::vector<std::pair<std::string, MmcMemBlobDesc>> &)> onAsyncFlushComplete_; | 174 | std::function<void(uint32_t, const std::vector<std::pair<std::string, MmcMemBlobDesc>> &)> onAsyncFlushComplete_; |
| @@ -1432,47 +1432,7 @@ Result MmcMetaManager::GetAllKeys(std::vector<std::string> &keys) | |||
| 1432 | return MMC_OK; | 1432 | return MMC_OK; |
| 1433 | } | 1433 | } |
| 1434 | 1434 | ||
| 1435 | -Result MmcMetaManager::CopyBlobToSsd(const std::string &key, const MmcMemObjMetaPtr &objMeta, | 1435 | +Result MmcMetaManager::CopyBlob(const std::string &key, const MmcMemObjMetaPtr &objMeta, const MmcMemBlobDesc &srcBlob, |
| 1436 | - std::unique_lock<std::mutex> &guard, const MmcMemBlobDesc &srcBlob, | ||
| 1437 | - const MmcLocation &dstLoc) | ||
| 1438 | -{ | ||
| 1439 | - if (metaNetServer_.Get() == nullptr) { | ||
| 1440 | - MMC_LOG_ERROR("CopyBlobToSsd: metaNetServer_ is null, key=" << key); | ||
| 1441 | - return MMC_ERROR; | ||
| 1442 | - } | ||
| 1443 | - | ||
| 1444 | - MmcMemBlobDesc dstDesc{srcBlob.rank_, 0, srcBlob.size_, MEDIA_SSD, READABLE}; | ||
| 1445 | - BlobCopyRequest request{key, srcBlob, dstDesc}; | ||
| 1446 | - Response response; | ||
| 1447 | - TP_TRACE_BEGIN(TP_MMC_META_MOVEBLOB_RPC); | ||
| 1448 | - Result ret = metaNetServer_->SyncCall(request.dstBlob_.rank_, request, response, TIMEOUT_SECOND); | ||
| 1449 | - TP_TRACE_END(TP_MMC_META_MOVEBLOB_RPC, ret); | ||
| 1450 | - | ||
| 1451 | - if (ret != MMC_OK || response.ret_ != MMC_OK) { | ||
| 1452 | - MMC_LOG_ERROR("CopyBlobToSsd: RPC failed, key=" << key << ", srcRank=" << srcBlob.rank_ | ||
| 1453 | - << ", dstRank=" << dstDesc.rank_ << ", ret=" << ret | ||
| 1454 | - << ", resp=" << response.ret_); | ||
| 1455 | - return MMC_ERROR; | ||
| 1456 | - } | ||
| 1457 | - | ||
| 1458 | - auto ssdBlob = MmcMakeRef<MmcMemBlob>(dstLoc.rank_, 0, srcBlob.size_, MEDIA_SSD, READABLE); | ||
| 1459 | - if (ssdBlob == nullptr) { | ||
| 1460 | - MMC_LOG_ERROR("CopyBlobToSsd: create SSD blob failed, key=" << key); | ||
| 1461 | - return MMC_MALLOC_FAILED; | ||
| 1462 | - } | ||
| 1463 | - | ||
| 1464 | - ret = objMeta->AddBlob(ssdBlob); | ||
| 1465 | - if (ret != MMC_OK) { | ||
| 1466 | - MMC_LOG_ERROR("CopyBlobToSsd: AddBlob SSD failed, key=" << key << ", ret=" << ret); | ||
| 1467 | - return ret; | ||
| 1468 | - } | ||
| 1469 | - | ||
| 1470 | - MMC_LOG_DEBUG("CopyBlobToSsd ok, key=" << key << ", dstRank=" << dstDesc.rank_ << ", size=" << dstDesc.size_); | ||
| 1471 | - return MMC_OK; | ||
| 1472 | -} | ||
| 1473 | - | ||
| 1474 | -Result MmcMetaManager::CopyBlob(const std::string &key, const MmcMemObjMetaPtr &objMeta, | ||
| 1475 | - std::unique_lock<std::mutex> &guard, const MmcMemBlobDesc &srcBlob, | ||
| 1476 | const MmcLocation &dstLoc) | 1436 | const MmcLocation &dstLoc) |
| 1477 | { | 1437 | { |
| 1478 | if (objMeta == nullptr) { | 1438 | if (objMeta == nullptr) { |
| @@ -1480,16 +1440,6 @@ Result MmcMetaManager::CopyBlob(const std::string &key, const MmcMemObjMetaPtr & | |||
| 1480 | return MMC_INVALID_PARAM; | 1440 | return MMC_INVALID_PARAM; |
| 1481 | } | 1441 | } |
| 1482 | 1442 | ||
| 1483 | - if (dstLoc.mediaType_ == MEDIA_SSD) { | ||
| 1484 | - return CopyBlobToSsd(key, objMeta, guard, srcBlob, dstLoc); | ||
| 1485 | - } | ||
| 1486 | - return CopyBlobToDram(key, objMeta, guard, srcBlob, dstLoc); | ||
| 1487 | -} | ||
| 1488 | - | ||
| 1489 | -Result MmcMetaManager::CopyBlobAlloc(const std::string &key, const MmcMemObjMetaPtr &objMeta, | ||
| 1490 | - const MmcMemBlobDesc &srcBlob, const MmcLocation &dstLoc, MmcMemBlobPtr &outBlob, | ||
| 1491 | - MmcMemBlobDesc &outDesc) | ||
| 1492 | -{ | ||
| 1493 | std::vector<MmcMemBlobPtr> blobs; | 1443 | std::vector<MmcMemBlobPtr> blobs; |
| 1494 | AllocOptions allocOpt{}; | 1444 | AllocOptions allocOpt{}; |
| 1495 | allocOpt.blobSize_ = srcBlob.size_; | 1445 | allocOpt.blobSize_ = srcBlob.size_; |
| @@ -1506,48 +1456,12 @@ Result MmcMetaManager::CopyBlobAlloc(const std::string &key, const MmcMemObjMeta | |||
| 1506 | MMC_LOG_WARN("alloc failed, ret=" << ret << ", key=" << key); | 1456 | MMC_LOG_WARN("alloc failed, ret=" << ret << ", key=" << key); |
| 1507 | return MMC_MALLOC_FAILED; | 1457 | return MMC_MALLOC_FAILED; |
| 1508 | } | 1458 | } |
| 1509 | - | 1459 | + MmcMemBlobPtr blob = blobs[0]; |
| 1510 | - ret = blobs[0]->UpdateState(key, dstLoc.rank_, 0, MMC_ALLOCATED_OK); | 1460 | + MmcMemBlobDesc blobDesc = blob->GetDesc(); |
| 1511 | - if (ret != MMC_OK) { | ||
| 1512 | - MMC_LOG_ERROR("UpdateState ALLOCATED_OK failed, key=" << key << ", ret=" << ret); | ||
| 1513 | - globalAllocator_->Free(blobs); | ||
| 1514 | - return ret; | ||
| 1515 | - } | ||
| 1516 | - | ||
| 1517 | - ret = objMeta->AddBlob(blobs[0]); | ||
| 1518 | - if (ret != MMC_OK) { | ||
| 1519 | - MMC_LOG_ERROR("AddBlob failed, key=" << key << ", ret=" << ret); | ||
| 1520 | - globalAllocator_->Free(blobs); | ||
| 1521 | - return ret; | ||
| 1522 | - } | ||
| 1523 | - outBlob = blobs[0]; | ||
| 1524 | - outDesc = blobs[0]->GetDesc(); | ||
| 1525 | - MMC_LOG_DEBUG("alloc ok, key=" << key << ", dstRank=" << outDesc.rank_ << ", size=" << outDesc.size_); | ||
| 1526 | - | ||
| 1527 | - { | ||
| 1528 | - std::lock_guard<std::mutex> cbLock(changeCallbacks_.mutex); | ||
| 1529 | - if (changeCallbacks_.stored) { | ||
| 1530 | - changeCallbacks_.stored(key, outDesc.rank_, outDesc.mediaType_); | ||
| 1531 | - } | ||
| 1532 | - } | ||
| 1533 | - return MMC_OK; | ||
| 1534 | -} | ||
| 1535 | - | ||
| 1536 | -Result MmcMetaManager::CopyBlobToDram(const std::string &key, const MmcMemObjMetaPtr &objMeta, | ||
| 1537 | - std::unique_lock<std::mutex> &guard, const MmcMemBlobDesc &srcBlob, | ||
| 1538 | - const MmcLocation &dstLoc) | ||
| 1539 | -{ | ||
| 1540 | - MmcMemBlobPtr blob; | ||
| 1541 | - MmcMemBlobDesc blobDesc; | ||
| 1542 | - Result ret = CopyBlobAlloc(key, objMeta, srcBlob, dstLoc, blob, blobDesc); | ||
| 1543 | - if (ret != MMC_OK) { | ||
| 1544 | - return ret; | ||
| 1545 | - } | ||
| 1546 | 1461 | ||
| 1547 | if (metaNetServer_.Get() == nullptr) { | 1462 | if (metaNetServer_.Get() == nullptr) { |
| 1548 | - MMC_LOG_ERROR("CopyBlobToDram: metaNetServer_ is null, key=" << key); | 1463 | + MMC_LOG_ERROR("metaNetServer_ is null, key=" << key); |
| 1549 | - MmcBlobFilterPtr rbFilter = MmcMakeRef<MmcBlobFilter>(blobDesc.rank_, dstLoc.mediaType_, NONE); | 1464 | + globalAllocator_->Free(blob); |
| 1550 | - objMeta->FreeBlobs(key, globalAllocator_, rbFilter, false); | ||
| 1551 | return MMC_ERROR; | 1465 | return MMC_ERROR; |
| 1552 | } | 1466 | } |
| 1553 | 1467 | ||
| @@ -1558,62 +1472,40 @@ Result MmcMetaManager::CopyBlobToDram(const std::string &key, const MmcMemObjMet | |||
| 1558 | TP_TRACE_END(TP_MMC_META_MOVEBLOB_RPC, ret); | 1472 | TP_TRACE_END(TP_MMC_META_MOVEBLOB_RPC, ret); |
| 1559 | 1473 | ||
| 1560 | if (ret != MMC_OK || response.ret_ != MMC_OK) { | 1474 | if (ret != MMC_OK || response.ret_ != MMC_OK) { |
| 1561 | - MMC_LOG_ERROR("CopyBlobToDram: RPC failed, key=" << key << ", srcRank=" << request.srcBlob_.rank_ | 1475 | + MMC_LOG_ERROR("RPC failed, key=" << key << ", srcRank=" << request.srcBlob_.rank_ << ", dstRank=" |
| 1562 | - << ", dstRank=" << request.dstBlob_.rank_ << ", ret=" << ret | 1476 | + << request.dstBlob_.rank_ << ", ret=" << ret << ", resp=" << response.ret_); |
| 1563 | - << ", resp=" << response.ret_); | 1477 | + globalAllocator_->Free(blob); |
| 1564 | - MmcBlobFilterPtr rbFilter = MmcMakeRef<MmcBlobFilter>(blobDesc.rank_, dstLoc.mediaType_, NONE); | ||
| 1565 | - objMeta->FreeBlobs(key, globalAllocator_, rbFilter, false); | ||
| 1566 | return MMC_ERROR; | 1478 | return MMC_ERROR; |
| 1567 | } | 1479 | } |
| 1568 | 1480 | ||
| 1569 | ret = blob->UpdateState(key, dstLoc.rank_, 0, MMC_WRITE_OK); | 1481 | ret = blob->UpdateState(key, dstLoc.rank_, 0, MMC_WRITE_OK); |
| 1570 | if (ret != MMC_OK) { | 1482 | if (ret != MMC_OK) { |
| 1571 | - MMC_LOG_ERROR("CopyBlobToDram: UpdateState WRITE_OK failed, key=" << key << ", ret=" << ret); | 1483 | + MMC_LOG_ERROR("UpdateState WRITE_OK failed, key=" << key << ", ret=" << ret); |
| 1572 | - MmcBlobFilterPtr rbFilter = MmcMakeRef<MmcBlobFilter>(blobDesc.rank_, dstLoc.mediaType_, NONE); | 1484 | + globalAllocator_->Free(blob); |
| 1573 | - objMeta->FreeBlobs(key, globalAllocator_, rbFilter, false); | ||
| 1574 | return MMC_ERROR; | 1485 | return MMC_ERROR; |
| 1575 | } | 1486 | } |
| 1487 | + | ||
| 1488 | + ret = objMeta->AddBlob(blob); | ||
| 1489 | + if (ret != MMC_OK) { | ||
| 1490 | + MMC_LOG_ERROR("AddBlob failed, key=" << key << ", ret=" << ret); | ||
| 1491 | + globalAllocator_->Free(blob); | ||
| 1492 | + return MMC_ERROR; | ||
| 1493 | + } | ||
| 1494 | + | ||
| 1495 | + { | ||
| 1496 | + std::lock_guard<std::mutex> cbLock(changeCallbacks_.mutex); | ||
| 1497 | + if (changeCallbacks_.stored) { | ||
| 1498 | + changeCallbacks_.stored(key, blobDesc.rank_, blobDesc.mediaType_); | ||
| 1499 | + } | ||
| 1500 | + } | ||
| 1501 | + MMC_LOG_DEBUG("copy ok, key=" << key << ", dstRank=" << blobDesc.rank_ << ", size=" << blobDesc.size_); | ||
| 1576 | return MMC_OK; | 1502 | return MMC_OK; |
| 1577 | } | 1503 | } |
| 1578 | 1504 | ||
| 1579 | -bool MmcMetaManager::HandleMoveBlobExistingDst(const std::string &key, const MmcMemObjMetaPtr &objMeta, | ||
| 1580 | - const MmcLocation &src, const MmcLocation &dst, uint32_t srcRank, | ||
| 1581 | - std::unique_lock<std::mutex> &guard) | ||
| 1582 | -{ | ||
| 1583 | - MmcBlobFilterPtr dstFilter = MmcMakeRef<MmcBlobFilter>(srcRank, dst.mediaType_, NONE); | ||
| 1584 | - if (dstFilter == nullptr) { | ||
| 1585 | - return false; | ||
| 1586 | - } | ||
| 1587 | - std::vector<MmcMemBlobPtr> dstBlobPtrs = objMeta->GetBlobs(dstFilter); | ||
| 1588 | - if (dstBlobPtrs.empty()) { | ||
| 1589 | - return false; | ||
| 1590 | - } | ||
| 1591 | - | ||
| 1592 | - MmcBlobFilterPtr srcFilter = MmcMakeRef<MmcBlobFilter>(src.rank_, src.mediaType_, NONE); | ||
| 1593 | - auto blobs = objMeta->FreeBlobs(key, globalAllocator_, srcFilter); | ||
| 1594 | - MmcLocation dstSameRank{srcRank, dst.mediaType_}; | ||
| 1595 | - MMC_LOG_DEBUG("move " << key << " from " << src << " skipped, dst already exists on " << dstSameRank << ", freed " | ||
| 1596 | - << blobs.size() << " src blobs"); | ||
| 1597 | - if (src.mediaType_ == MEDIA_SSD) { | ||
| 1598 | - MmcMetaMetricManager::GetInstance().IncrementEvictSsdDeleteCounter(srcRank); | ||
| 1599 | - } else { | ||
| 1600 | - MmcMetaMetricManager::GetInstance().IncrementEvictMemDeleteCounter(srcRank); | ||
| 1601 | - } | ||
| 1602 | - guard.unlock(); | ||
| 1603 | - | ||
| 1604 | - metaContainer_->InsertLru(key, dst.mediaType_); | ||
| 1605 | - return true; | ||
| 1606 | -} | ||
| 1607 | - | ||
| 1608 | namespace { | 1505 | namespace { |
| 1609 | 1506 | ||
| 1610 | -struct MoveSrcInfo { | ||
| 1611 | - uint32_t srcRank = 0; | ||
| 1612 | - MmcMemBlobDesc blobDesc; | ||
| 1613 | -}; | ||
| 1614 | - | ||
| 1615 | Result GetMoveBlobSrcDesc(const std::string &key, const MmcMemObjMetaPtr &objMeta, const MmcLocation &src, | 1507 | Result GetMoveBlobSrcDesc(const std::string &key, const MmcMemObjMetaPtr &objMeta, const MmcLocation &src, |
| 1616 | - MoveSrcInfo &outInfo) | 1508 | + MmcMemBlobDesc &outDesc) |
| 1617 | { | 1509 | { |
| 1618 | MmcBlobFilterPtr filter = MmcMakeRef<MmcBlobFilter>(src.rank_, src.mediaType_, READABLE); | 1510 | MmcBlobFilterPtr filter = MmcMakeRef<MmcBlobFilter>(src.rank_, src.mediaType_, READABLE); |
| 1619 | if (filter == nullptr) { | 1511 | if (filter == nullptr) { |
| @@ -1626,8 +1518,7 @@ Result GetMoveBlobSrcDesc(const std::string &key, const MmcMemObjMetaPtr &objMet | |||
| 1626 | MMC_LOG_ERROR("blob for " << src << " is empty with key : " << key << "," << objMeta); | 1518 | MMC_LOG_ERROR("blob for " << src << " is empty with key : " << key << "," << objMeta); |
| 1627 | return MMC_UNMATCHED_KEY; | 1519 | return MMC_UNMATCHED_KEY; |
| 1628 | } | 1520 | } |
| 1629 | - outInfo.srcRank = blobsDesc[0].rank_; | 1521 | + outDesc = blobsDesc[0]; |
| 1630 | - outInfo.blobDesc = blobsDesc[0]; | ||
| 1631 | return MMC_OK; | 1522 | return MMC_OK; |
| 1632 | } | 1523 | } |
| 1633 | 1524 | ||
| @@ -1642,41 +1533,27 @@ Result MmcMetaManager::MoveBlob(const std::string &key, const MmcLocation &src, | |||
| 1642 | } | 1533 | } |
| 1643 | 1534 | ||
| 1644 | TP_TRACE_BEGIN(TP_MMC_META_MOVEBLOB); | 1535 | TP_TRACE_BEGIN(TP_MMC_META_MOVEBLOB); |
| 1645 | - uint32_t srcRank = 0; | ||
| 1646 | { | 1536 | { |
| 1647 | std::unique_lock<std::mutex> guard(objMeta->Mutex()); | 1537 | std::unique_lock<std::mutex> guard(objMeta->Mutex()); |
| 1648 | - MoveSrcInfo srcInfo; | 1538 | + MmcMemBlobDesc srcDesc; |
| 1649 | - Result ret = GetMoveBlobSrcDesc(key, objMeta, src, srcInfo); | 1539 | + Result ret = GetMoveBlobSrcDesc(key, objMeta, src, srcDesc); |
| 1650 | if (ret != MMC_OK) { | 1540 | if (ret != MMC_OK) { |
| 1651 | TP_TRACE_END(TP_MMC_META_MOVEBLOB, ret); | 1541 | TP_TRACE_END(TP_MMC_META_MOVEBLOB, ret); |
| 1652 | return ret; | 1542 | return ret; |
| 1653 | } | 1543 | } |
| 1654 | - srcRank = srcInfo.srcRank; | ||
| 1655 | 1544 | ||
| 1656 | - if (extConfig_.asyncFlushEnabled && dst.mediaType_ == MEDIA_SSD) { | ||
| 1657 | - MmcBlobFilterPtr filter = MmcMakeRef<MmcBlobFilter>(src.rank_, src.mediaType_, NONE); | ||
| 1658 | - if (filter == nullptr) { | ||
| 1659 | - TP_TRACE_END(TP_MMC_META_MOVEBLOB, MMC_MALLOC_FAILED); | ||
| 1660 | - return MMC_MALLOC_FAILED; | ||
| 1661 | - } | ||
| 1662 | - MMC_LOG_DEBUG("async flush enabled, skip SSD copy, key=" << key); | ||
| 1663 | - PushRemoveList(key, objMeta, filter); | ||
| 1664 | - guard.unlock(); | ||
| 1665 | - MmcMetaMetricManager::GetInstance().IncrementEvictMemDeleteCounter(srcRank); | ||
| 1666 | - TP_TRACE_END(TP_MMC_META_MOVEBLOB, MMC_OK); | ||
| 1667 | - return MMC_OK; | ||
| 1668 | - } | ||
| 1669 | - | ||
| 1670 | - if (HandleMoveBlobExistingDst(key, objMeta, src, dst, srcRank, guard)) { | ||
| 1671 | - TP_TRACE_END(TP_MMC_META_MOVEBLOB, MMC_OK); | ||
| 1672 | - return MMC_OK; | ||
| 1673 | - } | ||
| 1674 | - | ||
| 1675 | - MmcLocation dstSameRank{srcRank, dst.mediaType_}; | ||
| 1676 | TP_TRACE_BEGIN(TP_MMC_META_MOVEBLOB_COPY); | 1545 | TP_TRACE_BEGIN(TP_MMC_META_MOVEBLOB_COPY); |
| 1677 | - ret = CopyBlob(key, objMeta, guard, srcInfo.blobDesc, dstSameRank); | 1546 | + ret = CopyBlob(key, objMeta, srcDesc, dst); |
| 1678 | TP_TRACE_END(TP_MMC_META_MOVEBLOB_COPY, ret); | 1547 | TP_TRACE_END(TP_MMC_META_MOVEBLOB_COPY, ret); |
| 1679 | 1548 | ||
| 1549 | + if (ret != MMC_OK) { | ||
| 1550 | + MMC_LOG_WARN("key: " << key << " copy blob failed, ret " << ret); | ||
| 1551 | + guard.unlock(); | ||
| 1552 | + | ||
| 1553 | + TP_TRACE_END(TP_MMC_META_MOVEBLOB, ret); | ||
| 1554 | + return ret; | ||
| 1555 | + } | ||
| 1556 | + | ||
| 1680 | MmcBlobFilterPtr filter = MmcMakeRef<MmcBlobFilter>(src.rank_, src.mediaType_, NONE); | 1557 | MmcBlobFilterPtr filter = MmcMakeRef<MmcBlobFilter>(src.rank_, src.mediaType_, NONE); |
| 1681 | if (filter == nullptr) { | 1558 | if (filter == nullptr) { |
| 1682 | MMC_LOG_ERROR("Fail to malloc filter"); | 1559 | MMC_LOG_ERROR("Fail to malloc filter"); |
| @@ -1684,18 +1561,8 @@ Result MmcMetaManager::MoveBlob(const std::string &key, const MmcLocation &src, | |||
| 1684 | return MMC_MALLOC_FAILED; | 1561 | return MMC_MALLOC_FAILED; |
| 1685 | } | 1562 | } |
| 1686 | 1563 | ||
| 1687 | - if (ret != MMC_OK) { | ||
| 1688 | - MMC_LOG_WARN("key: " << key << " copy blob failed, ret " << ret); | ||
| 1689 | - auto blobs = objMeta->FreeBlobs(key, globalAllocator_, filter); | ||
| 1690 | - guard.unlock(); | ||
| 1691 | - | ||
| 1692 | - TP_TRACE_END(TP_MMC_META_MOVEBLOB, ret); | ||
| 1693 | - return ret; | ||
| 1694 | - } | ||
| 1695 | - | ||
| 1696 | auto blobs = objMeta->FreeBlobs(key, globalAllocator_, filter); | 1564 | auto blobs = objMeta->FreeBlobs(key, globalAllocator_, filter); |
| 1697 | - MMC_LOG_TRACE("move " << key << " from " << src << " to " << dstSameRank << " " << srcInfo.blobDesc << ", " | 1565 | + MMC_LOG_TRACE("move " << key << " from " << src << " to " << dst << " " << srcDesc << ", " << objMeta); |
| 1698 | - << objMeta); | ||
| 1699 | guard.unlock(); | 1566 | guard.unlock(); |
| 1700 | { | 1567 | { |
| 1701 | std::lock_guard<std::mutex> cbLock(changeCallbacks_.mutex); | 1568 | std::lock_guard<std::mutex> cbLock(changeCallbacks_.mutex); |
| @@ -1709,9 +1576,6 @@ Result MmcMetaManager::MoveBlob(const std::string &key, const MmcLocation &src, | |||
| 1709 | } | 1576 | } |
| 1710 | } | 1577 | } |
| 1711 | metaContainer_->InsertLru(key, dst.mediaType_); | 1578 | metaContainer_->InsertLru(key, dst.mediaType_); |
| 1712 | - if (dst.mediaType_ == MEDIA_SSD) { | ||
| 1713 | - MmcMetaMetricManager::GetInstance().IncrementEvictToSsdCounter(srcRank); | ||
| 1714 | - } | ||
| 1715 | TP_TRACE_END(TP_MMC_META_MOVEBLOB, MMC_OK); | 1579 | TP_TRACE_END(TP_MMC_META_MOVEBLOB, MMC_OK); |
| 1716 | return MMC_OK; | 1580 | return MMC_OK; |
| 1717 | } | 1581 | } |
| @@ -1732,7 +1596,7 @@ Result MmcMetaManager::ReplicateBlob(const std::string &key, const MmcLocation & | |||
| 1732 | return MMC_UNMATCHED_KEY; | 1596 | return MMC_UNMATCHED_KEY; |
| 1733 | } | 1597 | } |
| 1734 | 1598 | ||
| 1735 | - return CopyBlob(key, objMeta, guard, blobsDesc[0], loc); | 1599 | + return CopyBlob(key, objMeta, blobsDesc[0], loc); |
| 1736 | } | 1600 | } |
| 1737 | 1601 | ||
| 1738 | namespace { | 1602 | namespace { |
| @@ -1763,83 +1627,43 @@ bool HasRemainingBlobsAfterEvict(const MmcMemObjMetaPtr &objMeta, uint32_t srcRa | |||
| 1763 | } // namespace | 1627 | } // namespace |
| 1764 | 1628 | ||
| 1765 | EvictResult MmcMetaManager::EvictRemoveSrc(const std::string &key, const MmcMemObjMetaPtr &objMeta, | 1629 | EvictResult MmcMetaManager::EvictRemoveSrc(const std::string &key, const MmcMemObjMetaPtr &objMeta, |
| 1766 | - const MmcBlobFilterPtr &srcFilter, uint32_t evictRank, | 1630 | + const MmcBlobFilterPtr &srcFilter, MediaType srcMediaType, |
| 1767 | - MediaType srcMediaType, MediaType dstMedium, bool isSsdDelete) | 1631 | + MediaType dstMedium) |
| 1768 | { | 1632 | { |
| 1769 | PushRemoveList(key, objMeta, srcFilter); | 1633 | PushRemoveList(key, objMeta, srcFilter); |
| 1770 | - if (isSsdDelete) { | ||
| 1771 | - MmcMetaMetricManager::GetInstance().IncrementEvictSsdDeleteCounter(evictRank); | ||
| 1772 | - } else { | ||
| 1773 | - MmcMetaMetricManager::GetInstance().IncrementEvictMemDeleteCounter(evictRank); | ||
| 1774 | - } | ||
| 1775 | return HasRemainingBlobsAfterEvict(objMeta, UINT32_MAX, srcMediaType, dstMedium) ? EvictResult::MOVE_DOWN | 1634 | return HasRemainingBlobsAfterEvict(objMeta, UINT32_MAX, srcMediaType, dstMedium) ? EvictResult::MOVE_DOWN |
| 1776 | : EvictResult::REMOVE; | 1635 | : EvictResult::REMOVE; |
| 1777 | } | 1636 | } |
| 1778 | 1637 | ||
| 1779 | EvictResult MmcMetaManager::EvictRemoveSrc(const std::string &key, const MmcMemObjMetaPtr &objMeta, | 1638 | EvictResult MmcMetaManager::EvictRemoveSrc(const std::string &key, const MmcMemObjMetaPtr &objMeta, |
| 1780 | - MediaType srcMediaType, MediaType dstMedium, bool isSsdDelete) | 1639 | + MediaType srcMediaType, MediaType dstMedium) |
| 1781 | { | 1640 | { |
| 1782 | MmcBlobFilterPtr srcFilter = MmcMakeRef<MmcBlobFilter>(UINT32_MAX, srcMediaType, NONE); | 1641 | MmcBlobFilterPtr srcFilter = MmcMakeRef<MmcBlobFilter>(UINT32_MAX, srcMediaType, NONE); |
| 1783 | if (srcFilter == nullptr) { | 1642 | if (srcFilter == nullptr) { |
| 1784 | MMC_LOG_ERROR("Evict skip key=" << key << " from " << srcMediaType << ", create filter failed"); | 1643 | MMC_LOG_ERROR("Evict skip key=" << key << " from " << srcMediaType << ", create filter failed"); |
| 1785 | return EvictResult::FAIL; | 1644 | return EvictResult::FAIL; |
| 1786 | } | 1645 | } |
| 1787 | - return EvictRemoveSrc(key, objMeta, srcFilter, UINT32_MAX, srcMediaType, dstMedium, isSsdDelete); | 1646 | + return EvictRemoveSrc(key, objMeta, srcFilter, srcMediaType, dstMedium); |
| 1788 | -} | ||
| 1789 | - | ||
| 1790 | -bool MmcMetaManager::HandleEvictSsdBranch(const std::string &key, const MmcMemObjMetaPtr &objMeta, | ||
| 1791 | - const MmcBlobFilterPtr &srcFilter, uint32_t evictRank, MediaType srcMediaType, | ||
| 1792 | - EvictResult &outResult) | ||
| 1793 | -{ | ||
| 1794 | - if (!IsSsdAvailable(evictRank)) { | ||
| 1795 | - outResult = EvictRemoveSrc(key, objMeta, srcFilter, evictRank, srcMediaType, MEDIA_SSD, false); | ||
| 1796 | - return true; | ||
| 1797 | - } | ||
| 1798 | - uint16_t dramWatermark = GetRewarmWatermark(MEDIA_DRAM); | ||
| 1799 | - if (globalAllocator_->IsAboveUsageRatio(MEDIA_DRAM, dramWatermark)) { | ||
| 1800 | - MMC_LOG_DEBUG("Evict REMOVE key=" << key << " from " << srcMediaType << " reason=dram_full_skip_ssd"); | ||
| 1801 | - if (evictRank != UINT32_MAX) { | ||
| 1802 | - MmcBlobFilterPtr ssdFilter = MmcMakeRef<MmcBlobFilter>(evictRank, MEDIA_SSD, NONE); | ||
| 1803 | - if (ssdFilter != nullptr) { | ||
| 1804 | - auto ssdBlobs = objMeta->GetBlobs(ssdFilter); | ||
| 1805 | - if (!ssdBlobs.empty()) { | ||
| 1806 | - ssdBlobs[0]->Backup(key); | ||
| 1807 | - } | ||
| 1808 | - } | ||
| 1809 | - } | ||
| 1810 | - outResult = EvictRemoveSrc(key, objMeta, srcFilter, evictRank, srcMediaType, MEDIA_SSD, false); | ||
| 1811 | - return true; | ||
| 1812 | - } | ||
| 1813 | - return false; | ||
| 1814 | } | 1647 | } |
| 1815 | 1648 | ||
| 1816 | EvictResult MmcMetaManager::DispatchMoveBlob(const std::string &key, const MmcMemObjMetaPtr &objMeta, | 1649 | EvictResult MmcMetaManager::DispatchMoveBlob(const std::string &key, const MmcMemObjMetaPtr &objMeta, |
| 1817 | - const MmcBlobFilterPtr &srcFilter, uint32_t evictRank, | 1650 | + const MmcBlobFilterPtr &srcFilter, const MmcLocation &src, |
| 1818 | - const MmcLocation &src, const MmcLocation &dst, MediaType srcMediaType, | 1651 | + const MmcLocation &dst, MediaType srcMediaType, MediaType dstMedium) |
| 1819 | - MediaType dstMedium) | ||
| 1820 | { | 1652 | { |
| 1821 | auto future = threadPool_->Enqueue( | 1653 | auto future = threadPool_->Enqueue( |
| 1822 | - [this, objMeta, srcFilter](const std::string keyL, const MmcLocation srcL, const MmcLocation dstL, | 1654 | + [this, objMeta, srcFilter](const std::string keyL, const MmcLocation srcL, const MmcLocation dstL) { |
| 1823 | - uint32_t rankL) { | ||
| 1824 | auto ret = MoveBlob(keyL, srcL, dstL); | 1655 | auto ret = MoveBlob(keyL, srcL, dstL); |
| 1825 | if (ret != MMC_OK) { | 1656 | if (ret != MMC_OK) { |
| 1826 | PushRemoveList(keyL, objMeta, srcFilter); | 1657 | PushRemoveList(keyL, objMeta, srcFilter); |
| 1827 | - if (srcL.mediaType_ == MEDIA_SSD) { | ||
| 1828 | - MmcMetaMetricManager::GetInstance().IncrementEvictSsdDeleteCounter(rankL); | ||
| 1829 | - } else { | ||
| 1830 | - MmcMetaMetricManager::GetInstance().IncrementEvictMemDeleteCounter(rankL); | ||
| 1831 | - } | ||
| 1832 | MMC_LOG_WARN("key: " << keyL << " move blob from " << srcL << " to " << dstL | 1658 | MMC_LOG_WARN("key: " << keyL << " move blob from " << srcL << " to " << dstL |
| 1833 | << " not successful: " << ret << ", remove src blob"); | 1659 | << " not successful: " << ret << ", remove src blob"); |
| 1834 | - } else if (dstL.mediaType_ == MEDIA_SSD) { | ||
| 1835 | - TP_TRACE_RECORD(TP_MMC_META_EVICT_SSD_WRITE, 0, 0); | ||
| 1836 | } | 1660 | } |
| 1837 | return ret; | 1661 | return ret; |
| 1838 | }, | 1662 | }, |
| 1839 | - key, src, dst, evictRank); | 1663 | + key, src, dst); |
| 1840 | if (!future.valid()) { | 1664 | if (!future.valid()) { |
| 1841 | MMC_LOG_WARN("key: " << key << " move blob from " << src << " to " << dst << " not successful"); | 1665 | MMC_LOG_WARN("key: " << key << " move blob from " << src << " to " << dst << " not successful"); |
| 1842 | - return EvictRemoveSrc(key, objMeta, srcFilter, evictRank, srcMediaType, dstMedium, false); | 1666 | + return EvictRemoveSrc(key, objMeta, srcFilter, srcMediaType, dstMedium); |
| 1843 | } | 1667 | } |
| 1844 | return EvictResult::MOVE_DOWN; | 1668 | return EvictResult::MOVE_DOWN; |
| 1845 | } | 1669 | } |
| @@ -1866,37 +1690,23 @@ EvictResult MmcMetaManager::EvictCallBackFunction(const std::string &key, const | |||
| 1866 | // READABLE path; skipping would block LRU eviction for every key. | 1690 | // READABLE path; skipping would block LRU eviction for every key. |
| 1867 | MMC_LOG_WARN("Evict ALLOCATED-only key=" << key << " from " << srcMediaType << ", remove unreadable blob"); | 1691 | MMC_LOG_WARN("Evict ALLOCATED-only key=" << key << " from " << srcMediaType << ", remove unreadable blob"); |
| 1868 | TP_TRACE_END(TP_MMC_META_EVICT, MMC_OK); | 1692 | TP_TRACE_END(TP_MMC_META_EVICT, MMC_OK); |
| 1869 | - return EvictRemoveSrc(key, objMeta, srcMediaType, dstMedium, false); | 1693 | + return EvictRemoveSrc(key, objMeta, srcMediaType, dstMedium); |
| 1870 | } | 1694 | } |
| 1871 | uint32_t evictRank = evictBlobs[0].rank_; | 1695 | uint32_t evictRank = evictBlobs[0].rank_; |
| 1872 | MmcMetaMetricManager::GetInstance().IncrementEvictCounter(evictRank); | 1696 | MmcMetaMetricManager::GetInstance().IncrementEvictCounter(evictRank); |
| 1873 | 1697 | ||
| 1874 | - if (dstMedium == MEDIA_NONE) { | ||
| 1875 | - MMC_LOG_DEBUG("Evict REMOVE key=" << key << " from " << srcMediaType << " reason=no_lower_tier"); | ||
| 1876 | - TP_TRACE_END(TP_MMC_META_EVICT, MMC_OK); | ||
| 1877 | - return EvictRemoveSrc(key, objMeta, srcFilter, evictRank, srcMediaType, dstMedium, true); | ||
| 1878 | - } | ||
| 1879 | - | ||
| 1880 | - if (dstMedium == MEDIA_SSD) { | ||
| 1881 | - EvictResult outResult; | ||
| 1882 | - if (HandleEvictSsdBranch(key, objMeta, srcFilter, evictRank, srcMediaType, outResult)) { | ||
| 1883 | - TP_TRACE_END(TP_MMC_META_EVICT, MMC_OK); | ||
| 1884 | - return outResult; | ||
| 1885 | - } | ||
| 1886 | - } | ||
| 1887 | - | ||
| 1888 | uint64_t freeSize = globalAllocator_->GetFreeSpace(dstMedium); | 1698 | uint64_t freeSize = globalAllocator_->GetFreeSpace(dstMedium); |
| 1889 | - if (dstMedium != MEDIA_SSD && freeSize < objMeta->Size()) { | 1699 | + if (freeSize < objMeta->Size()) { |
| 1890 | MMC_LOG_DEBUG("Evict REMOVE key=" << key << " from " << srcMediaType | 1700 | MMC_LOG_DEBUG("Evict REMOVE key=" << key << " from " << srcMediaType |
| 1891 | << " reason=no_space, freeSize=" << freeSize << ", need=" << objMeta->Size()); | 1701 | << " reason=no_space, freeSize=" << freeSize << ", need=" << objMeta->Size()); |
| 1892 | TP_TRACE_END(TP_MMC_META_EVICT, MMC_OK); | 1702 | TP_TRACE_END(TP_MMC_META_EVICT, MMC_OK); |
| 1893 | - return EvictRemoveSrc(key, objMeta, srcFilter, evictRank, srcMediaType, dstMedium, false); | 1703 | + return EvictRemoveSrc(key, objMeta, srcFilter, srcMediaType, dstMedium); |
| 1894 | } | 1704 | } |
| 1895 | 1705 | ||
| 1896 | MmcLocation src{UINT32_MAX, srcMediaType}; | 1706 | MmcLocation src{UINT32_MAX, srcMediaType}; |
| 1897 | MmcLocation dst{UINT32_MAX, dstMedium}; | 1707 | MmcLocation dst{UINT32_MAX, dstMedium}; |
| 1898 | TP_TRACE_END(TP_MMC_META_EVICT, MMC_OK); | 1708 | TP_TRACE_END(TP_MMC_META_EVICT, MMC_OK); |
| 1899 | - return DispatchMoveBlob(key, objMeta, srcFilter, evictRank, src, dst, srcMediaType, dstMedium); | 1709 | + return DispatchMoveBlob(key, objMeta, srcFilter, src, dst, srcMediaType, dstMedium); |
| 1900 | } | 1710 | } |
| 1901 | 1711 | ||
| 1902 | Result MmcMetaManager::RewarmAllocBlob(const std::string &key, const MmcMemBlobDesc &srcDesc, MediaType dstMediaType, | 1712 | Result MmcMetaManager::RewarmAllocBlob(const std::string &key, const MmcMemBlobDesc &srcDesc, MediaType dstMediaType, |
| @@ -34,7 +34,6 @@ namespace mmc { | |||
| 34 | constexpr int METAMGR_POOL_BASE = 16; | 34 | constexpr int METAMGR_POOL_BASE = 16; |
| 35 | constexpr int REWARM_POOL_BASE = 32; | 35 | constexpr int REWARM_POOL_BASE = 32; |
| 36 | constexpr int REMOVE_POOL_BASE = 16; | 36 | constexpr int REMOVE_POOL_BASE = 16; |
| 37 | -constexpr uint16_t DEFAULT_REWARM_HIGH_WATERMARK = 95U; | ||
| 38 | 37 | ||
| 39 | struct MmcMetaChangeCallbacks { | 38 | struct MmcMetaChangeCallbacks { |
| 40 | using Callback = std::function<void(const std::string &key, uint32_t rank, uint16_t mediaType)>; | 39 | using Callback = std::function<void(const std::string &key, uint32_t rank, uint16_t mediaType)>; |
| @@ -121,7 +120,6 @@ struct MmcMemMetaDesc { | |||
| 121 | 120 | ||
| 122 | struct MmcMetaExtConfig { | 121 | struct MmcMetaExtConfig { |
| 123 | bool prefetchEnabled = false; | 122 | bool prefetchEnabled = false; |
| 124 | - bool asyncFlushEnabled = false; | ||
| 125 | uint64_t pendingWaitTimeoutMs = 300U; | 123 | uint64_t pendingWaitTimeoutMs = 300U; |
| 126 | }; | 124 | }; |
| 127 | 125 | ||
| @@ -130,11 +128,11 @@ class MmcMetaManager : public MmcReferable { | |||
| 130 | 128 | ||
| 131 | public: | 129 | public: |
| 132 | explicit MmcMetaManager(uint64_t defaultTtl, uint16_t evictThresholdHigh, uint16_t evictThresholdLow, | 130 | explicit MmcMetaManager(uint64_t defaultTtl, uint16_t evictThresholdHigh, uint16_t evictThresholdLow, |
| 133 | - uint16_t rewarmDramWatermark, const MmcMetaExtConfig &extConfig = {}, | 131 | + const MmcMetaExtConfig &extConfig = {}, uint32_t evictYieldInterval = 0, |
| 134 | - uint32_t evictYieldInterval = 0, uint32_t evictYieldDurationUs = 100) | 132 | + uint32_t evictYieldDurationUs = 100) |
| 135 | : defaultTtlMs_(defaultTtl == 0 ? MMC_DATA_TTL_MS : defaultTtl), evictThresholdHigh_(evictThresholdHigh), | 133 | : defaultTtlMs_(defaultTtl == 0 ? MMC_DATA_TTL_MS : defaultTtl), evictThresholdHigh_(evictThresholdHigh), |
| 136 | - evictThresholdLow_(evictThresholdLow), rewarmDramWatermark_(rewarmDramWatermark), extConfig_(extConfig), | 134 | + evictThresholdLow_(evictThresholdLow), extConfig_(extConfig), evictYieldInterval_(evictYieldInterval), |
| 137 | - evictYieldInterval_(evictYieldInterval), evictYieldDurationUs_(evictYieldDurationUs) | 135 | + evictYieldDurationUs_(evictYieldDurationUs) |
| 138 | {} | 136 | {} |
| 139 | // evictYieldInterval: number of evicted objects between yields (0=disabled, default=0) | 137 | // evictYieldInterval: number of evicted objects between yields (0=disabled, default=0) |
| 140 | // evictYieldDurationUs: sleep duration per yield in microseconds (default=100us) | 138 | // evictYieldDurationUs: sleep duration per yield in microseconds (default=100us) |
| @@ -369,11 +367,6 @@ public: | |||
| 369 | return defaultTtlMs_.load(std::memory_order_relaxed); | 367 | return defaultTtlMs_.load(std::memory_order_relaxed); |
| 370 | } | 368 | } |
| 371 | 369 | ||
| 372 | - uint16_t GetRewarmWatermark(MediaType media) const | ||
| 373 | - { | ||
| 374 | - return rewarmDramWatermark_; | ||
| 375 | - } | ||
| 376 | - | ||
| 377 | std::vector<std::pair<uint16_t, uint16_t>> GetEvictWatermark() const | 370 | std::vector<std::pair<uint16_t, uint16_t>> GetEvictWatermark() const |
| 378 | { | 371 | { |
| 379 | std::vector<std::pair<uint16_t, uint16_t>> result(MEDIA_NONE); | 372 | std::vector<std::pair<uint16_t, uint16_t>> result(MEDIA_NONE); |
| @@ -433,20 +426,8 @@ private: | |||
| 433 | Result TryRewarmForGet(const std::string &key, uint64_t operateId, const MmcMemObjMetaPtr &memObj, | 426 | Result TryRewarmForGet(const std::string &key, uint64_t operateId, const MmcMemObjMetaPtr &memObj, |
| 434 | MmcMemBlobPtr &lowerBlob, std::unique_lock<std::mutex> &guard, MmcMemBlobPtr &selectedBlob); | 427 | MmcMemBlobPtr &lowerBlob, std::unique_lock<std::mutex> &guard, MmcMemBlobPtr &selectedBlob); |
| 435 | 428 | ||
| 436 | - Result CopyBlob(const std::string &key, const MmcMemObjMetaPtr &objMeta, std::unique_lock<std::mutex> &guard, | 429 | + Result CopyBlob(const std::string &key, const MmcMemObjMetaPtr &objMeta, const MmcMemBlobDesc &srcBlob, |
| 437 | - const MmcMemBlobDesc &srcBlob, const MmcLocation &dstLoc); | 430 | + const MmcLocation &dstLoc); |
| 438 | - | ||
| 439 | - Result CopyBlobToSsd(const std::string &key, const MmcMemObjMetaPtr &objMeta, std::unique_lock<std::mutex> &guard, | ||
| 440 | - const MmcMemBlobDesc &srcBlob, const MmcLocation &dstLoc); | ||
| 441 | - | ||
| 442 | - Result CopyBlobAlloc(const std::string &key, const MmcMemObjMetaPtr &objMeta, const MmcMemBlobDesc &srcBlob, | ||
| 443 | - const MmcLocation &dstLoc, MmcMemBlobPtr &outBlob, MmcMemBlobDesc &outDesc); | ||
| 444 | - | ||
| 445 | - Result CopyBlobToDram(const std::string &key, const MmcMemObjMetaPtr &objMeta, std::unique_lock<std::mutex> &guard, | ||
| 446 | - const MmcMemBlobDesc &srcBlob, const MmcLocation &dstLoc); | ||
| 447 | - | ||
| 448 | - bool HandleMoveBlobExistingDst(const std::string &key, const MmcMemObjMetaPtr &objMeta, const MmcLocation &src, | ||
| 449 | - const MmcLocation &dst, uint32_t srcRank, std::unique_lock<std::mutex> &guard); | ||
| 450 | 431 | ||
| 451 | Result RebuildMeta(std::vector<std::pair<std::string, MmcMemBlobDesc>> &blobList); | 432 | Result RebuildMeta(std::vector<std::pair<std::string, MmcMemBlobDesc>> &blobList); |
| 452 | 433 | ||
| @@ -458,18 +439,13 @@ private: | |||
| 458 | EvictResult EvictCallBackFunction(const std::string &key, const MmcMemObjMetaPtr &objMeta, MediaType srcMediaType); | 439 | EvictResult EvictCallBackFunction(const std::string &key, const MmcMemObjMetaPtr &objMeta, MediaType srcMediaType); |
| 459 | 440 | ||
| 460 | EvictResult EvictRemoveSrc(const std::string &key, const MmcMemObjMetaPtr &objMeta, | 441 | EvictResult EvictRemoveSrc(const std::string &key, const MmcMemObjMetaPtr &objMeta, |
| 461 | - const MmcBlobFilterPtr &srcFilter, uint32_t evictRank, MediaType srcMediaType, | 442 | + const MmcBlobFilterPtr &srcFilter, MediaType srcMediaType, MediaType dstMedium); |
| 462 | - MediaType dstMedium, bool isSsdDelete); | ||
| 463 | EvictResult EvictRemoveSrc(const std::string &key, const MmcMemObjMetaPtr &objMeta, MediaType srcMediaType, | 443 | EvictResult EvictRemoveSrc(const std::string &key, const MmcMemObjMetaPtr &objMeta, MediaType srcMediaType, |
| 464 | - MediaType dstMedium, bool isSsdDelete); | 444 | + MediaType dstMedium); |
| 465 | - | ||
| 466 | - bool HandleEvictSsdBranch(const std::string &key, const MmcMemObjMetaPtr &objMeta, | ||
| 467 | - const MmcBlobFilterPtr &srcFilter, uint32_t evictRank, MediaType srcMediaType, | ||
| 468 | - EvictResult &outResult); | ||
| 469 | 445 | ||
| 470 | EvictResult DispatchMoveBlob(const std::string &key, const MmcMemObjMetaPtr &objMeta, | 446 | EvictResult DispatchMoveBlob(const std::string &key, const MmcMemObjMetaPtr &objMeta, |
| 471 | - const MmcBlobFilterPtr &srcFilter, uint32_t evictRank, const MmcLocation &src, | 447 | + const MmcBlobFilterPtr &srcFilter, const MmcLocation &src, const MmcLocation &dst, |
| 472 | - const MmcLocation &dst, MediaType srcMediaType, MediaType dstMedium); | 448 | + MediaType srcMediaType, MediaType dstMedium); |
| 473 | 449 | ||
| 474 | Result BlobDeleteRpc(const std::string &key, const MmcMemBlobDesc &blob); | 450 | Result BlobDeleteRpc(const std::string &key, const MmcMemBlobDesc &blob); |
| 475 | 451 | ||
| @@ -554,7 +530,6 @@ private: | |||
| 554 | std::atomic<uint64_t> defaultTtlMs_; /* default ttl in milliseconds */ | 530 | std::atomic<uint64_t> defaultTtlMs_; /* default ttl in milliseconds */ |
| 555 | std::atomic<uint16_t> evictThresholdHigh_; | 531 | std::atomic<uint16_t> evictThresholdHigh_; |
| 556 | std::atomic<uint16_t> evictThresholdLow_; | 532 | std::atomic<uint16_t> evictThresholdLow_; |
| 557 | - uint16_t rewarmDramWatermark_; | ||
| 558 | MmcMetaExtConfig extConfig_; | 533 | MmcMetaExtConfig extConfig_; |
| 559 | uint32_t evictYieldInterval_; /* GC eviction yield interval (0=disabled) */ | 534 | uint32_t evictYieldInterval_; /* GC eviction yield interval (0=disabled) */ |
| 560 | uint32_t evictYieldDurationUs_; /* GC eviction yield sleep duration in microseconds */ | 535 | uint32_t evictYieldDurationUs_; /* GC eviction yield sleep duration in microseconds */ |
| @@ -107,10 +107,6 @@ MmcMetaMetricManager::MmcMetaMetricManager() | |||
| 107 | unmountSuccessCounter_("memcache_unmount_successes_total", "Total number of Unmount successes"), | 107 | unmountSuccessCounter_("memcache_unmount_successes_total", "Total number of Unmount successes"), |
| 108 | unmountFailureCounter_("memcache_unmount_failures_total", "Total number of Unmount failures"), | 108 | unmountFailureCounter_("memcache_unmount_failures_total", "Total number of Unmount failures"), |
| 109 | evictCounter_("memcache_evict_operations_total", "Total number of eviction operations"), | 109 | evictCounter_("memcache_evict_operations_total", "Total number of eviction operations"), |
| 110 | - evictToSsdCounter_("memcache_evict_to_ssd_total", "Total number of eviction to SSD operations"), | ||
| 111 | - evictSsdDeleteCounter_("memcache_evict_ssd_delete_total", "Total number of SSD eviction delete operations"), | ||
| 112 | - evictMemDeleteCounter_("memcache_evict_mem_delete_total", | ||
| 113 | - "Total number of memory tier eviction delete operations"), | ||
| 114 | rewarmCounter_("memcache_rewarm_total", "Total number of SSD->DRAM rewarm operations"), | 110 | rewarmCounter_("memcache_rewarm_total", "Total number of SSD->DRAM rewarm operations"), |
| 115 | rewarmFailCounter_("memcache_rewarm_failed_total", "Total number of failed SSD->DRAM rewarm operations"), | 111 | rewarmFailCounter_("memcache_rewarm_failed_total", "Total number of failed SSD->DRAM rewarm operations"), |
| 116 | getHitDramCounter_("memcache_get_hits_dram_total", "Total number of Get hits served from DRAM"), | 112 | getHitDramCounter_("memcache_get_hits_dram_total", "Total number of Get hits served from DRAM"), |
| @@ -118,10 +114,8 @@ MmcMetaMetricManager::MmcMetaMetricManager() | |||
| 118 | rewarmBytesCounter_("memcache_rewarm_bytes_total", "Total bytes rewarmed from SSD to DRAM"), | 114 | rewarmBytesCounter_("memcache_rewarm_bytes_total", "Total bytes rewarmed from SSD to DRAM"), |
| 119 | rewarmBytesCurrentGauge_("memcache_rewarm_bytes_current", "Current bytes occupied by rewarmed data"), | 115 | rewarmBytesCurrentGauge_("memcache_rewarm_bytes_current", "Current bytes occupied by rewarmed data"), |
| 120 | keyCountGauge_("memcache_stored_keys", "Current number of stored keys"), | 116 | keyCountGauge_("memcache_stored_keys", "Current number of stored keys"), |
| 121 | - asyncFlushBlobAddedCounter_("memcache_async_flush_blobs_added_total", | 117 | + asyncFlushBlobAddedCounter_("memcache_flush_blobs_total", "Total number of SSD blobs registered via async flush"), |
| 122 | - "Total number of SSD blobs registered via async flush"), | 118 | + asyncFlushBlobBytesCounter_("memcache_flush_bytes_total", "Total bytes flushed to SSD via async flush") |
| 123 | - asyncFlushBlobBytesCounter_("memcache_async_flush_bytes_total", "Total bytes flushed to SSD via async flush"), | ||
| 124 | - asyncFlushWriteCounter_("memcache_async_flush_writes_total", "Total number of async flush SSD write operations") | ||
| 125 | // per-rank counters (pure data, metric names passed at serialization time) | 119 | // per-rank counters (pure data, metric names passed at serialization time) |
| 126 | {} | 120 | {} |
| 127 | 121 | ||
| @@ -187,9 +181,6 @@ MmcMetaMetricSnapshot MmcMetaMetricManager::GetSnapshot() const | |||
| 187 | snapshot.unmountSuccessCount = static_cast<uint64_t>(unmountSuccessCounter_.value()); | 181 | snapshot.unmountSuccessCount = static_cast<uint64_t>(unmountSuccessCounter_.value()); |
| 188 | snapshot.unmountFailureCount = static_cast<uint64_t>(unmountFailureCounter_.value()); | 182 | snapshot.unmountFailureCount = static_cast<uint64_t>(unmountFailureCounter_.value()); |
| 189 | snapshot.evictCount = static_cast<uint64_t>(evictCounter_.value()); | 183 | snapshot.evictCount = static_cast<uint64_t>(evictCounter_.value()); |
| 190 | - snapshot.evictToSsdCount = static_cast<uint64_t>(evictToSsdCounter_.value()); | ||
| 191 | - snapshot.evictSsdDeleteCount = static_cast<uint64_t>(evictSsdDeleteCounter_.value()); | ||
| 192 | - snapshot.evictMemDeleteCount = static_cast<uint64_t>(evictMemDeleteCounter_.value()); | ||
| 193 | snapshot.rewarmCount = static_cast<uint64_t>(rewarmCounter_.value()); | 184 | snapshot.rewarmCount = static_cast<uint64_t>(rewarmCounter_.value()); |
| 194 | snapshot.rewarmFailCount = static_cast<uint64_t>(rewarmFailCounter_.value()); | 185 | snapshot.rewarmFailCount = static_cast<uint64_t>(rewarmFailCounter_.value()); |
| 195 | snapshot.getHitDramCount = static_cast<uint64_t>(getHitDramCounter_.value()); | 186 | snapshot.getHitDramCount = static_cast<uint64_t>(getHitDramCounter_.value()); |
| @@ -199,14 +190,10 @@ MmcMetaMetricSnapshot MmcMetaMetricManager::GetSnapshot() const | |||
| 199 | snapshot.keyCount = static_cast<uint64_t>(keyCountGauge_.value()); | 190 | snapshot.keyCount = static_cast<uint64_t>(keyCountGauge_.value()); |
| 200 | snapshot.asyncFlushBlobAdded = static_cast<uint64_t>(asyncFlushBlobAddedCounter_.value()); | 191 | snapshot.asyncFlushBlobAdded = static_cast<uint64_t>(asyncFlushBlobAddedCounter_.value()); |
| 201 | snapshot.asyncFlushBlobBytes = static_cast<uint64_t>(asyncFlushBlobBytesCounter_.value()); | 192 | snapshot.asyncFlushBlobBytes = static_cast<uint64_t>(asyncFlushBlobBytesCounter_.value()); |
| 202 | - snapshot.asyncFlushWriteCount = static_cast<uint64_t>(asyncFlushWriteCounter_.value()); | ||
| 203 | 193 | ||
| 204 | // per-rank internal counters | 194 | // per-rank internal counters |
| 205 | if (IsPerRankEnabled()) { | 195 | if (IsPerRankEnabled()) { |
| 206 | snapshot.evictCountByRank = evictRankedCounter_.GetRankMap(); | 196 | snapshot.evictCountByRank = evictRankedCounter_.GetRankMap(); |
| 207 | - snapshot.evictToSsdCountByRank = evictToSsdRankedCounter_.GetRankMap(); | ||
| 208 | - snapshot.evictSsdDeleteCountByRank = evictSsdDeleteRankedCounter_.GetRankMap(); | ||
| 209 | - snapshot.evictMemDeleteCountByRank = evictMemDeleteRankedCounter_.GetRankMap(); | ||
| 210 | snapshot.getHitDramCountByRank = getHitDramRankedCounter_.GetRankMap(); | 197 | snapshot.getHitDramCountByRank = getHitDramRankedCounter_.GetRankMap(); |
| 211 | snapshot.getHitSsdCountByRank = getHitSsdRankedCounter_.GetRankMap(); | 198 | snapshot.getHitSsdCountByRank = getHitSsdRankedCounter_.GetRankMap(); |
| 212 | snapshot.rewarmCountByRank = rewarmRankedCounter_.GetRankMap(); | 199 | snapshot.rewarmCountByRank = rewarmRankedCounter_.GetRankMap(); |
| @@ -215,7 +202,6 @@ MmcMetaMetricSnapshot MmcMetaMetricManager::GetSnapshot() const | |||
| 215 | snapshot.rewarmBytesCurrentByRank = rewarmBytesCurrentRankedCounter_.GetRankMap(); | 202 | snapshot.rewarmBytesCurrentByRank = rewarmBytesCurrentRankedCounter_.GetRankMap(); |
| 216 | snapshot.asyncFlushBlobAddedByRank = asyncFlushBlobAddedRankedCounter_.GetRankMap(); | 203 | snapshot.asyncFlushBlobAddedByRank = asyncFlushBlobAddedRankedCounter_.GetRankMap(); |
| 217 | snapshot.asyncFlushBlobBytesByRank = asyncFlushBlobBytesRankedCounter_.GetRankMap(); | 204 | snapshot.asyncFlushBlobBytesByRank = asyncFlushBlobBytesRankedCounter_.GetRankMap(); |
| 218 | - snapshot.asyncFlushWriteCountByRank = asyncFlushWriteRankedCounter_.GetRankMap(); | ||
| 219 | } | 205 | } |
| 220 | 206 | ||
| 221 | return snapshot; | 207 | return snapshot; |
| @@ -242,28 +242,21 @@ struct MmcMetaMetricSnapshot { | |||
| 242 | uint64_t unmountSuccessCount{0}; | 242 | uint64_t unmountSuccessCount{0}; |
| 243 | uint64_t unmountFailureCount{0}; | 243 | uint64_t unmountFailureCount{0}; |
| 244 | // internal global counters | 244 | // internal global counters |
| 245 | - uint64_t evictCount{0}; // total eviction operations | 245 | + uint64_t evictCount{0}; // total eviction operations |
| 246 | - uint64_t evictToSsdCount{0}; // evictions that moved data to SSD | 246 | + uint64_t rewarmCount{0}; // total rewarm operations (SSD->DRAM) |
| 247 | - uint64_t evictSsdDeleteCount{0}; // SSD blob deletions during eviction | 247 | + uint64_t rewarmFailCount{0}; // failed rewarm operations |
| 248 | - uint64_t evictMemDeleteCount{0}; // DRAM/HBM blob deletions during eviction | 248 | + uint64_t getHitDramCount{0}; // Get requests served from DRAM |
| 249 | - uint64_t rewarmCount{0}; // total rewarm operations (SSD->DRAM) | 249 | + uint64_t getHitSsdCount{0}; // Get requests served from SSD (triggered rewarm) |
| 250 | - uint64_t rewarmFailCount{0}; // failed rewarm operations | 250 | + uint64_t rewarmBytesCount{0}; // total bytes rewarmed from SSD to DRAM |
| 251 | - uint64_t getHitDramCount{0}; // Get requests served from DRAM | 251 | + uint64_t rewarmBytesCurrent{0}; // current inflight rewarm bytes |
| 252 | - uint64_t getHitSsdCount{0}; // Get requests served from SSD (triggered rewarm) | 252 | + uint64_t keyCount{0}; // current number of stored keys |
| 253 | - uint64_t rewarmBytesCount{0}; // total bytes rewarmed from SSD to DRAM | 253 | + uint64_t asyncFlushBlobAdded{0}; // SSD blobs successfully registered via async flush callback |
| 254 | - uint64_t rewarmBytesCurrent{0}; // current inflight rewarm bytes | 254 | + uint64_t asyncFlushBlobBytes{0}; // total bytes flushed via async flush |
| 255 | - uint64_t keyCount{0}; // current number of stored keys | ||
| 256 | - uint64_t asyncFlushBlobAdded{0}; // SSD blobs successfully registered via async flush callback | ||
| 257 | - uint64_t asyncFlushBlobBytes{0}; // total bytes flushed via async flush | ||
| 258 | - uint64_t asyncFlushWriteCount{0}; // async flush SSD write operations | ||
| 259 | 255 | ||
| 260 | // per-rank internal counters: key = rank ID, value = counter value | 256 | // per-rank internal counters: key = rank ID, value = counter value |
| 261 | // Only populated when MMC_ENABLE_PER_RANK_METRICS is enabled. | 257 | // Only populated when MMC_ENABLE_PER_RANK_METRICS is enabled. |
| 262 | - std::unordered_map<uint32_t, uint64_t> evictCountByRank; // eviction operations per rank | 258 | + std::unordered_map<uint32_t, uint64_t> evictCountByRank; // eviction operations per rank |
| 263 | - std::unordered_map<uint32_t, uint64_t> evictToSsdCountByRank; // evictions to SSD per rank | 259 | + std::unordered_map<uint32_t, uint64_t> getHitDramCountByRank; // Get requests that hit DRAM per rank |
| 264 | - std::unordered_map<uint32_t, uint64_t> evictSsdDeleteCountByRank; // SSD blob deletions on eviction per rank | ||
| 265 | - std::unordered_map<uint32_t, uint64_t> evictMemDeleteCountByRank; // DRAM/HBM blob deletions on eviction per rank | ||
| 266 | - std::unordered_map<uint32_t, uint64_t> getHitDramCountByRank; // Get requests that hit DRAM per rank | ||
| 267 | // Get requests that hit SSD (triggered rewarm) per rank | 260 | // Get requests that hit SSD (triggered rewarm) per rank |
| 268 | std::unordered_map<uint32_t, uint64_t> getHitSsdCountByRank; | 261 | std::unordered_map<uint32_t, uint64_t> getHitSsdCountByRank; |
| 269 | std::unordered_map<uint32_t, uint64_t> rewarmCountByRank; // rewarm operations per rank | 262 | std::unordered_map<uint32_t, uint64_t> rewarmCountByRank; // rewarm operations per rank |
| @@ -272,8 +265,6 @@ struct MmcMetaMetricSnapshot { | |||
| 272 | std::unordered_map<uint32_t, uint64_t> rewarmBytesCurrentByRank; // current inflight rewarm bytes per rank | 265 | std::unordered_map<uint32_t, uint64_t> rewarmBytesCurrentByRank; // current inflight rewarm bytes per rank |
| 273 | std::unordered_map<uint32_t, uint64_t> asyncFlushBlobAddedByRank; // SSD blobs added via async flush per rank | 266 | std::unordered_map<uint32_t, uint64_t> asyncFlushBlobAddedByRank; // SSD blobs added via async flush per rank |
| 274 | std::unordered_map<uint32_t, uint64_t> asyncFlushBlobBytesByRank; // bytes flushed via async flush per rank | 267 | std::unordered_map<uint32_t, uint64_t> asyncFlushBlobBytesByRank; // bytes flushed via async flush per rank |
| 275 | - // async flush SSD write operations per rank | ||
| 276 | - std::unordered_map<uint32_t, uint64_t> asyncFlushWriteCountByRank; | ||
| 277 | }; | 268 | }; |
| 278 | 269 | ||
| 279 | class MmcMetaMetricManager { | 270 | class MmcMetaMetricManager { |
| @@ -314,39 +305,6 @@ public: | |||
| 314 | evictRankedCounter_.Increment(rank); | 305 | evictRankedCounter_.Increment(rank); |
| 315 | } | 306 | } |
| 316 | } | 307 | } |
| 317 | - void IncrementEvictToSsdCounter() | ||
| 318 | - { | ||
| 319 | - evictToSsdCounter_++; | ||
| 320 | - } | ||
| 321 | - void IncrementEvictToSsdCounter(uint32_t rank) | ||
| 322 | - { | ||
| 323 | - IncrementEvictToSsdCounter(); | ||
| 324 | - if (IsPerRankEnabled()) { | ||
| 325 | - evictToSsdRankedCounter_.Increment(rank); | ||
| 326 | - } | ||
| 327 | - } | ||
| 328 | - void IncrementEvictSsdDeleteCounter() | ||
| 329 | - { | ||
| 330 | - evictSsdDeleteCounter_++; | ||
| 331 | - } | ||
| 332 | - void IncrementEvictSsdDeleteCounter(uint32_t rank) | ||
| 333 | - { | ||
| 334 | - IncrementEvictSsdDeleteCounter(); | ||
| 335 | - if (IsPerRankEnabled()) { | ||
| 336 | - evictSsdDeleteRankedCounter_.Increment(rank); | ||
| 337 | - } | ||
| 338 | - } | ||
| 339 | - void IncrementEvictMemDeleteCounter() | ||
| 340 | - { | ||
| 341 | - evictMemDeleteCounter_++; | ||
| 342 | - } | ||
| 343 | - void IncrementEvictMemDeleteCounter(uint32_t rank) | ||
| 344 | - { | ||
| 345 | - IncrementEvictMemDeleteCounter(); | ||
| 346 | - if (IsPerRankEnabled()) { | ||
| 347 | - evictMemDeleteRankedCounter_.Increment(rank); | ||
| 348 | - } | ||
| 349 | - } | ||
| 350 | void IncrementGetHitDramCounter() | 308 | void IncrementGetHitDramCounter() |
| 351 | { | 309 | { |
| 352 | getHitDramCounter_++; | 310 | getHitDramCounter_++; |
| @@ -433,13 +391,6 @@ public: | |||
| 433 | asyncFlushBlobBytesRankedCounter_.Increment(rank, bytes); | 391 | asyncFlushBlobBytesRankedCounter_.Increment(rank, bytes); |
| 434 | } | 392 | } |
| 435 | } | 393 | } |
| 436 | - void IncrementAsyncFlushWriteCount(uint32_t rank) | ||
| 437 | - { | ||
| 438 | - asyncFlushWriteCounter_++; | ||
| 439 | - if (IsPerRankEnabled()) { | ||
| 440 | - asyncFlushWriteRankedCounter_.Increment(rank); | ||
| 441 | - } | ||
| 442 | - } | ||
| 443 | void SetKeyCount(const size_t count) | 394 | void SetKeyCount(const size_t count) |
| 444 | { | 395 | { |
| 445 | keyCountGauge_ = static_cast<int64_t>(count); | 396 | keyCountGauge_ = static_cast<int64_t>(count); |
| @@ -512,9 +463,6 @@ private: | |||
| 512 | prometheus::simpleapi::counter_metric_t unmountSuccessCounter_; | 463 | prometheus::simpleapi::counter_metric_t unmountSuccessCounter_; |
| 513 | prometheus::simpleapi::counter_metric_t unmountFailureCounter_; | 464 | prometheus::simpleapi::counter_metric_t unmountFailureCounter_; |
| 514 | prometheus::simpleapi::counter_metric_t evictCounter_; | 465 | prometheus::simpleapi::counter_metric_t evictCounter_; |
| 515 | - prometheus::simpleapi::counter_metric_t evictToSsdCounter_; | ||
| 516 | - prometheus::simpleapi::counter_metric_t evictSsdDeleteCounter_; | ||
| 517 | - prometheus::simpleapi::counter_metric_t evictMemDeleteCounter_; | ||
| 518 | prometheus::simpleapi::counter_metric_t rewarmCounter_; | 466 | prometheus::simpleapi::counter_metric_t rewarmCounter_; |
| 519 | prometheus::simpleapi::counter_metric_t rewarmFailCounter_; | 467 | prometheus::simpleapi::counter_metric_t rewarmFailCounter_; |
| 520 | prometheus::simpleapi::counter_metric_t getHitDramCounter_; | 468 | prometheus::simpleapi::counter_metric_t getHitDramCounter_; |
| @@ -543,9 +491,6 @@ private: | |||
| 543 | 491 | ||
| 544 | // per-rank internal counters (eviction + rewarm) | 492 | // per-rank internal counters (eviction + rewarm) |
| 545 | SimplePerRankCounter evictRankedCounter_; | 493 | SimplePerRankCounter evictRankedCounter_; |
| 546 | - SimplePerRankCounter evictToSsdRankedCounter_; | ||
| 547 | - SimplePerRankCounter evictSsdDeleteRankedCounter_; | ||
| 548 | - SimplePerRankCounter evictMemDeleteRankedCounter_; | ||
| 549 | SimplePerRankCounter getHitDramRankedCounter_; | 494 | SimplePerRankCounter getHitDramRankedCounter_; |
| 550 | SimplePerRankCounter getHitSsdRankedCounter_; | 495 | SimplePerRankCounter getHitSsdRankedCounter_; |
| 551 | SimplePerRankCounter rewarmRankedCounter_; | 496 | SimplePerRankCounter rewarmRankedCounter_; |
| @@ -556,8 +501,6 @@ private: | |||
| 556 | prometheus::simpleapi::counter_metric_t asyncFlushBlobBytesCounter_; | 501 | prometheus::simpleapi::counter_metric_t asyncFlushBlobBytesCounter_; |
| 557 | SimplePerRankCounter asyncFlushBlobAddedRankedCounter_; | 502 | SimplePerRankCounter asyncFlushBlobAddedRankedCounter_; |
| 558 | SimplePerRankCounter asyncFlushBlobBytesRankedCounter_; | 503 | SimplePerRankCounter asyncFlushBlobBytesRankedCounter_; |
| 559 | - prometheus::simpleapi::counter_metric_t asyncFlushWriteCounter_; | ||
| 560 | - SimplePerRankCounter asyncFlushWriteRankedCounter_; | ||
| 561 | }; | 504 | }; |
| 562 | 505 | ||
| 563 | } // namespace mmc | 506 | } // namespace mmc |
| @@ -341,7 +341,8 @@ Result MmcMetaMgrProxy::BatchGet(const BatchGetRequest &req, BatchAllocResponse | |||
| 341 | metricManager.IncrementRequestCounter(RestMetricType::GET, rank); | 341 | metricManager.IncrementRequestCounter(RestMetricType::GET, rank); |
| 342 | auto &objMeta = objMetas[i]; | 342 | auto &objMeta = objMetas[i]; |
| 343 | if (objMeta.numBlobs_ == 0 || objMeta.blobs_.empty() || HasSsdBlob(objMeta, req.keys_[i], "BatchGet")) { | 343 | if (objMeta.numBlobs_ == 0 || objMeta.blobs_.empty() || HasSsdBlob(objMeta, req.keys_[i], "BatchGet")) { |
| 344 | - MMC_LOG_WARN("BatchGet key: " << req.keys_[i] << " no blob found, numBlobs: " << objMeta.numBlobs_ | 344 | + MMC_LOG_WARN("BatchGet key: " << req.keys_[i] << " no blob found, numBlobs: " |
| 345 | + << static_cast<unsigned int>(objMeta.numBlobs_) | ||
| 345 | << ", blobs.size: " << objMeta.blobs_.size()); | 346 | << ", blobs.size: " << objMeta.blobs_.size()); |
| 346 | resp.numBlobs_[i] = 0; | 347 | resp.numBlobs_[i] = 0; |
| 347 | resp.blobs_[i] = {}; | 348 | resp.blobs_[i] = {}; |
| @@ -34,7 +34,7 @@ public: | |||
| 34 | ~MmcMetaMgrProxy() override = default; | 34 | ~MmcMetaMgrProxy() override = default; |
| 35 | 35 | ||
| 36 | Result Start(uint64_t leaseTtl, uint16_t evictThresholdHigh, uint16_t evictThresholdLow, | 36 | Result Start(uint64_t leaseTtl, uint16_t evictThresholdHigh, uint16_t evictThresholdLow, |
| 37 | - uint16_t rewarmDramWatermark, const MmcMetaExtConfig &extConfig = {}, uint32_t evictYieldInterval = 0, | 37 | + const MmcMetaExtConfig &extConfig = {}, uint32_t evictYieldInterval = 0, |
| 38 | uint32_t evictYieldDurationUs = 100) | 38 | uint32_t evictYieldDurationUs = 100) |
| 39 | { | 39 | { |
| 40 | std::lock_guard<std::mutex> guard(mutex_); | 40 | std::lock_guard<std::mutex> guard(mutex_); |
| @@ -42,9 +42,8 @@ public: | |||
| 42 | MMC_LOG_TRACE("MmcMetaMgrProxyDefault already started"); | 42 | MMC_LOG_TRACE("MmcMetaMgrProxyDefault already started"); |
| 43 | return MMC_OK; | 43 | return MMC_OK; |
| 44 | } | 44 | } |
| 45 | - metaMangerPtr_ = | 45 | + metaMangerPtr_ = MmcMakeRef<MmcMetaManager>(leaseTtl, evictThresholdHigh, evictThresholdLow, extConfig, |
| 46 | - MmcMakeRef<MmcMetaManager>(leaseTtl, evictThresholdHigh, evictThresholdLow, rewarmDramWatermark, extConfig, | 46 | + evictYieldInterval, evictYieldDurationUs); |
| 47 | - evictYieldInterval, evictYieldDurationUs); | ||
| 48 | if (metaMangerPtr_ == nullptr) { | 47 | if (metaMangerPtr_ == nullptr) { |
| 49 | MMC_LOG_ERROR("new object failed, probably out of memory"); | 48 | MMC_LOG_ERROR("new object failed, probably out of memory"); |
| 50 | return MMC_NEW_OBJECT_FAILED; | 49 | return MMC_NEW_OBJECT_FAILED; |
| @@ -11,6 +11,7 @@ | |||
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | + | ||
| 14 | 15 | ||
| 15 | 16 | ||
| 16 | 17 | ||
| @@ -20,6 +21,7 @@ | |||
| 20 | 21 | ||
| 21 | 22 | ||
| 22 | 23 | ||
| 24 | + | ||
| 23 | 25 | ||
| 24 | 26 | ||
| 25 | 27 | ||
| @@ -55,6 +57,18 @@ Result MmcMetaService::Start(const mmc_meta_service_config_t &options) | |||
| 55 | MMC_VALIDATE_RETURN(options.evictThresholdHigh > options.evictThresholdLow, | 57 | MMC_VALIDATE_RETURN(options.evictThresholdHigh > options.evictThresholdLow, |
| 56 | "invalid param, evictThresholdHigh must large than evictThresholdLow", MMC_INVALID_PARAM); | 58 | "invalid param, evictThresholdHigh must large than evictThresholdLow", MMC_INVALID_PARAM); |
| 57 | options_.leaseTtlMs = options.leaseTtlMs == 0 ? MMC_DATA_TTL_MS : options.leaseTtlMs; | 59 | options_.leaseTtlMs = options.leaseTtlMs == 0 ? MMC_DATA_TTL_MS : options.leaseTtlMs; |
| 60 | + MMC_VALIDATE_RETURN(options.asyncFlushIntervalMs >= MIN_FLUSH_INTERVAL_MS && | ||
| 61 | + options.asyncFlushIntervalMs <= MAX_FLUSH_INTERVAL_MS, | ||
| 62 | + "invalid param, asyncFlushIntervalMs must be in range [" + | ||
| 63 | + std::to_string(MIN_FLUSH_INTERVAL_MS) + ", " + std::to_string(MAX_FLUSH_INTERVAL_MS) + "]", | ||
| 64 | + MMC_INVALID_PARAM); | ||
| 65 | + options_.asyncFlushIntervalMs = options.asyncFlushIntervalMs; | ||
| 66 | + MMC_VALIDATE_RETURN(options.asyncFlushBatchLimit >= MIN_FLUSH_BATCH_LIMIT && | ||
| 67 | + options.asyncFlushBatchLimit <= MAX_FLUSH_BATCH_LIMIT, | ||
| 68 | + "invalid param, asyncFlushBatchLimit must be in range [" + | ||
| 69 | + std::to_string(MIN_FLUSH_BATCH_LIMIT) + ", " + std::to_string(MAX_FLUSH_BATCH_LIMIT) + "]", | ||
| 70 | + MMC_INVALID_PARAM); | ||
| 71 | + options_.asyncFlushBatchLimit = options.asyncFlushBatchLimit; | ||
| 58 | MMC_VALIDATE_RETURN(options_.leaseTtlMs > 0, "invalid param, leaseTtlMs must be greater than 0", MMC_INVALID_PARAM); | 72 | MMC_VALIDATE_RETURN(options_.leaseTtlMs > 0, "invalid param, leaseTtlMs must be greater than 0", MMC_INVALID_PARAM); |
| 59 | 73 | ||
| 60 | metaNetServer_ = MmcMakeRef<MetaNetServer>(this, name_ + "_MetaServer").Get(); | 74 | metaNetServer_ = MmcMakeRef<MetaNetServer>(this, name_ + "_MetaServer").Get(); |
| @@ -74,31 +88,27 @@ Result MmcMetaService::Start(const mmc_meta_service_config_t &options) | |||
| 74 | metaMgrProxy_ = MmcMakeRef<MmcMetaMgrProxy>(metaNetServer_).Get(); | 88 | metaMgrProxy_ = MmcMakeRef<MmcMetaMgrProxy>(metaNetServer_).Get(); |
| 75 | MmcMetaExtConfig extConfig{}; | 89 | MmcMetaExtConfig extConfig{}; |
| 76 | extConfig.prefetchEnabled = options.prefetchEnabled; | 90 | extConfig.prefetchEnabled = options.prefetchEnabled; |
| 77 | - extConfig.asyncFlushEnabled = options_.asyncFlushEnabled; | ||
| 78 | extConfig.pendingWaitTimeoutMs = options_.pendingWaitTimeoutMs; | 91 | extConfig.pendingWaitTimeoutMs = options_.pendingWaitTimeoutMs; |
| 79 | MMC_RETURN_ERROR(metaMgrProxy_->Start(options_.leaseTtlMs, options.evictThresholdHigh, options.evictThresholdLow, | 92 | MMC_RETURN_ERROR(metaMgrProxy_->Start(options_.leaseTtlMs, options.evictThresholdHigh, options.evictThresholdLow, |
| 80 | - options.rewarmDramWatermark, extConfig, options.evictYieldInterval, | 93 | + extConfig, options.evictYieldInterval, options.evictYieldDurationUs), |
| 81 | - options.evictYieldDurationUs), | ||
| 82 | "Failed to start meta mgr proxy of meta service " << name_); | 94 | "Failed to start meta mgr proxy of meta service " << name_); |
| 83 | 95 | ||
| 84 | metaBackUpMgrPtr_ = MMCMetaBackUpMgrFactory::GetInstance("DefaultMetaBackup"); | 96 | metaBackUpMgrPtr_ = MMCMetaBackUpMgrFactory::GetInstance("DefaultMetaBackup"); |
| 85 | auto backupConf = MmcMakeRef<MMCMetaBackUpConfDefault>(metaNetServer_); | 97 | auto backupConf = MmcMakeRef<MMCMetaBackUpConfDefault>(metaNetServer_); |
| 86 | MMC_ASSERT_LOG_AND_RETURN(backupConf.Get() != nullptr, "backupConf.Get() is nullptr", MMC_MALLOC_FAILED); | 98 | MMC_ASSERT_LOG_AND_RETURN(backupConf.Get() != nullptr, "backupConf.Get() is nullptr", MMC_MALLOC_FAILED); |
| 87 | MMC_ASSERT_LOG_AND_RETURN(metaBackUpMgrPtr_ != nullptr, "metaBackUpMgrPtr_ is nullptr", MMC_MALLOC_FAILED); | 99 | MMC_ASSERT_LOG_AND_RETURN(metaBackUpMgrPtr_ != nullptr, "metaBackUpMgrPtr_ is nullptr", MMC_MALLOC_FAILED); |
| 88 | - // async flush 复用 backup 通道,可独立拉起,不再要求 HA/backup 同时开启 | 100 | + // backup 通道默认启动,服务于异步刷盘和 Rewarm |
| 89 | - if (options_.haEnable || options_.backupEnable || options_.asyncFlushEnabled) { | 101 | + MMC_LOG_TRACE("Meta backup channel starting, ha=" << options_.haEnable |
| 90 | - MMC_LOG_TRACE("Meta backup channel starting, ha=" << options_.haEnable << ", backup=" << options_.backupEnable | 102 | + << ", async_flush_interval=" << options_.asyncFlushIntervalMs); |
| 91 | - << ", async_flush=" << options_.asyncFlushEnabled); | 103 | + backupConf->Setup( |
| 92 | - backupConf->Setup( | 104 | + options.asyncFlushIntervalMs, options.asyncFlushBatchLimit, |
| 93 | - options.asyncFlushIntervalMs, options.asyncFlushBatchLimit, options.asyncFlushEnabled, | 105 | + std::bind(&MmcMetaService::IsSsdAvailable, this, std::placeholders::_1), |
| 94 | - std::bind(&MmcMetaService::IsSsdAvailable, this, std::placeholders::_1), | 106 | + std::bind(&MmcMetaService::OnAsyncFlushComplete, this, std::placeholders::_1, std::placeholders::_2)); |
| 95 | - std::bind(&MmcMetaService::OnAsyncFlushComplete, this, std::placeholders::_1, std::placeholders::_2)); | 107 | + if (metaMgrProxy_ != nullptr && metaMgrProxy_->GetMetaManager() != nullptr) { |
| 96 | - if (options.asyncFlushEnabled && metaMgrProxy_ != nullptr && metaMgrProxy_->GetMetaManager() != nullptr) { | 108 | + backupConf->rewarmPool_ = metaMgrProxy_->GetMetaManager()->GetRewarmThreadPool(); |
| 97 | - backupConf->rewarmPool_ = metaMgrProxy_->GetMetaManager()->GetRewarmThreadPool(); | ||
| 98 | - } | ||
| 99 | - MMCMetaBackUpConfPtr defaultPtr = Convert<MMCMetaBackUpConfDefault, MMCMetaBackUpConf>(backupConf); | ||
| 100 | - MMC_RETURN_ERROR(metaBackUpMgrPtr_->Start(defaultPtr), "metaBackUpMgr start failed"); | ||
| 101 | } | 109 | } |
| 110 | + MMCMetaBackUpConfPtr defaultPtr = Convert<MMCMetaBackUpConfDefault, MMCMetaBackUpConf>(backupConf); | ||
| 111 | + MMC_RETURN_ERROR(metaBackUpMgrPtr_->Start(defaultPtr), "metaBackUpMgr start failed"); | ||
| 102 | 112 | ||
| 103 | NetEngineOptions configStoreOpt{}; | 113 | NetEngineOptions configStoreOpt{}; |
| 104 | // etcd:// 等分布式后端由 MF 侧解析,此处仅解析 tcp/http/https。 | 114 | // etcd:// 等分布式后端由 MF 侧解析,此处仅解析 tcp/http/https。 |
| @@ -441,9 +451,6 @@ void MmcMetaService::OnAsyncFlushComplete(uint32_t rank, | |||
| 441 | metaMgrProxy_->GetMetaManager()->AddSsdBlob(key, desc); | 451 | metaMgrProxy_->GetMetaManager()->AddSsdBlob(key, desc); |
| 442 | metricMgr.IncrementAsyncFlushBlobAdded(rank, desc.size_); | 452 | metricMgr.IncrementAsyncFlushBlobAdded(rank, desc.size_); |
| 443 | } | 453 | } |
| 444 | - if (!blobs.empty()) { | ||
| 445 | - metricMgr.IncrementAsyncFlushWriteCount(rank); | ||
| 446 | - } | ||
| 447 | } | 454 | } |
| 448 | } | 455 | } |
| 449 | 456 | ||
| @@ -243,12 +243,6 @@ int MmcMetaServiceProcess::ValidateConfig() const | |||
| 243 | std::cerr << "Invalid log level." << std::endl; | 243 | std::cerr << "Invalid log level." << std::endl; |
| 244 | return -1; | 244 | return -1; |
| 245 | } | 245 | } |
| 246 | - if (config_.rewarmDramWatermark <= config_.evictThresholdHigh) { | ||
| 247 | - std::cerr << "Invalid dram watermark, 'ock.mmc.rewarm.dram_watermark' should be greater than " | ||
| 248 | - "'ock.mmc.evict_threshold_high'." | ||
| 249 | - << std::endl; | ||
| 250 | - return -1; | ||
| 251 | - } | ||
| 252 | if (MetaServiceConfig::ValidateTLSConfig(config_.accTlsConfig) != MMC_OK) { | 246 | if (MetaServiceConfig::ValidateTLSConfig(config_.accTlsConfig) != MMC_OK) { |
| 253 | std::cerr << "Invalid tls config." << std::endl; | 247 | std::cerr << "Invalid tls config." << std::endl; |
| 254 | return -1; | 248 | return -1; |
| @@ -688,20 +688,16 @@ Result MmcRestApiFacade::BuildMetricsSummary(bool serviceReady, std::string &res | |||
| 688 | } | 688 | } |
| 689 | 689 | ||
| 690 | std::ostringstream oss; | 690 | std::ostringstream oss; |
| 691 | - oss << "keys=" << keys.size() << " evict=" << metricSnapshot.evictCount | 691 | + oss << "keys=" << keys.size() << " evict=" << metricSnapshot.evictCount << " rewarm=" << metricSnapshot.rewarmCount |
| 692 | - << " evict_to_ssd=" << metricSnapshot.evictToSsdCount | ||
| 693 | - << " evict_ssd_delete=" << metricSnapshot.evictSsdDeleteCount | ||
| 694 | - << " evict_mem_delete=" << metricSnapshot.evictMemDeleteCount << " rewarm=" << metricSnapshot.rewarmCount | ||
| 695 | << " rewarm_fail=" << metricSnapshot.rewarmFailCount | 692 | << " rewarm_fail=" << metricSnapshot.rewarmFailCount |
| 696 | << " rewarm_bytes_total=" << metricSnapshot.rewarmBytesCount | 693 | << " rewarm_bytes_total=" << metricSnapshot.rewarmBytesCount |
| 697 | << " rewarm_bytes_current=" << metricSnapshot.rewarmBytesCurrent | 694 | << " rewarm_bytes_current=" << metricSnapshot.rewarmBytesCurrent |
| 698 | - << " async_flush_blobs_added=" << metricSnapshot.asyncFlushBlobAdded | 695 | + << " flush_blobs=" << metricSnapshot.asyncFlushBlobAdded |
| 699 | - << " async_flush_bytes=" << metricSnapshot.asyncFlushBlobBytes | 696 | + << " flush_bytes=" << metricSnapshot.asyncFlushBlobBytes << " get_hit_dram=" << metricSnapshot.getHitDramCount |
| 700 | - << " async_flush_writes=" << metricSnapshot.asyncFlushWriteCount | 697 | + << " get_hit_ssd=" << metricSnapshot.getHitSsdCount << " hbm_used=" << BuildUsedText(hbmUsage) |
| 701 | - << " get_hit_dram=" << metricSnapshot.getHitDramCount << " get_hit_ssd=" << metricSnapshot.getHitSsdCount | 698 | + << " dram_used=" << BuildUsedText(dramUsage) << " ssd_used=" << BuildUsedText(ssdUsage) |
| 702 | - << " hbm_used=" << BuildUsedText(hbmUsage) << " dram_used=" << BuildUsedText(dramUsage) | 699 | + << " alloc_req=" << metricSnapshot.allocRequestCount << " alloc_success=" << metricSnapshot.allocSuccessCount |
| 703 | - << " ssd_used=" << BuildUsedText(ssdUsage) << " alloc_req=" << metricSnapshot.allocRequestCount | 700 | + << " alloc_fail=" << metricSnapshot.allocFailureCount |
| 704 | - << " alloc_success=" << metricSnapshot.allocSuccessCount << " alloc_fail=" << metricSnapshot.allocFailureCount | ||
| 705 | << " batch_alloc_req=" << metricSnapshot.batchAllocRequestCount | 701 | << " batch_alloc_req=" << metricSnapshot.batchAllocRequestCount |
| 706 | << " batch_alloc_success=" << metricSnapshot.batchAllocSuccessCount | 702 | << " batch_alloc_success=" << metricSnapshot.batchAllocSuccessCount |
| 707 | << " batch_alloc_fail=" << metricSnapshot.batchAllocFailureCount | 703 | << " batch_alloc_fail=" << metricSnapshot.batchAllocFailureCount |
| @@ -754,18 +750,14 @@ Result MmcRestApiFacade::BuildMetricsSummary(bool serviceReady, std::string &res | |||
| 754 | << " unmount_fail=" << metricSnapshot.unmountFailureCount; | 750 | << " unmount_fail=" << metricSnapshot.unmountFailureCount; |
| 755 | if (MmcMetaMetricManager::IsPerRankEnabled()) { | 751 | if (MmcMetaMetricManager::IsPerRankEnabled()) { |
| 756 | AppendPerRankText(oss, "evict_by_rank", metricSnapshot.evictCountByRank); | 752 | AppendPerRankText(oss, "evict_by_rank", metricSnapshot.evictCountByRank); |
| 757 | - AppendPerRankText(oss, "evict_to_ssd_by_rank", metricSnapshot.evictToSsdCountByRank); | ||
| 758 | - AppendPerRankText(oss, "evict_ssd_delete_by_rank", metricSnapshot.evictSsdDeleteCountByRank); | ||
| 759 | - AppendPerRankText(oss, "evict_mem_delete_by_rank", metricSnapshot.evictMemDeleteCountByRank); | ||
| 760 | AppendPerRankText(oss, "get_hit_dram_by_rank", metricSnapshot.getHitDramCountByRank); | 753 | AppendPerRankText(oss, "get_hit_dram_by_rank", metricSnapshot.getHitDramCountByRank); |
| 761 | AppendPerRankText(oss, "get_hit_ssd_by_rank", metricSnapshot.getHitSsdCountByRank); | 754 | AppendPerRankText(oss, "get_hit_ssd_by_rank", metricSnapshot.getHitSsdCountByRank); |
| 762 | AppendPerRankText(oss, "rewarm_by_rank", metricSnapshot.rewarmCountByRank); | 755 | AppendPerRankText(oss, "rewarm_by_rank", metricSnapshot.rewarmCountByRank); |
| 763 | AppendPerRankText(oss, "rewarm_fail_by_rank", metricSnapshot.rewarmFailCountByRank); | 756 | AppendPerRankText(oss, "rewarm_fail_by_rank", metricSnapshot.rewarmFailCountByRank); |
| 764 | AppendPerRankText(oss, "rewarm_bytes_by_rank", metricSnapshot.rewarmBytesByRank); | 757 | AppendPerRankText(oss, "rewarm_bytes_by_rank", metricSnapshot.rewarmBytesByRank); |
| 765 | AppendPerRankText(oss, "rewarm_bytes_current_by_rank", metricSnapshot.rewarmBytesCurrentByRank); | 758 | AppendPerRankText(oss, "rewarm_bytes_current_by_rank", metricSnapshot.rewarmBytesCurrentByRank); |
| 766 | - AppendPerRankText(oss, "async_flush_blobs_added_by_rank", metricSnapshot.asyncFlushBlobAddedByRank); | 759 | + AppendPerRankText(oss, "flush_blobs_by_rank", metricSnapshot.asyncFlushBlobAddedByRank); |
| 767 | - AppendPerRankText(oss, "async_flush_bytes_by_rank", metricSnapshot.asyncFlushBlobBytesByRank); | 760 | + AppendPerRankText(oss, "flush_bytes_by_rank", metricSnapshot.asyncFlushBlobBytesByRank); |
| 768 | - AppendPerRankText(oss, "async_flush_writes_by_rank", metricSnapshot.asyncFlushWriteCountByRank); | ||
| 769 | } | 761 | } |
| 770 | result = oss.str(); | 762 | result = oss.str(); |
| 771 | return MMC_OK; | 763 | return MMC_OK; |
| @@ -814,16 +806,11 @@ Result MmcRestApiFacade::BuildPrometheusMetrics(bool serviceReady, std::string & | |||
| 814 | // per-rank internal counters (SimplePerRankCounter, not in registry) | 806 | // per-rank internal counters (SimplePerRankCounter, not in registry) |
| 815 | if (MmcMetaMetricManager::IsPerRankEnabled()) { | 807 | if (MmcMetaMetricManager::IsPerRankEnabled()) { |
| 816 | AppendPerRankPrometheus(oss, "memcache_evict_operations_total", metricSnapshot.evictCountByRank); | 808 | AppendPerRankPrometheus(oss, "memcache_evict_operations_total", metricSnapshot.evictCountByRank); |
| 817 | - AppendPerRankPrometheus(oss, "memcache_evict_to_ssd_total", metricSnapshot.evictToSsdCountByRank); | ||
| 818 | - AppendPerRankPrometheus(oss, "memcache_evict_ssd_delete_total", metricSnapshot.evictSsdDeleteCountByRank); | ||
| 819 | - AppendPerRankPrometheus(oss, "memcache_evict_mem_delete_total", metricSnapshot.evictMemDeleteCountByRank); | ||
| 820 | AppendPerRankPrometheus(oss, "memcache_get_hits_dram_total", metricSnapshot.getHitDramCountByRank); | 809 | AppendPerRankPrometheus(oss, "memcache_get_hits_dram_total", metricSnapshot.getHitDramCountByRank); |
| 821 | AppendPerRankPrometheus(oss, "memcache_get_hits_ssd_total", metricSnapshot.getHitSsdCountByRank); | 810 | AppendPerRankPrometheus(oss, "memcache_get_hits_ssd_total", metricSnapshot.getHitSsdCountByRank); |
| 822 | AppendPerRankPrometheus(oss, "memcache_rewarm_total", metricSnapshot.rewarmCountByRank); | 811 | AppendPerRankPrometheus(oss, "memcache_rewarm_total", metricSnapshot.rewarmCountByRank); |
| 823 | - AppendPerRankPrometheus(oss, "memcache_async_flush_blobs_added_total", | 812 | + AppendPerRankPrometheus(oss, "memcache_flush_blobs_total", metricSnapshot.asyncFlushBlobAddedByRank); |
| 824 | - metricSnapshot.asyncFlushBlobAddedByRank); | 813 | + AppendPerRankPrometheus(oss, "memcache_flush_bytes_total", metricSnapshot.asyncFlushBlobBytesByRank); |
| 825 | - AppendPerRankPrometheus(oss, "memcache_async_flush_bytes_total", metricSnapshot.asyncFlushBlobBytesByRank); | ||
| 826 | - AppendPerRankPrometheus(oss, "memcache_async_flush_writes_total", metricSnapshot.asyncFlushWriteCountByRank); | ||
| 827 | AppendPerRankPrometheus(oss, "memcache_rewarm_failed_total", metricSnapshot.rewarmFailCountByRank); | 814 | AppendPerRankPrometheus(oss, "memcache_rewarm_failed_total", metricSnapshot.rewarmFailCountByRank); |
| 828 | AppendPerRankPrometheus(oss, "memcache_rewarm_bytes_total", metricSnapshot.rewarmBytesByRank); | 815 | AppendPerRankPrometheus(oss, "memcache_rewarm_bytes_total", metricSnapshot.rewarmBytesByRank); |
| 829 | AppendPerRankPrometheus(oss, "memcache_rewarm_bytes_current", metricSnapshot.rewarmBytesCurrentByRank); | 816 | AppendPerRankPrometheus(oss, "memcache_rewarm_bytes_current", metricSnapshot.rewarmBytesCurrentByRank); |
| @@ -900,26 +887,14 @@ Result MmcRestApiFacade::BuildPrometheusMetrics(bool serviceReady, std::string & | |||
| 900 | metricSnapshot.unmountSuccessCount, metricSnapshot.unmountFailureCount); | 887 | metricSnapshot.unmountSuccessCount, metricSnapshot.unmountFailureCount); |
| 901 | AppendMetricHeader(oss, "memcache_evict_operations_total", "Total number of eviction operations", "counter"); | 888 | AppendMetricHeader(oss, "memcache_evict_operations_total", "Total number of eviction operations", "counter"); |
| 902 | AppendMetricValue(oss, "memcache_evict_operations_total", metricSnapshot.evictCount); | 889 | AppendMetricValue(oss, "memcache_evict_operations_total", metricSnapshot.evictCount); |
| 903 | - AppendMetricHeader(oss, "memcache_evict_to_ssd_total", "Total number of eviction to SSD operations", "counter"); | ||
| 904 | - AppendMetricValue(oss, "memcache_evict_to_ssd_total", metricSnapshot.evictToSsdCount); | ||
| 905 | - AppendMetricHeader(oss, "memcache_evict_ssd_delete_total", "Total number of SSD eviction delete operations", | ||
| 906 | - "counter"); | ||
| 907 | - AppendMetricValue(oss, "memcache_evict_ssd_delete_total", metricSnapshot.evictSsdDeleteCount); | ||
| 908 | - AppendMetricHeader(oss, "memcache_evict_mem_delete_total", "Total number of memory tier eviction delete operations", | ||
| 909 | - "counter"); | ||
| 910 | - AppendMetricValue(oss, "memcache_evict_mem_delete_total", metricSnapshot.evictMemDeleteCount); | ||
| 911 | AppendMetricHeader(oss, "memcache_evict_running", "Whether eviction (GC) is currently running (1=yes, 0=no)", | 890 | AppendMetricHeader(oss, "memcache_evict_running", "Whether eviction (GC) is currently running (1=yes, 0=no)", |
| 912 | "gauge"); | 891 | "gauge"); |
| 913 | AppendMetricValue(oss, "memcache_evict_running", metaManager_ != nullptr && metaManager_->IsEvictRunning() ? 1 : 0); | 892 | AppendMetricValue(oss, "memcache_evict_running", metaManager_ != nullptr && metaManager_->IsEvictRunning() ? 1 : 0); |
| 914 | - AppendMetricHeader(oss, "memcache_async_flush_blobs_added_total", | 893 | + AppendMetricHeader(oss, "memcache_flush_blobs_total", "Total number of SSD blobs registered via async flush", |
| 915 | - "Total number of SSD blobs registered via async flush", "counter"); | ||
| 916 | - AppendMetricValue(oss, "memcache_async_flush_blobs_added_total", metricSnapshot.asyncFlushBlobAdded); | ||
| 917 | - AppendMetricHeader(oss, "memcache_async_flush_bytes_total", "Total bytes flushed to SSD via async flush", | ||
| 918 | "counter"); | 894 | "counter"); |
| 919 | - AppendMetricValue(oss, "memcache_async_flush_bytes_total", metricSnapshot.asyncFlushBlobBytes); | 895 | + AppendMetricValue(oss, "memcache_flush_blobs_total", metricSnapshot.asyncFlushBlobAdded); |
| 920 | - AppendMetricHeader(oss, "memcache_async_flush_writes_total", "Total number of async flush SSD write operations", | 896 | + AppendMetricHeader(oss, "memcache_flush_bytes_total", "Total bytes flushed to SSD via async flush", "counter"); |
| 921 | - "counter"); | 897 | + AppendMetricValue(oss, "memcache_flush_bytes_total", metricSnapshot.asyncFlushBlobBytes); |
| 922 | - AppendMetricValue(oss, "memcache_async_flush_writes_total", metricSnapshot.asyncFlushWriteCount); | ||
| 923 | AppendMetricHeader(oss, "memcache_get_hits_dram_total", "Total number of Get hits served from DRAM", "counter"); | 898 | AppendMetricHeader(oss, "memcache_get_hits_dram_total", "Total number of Get hits served from DRAM", "counter"); |
| 924 | AppendMetricValue(oss, "memcache_get_hits_dram_total", metricSnapshot.getHitDramCount); | 899 | AppendMetricValue(oss, "memcache_get_hits_dram_total", metricSnapshot.getHitDramCount); |
| 925 | AppendMetricHeader(oss, "memcache_get_hits_ssd_total", "Total number of Get hits served from SSD (rewarm)", | 900 | AppendMetricHeader(oss, "memcache_get_hits_ssd_total", "Total number of Get hits served from SSD (rewarm)", |
| @@ -77,8 +77,9 @@ mmc_meta_service_config_t create_default_meta_config() | |||
| 77 | config.logOutputTarget = LOG_OUTPUT_TARGET_FILE; | 77 | config.logOutputTarget = LOG_OUTPUT_TARGET_FILE; |
| 78 | config.evictThresholdHigh = 90U; | 78 | config.evictThresholdHigh = 90U; |
| 79 | config.evictThresholdLow = 80U; | 79 | config.evictThresholdLow = 80U; |
| 80 | - config.rewarmDramWatermark = DEFAULT_REWARM_HIGH_WATERMARK; | ||
| 81 | config.prefetchEnabled = false; | 80 | config.prefetchEnabled = false; |
| 81 | + config.asyncFlushIntervalMs = static_cast<uint32_t>(ConfConstant::OCK_MMC_ASYNC_FLUSH_INTERVAL_MS.second); | ||
| 82 | + config.asyncFlushBatchLimit = static_cast<uint32_t>(ConfConstant::OCK_MMC_ASYNC_FLUSH_BATCH_LIMIT.second); | ||
| 82 | config.pendingWaitTimeoutMs = 300U; | 83 | config.pendingWaitTimeoutMs = 300U; |
| 83 | config.leaseTtlMs = MMC_DATA_TTL_MS; | 84 | config.leaseTtlMs = MMC_DATA_TTL_MS; |
| 84 | config.evictYieldInterval = 0U; /* disabled by default, set e.g. 100 to enable */ | 85 | config.evictYieldInterval = 0U; /* disabled by default, set e.g. 100 to enable */ |
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | namespace ock { | 21 | namespace ock { |
| 22 | namespace mmc { | 22 | namespace mmc { |
| 23 | + | ||
| 23 | struct AllocOptions { | 24 | struct AllocOptions { |
| 24 | uint64_t blobSize_{0}; | 25 | uint64_t blobSize_{0}; |
| 25 | uint32_t numBlobs_{0}; | 26 | uint32_t numBlobs_{0}; |
| @@ -624,7 +625,6 @@ struct MetaReplicateRequest : public MsgBase { | |||
| 624 | std::vector<uint32_t> ops_; | 625 | std::vector<uint32_t> ops_; |
| 625 | std::vector<std::string> keys_; | 626 | std::vector<std::string> keys_; |
| 626 | std::vector<MmcMemBlobDesc> blobs_; /* pointers of blobs */ | 627 | std::vector<MmcMemBlobDesc> blobs_; /* pointers of blobs */ |
| 627 | - bool asyncFlush_ = false; | ||
| 628 | 628 | ||
| 629 | MetaReplicateRequest() : MsgBase{0, LM_META_REPLICATE_REQ, 0} {} | 629 | MetaReplicateRequest() : MsgBase{0, LM_META_REPLICATE_REQ, 0} {} |
| 630 | MetaReplicateRequest(const std::vector<uint32_t> &ops, const std::vector<std::string> &keys, | 630 | MetaReplicateRequest(const std::vector<uint32_t> &ops, const std::vector<std::string> &keys, |
| @@ -640,7 +640,6 @@ struct MetaReplicateRequest : public MsgBase { | |||
| 640 | packer.Serialize(ops_); | 640 | packer.Serialize(ops_); |
| 641 | packer.Serialize(keys_); | 641 | packer.Serialize(keys_); |
| 642 | packer.Serialize(blobs_); | 642 | packer.Serialize(blobs_); |
| 643 | - packer.Serialize(asyncFlush_); | ||
| 644 | return MMC_OK; | 643 | return MMC_OK; |
| 645 | } | 644 | } |
| 646 | 645 | ||
| @@ -652,7 +651,6 @@ struct MetaReplicateRequest : public MsgBase { | |||
| 652 | packer.Deserialize(ops_); | 651 | packer.Deserialize(ops_); |
| 653 | packer.Deserialize(keys_); | 652 | packer.Deserialize(keys_); |
| 654 | packer.Deserialize(blobs_); | 653 | packer.Deserialize(blobs_); |
| 655 | - packer.Deserialize(asyncFlush_); | ||
| 656 | return MMC_OK; | 654 | return MMC_OK; |
| 657 | } | 655 | } |
| 658 | 656 | ||
| @@ -391,12 +391,6 @@ void DefineMmcStructModule(py::module_ &m) | |||
| 391 | R"pbdoc( | 391 | R"pbdoc( |
| 392 | Enable or disable high availability deployment. | 392 | Enable or disable high availability deployment. |
| 393 | )pbdoc") | 393 | )pbdoc") |
| 394 | - .def_property( | ||
| 395 | - "backup_enable", [](const mmc_meta_service_config_t &config) { return config.backupEnable; }, | ||
| 396 | - [](mmc_meta_service_config_t &config, bool value) { config.backupEnable = value; }, | ||
| 397 | - R"pbdoc( | ||
| 398 | - Enable or disable meta service backup. | ||
| 399 | - )pbdoc") | ||
| 400 | .def_property( | 394 | .def_property( |
| 401 | "log_level", | 395 | "log_level", |
| 402 | [](const mmc_meta_service_config_t &config) { return MetaLogLevelToString(config.logLevel); }, | 396 | [](const mmc_meta_service_config_t &config) { return MetaLogLevelToString(config.logLevel); }, |
| @@ -66,7 +66,6 @@ typedef struct { | |||
| 66 | char configStoreURL[DISCOVERY_URL_SIZE]; /* composed by schema and url, e.g. tcp:// or etcd:// or zk:// */ | 66 | char configStoreURL[DISCOVERY_URL_SIZE]; /* composed by schema and url, e.g. tcp:// or etcd:// or zk:// */ |
| 67 | char httpURL[DISCOVERY_URL_SIZE]; | 67 | char httpURL[DISCOVERY_URL_SIZE]; |
| 68 | bool haEnable; | 68 | bool haEnable; |
| 69 | - bool backupEnable; | ||
| 70 | int32_t logLevel; | 69 | int32_t logLevel; |
| 71 | char logPath[PATH_MAX_SIZE]; | 70 | char logPath[PATH_MAX_SIZE]; |
| 72 | int32_t logRotationFileSize; | 71 | int32_t logRotationFileSize; |
| @@ -83,9 +82,7 @@ typedef struct { | |||
| 83 | uint32_t metricsReportIntervalSeconds; | 82 | uint32_t metricsReportIntervalSeconds; |
| 84 | /* KV cache event publisher (opt-in, default disabled). */ | 83 | /* KV cache event publisher (opt-in, default disabled). */ |
| 85 | mmc_kv_events_config_t kvEvents; | 84 | mmc_kv_events_config_t kvEvents; |
| 86 | - uint16_t rewarmDramWatermark; | ||
| 87 | bool prefetchEnabled; | 85 | bool prefetchEnabled; |
| 88 | - bool asyncFlushEnabled; | ||
| 89 | uint32_t asyncFlushIntervalMs; | 86 | uint32_t asyncFlushIntervalMs; |
| 90 | uint32_t asyncFlushBatchLimit; | 87 | uint32_t asyncFlushBatchLimit; |
| 91 | /* ZMQ transport plugin config (independent of kv_events). */ | 88 | /* ZMQ transport plugin config (independent of kv_events). */ |
| @@ -23,8 +23,6 @@ using namespace std; | |||
| 23 | namespace ock { | 23 | namespace ock { |
| 24 | namespace mmc { | 24 | namespace mmc { |
| 25 | 25 | ||
| 26 | -constexpr uint16_t REWARM_DRAM_WATERMARK = 100U; | ||
| 27 | - | ||
| 28 | // SIZE_32K is defined as macro in mmc_blob_allocator.h: #define SIZE_32K (uint64_t)(32 * 1024) | 26 | // SIZE_32K is defined as macro in mmc_blob_allocator.h: #define SIZE_32K (uint64_t)(32 * 1024) |
| 29 | 27 | ||
| 30 | // ============================================================================ | 28 | // ============================================================================ |
| @@ -66,7 +64,7 @@ TEST_F(TestThreeTierCache, PutGet_HbmHit) | |||
| 66 | MmcLocation hbmLoc{0, MEDIA_HBM}; | 64 | MmcLocation hbmLoc{0, MEDIA_HBM}; |
| 67 | MmcLocalMemlInitInfo hbmInfo{0, 128 * 1024}; | 65 | MmcLocalMemlInitInfo hbmInfo{0, 128 * 1024}; |
| 68 | 66 | ||
| 69 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U, REWARM_DRAM_WATERMARK); | 67 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U); |
| 70 | ASSERT_EQ(mgr->Start(), MMC_OK); | 68 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 71 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 69 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 72 | mgr->Mount(hbmLoc, hbmInfo, blobMap, false); | 70 | mgr->Mount(hbmLoc, hbmInfo, blobMap, false); |
| @@ -94,7 +92,7 @@ TEST_F(TestThreeTierCache, EvictDram_CascadingEviction) | |||
| 94 | MmcLocation ssdLoc{0, MEDIA_SSD}; | 92 | MmcLocation ssdLoc{0, MEDIA_SSD}; |
| 95 | MmcLocalMemlInitInfo ssdInfo{0, 128UL * 1024UL}; | 93 | MmcLocalMemlInitInfo ssdInfo{0, 128UL * 1024UL}; |
| 96 | 94 | ||
| 97 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 50U, REWARM_DRAM_WATERMARK); | 95 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 50U); |
| 98 | ASSERT_EQ(mgr->Start(), MMC_OK); | 96 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 99 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 97 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 100 | mgr->Mount(dramLoc, dramInfo, blobMap, false); | 98 | mgr->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -137,7 +135,7 @@ TEST_F(TestThreeTierCache, MassivePut_MultiLevelEviction) | |||
| 137 | MmcLocation ssdLoc{0, MEDIA_SSD}; | 135 | MmcLocation ssdLoc{0, MEDIA_SSD}; |
| 138 | MmcLocalMemlInitInfo ssdInfo{0, 256UL * 1024UL}; | 136 | MmcLocalMemlInitInfo ssdInfo{0, 256UL * 1024UL}; |
| 139 | 137 | ||
| 140 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 50U, REWARM_DRAM_WATERMARK); | 138 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 50U); |
| 141 | ASSERT_EQ(mgr->Start(), MMC_OK); | 139 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 142 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 140 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 143 | mgr->Mount(dramLoc, dramInfo, blobMap, false); | 141 | mgr->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -183,7 +181,7 @@ TEST_F(TestThreeTierCache, EmptyCluster_GetReturnsUnmatchedKey) | |||
| 183 | MmcLocation dramLoc{0, MEDIA_DRAM}; | 181 | MmcLocation dramLoc{0, MEDIA_DRAM}; |
| 184 | MmcLocalMemlInitInfo dramInfo{0, 128UL * 1024UL}; | 182 | MmcLocalMemlInitInfo dramInfo{0, 128UL * 1024UL}; |
| 185 | 183 | ||
| 186 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U, REWARM_DRAM_WATERMARK); | 184 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U); |
| 187 | ASSERT_EQ(mgr->Start(), MMC_OK); | 185 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 188 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 186 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 189 | mgr->Mount(dramLoc, dramInfo, blobMap, false); | 187 | mgr->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -201,7 +199,7 @@ TEST_F(TestThreeTierCache, RepeatedPut_OverwritesOldData) | |||
| 201 | MmcLocation dramLoc{0, MEDIA_DRAM}; | 199 | MmcLocation dramLoc{0, MEDIA_DRAM}; |
| 202 | MmcLocalMemlInitInfo dramInfo{0, 128UL * 1024UL}; | 200 | MmcLocalMemlInitInfo dramInfo{0, 128UL * 1024UL}; |
| 203 | 201 | ||
| 204 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U, REWARM_DRAM_WATERMARK); | 202 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U); |
| 205 | ASSERT_EQ(mgr->Start(), MMC_OK); | 203 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 206 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 204 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 207 | mgr->Mount(dramLoc, dramInfo, blobMap, false); | 205 | mgr->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -250,7 +248,7 @@ TEST_F(TestThreeTierCache, SsdWriteFailure_EvictionFallsBackToRemove) | |||
| 250 | MmcLocation ssdLoc{0, MEDIA_SSD}; | 248 | MmcLocation ssdLoc{0, MEDIA_SSD}; |
| 251 | MmcLocalMemlInitInfo ssdInfo{0, 128UL * 1024UL}; | 249 | MmcLocalMemlInitInfo ssdInfo{0, 128UL * 1024UL}; |
| 252 | 250 | ||
| 253 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 50U, REWARM_DRAM_WATERMARK); | 251 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 50U); |
| 254 | ASSERT_EQ(mgr->Start(), MMC_OK); | 252 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 255 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 253 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 256 | mgr->Mount(dramLoc, dramInfo, blobMap, false); | 254 | mgr->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -290,7 +288,7 @@ TEST_F(TestThreeTierCache, RebuildMeta_SegmentInfoConsistent) | |||
| 290 | MmcLocation dramLoc{0, MEDIA_DRAM}; | 288 | MmcLocation dramLoc{0, MEDIA_DRAM}; |
| 291 | MmcLocalMemlInitInfo dramInfo{0, 128UL * 1024UL}; | 289 | MmcLocalMemlInitInfo dramInfo{0, 128UL * 1024UL}; |
| 292 | 290 | ||
| 293 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U, REWARM_DRAM_WATERMARK); | 291 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U); |
| 294 | ASSERT_EQ(mgr->Start(), MMC_OK); | 292 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 295 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 293 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 296 | mgr->Mount(dramLoc, dramInfo, blobMap, false); | 294 | mgr->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -317,7 +315,7 @@ TEST_F(TestThreeTierCache, SsdFull_DramEviction_HandlesGracefully) | |||
| 317 | MmcLocation ssdLoc{0, MEDIA_SSD}; | 315 | MmcLocation ssdLoc{0, MEDIA_SSD}; |
| 318 | MmcLocalMemlInitInfo ssdInfo{0, 64UL * 1024UL}; | 316 | MmcLocalMemlInitInfo ssdInfo{0, 64UL * 1024UL}; |
| 319 | 317 | ||
| 320 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 50U, REWARM_DRAM_WATERMARK); | 318 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 50U); |
| 321 | ASSERT_EQ(mgr->Start(), MMC_OK); | 319 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 322 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 320 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 323 | mgr->Mount(dramLoc, dramInfo, blobMap, false); | 321 | mgr->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -360,7 +358,7 @@ TEST_F(TestThreeTierCache, NoMetaNetServer_RpcFailsGracefully) | |||
| 360 | MmcLocation ssdLoc{0, MEDIA_SSD}; | 358 | MmcLocation ssdLoc{0, MEDIA_SSD}; |
| 361 | MmcLocalMemlInitInfo ssdInfo{0, 128UL * 1024UL}; | 359 | MmcLocalMemlInitInfo ssdInfo{0, 128UL * 1024UL}; |
| 362 | 360 | ||
| 363 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U, REWARM_DRAM_WATERMARK); | 361 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U); |
| 364 | ASSERT_EQ(mgr->Start(), MMC_OK); | 362 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 365 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 363 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 366 | mgr->Mount(dramLoc, dramInfo, blobMap, false); | 364 | mgr->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -391,7 +389,7 @@ TEST_F(TestThreeTierCache, ConcurrentGet_DuringWrite) | |||
| 391 | MmcLocation dramLoc{0, MEDIA_DRAM}; | 389 | MmcLocation dramLoc{0, MEDIA_DRAM}; |
| 392 | MmcLocalMemlInitInfo dramInfo{0, 128UL * 1024UL}; | 390 | MmcLocalMemlInitInfo dramInfo{0, 128UL * 1024UL}; |
| 393 | 391 | ||
| 394 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U, REWARM_DRAM_WATERMARK); | 392 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U); |
| 395 | ASSERT_EQ(mgr->Start(), MMC_OK); | 393 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 396 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 394 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 397 | mgr->Mount(dramLoc, dramInfo, blobMap, false); | 395 | mgr->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -438,7 +436,7 @@ TEST_F(TestThreeTierCache, GetLatency_Benchmark) | |||
| 438 | MmcLocation ssdLoc{0, MEDIA_SSD}; | 436 | MmcLocation ssdLoc{0, MEDIA_SSD}; |
| 439 | MmcLocalMemlInitInfo ssdInfo{0, 128UL * 1024UL}; | 437 | MmcLocalMemlInitInfo ssdInfo{0, 128UL * 1024UL}; |
| 440 | 438 | ||
| 441 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U, REWARM_DRAM_WATERMARK); | 439 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U); |
| 442 | ASSERT_EQ(mgr->Start(), MMC_OK); | 440 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 443 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 441 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 444 | mgr->Mount(dramLoc, dramInfo, blobMap, false); | 442 | mgr->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -473,7 +471,7 @@ TEST_F(TestThreeTierCache, Eviction_Throughput) | |||
| 473 | MmcLocation ssdLoc{0, MEDIA_SSD}; | 471 | MmcLocation ssdLoc{0, MEDIA_SSD}; |
| 474 | MmcLocalMemlInitInfo ssdInfo{0, 512UL * 1024UL}; | 472 | MmcLocalMemlInitInfo ssdInfo{0, 512UL * 1024UL}; |
| 475 | 473 | ||
| 476 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 50U, REWARM_DRAM_WATERMARK); | 474 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 50U); |
| 477 | ASSERT_EQ(mgr->Start(), MMC_OK); | 475 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 478 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 476 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 479 | mgr->Mount(dramLoc, dramInfo, blobMap, false); | 477 | mgr->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -524,7 +522,7 @@ TEST_F(TestThreeTierCache, ThreeTierFullPath_LatencyRegression) | |||
| 524 | MmcLocation ssdLoc{0, MEDIA_SSD}; | 522 | MmcLocation ssdLoc{0, MEDIA_SSD}; |
| 525 | MmcLocalMemlInitInfo ssdInfo{0, 128UL * 1024UL}; | 523 | MmcLocalMemlInitInfo ssdInfo{0, 128UL * 1024UL}; |
| 526 | 524 | ||
| 527 | - MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U, REWARM_DRAM_WATERMARK); | 525 | + MmcRef<MmcMetaManager> mgr = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U); |
| 528 | ASSERT_EQ(mgr->Start(), MMC_OK); | 526 | ASSERT_EQ(mgr->Start(), MMC_OK); |
| 529 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 527 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 530 | mgr->Mount(hbmLoc, hbmInfo, blobMap, false); | 528 | mgr->Mount(hbmLoc, hbmInfo, blobMap, false); |
| @@ -70,8 +70,6 @@ using namespace testing; | |||
| 70 | using namespace std; | 70 | using namespace std; |
| 71 | using namespace ock::mmc; | 71 | using namespace ock::mmc; |
| 72 | 72 | ||
| 73 | -constexpr uint16_t REWARM_DRAM_WATERMARK = 100U; | ||
| 74 | - | ||
| 75 | class TestLocalHandler : public testing::Test { | 73 | class TestLocalHandler : public testing::Test { |
| 76 | public: | 74 | public: |
| 77 | TestLocalHandler(); | 75 | TestLocalHandler(); |
| @@ -100,7 +98,7 @@ TEST_F(TestLocalHandler, Init) | |||
| 100 | MmcLocalMemlInitInfo locInfo{100, 1000}; | 98 | MmcLocalMemlInitInfo locInfo{100, 1000}; |
| 101 | 99 | ||
| 102 | uint64_t defaultTtl = 2000; | 100 | uint64_t defaultTtl = 2000; |
| 103 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 101 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 104 | metaMng->Start(); | 102 | metaMng->Start(); |
| 105 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 103 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 106 | metaMng->Mount(loc, locInfo, blobMap, false); | 104 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -114,7 +112,7 @@ TEST_F(TestLocalHandler, Alloc) | |||
| 114 | MmcLocalMemlInitInfo locInfo{0, 1000000}; | 112 | MmcLocalMemlInitInfo locInfo{0, 1000000}; |
| 115 | 113 | ||
| 116 | uint64_t defaultTtl = 2000; | 114 | uint64_t defaultTtl = 2000; |
| 117 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 115 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 118 | metaMng->Start(); | 116 | metaMng->Start(); |
| 119 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 117 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 120 | metaMng->Mount(loc, locInfo, blobMap, false); | 118 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -166,6 +166,8 @@ TEST_F(TestMmcacheStore, Init) | |||
| 166 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; | 166 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; |
| 167 | metaServiceConfig.logRotationFileCount = 20UL; | 167 | metaServiceConfig.logRotationFileCount = 20UL; |
| 168 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 168 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 169 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 170 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 169 | metaServiceConfig.evictThresholdHigh = 80UL; | 171 | metaServiceConfig.evictThresholdHigh = 80UL; |
| 170 | metaServiceConfig.evictThresholdLow = 60UL; | 172 | metaServiceConfig.evictThresholdLow = 60UL; |
| 171 | metaServiceConfig.haEnable = false; | 173 | metaServiceConfig.haEnable = false; |
| @@ -223,6 +225,8 @@ static mmc_meta_service_t StartMetaService() | |||
| 223 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; | 225 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; |
| 224 | metaServiceConfig.logRotationFileCount = 20; | 226 | metaServiceConfig.logRotationFileCount = 20; |
| 225 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 227 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 228 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 229 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 226 | metaServiceConfig.evictThresholdHigh = 80UL; | 230 | metaServiceConfig.evictThresholdHigh = 80UL; |
| 227 | metaServiceConfig.evictThresholdLow = 60UL; | 231 | metaServiceConfig.evictThresholdLow = 60UL; |
| 228 | metaServiceConfig.haEnable = false; | 232 | metaServiceConfig.haEnable = false; |
| @@ -341,6 +345,8 @@ TEST_F(TestMmcacheStore, BatchMalloc) | |||
| 341 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; | 345 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; |
| 342 | metaServiceConfig.logRotationFileCount = 20UL; | 346 | metaServiceConfig.logRotationFileCount = 20UL; |
| 343 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 347 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 348 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 349 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 344 | metaServiceConfig.evictThresholdHigh = 80UL; | 350 | metaServiceConfig.evictThresholdHigh = 80UL; |
| 345 | metaServiceConfig.evictThresholdLow = 60UL; | 351 | metaServiceConfig.evictThresholdLow = 60UL; |
| 346 | metaServiceConfig.haEnable = false; | 352 | metaServiceConfig.haEnable = false; |
| @@ -448,6 +454,8 @@ TEST_F(TestMmcacheStore, SsdConfig_InitsUbsIoWithSsdSize) | |||
| 448 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; | 454 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; |
| 449 | metaServiceConfig.logRotationFileCount = 20; | 455 | metaServiceConfig.logRotationFileCount = 20; |
| 450 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 456 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 457 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 458 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 451 | metaServiceConfig.evictThresholdHigh = 80U; | 459 | metaServiceConfig.evictThresholdHigh = 80U; |
| 452 | metaServiceConfig.evictThresholdLow = 60U; | 460 | metaServiceConfig.evictThresholdLow = 60U; |
| 453 | metaServiceConfig.haEnable = false; | 461 | metaServiceConfig.haEnable = false; |
| @@ -503,6 +511,8 @@ TEST_F(TestMmcacheStore, SsdEvictHandler_DramToSsdCopy) | |||
| 503 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; | 511 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; |
| 504 | metaServiceConfig.logRotationFileCount = 20UL; | 512 | metaServiceConfig.logRotationFileCount = 20UL; |
| 505 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 513 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 514 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 515 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 506 | metaServiceConfig.evictThresholdHigh = 80U; | 516 | metaServiceConfig.evictThresholdHigh = 80U; |
| 507 | metaServiceConfig.evictThresholdLow = 60U; | 517 | metaServiceConfig.evictThresholdLow = 60U; |
| 508 | metaServiceConfig.haEnable = false; | 518 | metaServiceConfig.haEnable = false; |
| @@ -576,6 +586,8 @@ TEST_F(TestMmcacheStore, SsdExistQueryHandler) | |||
| 576 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; | 586 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; |
| 577 | metaServiceConfig.logRotationFileCount = 20; | 587 | metaServiceConfig.logRotationFileCount = 20; |
| 578 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 588 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 589 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 590 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 579 | metaServiceConfig.evictThresholdHigh = 80U; | 591 | metaServiceConfig.evictThresholdHigh = 80U; |
| 580 | metaServiceConfig.evictThresholdLow = 60U; | 592 | metaServiceConfig.evictThresholdLow = 60U; |
| 581 | metaServiceConfig.haEnable = false; | 593 | metaServiceConfig.haEnable = false; |
| @@ -634,6 +646,8 @@ TEST_F(TestMmcacheStore, SsdRemoveHandler) | |||
| 634 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; | 646 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; |
| 635 | metaServiceConfig.logRotationFileCount = 20UL; | 647 | metaServiceConfig.logRotationFileCount = 20UL; |
| 636 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 648 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 649 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 650 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 637 | metaServiceConfig.evictThresholdHigh = 80U; | 651 | metaServiceConfig.evictThresholdHigh = 80U; |
| 638 | metaServiceConfig.evictThresholdLow = 60U; | 652 | metaServiceConfig.evictThresholdLow = 60U; |
| 639 | metaServiceConfig.haEnable = false; | 653 | metaServiceConfig.haEnable = false; |
| @@ -714,6 +728,8 @@ TEST_F(TestMmcacheStore, CopyBlob_SsdToDram) | |||
| 714 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; | 728 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; |
| 715 | metaServiceConfig.logRotationFileCount = 20UL; | 729 | metaServiceConfig.logRotationFileCount = 20UL; |
| 716 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 730 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 731 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 732 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 717 | metaServiceConfig.evictThresholdHigh = 80UL; | 733 | metaServiceConfig.evictThresholdHigh = 80UL; |
| 718 | metaServiceConfig.evictThresholdLow = 60UL; | 734 | metaServiceConfig.evictThresholdLow = 60UL; |
| 719 | metaServiceConfig.haEnable = false; | 735 | metaServiceConfig.haEnable = false; |
| @@ -782,6 +798,8 @@ TEST_F(TestMmcacheStore, RegisterBm_ReportsSsdMount) | |||
| 782 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; | 798 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; |
| 783 | metaServiceConfig.logRotationFileCount = 20UL; | 799 | metaServiceConfig.logRotationFileCount = 20UL; |
| 784 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 800 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 801 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 802 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 785 | metaServiceConfig.evictThresholdHigh = 80UL; | 803 | metaServiceConfig.evictThresholdHigh = 80UL; |
| 786 | metaServiceConfig.evictThresholdLow = 60UL; | 804 | metaServiceConfig.evictThresholdLow = 60UL; |
| 787 | metaServiceConfig.haEnable = false; | 805 | metaServiceConfig.haEnable = false; |
| @@ -826,6 +844,8 @@ TEST_F(TestMmcacheStore, BatchMallocLeaseCleanUp) | |||
| 826 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; | 844 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; |
| 827 | metaServiceConfig.logRotationFileCount = 20; | 845 | metaServiceConfig.logRotationFileCount = 20; |
| 828 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 846 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 847 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 848 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 829 | metaServiceConfig.evictThresholdHigh = 80; | 849 | metaServiceConfig.evictThresholdHigh = 80; |
| 830 | metaServiceConfig.evictThresholdLow = 60; | 850 | metaServiceConfig.evictThresholdLow = 60; |
| 831 | metaServiceConfig.haEnable = false; | 851 | metaServiceConfig.haEnable = false; |
| @@ -891,6 +911,8 @@ TEST_F(TestMmcacheStore, BatchWriteFinishBasic) | |||
| 891 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; | 911 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; |
| 892 | metaServiceConfig.logRotationFileCount = 20UL; | 912 | metaServiceConfig.logRotationFileCount = 20UL; |
| 893 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 913 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 914 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 915 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 894 | metaServiceConfig.evictThresholdHigh = 80UL; | 916 | metaServiceConfig.evictThresholdHigh = 80UL; |
| 895 | metaServiceConfig.evictThresholdLow = 60UL; | 917 | metaServiceConfig.evictThresholdLow = 60UL; |
| 896 | metaServiceConfig.haEnable = false; | 918 | metaServiceConfig.haEnable = false; |
| @@ -957,6 +979,8 @@ TEST_F(TestMmcacheStore, BatchWriteFinishFailRemovesBlob) | |||
| 957 | mmc_meta_service_config_t metaServiceConfig{}; | 979 | mmc_meta_service_config_t metaServiceConfig{}; |
| 958 | metaServiceConfig.logLevel = INFO_LEVEL; | 980 | metaServiceConfig.logLevel = INFO_LEVEL; |
| 959 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 981 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 982 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 983 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 960 | metaServiceConfig.evictThresholdHigh = 80UL; | 984 | metaServiceConfig.evictThresholdHigh = 80UL; |
| 961 | metaServiceConfig.evictThresholdLow = 60UL; | 985 | metaServiceConfig.evictThresholdLow = 60UL; |
| 962 | metaServiceConfig.haEnable = false; | 986 | metaServiceConfig.haEnable = false; |
| @@ -1016,6 +1040,8 @@ TEST_F(TestMmcacheStore, BatchWriteFinishUnknownKey) | |||
| 1016 | mmc_meta_service_config_t metaServiceConfig{}; | 1040 | mmc_meta_service_config_t metaServiceConfig{}; |
| 1017 | metaServiceConfig.logLevel = INFO_LEVEL; | 1041 | metaServiceConfig.logLevel = INFO_LEVEL; |
| 1018 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 1042 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 1043 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 1044 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 1019 | metaServiceConfig.evictThresholdHigh = 80UL; | 1045 | metaServiceConfig.evictThresholdHigh = 80UL; |
| 1020 | metaServiceConfig.evictThresholdLow = 60UL; | 1046 | metaServiceConfig.evictThresholdLow = 60UL; |
| 1021 | metaServiceConfig.haEnable = false; | 1047 | metaServiceConfig.haEnable = false; |
| @@ -1053,6 +1079,8 @@ TEST_F(TestMmcacheStore, BatchWriteFinishLeaseExpiryCleanup) | |||
| 1053 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; | 1079 | metaServiceConfig.logRotationFileSize = 2UL * 1024UL * 1024UL; |
| 1054 | metaServiceConfig.logRotationFileCount = 20UL; | 1080 | metaServiceConfig.logRotationFileCount = 20UL; |
| 1055 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 1081 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 1082 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 1083 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 1056 | metaServiceConfig.evictThresholdHigh = 80UL; | 1084 | metaServiceConfig.evictThresholdHigh = 80UL; |
| 1057 | metaServiceConfig.evictThresholdLow = 60UL; | 1085 | metaServiceConfig.evictThresholdLow = 60UL; |
| 1058 | metaServiceConfig.haEnable = false; | 1086 | metaServiceConfig.haEnable = false; |
| @@ -1117,6 +1145,8 @@ TEST_F(TestMmcacheStore, BatchCopySkipsReadableBlob) | |||
| 1117 | mmc_meta_service_config_t metaServiceConfig{}; | 1145 | mmc_meta_service_config_t metaServiceConfig{}; |
| 1118 | metaServiceConfig.logLevel = INFO_LEVEL; | 1146 | metaServiceConfig.logLevel = INFO_LEVEL; |
| 1119 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 1147 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 1148 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 1149 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 1120 | metaServiceConfig.evictThresholdHigh = 80UL; | 1150 | metaServiceConfig.evictThresholdHigh = 80UL; |
| 1121 | metaServiceConfig.evictThresholdLow = 60UL; | 1151 | metaServiceConfig.evictThresholdLow = 60UL; |
| 1122 | metaServiceConfig.haEnable = false; | 1152 | metaServiceConfig.haEnable = false; |
| @@ -93,6 +93,8 @@ TEST_F(TestMmcServiceError, metaService) | |||
| 93 | metaServiceConfig.evictThresholdLow = 60U; | 93 | metaServiceConfig.evictThresholdLow = 60U; |
| 94 | metaServiceConfig.haEnable = true; | 94 | metaServiceConfig.haEnable = true; |
| 95 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 95 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 96 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 97 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 96 | // mmc_meta_service_config_t no longer has localSsdSize | 98 | // mmc_meta_service_config_t no longer has localSsdSize |
| 97 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); | 99 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); |
| 98 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); | 100 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); |
| @@ -225,6 +227,8 @@ TEST_F(TestMmcServiceError, metaServiceRebuild) | |||
| 225 | metaServiceConfig.evictThresholdLow = 60U; | 227 | metaServiceConfig.evictThresholdLow = 60U; |
| 226 | metaServiceConfig.haEnable = true; | 228 | metaServiceConfig.haEnable = true; |
| 227 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 229 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 230 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 231 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 228 | // mmc_meta_service_config_t no longer has localSsdSize | 232 | // mmc_meta_service_config_t no longer has localSsdSize |
| 229 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); | 233 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); |
| 230 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); | 234 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); |
| @@ -182,6 +182,8 @@ void MmcMetaServiceHttpTest::StartService() | |||
| 182 | metaServiceConfig_.evictThresholdLow = kHttpEvictThresholdLow; | 182 | metaServiceConfig_.evictThresholdLow = kHttpEvictThresholdLow; |
| 183 | metaServiceConfig_.haEnable = false; | 183 | metaServiceConfig_.haEnable = false; |
| 184 | metaServiceConfig_.accTlsConfig.tlsEnable = false; | 184 | metaServiceConfig_.accTlsConfig.tlsEnable = false; |
| 185 | + metaServiceConfig_.asyncFlushIntervalMs = 1000UL; | ||
| 186 | + metaServiceConfig_.asyncFlushBatchLimit = 8UL; | ||
| 185 | // mmc_meta_service_config_t no longer has localSsdSize | 187 | // mmc_meta_service_config_t no longer has localSsdSize |
| 186 | 188 | ||
| 187 | const std::string discoveryUrl = std::string(kHttpTcpUrlPrefix) + std::to_string(discoveryPort_); | 189 | const std::string discoveryUrl = std::string(kHttpTcpUrlPrefix) + std::to_string(discoveryPort_); |
| @@ -472,14 +474,10 @@ TEST_F(MmcMetaServiceHttpTest, MetricsContract) | |||
| 472 | const MmcMetaMetricSnapshot snapshot = MmcMetaMetricManager::GetInstance().GetSnapshot(); | 474 | const MmcMetaMetricSnapshot snapshot = MmcMetaMetricManager::GetInstance().GetSnapshot(); |
| 473 | std::ostringstream expectedSummary; | 475 | std::ostringstream expectedSummary; |
| 474 | expectedSummary | 476 | expectedSummary |
| 475 | - << "keys=" << kHttpExpectedBlobCount << " evict=" << snapshot.evictCount | 477 | + << "keys=" << kHttpExpectedBlobCount << " evict=" << snapshot.evictCount << " rewarm=" << snapshot.rewarmCount |
| 476 | - << " evict_to_ssd=" << snapshot.evictToSsdCount << " evict_ssd_delete=" << snapshot.evictSsdDeleteCount | ||
| 477 | - << " evict_mem_delete=" << snapshot.evictMemDeleteCount << " rewarm=" << snapshot.rewarmCount | ||
| 478 | << " rewarm_fail=" << snapshot.rewarmFailCount << " rewarm_bytes_total=" << snapshot.rewarmBytesCount | 478 | << " rewarm_fail=" << snapshot.rewarmFailCount << " rewarm_bytes_total=" << snapshot.rewarmBytesCount |
| 479 | - << " rewarm_bytes_current=" << snapshot.rewarmBytesCurrent | 479 | + << " rewarm_bytes_current=" << snapshot.rewarmBytesCurrent << " flush_blobs=" << snapshot.asyncFlushBlobAdded |
| 480 | - << " async_flush_blobs_added=" << snapshot.asyncFlushBlobAdded | 480 | + << " flush_bytes=" << snapshot.asyncFlushBlobBytes << " get_hit_dram=" << snapshot.getHitDramCount |
| 481 | - << " async_flush_bytes=" << snapshot.asyncFlushBlobBytes | ||
| 482 | - << " async_flush_writes=" << snapshot.asyncFlushWriteCount << " get_hit_dram=" << snapshot.getHitDramCount | ||
| 483 | << " get_hit_ssd=" << snapshot.getHitSsdCount << " hbm_used=" << SIZE_32K << "/" << kHttpSegmentCapacityBytes | 481 | << " get_hit_ssd=" << snapshot.getHitSsdCount << " hbm_used=" << SIZE_32K << "/" << kHttpSegmentCapacityBytes |
| 484 | << " dram_used=" << kHttpZeroUsedBytes << "/" << kHttpSegmentCapacityBytes << " ssd_used=" << kHttpZeroUsedBytes | 482 | << " dram_used=" << kHttpZeroUsedBytes << "/" << kHttpSegmentCapacityBytes << " ssd_used=" << kHttpZeroUsedBytes |
| 485 | << "/" << kHttpZeroUsedBytes << " alloc_req=" << snapshot.allocRequestCount | 483 | << "/" << kHttpZeroUsedBytes << " alloc_req=" << snapshot.allocRequestCount |
| @@ -1,8 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. | 2 | * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved. |
| 3 | * MemCache_Hybrid is licensed under Mulan PSL v2. | 3 | * MemCache_Hybrid is licensed under Mulan PSL v2. |
| 4 | - * You can use this software according to the terms and conditions of the Mulan PSL v2. | 4 | + * You can use this software according to the terms and conditions of the Mulan PSL v2 at: |
| 5 | - * You may obtain a copy of Mulan PSL v2 at: | ||
| 6 | * http://license.coscl.org.cn/MulanPSL2 | 5 | * http://license.coscl.org.cn/MulanPSL2 |
| 7 | * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | 6 | * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, |
| 8 | * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | 7 | * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, |
| @@ -31,6 +30,8 @@ public: | |||
| 31 | void TearDown() override; | 30 | void TearDown() override; |
| 32 | 31 | ||
| 33 | protected: | 32 | protected: |
| 33 | + MmcMetaServicePtr metaServicePtr_; | ||
| 34 | + MmcLocalServicePtr localServicePtr1_; | ||
| 34 | }; | 35 | }; |
| 35 | TestBmInit::TestBmInit() {} | 36 | TestBmInit::TestBmInit() {} |
| 36 | 37 | ||
| @@ -42,6 +43,12 @@ void TestBmInit::SetUp() | |||
| 42 | void TestBmInit::TearDown() | 43 | void TestBmInit::TearDown() |
| 43 | { | 44 | { |
| 44 | cout << "this is NetEngine TEST_F teardown" << endl; | 45 | cout << "this is NetEngine TEST_F teardown" << endl; |
| 46 | + if (localServicePtr1_.Get() != nullptr) { | ||
| 47 | + localServicePtr1_->Stop(); | ||
| 48 | + } | ||
| 49 | + if (metaServicePtr_.Get() != nullptr) { | ||
| 50 | + metaServicePtr_->Stop(); | ||
| 51 | + } | ||
| 45 | } | 52 | } |
| 46 | 53 | ||
| 47 | static void UrlStringToChar(std::string &urlString, char *urlChar) | 54 | static void UrlStringToChar(std::string &urlString, char *urlChar) |
| @@ -65,12 +72,14 @@ TEST_F(TestBmInit, Init) | |||
| 65 | metaServiceConfig.evictThresholdLow = 60U; | 72 | metaServiceConfig.evictThresholdLow = 60U; |
| 66 | metaServiceConfig.haEnable = true; | 73 | metaServiceConfig.haEnable = true; |
| 67 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 74 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 75 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 76 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 68 | // mmc_meta_service_config_t no longer has localSsdSize | 77 | // mmc_meta_service_config_t no longer has localSsdSize |
| 69 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); | 78 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); |
| 70 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); | 79 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); |
| 71 | auto metaServiceDefault = MmcMakeRef<MmcMetaService>("testMetaService"); | 80 | auto metaServiceDefault = MmcMakeRef<MmcMetaService>("testMetaService"); |
| 72 | - MmcMetaServicePtr metaServicePtr = Convert<MmcMetaService, MmcMetaService>(metaServiceDefault); | 81 | + metaServicePtr_ = Convert<MmcMetaService, MmcMetaService>(metaServiceDefault); |
| 73 | - ASSERT_TRUE(metaServicePtr->Start(metaServiceConfig) == MMC_OK); | 82 | + ASSERT_TRUE(metaServicePtr_->Start(metaServiceConfig) == MMC_OK); |
| 74 | 83 | ||
| 75 | mmc_local_service_config_t localServiceConfig1 = { | 84 | mmc_local_service_config_t localServiceConfig1 = { |
| 76 | "", 0, 0, 1, "", "", "", 0, "device_sdma", 0, 0, 104857600, 104857600, 0, 0, {}, 0, nullptr, {}, {}}; | 85 | "", 0, 0, 1, "", "", "", 0, "device_sdma", 0, 0, 104857600, 104857600, 0, 0, {}, 0, nullptr, {}, {}}; |
| @@ -80,8 +89,8 @@ TEST_F(TestBmInit, Init) | |||
| 80 | UrlStringToChar(bmUrl, localServiceConfig1.bmIpPort); | 89 | UrlStringToChar(bmUrl, localServiceConfig1.bmIpPort); |
| 81 | UrlStringToChar(hcomUrl, localServiceConfig1.bmHcomUrl); | 90 | UrlStringToChar(hcomUrl, localServiceConfig1.bmHcomUrl); |
| 82 | auto localServiceDefault1 = MmcMakeRef<MmcLocalServiceDefault>("testLocalService1"); | 91 | auto localServiceDefault1 = MmcMakeRef<MmcLocalServiceDefault>("testLocalService1"); |
| 83 | - MmcLocalServicePtr localServicePtr1 = Convert<MmcLocalServiceDefault, MmcLocalService>(localServiceDefault1); | 92 | + localServicePtr1_ = Convert<MmcLocalServiceDefault, MmcLocalService>(localServiceDefault1); |
| 84 | - ASSERT_TRUE(localServicePtr1->Start(localServiceConfig1) == MMC_OK); | 93 | + ASSERT_TRUE(localServicePtr1_->Start(localServiceConfig1) == MMC_OK); |
| 85 | 94 | ||
| 86 | PingMsg req; | 95 | PingMsg req; |
| 87 | req.msgId = ML_PING_REQ; | 96 | req.msgId = ML_PING_REQ; |
| @@ -96,6 +105,4 @@ TEST_F(TestBmInit, Init) | |||
| 96 | ASSERT_TRUE(localServiceDefault1->SyncCallMeta(reqAlloc, response, 30) == MMC_OK); | 105 | ASSERT_TRUE(localServiceDefault1->SyncCallMeta(reqAlloc, response, 30) == MMC_OK); |
| 97 | ASSERT_TRUE(response.numBlobs_ == 1); | 106 | ASSERT_TRUE(response.numBlobs_ == 1); |
| 98 | ASSERT_TRUE(response.blobs_[0].size_ == SIZE_32K); | 107 | ASSERT_TRUE(response.blobs_[0].size_ == SIZE_32K); |
| 99 | - localServicePtr1->Stop(); | ||
| 100 | - metaServicePtr->Stop(); | ||
| 101 | } | 108 | } |
| @@ -23,8 +23,6 @@ using namespace std; | |||
| 23 | namespace ock { | 23 | namespace ock { |
| 24 | namespace mmc { | 24 | namespace mmc { |
| 25 | 25 | ||
| 26 | -constexpr uint16_t REWARM_DRAM_WATERMARK = 100U; | ||
| 27 | - | ||
| 28 | class TestMmcMetaManager : public testing::Test { | 26 | class TestMmcMetaManager : public testing::Test { |
| 29 | public: | 27 | public: |
| 30 | TestMmcMetaManager(); | 28 | TestMmcMetaManager(); |
| @@ -62,7 +60,7 @@ TEST_F(TestMmcMetaManager, Init) | |||
| 62 | MmcLocalMemlInitInfo locInfo{100, 1000}; | 60 | MmcLocalMemlInitInfo locInfo{100, 1000}; |
| 63 | 61 | ||
| 64 | uint64_t defaultTtl = 2000; | 62 | uint64_t defaultTtl = 2000; |
| 65 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 63 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 66 | metaMng->Start(); | 64 | metaMng->Start(); |
| 67 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 65 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 68 | metaMng->Mount(loc, locInfo, blobMap, false); | 66 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -76,7 +74,7 @@ TEST_F(TestMmcMetaManager, AllocAndFree) | |||
| 76 | MmcLocalMemlInitInfo locInfo{0, 1000000}; | 74 | MmcLocalMemlInitInfo locInfo{0, 1000000}; |
| 77 | 75 | ||
| 78 | uint64_t defaultTtl = 2000; | 76 | uint64_t defaultTtl = 2000; |
| 79 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 77 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 80 | metaMng->Start(); | 78 | metaMng->Start(); |
| 81 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 79 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 82 | metaMng->Mount(loc, locInfo, blobMap, false); | 80 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -101,7 +99,7 @@ TEST_F(TestMmcMetaManager, AllocUsesPerRequestLeaseTtl) | |||
| 101 | MmcLocalMemlInitInfo locInfo{0, 1000000}; | 99 | MmcLocalMemlInitInfo locInfo{0, 1000000}; |
| 102 | 100 | ||
| 103 | const uint64_t defaultTtl = 2000; | 101 | const uint64_t defaultTtl = 2000; |
| 104 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 102 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 105 | metaMng->Start(); | 103 | metaMng->Start(); |
| 106 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 104 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 107 | metaMng->Mount(loc, locInfo, blobMap, false); | 105 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -133,7 +131,7 @@ TEST_F(TestMmcMetaManager, AllocAndFreeMulti) | |||
| 133 | MmcLocalMemlInitInfo locInfo{0, 1000000}; | 131 | MmcLocalMemlInitInfo locInfo{0, 1000000}; |
| 134 | 132 | ||
| 135 | uint64_t defaultTtl = 200; | 133 | uint64_t defaultTtl = 200; |
| 136 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 134 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 137 | metaMng->Start(); | 135 | metaMng->Start(); |
| 138 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 136 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 139 | metaMng->Mount(loc, locInfo, blobMap, false); | 137 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -167,7 +165,7 @@ TEST_F(TestMmcMetaManager, GetAndUpdate) | |||
| 167 | MmcLocalMemlInitInfo locInfo{0, 1000000}; | 165 | MmcLocalMemlInitInfo locInfo{0, 1000000}; |
| 168 | // poolInitInfo[loc] = locInfo; | 166 | // poolInitInfo[loc] = locInfo; |
| 169 | uint64_t defaultTtl = 200; | 167 | uint64_t defaultTtl = 200; |
| 170 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 168 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 171 | metaMng->Start(); | 169 | metaMng->Start(); |
| 172 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 170 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 173 | metaMng->Mount(loc, locInfo, blobMap, false); | 171 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -205,7 +203,7 @@ TEST_F(TestMmcMetaManager, LRU) | |||
| 205 | MmcLocalMemlInitInfo locInfo{0, 163840}; | 203 | MmcLocalMemlInitInfo locInfo{0, 163840}; |
| 206 | uint64_t defaultTtl = 100; | 204 | uint64_t defaultTtl = 100; |
| 207 | 205 | ||
| 208 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U, REWARM_DRAM_WATERMARK); | 206 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U); |
| 209 | metaMng->Start(); | 207 | metaMng->Start(); |
| 210 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 208 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 211 | metaMng->Mount(loc, locInfo, blobMap, false); | 209 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -250,7 +248,7 @@ TEST_F(TestMmcMetaManager, AllocAndExistKey) | |||
| 250 | MmcLocation loc{0, MEDIA_DRAM}; | 248 | MmcLocation loc{0, MEDIA_DRAM}; |
| 251 | MmcLocalMemlInitInfo locInfo{0, 1000000}; | 249 | MmcLocalMemlInitInfo locInfo{0, 1000000}; |
| 252 | uint64_t defaultTtl = 2000; | 250 | uint64_t defaultTtl = 2000; |
| 253 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 251 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 254 | metaMng->Start(); | 252 | metaMng->Start(); |
| 255 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 253 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 256 | metaMng->Mount(loc, locInfo, blobMap, false); | 254 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -273,7 +271,7 @@ TEST_F(TestMmcMetaManager, AllocAndBatchExistKey) | |||
| 273 | MmcLocation loc{0, MEDIA_DRAM}; | 271 | MmcLocation loc{0, MEDIA_DRAM}; |
| 274 | MmcLocalMemlInitInfo locInfo{0, 1000000}; | 272 | MmcLocalMemlInitInfo locInfo{0, 1000000}; |
| 275 | uint64_t defaultTtl = 2000; | 273 | uint64_t defaultTtl = 2000; |
| 276 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 274 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 277 | metaMng->Start(); | 275 | metaMng->Start(); |
| 278 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 276 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 279 | metaMng->Mount(loc, locInfo, blobMap, false); | 277 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -330,7 +328,7 @@ TEST_F(TestMmcMetaManager, Remove) | |||
| 330 | MmcLocation loc{0, MEDIA_DRAM}; | 328 | MmcLocation loc{0, MEDIA_DRAM}; |
| 331 | MmcLocalMemlInitInfo locInfo{0, 1000000}; | 329 | MmcLocalMemlInitInfo locInfo{0, 1000000}; |
| 332 | uint64_t defaultTtl = 2000; | 330 | uint64_t defaultTtl = 2000; |
| 333 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 331 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 334 | metaMng->Start(); | 332 | metaMng->Start(); |
| 335 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 333 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 336 | metaMng->Mount(loc, locInfo, blobMap, false); | 334 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -360,7 +358,7 @@ TEST_F(TestMmcMetaManager, Get_NotAllBlobsReady) | |||
| 360 | MmcLocation loc{0, MEDIA_DRAM}; | 358 | MmcLocation loc{0, MEDIA_DRAM}; |
| 361 | MmcLocalMemlInitInfo locInfo{0, 1000000}; | 359 | MmcLocalMemlInitInfo locInfo{0, 1000000}; |
| 362 | uint64_t defaultTtl = 2000; | 360 | uint64_t defaultTtl = 2000; |
| 363 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 361 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 364 | metaMng->Start(); | 362 | metaMng->Start(); |
| 365 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 363 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 366 | metaMng->Mount(loc, locInfo, blobMap, false); | 364 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -384,7 +382,7 @@ TEST_F(TestMmcMetaManager, Alloc_ThresholdEviction) | |||
| 384 | MmcLocation loc{0, MEDIA_DRAM}; | 382 | MmcLocation loc{0, MEDIA_DRAM}; |
| 385 | MmcLocalMemlInitInfo locInfo{0, 96 * 1024}; | 383 | MmcLocalMemlInitInfo locInfo{0, 96 * 1024}; |
| 386 | uint64_t defaultTtl = 2000; | 384 | uint64_t defaultTtl = 2000; |
| 387 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 385 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 388 | metaMng->Start(); | 386 | metaMng->Start(); |
| 389 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 387 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 390 | metaMng->Mount(loc, locInfo, blobMap, false); | 388 | metaMng->Mount(loc, locInfo, blobMap, false); |
| @@ -423,7 +421,7 @@ TEST_F(TestMmcMetaManager, EvictCallback_NoSsd_GoesToRemove) | |||
| 423 | uint64_t operateId = 1; | 421 | uint64_t operateId = 1; |
| 424 | 422 | ||
| 425 | uint64_t defaultTtl = 2000; | 423 | uint64_t defaultTtl = 2000; |
| 426 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U, REWARM_DRAM_WATERMARK); | 424 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U); |
| 427 | metaMng->Start(); | 425 | metaMng->Start(); |
| 428 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 426 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 429 | metaMng->Mount(dramLoc, dramInfo, blobMap, false); | 427 | metaMng->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -459,7 +457,7 @@ TEST_F(TestMmcMetaManager, EvictCallback_AllocatedOnly_GoesToRemove) | |||
| 459 | MmcLocation dramLoc{0, MEDIA_DRAM}; | 457 | MmcLocation dramLoc{0, MEDIA_DRAM}; |
| 460 | MmcLocalMemlInitInfo dramInfo{0, 96 * 1024}; | 458 | MmcLocalMemlInitInfo dramInfo{0, 96 * 1024}; |
| 461 | uint64_t defaultTtl = 200; | 459 | uint64_t defaultTtl = 200; |
| 462 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U, REWARM_DRAM_WATERMARK); | 460 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U); |
| 463 | metaMng->Start(); | 461 | metaMng->Start(); |
| 464 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 462 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 465 | metaMng->Mount(dramLoc, dramInfo, blobMap, false); | 463 | metaMng->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -492,7 +490,7 @@ TEST_F(TestMmcMetaManager, EvictCallback_MoveDownIndependentOfBlobOrder) | |||
| 492 | MmcLocalMemlInitInfo ssdInfo{0, 16 * 1024}; // SSD 空间不足一个 32K blob | 490 | MmcLocalMemlInitInfo ssdInfo{0, 16 * 1024}; // SSD 空间不足一个 32K blob |
| 493 | 491 | ||
| 494 | uint64_t defaultTtl = 2000; | 492 | uint64_t defaultTtl = 2000; |
| 495 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U, REWARM_DRAM_WATERMARK); | 493 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U); |
| 496 | metaMng->Start(); | 494 | metaMng->Start(); |
| 497 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 495 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| 498 | metaMng->Mount(dramLoc, dramInfo, blobMap, false); | 496 | metaMng->Mount(dramLoc, dramInfo, blobMap, false); |
| @@ -522,7 +520,7 @@ TEST_F(TestMmcMetaManager, EvictCallback_MoveDownIndependentOfBlobOrder) | |||
| 522 | TEST_F(TestMmcMetaManager, RewarmBlob_StubCompiles) | 520 | TEST_F(TestMmcMetaManager, RewarmBlob_StubCompiles) |
| 523 | { | 521 | { |
| 524 | uint64_t defaultTtl = 2000; | 522 | uint64_t defaultTtl = 2000; |
| 525 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 523 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 526 | ASSERT_NE(metaMng, nullptr); | 524 | ASSERT_NE(metaMng, nullptr); |
| 527 | metaMng->Start(); | 525 | metaMng->Start(); |
| 528 | // RewarmBlob is a reserved interface, current stub returns MMC_ERROR | 526 | // RewarmBlob is a reserved interface, current stub returns MMC_ERROR |
| @@ -540,7 +538,7 @@ TEST_F(TestMmcMetaManager, EvictCallback_SsdEvictionDelegatesViaRpc) | |||
| 540 | MmcLocalMemlInitInfo ssdInfo{0, 64 * 1024}; // SSD 足以容纳一个 32K blob | 538 | MmcLocalMemlInitInfo ssdInfo{0, 64 * 1024}; // SSD 足以容纳一个 32K blob |
| 541 | 539 | ||
| 542 | uint64_t defaultTtl = 2000; | 540 | uint64_t defaultTtl = 2000; |
| 543 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U, REWARM_DRAM_WATERMARK); | 541 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U); |
| 544 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 542 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 545 | 543 | ||
| 546 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 544 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -582,7 +580,7 @@ TEST_F(TestMmcMetaManager, MountSsdAndDram_NoUbsIoProxy) | |||
| 582 | MmcLocalMemlInitInfo ssdInfo{0, 1024 * 1024 * 1024}; | 580 | MmcLocalMemlInitInfo ssdInfo{0, 1024 * 1024 * 1024}; |
| 583 | 581 | ||
| 584 | uint64_t defaultTtl = 2000; | 582 | uint64_t defaultTtl = 2000; |
| 585 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 583 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 586 | ASSERT_NE(metaMng, nullptr); | 584 | ASSERT_NE(metaMng, nullptr); |
| 587 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 585 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 588 | 586 | ||
| @@ -610,7 +608,7 @@ TEST_F(TestMmcMetaManager, RemoveMixedMedia_FreesAllAllocators) | |||
| 610 | MmcLocalMemlInitInfo dramInfo{0, 128U * 1024U}; | 608 | MmcLocalMemlInitInfo dramInfo{0, 128U * 1024U}; |
| 611 | 609 | ||
| 612 | uint64_t defaultTtl = 2000U; | 610 | uint64_t defaultTtl = 2000U; |
| 613 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U, REWARM_DRAM_WATERMARK); | 611 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U); |
| 614 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 612 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 615 | 613 | ||
| 616 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 614 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -652,7 +650,7 @@ TEST_F(TestMmcMetaManager, DramOnlyRemove_SsdPreFreeNoop) | |||
| 652 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; | 650 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; |
| 653 | 651 | ||
| 654 | uint64_t defaultTtl = 2000; | 652 | uint64_t defaultTtl = 2000; |
| 655 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U, REWARM_DRAM_WATERMARK); | 653 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U); |
| 656 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 654 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 657 | 655 | ||
| 658 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 656 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -692,7 +690,7 @@ TEST_F(TestMmcMetaManager, Get_DramHit_NoSsdRewarm) | |||
| 692 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; | 690 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; |
| 693 | 691 | ||
| 694 | uint64_t defaultTtl = 2000; | 692 | uint64_t defaultTtl = 2000; |
| 695 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U, REWARM_DRAM_WATERMARK); | 693 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U); |
| 696 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 694 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 697 | 695 | ||
| 698 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 696 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -727,7 +725,7 @@ TEST_F(TestMmcMetaManager, RewarmBlob_NoSsdBlob_ReturnsError) | |||
| 727 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; | 725 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; |
| 728 | 726 | ||
| 729 | uint64_t defaultTtl = 2000; | 727 | uint64_t defaultTtl = 2000; |
| 730 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U, REWARM_DRAM_WATERMARK); | 728 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 50U); |
| 731 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 729 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 732 | 730 | ||
| 733 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 731 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -757,7 +755,7 @@ TEST_F(TestMmcMetaManager, GvaAlloc_PendingWriteCannotRead) | |||
| 757 | uint64_t defaultTtl = 2000; | 755 | uint64_t defaultTtl = 2000; |
| 758 | uint64_t opId1 = 1; | 756 | uint64_t opId1 = 1; |
| 759 | uint64_t opId2 = 2; | 757 | uint64_t opId2 = 2; |
| 760 | - auto metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 758 | + auto metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 761 | ASSERT_TRUE(metaMng != nullptr); | 759 | ASSERT_TRUE(metaMng != nullptr); |
| 762 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 760 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 763 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 761 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -788,7 +786,7 @@ TEST_F(TestMmcMetaManager, GvaWriteOk_BecomesReadable) | |||
| 788 | uint64_t defaultTtl = 3210; | 786 | uint64_t defaultTtl = 3210; |
| 789 | uint64_t opId1 = 1; | 787 | uint64_t opId1 = 1; |
| 790 | uint64_t opId2 = 2; | 788 | uint64_t opId2 = 2; |
| 791 | - auto metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 789 | + auto metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 792 | ASSERT_TRUE(metaMng != nullptr); | 790 | ASSERT_TRUE(metaMng != nullptr); |
| 793 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 791 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 794 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 792 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -835,7 +833,7 @@ TEST_F(TestMmcMetaManager, AddRemoveLease_WorksForRegularReadableSingleBlob) | |||
| 835 | uint64_t defaultTtl = 3210; | 833 | uint64_t defaultTtl = 3210; |
| 836 | uint64_t opId1 = 1; | 834 | uint64_t opId1 = 1; |
| 837 | uint64_t opId2 = 2; | 835 | uint64_t opId2 = 2; |
| 838 | - auto metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 836 | + auto metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 839 | ASSERT_TRUE(metaMng != nullptr); | 837 | ASSERT_TRUE(metaMng != nullptr); |
| 840 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 838 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 841 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 839 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -870,7 +868,7 @@ TEST_F(TestMmcMetaManager, GvaRemoveAfterReadable_CleansIndex) | |||
| 870 | uint64_t defaultTtl = 2000; | 868 | uint64_t defaultTtl = 2000; |
| 871 | uint64_t opId1 = 1; | 869 | uint64_t opId1 = 1; |
| 872 | uint64_t opId2 = 2; | 870 | uint64_t opId2 = 2; |
| 873 | - auto metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 871 | + auto metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 874 | ASSERT_TRUE(metaMng != nullptr); | 872 | ASSERT_TRUE(metaMng != nullptr); |
| 875 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 873 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 876 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 874 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -913,7 +911,7 @@ TEST_F(TestMmcMetaManager, GvaWriteFail_RemovesKey) | |||
| 913 | uint64_t defaultTtl = 2000; | 911 | uint64_t defaultTtl = 2000; |
| 914 | uint64_t opId1 = 1; | 912 | uint64_t opId1 = 1; |
| 915 | uint64_t opId2 = 2; | 913 | uint64_t opId2 = 2; |
| 916 | - auto metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 914 | + auto metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 917 | ASSERT_TRUE(metaMng != nullptr); | 915 | ASSERT_TRUE(metaMng != nullptr); |
| 918 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 916 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 919 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 917 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -956,7 +954,7 @@ TEST_F(TestMmcMetaManager, GvaUnmount_CleansSegmentIndex) | |||
| 956 | uint64_t defaultTtl = 2000; | 954 | uint64_t defaultTtl = 2000; |
| 957 | uint64_t opId1 = 1; | 955 | uint64_t opId1 = 1; |
| 958 | uint64_t opId2 = 2; | 956 | uint64_t opId2 = 2; |
| 959 | - auto metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 957 | + auto metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 960 | ASSERT_TRUE(metaMng != nullptr); | 958 | ASSERT_TRUE(metaMng != nullptr); |
| 961 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 959 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 962 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 960 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -990,9 +988,7 @@ TEST_F(TestMmcMetaManager, UpdateConfigAppliesNewValues) | |||
| 990 | constexpr uint16_t lowWatermark = 60U; | 988 | constexpr uint16_t lowWatermark = 60U; |
| 991 | constexpr uint16_t newHighWatermark = 85U; | 989 | constexpr uint16_t newHighWatermark = 85U; |
| 992 | constexpr uint16_t newLowWatermark = 75U; | 990 | constexpr uint16_t newLowWatermark = 75U; |
| 993 | - constexpr uint16_t rewarmWatermark = 100U; | 991 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, highWatermark, lowWatermark); |
| 994 | - MmcRef<MmcMetaManager> metaMng = | ||
| 995 | - MmcMakeRef<MmcMetaManager>(defaultTtl, highWatermark, lowWatermark, rewarmWatermark); | ||
| 996 | 992 | ||
| 997 | ASSERT_EQ(metaMng->UpdateConfig(newTtl, newHighWatermark, newLowWatermark), MMC_OK); | 993 | ASSERT_EQ(metaMng->UpdateConfig(newTtl, newHighWatermark, newLowWatermark), MMC_OK); |
| 998 | EXPECT_EQ(metaMng->Ttl(), newTtl); | 994 | EXPECT_EQ(metaMng->Ttl(), newTtl); |
| @@ -1008,7 +1004,7 @@ TEST_F(TestMmcMetaManager, UpdateConfigAppliesNewValues) | |||
| 1008 | TEST_F(TestMmcMetaManager, PrefetchKeys_EmptyKeys_ReturnsOk) | 1004 | TEST_F(TestMmcMetaManager, PrefetchKeys_EmptyKeys_ReturnsOk) |
| 1009 | { | 1005 | { |
| 1010 | uint64_t defaultTtl = 2000; | 1006 | uint64_t defaultTtl = 2000; |
| 1011 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 1007 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 1012 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 1008 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 1013 | 1009 | ||
| 1014 | std::vector<std::string> emptyKeys; | 1010 | std::vector<std::string> emptyKeys; |
| @@ -1021,7 +1017,7 @@ TEST_F(TestMmcMetaManager, PrefetchKeys_EmptyKeys_ReturnsOk) | |||
| 1021 | TEST_F(TestMmcMetaManager, EvictKeys_EmptyKeys_ReturnsError) | 1017 | TEST_F(TestMmcMetaManager, EvictKeys_EmptyKeys_ReturnsError) |
| 1022 | { | 1018 | { |
| 1023 | uint64_t defaultTtl = 2000; | 1019 | uint64_t defaultTtl = 2000; |
| 1024 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 1020 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 1025 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 1021 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 1026 | 1022 | ||
| 1027 | std::vector<std::string> emptyKeys; | 1023 | std::vector<std::string> emptyKeys; |
| @@ -1035,11 +1031,9 @@ TEST_F(TestMmcMetaManager, UpdateConfigRejectsInvalidWatermark) | |||
| 1035 | constexpr uint64_t defaultTtl = 2000U; | 1031 | constexpr uint64_t defaultTtl = 2000U; |
| 1036 | constexpr uint16_t highWatermark = 70U; | 1032 | constexpr uint16_t highWatermark = 70U; |
| 1037 | constexpr uint16_t lowWatermark = 60U; | 1033 | constexpr uint16_t lowWatermark = 60U; |
| 1038 | - constexpr uint16_t rewarmWatermark = 100U; | ||
| 1039 | constexpr uint16_t invalidHighWatermark = 50U; | 1034 | constexpr uint16_t invalidHighWatermark = 50U; |
| 1040 | constexpr uint16_t invalidLowWatermark = 60U; | 1035 | constexpr uint16_t invalidLowWatermark = 60U; |
| 1041 | - MmcRef<MmcMetaManager> metaMng = | 1036 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, highWatermark, lowWatermark); |
| 1042 | - MmcMakeRef<MmcMetaManager>(defaultTtl, highWatermark, lowWatermark, rewarmWatermark); | ||
| 1043 | 1037 | ||
| 1044 | // high <= low is rejected and keeps current values | 1038 | // high <= low is rejected and keeps current values |
| 1045 | ASSERT_EQ(metaMng->UpdateConfig(defaultTtl, invalidHighWatermark, invalidLowWatermark), MMC_INVALID_PARAM); | 1039 | ASSERT_EQ(metaMng->UpdateConfig(defaultTtl, invalidHighWatermark, invalidLowWatermark), MMC_INVALID_PARAM); |
| @@ -1061,9 +1055,7 @@ TEST_F(TestMmcMetaManager, UpdateConfigUnchangedKeepsValues) | |||
| 1061 | constexpr uint64_t defaultTtl = 2000U; | 1055 | constexpr uint64_t defaultTtl = 2000U; |
| 1062 | constexpr uint16_t highWatermark = 70U; | 1056 | constexpr uint16_t highWatermark = 70U; |
| 1063 | constexpr uint16_t lowWatermark = 60U; | 1057 | constexpr uint16_t lowWatermark = 60U; |
| 1064 | - constexpr uint16_t rewarmWatermark = 100U; | 1058 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, highWatermark, lowWatermark); |
| 1065 | - MmcRef<MmcMetaManager> metaMng = | ||
| 1066 | - MmcMakeRef<MmcMetaManager>(defaultTtl, highWatermark, lowWatermark, rewarmWatermark); | ||
| 1067 | 1059 | ||
| 1068 | ASSERT_EQ(metaMng->UpdateConfig(defaultTtl, highWatermark, lowWatermark), MMC_OK); | 1060 | ASSERT_EQ(metaMng->UpdateConfig(defaultTtl, highWatermark, lowWatermark), MMC_OK); |
| 1069 | EXPECT_EQ(metaMng->Ttl(), defaultTtl); | 1061 | EXPECT_EQ(metaMng->Ttl(), defaultTtl); |
| @@ -1082,7 +1074,7 @@ TEST_F(TestMmcMetaManager, PrefetchKeys_ValidKeys_ReturnsOk) | |||
| 1082 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; | 1074 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; |
| 1083 | 1075 | ||
| 1084 | uint64_t defaultTtl = 2000; | 1076 | uint64_t defaultTtl = 2000; |
| 1085 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 1077 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 1086 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 1078 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 1087 | 1079 | ||
| 1088 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 1080 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -1112,7 +1104,7 @@ TEST_F(TestMmcMetaManager, EvictKeys_ValidKeys_ReturnsOk) | |||
| 1112 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; | 1104 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; |
| 1113 | 1105 | ||
| 1114 | uint64_t defaultTtl = 2000; | 1106 | uint64_t defaultTtl = 2000; |
| 1115 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 1107 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 1116 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 1108 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 1117 | 1109 | ||
| 1118 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 1110 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -1142,7 +1134,7 @@ TEST_F(TestMmcMetaManager, PrefetchKey_SingleKey_ReturnsOk) | |||
| 1142 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; | 1134 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; |
| 1143 | 1135 | ||
| 1144 | uint64_t defaultTtl = 2000; | 1136 | uint64_t defaultTtl = 2000; |
| 1145 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 1137 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 1146 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 1138 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 1147 | 1139 | ||
| 1148 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 1140 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -1167,7 +1159,7 @@ TEST_F(TestMmcMetaManager, EvictKey_SingleKey_ReturnsOk) | |||
| 1167 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; | 1159 | MmcLocalMemlInitInfo dramInfo{0, 128 * 1024}; |
| 1168 | 1160 | ||
| 1169 | uint64_t defaultTtl = 2000; | 1161 | uint64_t defaultTtl = 2000; |
| 1170 | - MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U, REWARM_DRAM_WATERMARK); | 1162 | + MmcRef<MmcMetaManager> metaMng = MmcMakeRef<MmcMetaManager>(defaultTtl, 70U, 60U); |
| 1171 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 1163 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 1172 | 1164 | ||
| 1173 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; | 1165 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobMap; |
| @@ -65,6 +65,8 @@ TEST_F(TestMmcMetaService, Init) | |||
| 65 | metaServiceConfig.evictThresholdLow = 60U; | 65 | metaServiceConfig.evictThresholdLow = 60U; |
| 66 | metaServiceConfig.haEnable = true; | 66 | metaServiceConfig.haEnable = true; |
| 67 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 67 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 68 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 69 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 68 | // mmc_meta_service_config_t no longer has localSsdSize | 70 | // mmc_meta_service_config_t no longer has localSsdSize |
| 69 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); | 71 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); |
| 70 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); | 72 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); |
| @@ -114,6 +116,8 @@ TEST_F(TestMmcMetaService, ExistRequest) | |||
| 114 | metaServiceConfig.evictThresholdLow = 60U; | 116 | metaServiceConfig.evictThresholdLow = 60U; |
| 115 | metaServiceConfig.haEnable = true; | 117 | metaServiceConfig.haEnable = true; |
| 116 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 118 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 119 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 120 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 117 | // mmc_meta_service_config_t no longer has localSsdSize | 121 | // mmc_meta_service_config_t no longer has localSsdSize |
| 118 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); | 122 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); |
| 119 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); | 123 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); |
| @@ -169,6 +173,8 @@ TEST_F(TestMmcMetaService, BatchExistRequest) | |||
| 169 | metaServiceConfig.evictThresholdLow = 60U; | 173 | metaServiceConfig.evictThresholdLow = 60U; |
| 170 | metaServiceConfig.haEnable = true; | 174 | metaServiceConfig.haEnable = true; |
| 171 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 175 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 176 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 177 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 172 | // mmc_meta_service_config_t no longer has localSsdSize | 178 | // mmc_meta_service_config_t no longer has localSsdSize |
| 173 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); | 179 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); |
| 174 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); | 180 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); |
| @@ -244,6 +250,8 @@ TEST_F(TestMmcMetaService, QueryRequest) | |||
| 244 | metaServiceConfig.evictThresholdLow = 60U; | 250 | metaServiceConfig.evictThresholdLow = 60U; |
| 245 | metaServiceConfig.haEnable = true; | 251 | metaServiceConfig.haEnable = true; |
| 246 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 252 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 253 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 254 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 247 | // mmc_meta_service_config_t no longer has localSsdSize | 255 | // mmc_meta_service_config_t no longer has localSsdSize |
| 248 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); | 256 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); |
| 249 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); | 257 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); |
| @@ -303,6 +311,8 @@ TEST_F(TestMmcMetaService, BatchQueryRequest) | |||
| 303 | metaServiceConfig.evictThresholdLow = 60U; | 311 | metaServiceConfig.evictThresholdLow = 60U; |
| 304 | metaServiceConfig.haEnable = true; | 312 | metaServiceConfig.haEnable = true; |
| 305 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 313 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 314 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 315 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 306 | // mmc_meta_service_config_t no longer has localSsdSize | 316 | // mmc_meta_service_config_t no longer has localSsdSize |
| 307 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); | 317 | UrlStringToChar(metaUrl, metaServiceConfig.discoveryURL); |
| 308 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); | 318 | UrlStringToChar(bmUrl, metaServiceConfig.configStoreURL); |
| @@ -28,8 +28,6 @@ using namespace ock::mmc; | |||
| 28 | 28 | ||
| 29 | namespace { | 29 | namespace { |
| 30 | 30 | ||
| 31 | -constexpr uint16_t REWARM_DRAM_WATERMARK = 100U; | ||
| 32 | - | ||
| 33 | struct RecordedEvent { | 31 | struct RecordedEvent { |
| 34 | std::string type; // "stored" / "removed" / "cleared" | 32 | std::string type; // "stored" / "removed" / "cleared" |
| 35 | std::string key; | 33 | std::string key; |
| @@ -103,7 +101,7 @@ TEST_F(TestMetaManagerKvEvents, UpdateStateEmitsStored) | |||
| 103 | { | 101 | { |
| 104 | MmcLocation loc{0, MEDIA_DRAM}; | 102 | MmcLocation loc{0, MEDIA_DRAM}; |
| 105 | MmcLocalMemlInitInfo locInfo{0, 1000000}; | 103 | MmcLocalMemlInitInfo locInfo{0, 1000000}; |
| 106 | - auto metaMng = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U, REWARM_DRAM_WATERMARK); | 104 | + auto metaMng = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U); |
| 107 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 105 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 108 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobList; | 106 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobList; |
| 109 | metaMng->Mount(loc, locInfo, blobList, false); | 107 | metaMng->Mount(loc, locInfo, blobList, false); |
| @@ -137,7 +135,7 @@ TEST_F(TestMetaManagerKvEvents, RemoveEmitsRemoved) | |||
| 137 | { | 135 | { |
| 138 | MmcLocation loc{0, MEDIA_DRAM}; | 136 | MmcLocation loc{0, MEDIA_DRAM}; |
| 139 | MmcLocalMemlInitInfo locInfo{0, 1000000}; | 137 | MmcLocalMemlInitInfo locInfo{0, 1000000}; |
| 140 | - auto metaMng = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U, REWARM_DRAM_WATERMARK); | 138 | + auto metaMng = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U); |
| 141 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 139 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 142 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobList; | 140 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobList; |
| 143 | metaMng->Mount(loc, locInfo, blobList, false); | 141 | metaMng->Mount(loc, locInfo, blobList, false); |
| @@ -173,7 +171,7 @@ TEST_F(TestMetaManagerKvEvents, NoSinkIsNoop) | |||
| 173 | { | 171 | { |
| 174 | MmcLocation loc{0, MEDIA_DRAM}; | 172 | MmcLocation loc{0, MEDIA_DRAM}; |
| 175 | MmcLocalMemlInitInfo locInfo{0, 1000000}; | 173 | MmcLocalMemlInitInfo locInfo{0, 1000000}; |
| 176 | - auto metaMng = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U, REWARM_DRAM_WATERMARK); | 174 | + auto metaMng = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U); |
| 177 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 175 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 178 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobList; | 176 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobList; |
| 179 | metaMng->Mount(loc, locInfo, blobList, false); | 177 | metaMng->Mount(loc, locInfo, blobList, false); |
| @@ -193,7 +191,7 @@ TEST_F(TestMetaManagerKvEvents, RemoveAllEmitsRemovedPerKey) | |||
| 193 | { | 191 | { |
| 194 | MmcLocation loc{0, MEDIA_DRAM}; | 192 | MmcLocation loc{0, MEDIA_DRAM}; |
| 195 | MmcLocalMemlInitInfo locInfo{0, 4000000}; | 193 | MmcLocalMemlInitInfo locInfo{0, 4000000}; |
| 196 | - auto metaMng = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U, REWARM_DRAM_WATERMARK); | 194 | + auto metaMng = MmcMakeRef<MmcMetaManager>(2000U, 70U, 60U); |
| 197 | ASSERT_EQ(metaMng->Start(), MMC_OK); | 195 | ASSERT_EQ(metaMng->Start(), MMC_OK); |
| 198 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobList; | 196 | std::vector<std::pair<std::string, MmcMemBlobDesc>> blobList; |
| 199 | metaMng->Mount(loc, locInfo, blobList, false); | 197 | metaMng->Mount(loc, locInfo, blobList, false); |
| @@ -101,6 +101,8 @@ TEST_F(TestMmcServiceInterface, MultiLevelEvict) | |||
| 101 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; | 101 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; |
| 102 | metaServiceConfig.logRotationFileCount = 20; | 102 | metaServiceConfig.logRotationFileCount = 20; |
| 103 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 103 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 104 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 105 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 104 | metaServiceConfig.evictThresholdHigh = 80U; | 106 | metaServiceConfig.evictThresholdHigh = 80U; |
| 105 | metaServiceConfig.evictThresholdLow = 60U; | 107 | metaServiceConfig.evictThresholdLow = 60U; |
| 106 | metaServiceConfig.haEnable = false; | 108 | metaServiceConfig.haEnable = false; |
| @@ -193,6 +195,8 @@ TEST_F(TestMmcServiceInterface, metaServiceStart) | |||
| 193 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; | 195 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; |
| 194 | metaServiceConfig.logRotationFileCount = 20; | 196 | metaServiceConfig.logRotationFileCount = 20; |
| 195 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 197 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 198 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 199 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 196 | metaServiceConfig.evictThresholdHigh = 70; | 200 | metaServiceConfig.evictThresholdHigh = 70; |
| 197 | metaServiceConfig.evictThresholdLow = 60U; | 201 | metaServiceConfig.evictThresholdLow = 60U; |
| 198 | metaServiceConfig.haEnable = true; | 202 | metaServiceConfig.haEnable = true; |
| @@ -109,6 +109,8 @@ TEST_F(TestUbsIoEnabled, PutAndGetWithUbsIoFallback) | |||
| 109 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; | 109 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; |
| 110 | metaServiceConfig.logRotationFileCount = 20; | 110 | metaServiceConfig.logRotationFileCount = 20; |
| 111 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 111 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 112 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 113 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 112 | metaServiceConfig.evictThresholdHigh = 80U; | 114 | metaServiceConfig.evictThresholdHigh = 80U; |
| 113 | metaServiceConfig.evictThresholdLow = 60U; | 115 | metaServiceConfig.evictThresholdLow = 60U; |
| 114 | metaServiceConfig.haEnable = false; | 116 | metaServiceConfig.haEnable = false; |
| @@ -189,6 +191,8 @@ TEST_F(TestUbsIoEnabled, BatchGetWithUbsIoFallback) | |||
| 189 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; | 191 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; |
| 190 | metaServiceConfig.logRotationFileCount = 20; | 192 | metaServiceConfig.logRotationFileCount = 20; |
| 191 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 193 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 194 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 195 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 192 | metaServiceConfig.evictThresholdHigh = 80U; | 196 | metaServiceConfig.evictThresholdHigh = 80U; |
| 193 | metaServiceConfig.evictThresholdLow = 60U; | 197 | metaServiceConfig.evictThresholdLow = 60U; |
| 194 | metaServiceConfig.haEnable = false; | 198 | metaServiceConfig.haEnable = false; |
| @@ -286,6 +290,8 @@ TEST_F(TestUbsIoEnabled, ExistOperationsWithUbsIo) | |||
| 286 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; | 290 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; |
| 287 | metaServiceConfig.logRotationFileCount = 20; | 291 | metaServiceConfig.logRotationFileCount = 20; |
| 288 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 292 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 293 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 294 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 289 | metaServiceConfig.evictThresholdHigh = 80U; | 295 | metaServiceConfig.evictThresholdHigh = 80U; |
| 290 | metaServiceConfig.evictThresholdLow = 60U; | 296 | metaServiceConfig.evictThresholdLow = 60U; |
| 291 | metaServiceConfig.haEnable = false; | 297 | metaServiceConfig.haEnable = false; |
| @@ -365,6 +371,8 @@ TEST_F(TestUbsIoEnabled, QueryOperationsWithUbsIo) | |||
| 365 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; | 371 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; |
| 366 | metaServiceConfig.logRotationFileCount = 20; | 372 | metaServiceConfig.logRotationFileCount = 20; |
| 367 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 373 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 374 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 375 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 368 | metaServiceConfig.evictThresholdHigh = 80U; | 376 | metaServiceConfig.evictThresholdHigh = 80U; |
| 369 | metaServiceConfig.evictThresholdLow = 60U; | 377 | metaServiceConfig.evictThresholdLow = 60U; |
| 370 | metaServiceConfig.haEnable = false; | 378 | metaServiceConfig.haEnable = false; |
| @@ -447,6 +455,8 @@ TEST_F(TestUbsIoEnabled, UbsIoFallbackWhenMemcacheFull) | |||
| 447 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; | 455 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; |
| 448 | metaServiceConfig.logRotationFileCount = 20; | 456 | metaServiceConfig.logRotationFileCount = 20; |
| 449 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 457 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 458 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 459 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 450 | metaServiceConfig.evictThresholdHigh = 80U; | 460 | metaServiceConfig.evictThresholdHigh = 80U; |
| 451 | metaServiceConfig.evictThresholdLow = 60U; | 461 | metaServiceConfig.evictThresholdLow = 60U; |
| 452 | metaServiceConfig.haEnable = false; | 462 | metaServiceConfig.haEnable = false; |
| @@ -532,6 +542,8 @@ TEST_F(TestUbsIoEnabled, UbsIoDisabledCompare) | |||
| 532 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; | 542 | metaServiceConfig.logRotationFileSize = 2 * 1024 * 1024; |
| 533 | metaServiceConfig.logRotationFileCount = 20; | 543 | metaServiceConfig.logRotationFileCount = 20; |
| 534 | metaServiceConfig.accTlsConfig.tlsEnable = false; | 544 | metaServiceConfig.accTlsConfig.tlsEnable = false; |
| 545 | + metaServiceConfig.asyncFlushIntervalMs = 1000UL; | ||
| 546 | + metaServiceConfig.asyncFlushBatchLimit = 8UL; | ||
| 535 | metaServiceConfig.evictThresholdHigh = 80U; | 547 | metaServiceConfig.evictThresholdHigh = 80U; |
| 536 | metaServiceConfig.evictThresholdLow = 60U; | 548 | metaServiceConfig.evictThresholdLow = 60U; |
| 537 | metaServiceConfig.haEnable = false; | 549 | metaServiceConfig.haEnable = false; |
这部分metrics的修改可以更新到memcache_restful_api.md