From b688470c7d58ec3fbb81c68f964c1705e2d63f07 Mon Sep 17 00:00:00 2001 From: jsy Date: Fri, 5 Jan 2024 13:18:57 +0800 Subject: [PATCH] fix: fix dbCoreService switch (#775) --- .../meta/core/service/DBCoreServiceSwitcher.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/server/meta/meta-core/src/main/java/io/holoinsight/server/meta/core/service/DBCoreServiceSwitcher.java b/server/meta/meta-core/src/main/java/io/holoinsight/server/meta/core/service/DBCoreServiceSwitcher.java index 6f5ccfe0a..62de0866b 100644 --- a/server/meta/meta-core/src/main/java/io/holoinsight/server/meta/core/service/DBCoreServiceSwitcher.java +++ b/server/meta/meta-core/src/main/java/io/holoinsight/server/meta/core/service/DBCoreServiceSwitcher.java @@ -3,15 +3,18 @@ */ package io.holoinsight.server.meta.core.service; +import io.holoinsight.server.common.dao.entity.MetaDataDictValue; import io.holoinsight.server.common.service.SuperCacheService; import io.holoinsight.server.meta.core.service.bitmap.BitmapDataCoreService; import io.holoinsight.server.meta.core.service.hashmap.HashMapDataCoreService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.HashMap; @Service +@Slf4j public class DBCoreServiceSwitcher { @Autowired @@ -24,13 +27,15 @@ public class DBCoreServiceSwitcher { private SuperCacheService superCacheService; public DBCoreService dbCoreService() { - boolean metaIndexBitMapEnable = true; + boolean metaIndexBitMapEnable = false; try { - metaIndexBitMapEnable = Boolean.parseBoolean(superCacheService.getSc().metaDataDictValueMap - .getOrDefault("global_config", new HashMap<>()).get("meta_index_bitmap_enable") - .getDictValue()); + MetaDataDictValue metaDataDictValue = superCacheService.getSc().metaDataDictValueMap + .getOrDefault("global_config", new HashMap<>()).get("meta_index_bitmap_enable"); + if (null != metaDataDictValue) { + metaIndexBitMapEnable = Boolean.parseBoolean(metaDataDictValue.getDictValue()); + } } catch (Exception e) { - metaIndexBitMapEnable = true; + log.warn("meta_index_bitmap_enable value illegal"); } DBCoreService service = metaIndexBitMapEnable ? bitmapDataCoreService : hashMapDataCoreService; service.startBuildIndex();