elasticsearch 5.2.2 学习笔记之源码阅读6-索引流程总览之删除索引

本文深入解析了Elasticsearch 5.2.2版本中删除索引的流程,涵盖了DeleteIndexAction、RestDeleteIndexAction及TransportDeleteIndexAction的交互过程。详细介绍了涉及的核心组件如MetaDataDeleteIndexService、AllocationService和DestructiveOperations的作用,以及它们如何协同工作完成索引的删除操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

elasticsearch 5.2.2 学习笔记之源码阅读6-索引流程总览之删除索引

概述

索引流程总览之删除索引 接上一篇 elasticsearch 5.2.2 学习笔记之源码阅读5-索引流程总览之添加索引类型数据

核心接口与类

  • 前置加载过程与 https://blog.youkuaiyun.com/undergrowth/article/details/82851401 类似,主要看各个Action的不同
  • 本文涉及到的Action
    • 删除索引
      • DeleteIndexAction/RestDeleteIndexAction/TransportDeleteIndexAction
  • 使用AbstractComponent和AbstractLifecycleComponent管理核心组件的配置与生命周期
    • AbstractComponent
      • MetaDataDeleteIndexService(负责提交删除索引请求)
      • AllocationService(管理集群中节点的分片行为)
      • DestructiveOperations(辅助操作类)
  • IndexComponent
    • AbstractIndexComponent
      • IndexService(负责索引相关功能)
      • MapperService(负责映射相关功能)
  • ClusterState(管理集群的状态以及各种元信息存放)
  • MetaData(存放集群元信息)
  • IndexMetaData(单个索引的元信息)
    • settings/mappings/aliases/numberOfShards/numberOfReplicas等信息
  • RoutingTable(存放集群范围内所有索引的路由信息)
  • TransportAction
    • HandledTransportAction(负责在传输层注册处理器处理消息)
      • TransportMasterNodeAction(封装需要在master节点才能操作的行为)
        • TransportDeleteIndexAction(删除索引Action)

以删除索引为例讲解加载过程

  • postman delete http://localhost:9200/testindex
    • 前置加载过程参看 https://blog.youkuaiyun.com/undergrowth/article/details/82851401
    • 分别来看DeleteIndexAction/RestDeleteIndexAction/TransportDeleteIndexAction三者间的消息扭转
      • 通过RestDeleteIndexAction#prepareRequest创建DeleteIndexRequest请求,借助NodeClient#executeLocally扭转到TransportDeleteIndexAction#doExecute
      • 创建AsyncSingleAction执行删除删除索引请求,进而回调TransportMasterNodeAction#masterOperation和TransportDeleteIndexAction#masterOperation,依赖org.elasticsearch.cluster.metadata.MetaDataDeleteIndexService#deleteIndices完成相关索引信息的更新与操作
      • 从集群中删除索引信息MetaDataDeleteIndexService#deleteIndices,例如进行快照检查SnapshotsService.checkIndexDeletion,从路由表中删除routingTableBuilder.remove,集群数据块中删除clusterBlocksBuilder.removeIndexBlocks,元信息中删除metaDataBuilder.remove,同时数据重新分片allocationService.reroute
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值