0%

分组优化

在使用group by进行分组时,实际上也需要进行排序操作,与order by相比,group by主要是多了排序之后的分组操作

group by的实现有三种方式

  • 使用松散索引扫描实现group by
  • 使用紧凑索引扫描实现group by
  • 使用临时表实现group by
阅读全文 »

开机

BIOS->

启动盘的第一个扇区,512K的大小,称之为MBR(Master Boot Record,主引导记录/扇区),这里保存了boot.img,将之加载到内存中->

boot.img加载grub2的另一个镜像core.img(core.img由diskboot.img、lzma_decompress.img、kernel.img和一系列模块组成)->

diskboot.img的任务是将core.img的其他部分加载进来,显示解压缩程序lzma_decompress.img,然后是kernel.img,最后是各个模块module对应的映像->

lzma_decompress.img实模式到保护模式,建立分段分页,打开地址线->

kernel.img里的grub_main会展示操作系统列表,选择操作系统->

启动内核

RequestBodyAdvice和ResponseBodyAdvice

有两个接口

RequestBodyAdviceResponseBodyAdvice 在spring4中新添加的两个接口

RequestBodyAdvice接口

该接口是在获取@RequestBody参数数据之前进行处理的

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public interface RequestBodyAdvice {


boolean supports(MethodParameter methodParameter, Type targetType,
Class<? extends HttpMessageConverter<?>> converterType);


Object handleEmptyBody(Object body, HttpInputMessage inputMessage, MethodParameter parameter,
Type targetType, Class<? extends HttpMessageConverter<?>> converterType);


HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter,
Type targetType, Class<? extends HttpMessageConverter<?>> converterType) throws IOException;


Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodParameter parameter,
Type targetType, Class<? extends HttpMessageConverter<?>> converterType);

}

ResponseBodyAdvice接口

该接口是在消息体被HttpMessageConverter消息解析器写入之前执行的

1
2
3
4
5
6
7
8
9
10
11
public interface ResponseBodyAdvice<T> {


boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType);


T beforeBodyWrite(T body, MethodParameter returnType, MediaType selectedContentType,
Class<? extends HttpMessageConverter<?>> selectedConverterType,
ServerHttpRequest request, ServerHttpResponse response);

}

数据备份和恢复

什么情况下会用到数据备份呢

数据丢失的场景

  • 人为误操作造成的某些数据被误操作
  • 软件BUG造成数据部分或者全部丢失
  • 硬件故障造成数据库部分或全部丢失
  • 安全漏洞被入侵数据恶意破坏

非数据丢失场景

  • 基于某个时间点的数据恢复
  • 开发测试环境数据库搭建
  • 相同数据库的新环境搭建
  • 数据库或者数据迁移
阅读全文 »

属性绑定原理

注意:使用版本为spring-boot-2.2.2.RELEASE

在进行自定义配置的时候,我们通常使用@ConfigurationProperties注解来进行配置文件和配置类的映射,那么为什么可以映射呢?

主要靠的是@EnableConfigurationProperties注解来进行自动的将外部配置绑定到@ConfigurationProperties标注的类的属性中

1
2
3
4
5
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import(EnableConfigurationPropertiesRegistrar.class)
public @interface EnableConfigurationProperties
阅读全文 »