Skip to content

Stop the world Approach, Versioning Approach, and more

Youngjin Yu edited this page Dec 15, 2022 · 7 revisions
sequenceDiagram
  participant BlockMapUpdateRequest
  participant MetaUpdater
  participant JournalWriter
  participant SegmentCtx
  participant Stripe
  participant VSAMapManager
  participant BlockMapUpdate
  participant LogWriteHandler
  participant MapUpdateLogWriteContext
  participant LogBufferIoContext
  participant JournalLogBuffer
  participant MetaFsFileIntf
  participant BufferOffsetAllocator
  participant DirtyMapManager
  participant LogGroupReleaser
  participant LogGroupResetCompletedEvent
  participant LogGroupFooterWriteEvent
  participant ResetLogGroup
  participant EventScheduler
  participant CallbackSequenceController
  participant CheckpointSubmission
  participant CheckpointManager
  participant CheckpointCompletion
  participant CheckpointHandler
  participant Mapper
  participant CheckpointMetaFlushCompleted
  participant ContextManager
  participant ContextIoManager

  BlockMapUpdateRequest->>MetaUpdater: UpdateBlockMap()
  Note left of BlockMapUpdateRequest: Submitted user I/O
  MetaUpdater->>JournalWriter: AddBlockMapUpdatedLog()
  JournalWriter->>LogWriteHandler: AddLog()
  LogWriteHandler->>BufferOffsetAllocator: AllocateBuffer()
  BufferOffsetAllocator->>BufferOffsetAllocator: _TryToSetFull()
  BufferOffsetAllocator->>LogGroupReleaser: MarkLogGroupFull()
  LogGroupReleaser->>LogGroupReleaser: _TriggerCheckpoint()
  LogGroupReleaser->>EventScheduler: CheckpointSubmission
  BufferOffsetAllocator->>LogWriteHandler: allocated offset
  LogWriteHandler->>JournalLogBuffer: WriteLog()
  JournalLogBuffer->>MetaFsFileIntf: AsyncIO()
  MetaFsFileIntf-->>LogWriteHandler: LogWriteDone() by AsyncMetaFileIoCtx
  LogWriteHandler->>MapUpdateLogWriteContext: IoDone()
  MapUpdateLogWriteContext->>CallbackSequenceController: Lock()
  MapUpdateLogWriteContext->>LogBufferIoContext: IoDone()
  LogBufferIoContext->>BlockMapUpdate: Execute()
  BlockMapUpdate->>VSAMapManager: SetVSAs()
  BlockMapUpdate->>Stripe: UpdateReverseMapEntry()
  BlockMapUpdate->>SegmentCtx: InvalidateBlocksWithGroupId() 1..N times
  BlockMapUpdate->>SegmentCtx: ValidateBlocksWithGroupId()
  MapUpdateLogWriteContext->>CallbackSequenceController: Unlock()

  EventScheduler-->>CheckpointSubmission: Execute()
  CheckpointSubmission->>CheckpointManager: RequestCheckpoint()
  CheckpointManager->>CallbackSequenceController: Lock()
  CheckpointManager->>CheckpointHandler: Start()
  CheckpointHandler->>Mapper: FlushDirtyMpages()
  Mapper->>CheckpointHandler: memcpy'd & I/O submitted
  CheckpointHandler->>ContextManager: FlushContexts()
  ContextManager->>ContextIoManager: FlushContexts()
  ContextIoManager->>ContextIoManager: SegmentCtx submitted
  ContextIoManager->>ContextIoManager: AllocatorCtx submitted
  ContextIoManager->>ContextManager: SUCCESS
  ContextManager->>CheckpointHandler: SUCCESS
  CheckpointHandler->>CheckpointManager: SUCCESS
  CheckpointManager->>CallbackSequenceController: Unlock()
  ContextIoManager-->>ContextIoManager: _FlushCompleted()
  ContextIoManager->>EventScheduler: CheckpointMetaFlushCompleted
  EventScheduler-->>CheckpointMetaFlushCompleted: Execute()
  CheckpointMetaFlushCompleted->>CheckpointHandler: FlushCompleted()
  CheckpointHandler->>CheckpointHandler: _TryToComplete()
  CheckpointHandler->>EventScheduler: CheckpointCompletion
  EventScheduler-->>CheckpointCompletion: Execute()
  CheckpointCompletion->>CheckpointManager: CheckpointCompleted()
  CheckpointManager->>EventScheduler: ResetLogGroup
  EventScheduler-->>ResetLogGroup: Execute()
  ResetLogGroup->>LogGroupFooterWriteEvent: Execute()
  LogGroupFooterWriteEvent-->>LogGroupResetCompletedEvent: Execute()
  LogGroupResetCompletedEvent->>LogGroupReleaser: LogGroupResetCompleted()
  LogGroupReleaser->>DirtyMapManager: LogFilled()
  LogGroupReleaser->>BufferOffsetAllocator: LogFilled()
  LogGroupReleaser->>LogWriteHandler: LogFilled()
Loading
Clone this wiki locally