Skip to content

Commit

Permalink
fix: fix dbCoreService switch (#775)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsy1001de authored Jan 5, 2024
1 parent 38ef61c commit b688470
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand Down

0 comments on commit b688470

Please sign in to comment.