侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

Kylin页面System操作源码解读

2023-12-18 星期一 / 0 评论 / 0 点赞 / 20 阅读 / 3365 字

System中的主要操作在AdminController和CacheController一. 源码结构前端源码:angular:下面为自定义方法:* Method type is PUT * Addi

System中的主要操作在AdminController和CacheController

一. 源码结构

前端源码:angular:下面为自定义方法:

* Method type is PUT * Additional Query parameter action=config is sent * The expected return type not is an Array */ updateConfig: {method: 'PUT', params: {action: 'config'}, isArray: false}KylinApp.factory('AdminService', ['$resource', function ($resource, config) {  return $resource(Config.service.url + 'admin/:action', {}, {    env: {method: 'GET', params: {action: 'env'}, isArray: false},    config: {method: 'GET', params: {action: 'config'}, isArray: false},    publicConfig: {method: 'GET', params: {action: 'public_config'}, isArray: false},    cleanStorage: {method: 'DELETE', params: {action: 'storage'}, isArray: false},    updateConfig: {method: 'PUT', params: {action: 'config'}, isArray: false}  });}]);params: {action: 'config'}对应AdminController的RequestMapping的映射

二. 探索每个按钮

1. Server Config的刷新按钮

调用的是getConfig(AdminController中的getConfig方法)getConfig操作会从ThreadLocal的KylinConfig中查找有没有此对象,如果有则获取返回,所以当set Config之后,有了KylinConfig对象,所以Server Config的刷新按钮可以获取到修改后的配置属性

2. Server Environment刷新按钮

调用的是getEnv操作(AdminController中的getEnv方法)

3. Set Config按钮

调用updateKylinConfig,会将前端也就是页面上传过来的kv值进行更新,会将数据存储到KylinConfig对象内存中。这是一个put操作,在restful中相当于调用服务器的update方法。

4. Clean Up Storage

调用(AdminController中的cleanupStorage方法)storage对应cleanupStorage,此操作的运行原理官网解释:http://kylin.apache.org/docs/howto/howto_cleanup_storage.html,也就是会清除kylin cube构建 工作期间生成的hdfs中间文件

5. reloadConfig

调用hotLoadKylinConfig(CacheController中)这是一个POST请求,可以热加载配置文件的更新,通过broadcast的方式KylinConfig.getInstanceFromEnv().reloadFromSiteProperties();cacheService.notifyMetadataChange(Broadcaster.SYNC_ALL, Broadcaster.Event.UPDATE, Broadcaster.SYNC_ALL);reloadFromSiteProperties操作会使用BackwardCompatibilityConfig的check方法,将key,value强制转换为String类型,类似于格式化

6. Calculate Cardinality

预估某个hive表的基数,点击这个按钮会让用户填写hive表相关信息

7. Disable Cache

是将kylin.query.cache-enabled参数设为false

8. Enable Cache

是将kylin.query.cache-enabled参数设为true

9. Reload metadata

调用CacheController的announceWipeCache方法 会使用Broadcaster清除所有节点缓存

所以,当set config之后,只是将参数设置到了Properties对象中,并不持久化,而当reload时,会读取kylin.properties文件的配置,所以reload会重新刷新缓存内容

广告 广告

评论区