Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/segment storage improvement #399

Merged
merged 23 commits into from Mar 4, 2020

Conversation

killme2008
Copy link
Contributor

@killme2008 killme2008 commented Feb 18, 2020

Motivation:

RocksDBSegmentLogStorage improvements. #316

Modification:

It's ready for review. @fengjiachun @zongtanghu @masaimu @SteNicholas .

Main changes:

  • Introduce a new data format for segment (See SegmentFile file comment), so it's not compilable with old versions.Because this log storage is experimental in old versions, i think it's acceptable.
  • Pre-allocate segments to prevent the slow mmap system call when creates a new segment file.
  • Concurrent write buffers when appending log entires in batch and fsync once(group commit).
  • Swap out segment file when it's idle, swap in if needed.
  • Some performance tweak.
  • Fixed some issues:
    • Can't read when RaftOptions's sync is false.
    • Forget to correct diskId in LogManager after snapshot is loaded.
    • RocksDBSegmentLogStorage#truncateSuffix throws exception when log not found.

Result:

Fixes #316.

@killme2008 killme2008 force-pushed the feature/segment-storage-improvement branch from 2fee163 to 938c808 Compare February 18, 2020 17:52
@sofastack-bot sofastack-bot bot added size/XXL and removed size/L labels Feb 21, 2020
@killme2008 killme2008 force-pushed the feature/segment-storage-improvement branch from 50e9925 to 7fd7ce2 Compare February 26, 2020 11:35
@killme2008 killme2008 changed the title [WIP] Feature/segment storage improvement Feature/segment storage improvement Feb 26, 2020
@killme2008
Copy link
Contributor Author

killme2008 commented Feb 26, 2020

It's ready for review. @fengjiachun @zongtanghu @masaimu @SteNicholas .

Main changes:

  • Introduce a new data format for segment (See SegmentFile file comment), so it's not compilable with old versions.Because this log storage is experimental in old versions, i think it's acceptable.
  • Pre-allocate segments to prevent the slow mmap system call when creates a new segment file.
  • Concurrent write buffers when appending log entires in batch and fsync once(group commit).
  • Swap out segment file when it's idle, swap in if needed.
  • Some performance tweak.
  • Fixed some issues:
    • Can't read when RaftOptions's sync is false.
    • Forget to correct diskId in LogManager after snapshot is loaded.
    • RocksDBSegmentLogStorage#truncateSuffix throws exception when log not found.

}

/**
* wait for all sub jobs finish.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait -> Wait

@fengjiachun fengjiachun merged commit 94c2ece into master Mar 4, 2020
@fengjiachun fengjiachun deleted the feature/segment-storage-improvement branch March 4, 2020 04:20
@fengjiachun fengjiachun mentioned this pull request Apr 17, 2020
12 tasks
zongtanghu pushed a commit that referenced this pull request Apr 28, 2020
* (fix) RocksDBSegmentLogStorage can't be read when sync is false

* (feat) Impl concurrent writing for segment log storage

* (feat) use segment log storage as default log storage

* (fix) forgot to reset diskId after loading snapshot

* (feat) tweak RocksDBSegmentLogStorage

* (feat) refactor RocksDBSegmentLogStorage: use a new data format and pre-allocate segments.

* (feat) Adds LogManagerWithSegmentLogStorageTest

* (feat) Named SegmentAllocator thread

* (fix) example log

* (feat) tweak test parameters and warn when using RocksDBSegmentLogStorage on mac

* (feat) make write executor configurable

* (feat) warmup segments for test

* (fix) stackoverflow when fsm caller is overload

* (feat) Impl segment swap in/out

* (fix) panic when RocksDBSegmentLogStorage#onTruncateSuffix log not found.

* (feat) remove mlock,because it has oom risk

* (feat) use filename in checkpoint instead of absolute path

* (feat) use RocksDBLogStorage as default log storage

* (feat) Destroy segment file out of lock

* (feat) minor changes by CR.

* (feat) Introduce WriteContext to wrap CountDownEvents

* (fix) typo

* (feat) minor changes by CR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RocksDBSegmentLogStorage improvements
3 participants