[Elasticsearch - The Definitive Guide] Making Changes Persistent

Elastic/TheDefinitiveGuide 2015. 12. 9. 17:02

per-segment search works 와 더불어 알아 두면 좋을 것 같아 올려봅니다.


원문링크)

https://www.elastic.co/guide/en/elasticsearch/guide/current/translog.html


원문 Snippet)

Elasticsearch uses this commit point during startup or when reopening an index to decide which segments belong to the current shard.

...중략...

Elasticsearch added a translog, or transaction log, which records every operation in Elasticsearch as it happens.


아래는 원문에 나와 있는 Making Changes Persistent 에 대한 flow 정리 입니다.


1) write in-memory buffer & translog

2) write new segment file without fsync

3) flush in-memory buffer (run refresh and not yet flush)

4) write in-memory buffer & append translog 

5) write new segment file (run flush)

6) flush in-memory buffer

7) write commit point on disk

8) flush filesystem cache with fsync

9) delete old translog

10) create new translog


기본적으로 refresh 와 flush 는 간단하게 아래와 같이 이해 하시면 됩니다.


- refresh

검색 가능한 상태로 만들어 줍니다.


- flush

fsync 작업을 합니다. (commit point 기록 및 translog 제거)

: