Everything about logs

1 Log definition

Log is a possible storage abstraction, it is an append-only, totally-ordered sequence of records ordered by time, with ‘timestamp’ as the log entry number.

log in database

logs are used to keep sync with the variety of data structures and indexes.

ACID: a database uses a log to write out information about the records they will be modifying, before applying the changes to all the various data structures it maintains. It is immediately persisted so that can be persistent structures if crash occurs.

log in distributed system

Ordering changes and distributing data

if two identical, deterministic processes begin in the same state and get the same inputs in the same order, they will produce the same output and end in the  same state.
  • deterministic: not time dependent
  • state of the process is whatever data remains on the machine, either on memory or on disk

physical logging: logging the contents of each row that is changed.
logical logging: logging not the changed rows but the sql commands that lead to the row changes.

reference

https://engineering.linkedin.com/distributed-systems/log-what-every-software-engineer-should-know-about-real-time-datas-unifying

https://www.kancloud.cn/kancloud/log-real-time-datas-unifying/58710