summaryrefslogtreecommitdiffstats
path: root/src/journal/JournalPlayer.cc (follow)
Commit message (Collapse)AuthorAgeFilesLines
* common/RefCountedObj: cleanup con/desPatrick Donnelly2019-09-161-51/+37
| | | | | | | | | | | | | | | | | | Also, don't allow children to set nref (to 0). This is the more significant change as it required fixing various code to not do this: <reftype> ptr = new RefCountedObjectFoo(..., 0); as a way to create a starting reference with nref==1. This is a pretty bad code smell so I've converted all the code doing this to use the new factory method which produces the reference safely: auto ptr = ceph::make_ref<RefCountedObjectFoo>(...); libradosstriper was particularly egregious in its abuse of setting the starting nref. :( Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* include: convert FunctionContext usage to generic LambdaContextPatrick Donnelly2019-09-161-2/+2
| | | | | | | | The main motivation for this change is to avoid copies due to the use of boost::function/std::function where captures of std::unique_ptr (in subsequent commits) would fail to compile. Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* journal: fix race between player shut down and cache rebalanceMykola Golub2019-08-211-0/+6
| | | | | | | | | 25a23364 was supposed to fix this race, but it was not enough: there was still a window between `prefetch` is queued for execution in handle_cache_rebalanced and is actually executed, during which shut_down can be called and completed. Signed-off-by: Mykola Golub <mgolub@suse.com>
* journal: s/Mutex/ceph::mutex/Kefu Chai2019-08-031-27/+27
| | | | | | | | | | | | | | * FutureImpl::m_lock is an exception. as, before this change, the lock was initialized like `m_lock("FutureImpl::m_lock", false, false)`, see the declaration of `Mutex(const std::string &n, bool r = false, bool ld=true, bool bt=false)` so `m_lock` is actually not using the extra features offered by `Mutex` like runtime lockdeps check. and `mutex_debugging_base` does not allow us to disable lockdeps individually. but it does use the `is_locked()` method. so instead of using `ceph::mutex` directly, a cutomized `ceph::mutex` is added for `CEPH_DEBUG_MUTEX` build. Signed-off-by: Kefu Chai <kchai@redhat.com>
* journal: fix race between player shut down and cache rebalanceMykola Golub2019-06-251-1/+1
| | | | Signed-off-by: Mykola Golub <mgolub@suse.com>
* journal: auto-tune journal fetch params based on memory targetMykola Golub2019-06-111-5/+81
| | | | | | (if a cache manager is specified) Signed-off-by: Mykola Golub <mgolub@suse.com>
* journal: Use ceph_assert for asserts.Adam C. Emerson2018-08-271-37/+37
| | | | Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* misc: fix various spelling errorsShengjing Zhu2018-03-101-1/+1
| | | | Signed-off-by: Shengjing Zhu <i@zhsj.me>
* journal: assert(false)->ceph_abort()Li Wang2017-10-021-2/+2
| | | | Signed-off-by: Li Wang <laurence.liwang@gmail.com>
* common: add override in header fileliuchang08122017-03-031-2/+2
| | | | Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
* common: add override for common submodule and miscliuchang08122017-02-161-4/+4
| | | | | | Fixes: http://tracker.ceph.com/issues/18922 Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
* journal: optimize speed of live replay journal pruningJason Dillaman2016-07-211-6/+22
| | | | | | | When streaming playback, avoid the unnecessary watch delay when one or more entries have been pruned. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: improve debug log messagesJason Dillaman2016-07-211-1/+1
| | | | | | | | rbd-mirror debugging involved potentially thousands of journals concurrently running. The instance address will correlate log messages between journals. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: support streaming entry playbackJason Dillaman2016-07-211-70/+100
| | | | | | | | Now that it's possible for the ObjectPlayer to only read a partial subset of available entries, the JournalPlayer needs to detect that more entries might be available. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: replay should only read from a single object setJason Dillaman2016-07-211-61/+26
| | | | | | | Previously it was prefetching up to 2 object sets worth of journal data objects which consumed too much memory. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: optionally fetch entries in small chunks during replayJason Dillaman2016-07-211-1/+2
| | | | | | | Support fetching the full object or incremental chunks (with a minimum of at least a single decoded entry if available). Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: player shutdown is now handled asynchronouslyJason Dillaman2016-05-251-13/+40
| | | | | Fixes: http://tracker.ceph.com/issues/15949 Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: eliminate watch delay for object refetchesJason Dillaman2016-05-241-1/+5
| | | | | | | | | The randomized write sizes of the modified rbd-mirror stress test results in a lot of journal object with few entries. Immediately fetch objects when performing a refetch check prior to closing an empty object. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: keep active tag to assist with pruning watched objectsJason Dillaman2016-05-241-99/+113
| | | | | | | | It's possible that there might be additional entries to prune in objects that haven't been prefetched yet. Keep the active tag to allow these entries to be pruned after they have been loaded. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: cleanup watch refetch flag handlingJason Dillaman2016-05-241-11/+25
| | | | | | | | | | | Clear the refetch required flag while scheduling the watch and remove the stale object after the watch completes if still empty. Previously, it was possible for the flag to become out-of-sync with whether or not it was actually refreshed and pruned. Fixes: http://tracker.ceph.com/issues/15993 Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* Merge pull request #9211 from dillaman/wip-15938Mykola Golub2016-05-201-1/+1
|\ | | | | | | | | librbd: write-after-write might result in an inconsistent replicated image Reviewed-by: Mykola Golub <mgolub@mirantis.com>
| * journal: replay position might change after pruning stale tagsJason Dillaman2016-05-201-1/+1
| | | | | | | | Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* | journal: reset watch step after pruning expired tagJason Dillaman2016-05-191-0/+1
|/ | | | Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: skip partially complete tag entries during playbackJason Dillaman2016-05-181-58/+194
| | | | | | | | | If a journal client does not fully write out its buffered entries before quiting, replay should skip over all remaining out-of- sequence entries for the tag. Fixes: http://tracker.ceph.com/issues/15864 Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: re-fetch active object before advancing set during replayJason Dillaman2016-05-181-9/+8
| | | | | | | | | | During a live replay, it's possible that an append and and overflow into the next object could race with the live playback of the same object. Re-fetch an "empty" object at least once before advancing to next set to ensure all records have been read. Fixes: http://tracker.ceph.com/issues/15665 Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* librbd: potential concurrent event processing during journal ↵Josh Durgin2016-05-101-2/+3
|\ | | | | | | | | replayReviewed-by: Josh Durgin <jdurgin@redhat.com> librbd: potential concurrent event processing during journal replay
| * journal: suppress notifications if client still in try_pop_front loopJason Dillaman2016-05-071-2/+3
| | | | | | | | | | | | | | | | | | | | One such example is popping the last entry from an object. The next object will be automatically prefetched. When that object is received, we do not want to alert the user that entries are available since try_pop_front already indicated more records were available. Fixes: http://tracker.ceph.com/issues/15755 Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* | journal: incorrectly computed object offset within setJason Dillaman2016-05-091-1/+1
|/ | | | Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: potential for double-free of context on shut downJason Dillaman2016-04-131-0/+5
| | | | | | | The context associated with a scheduled watch might be freed by two ObjectPlayers. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: possible race condition during live replayJason Dillaman2016-04-131-4/+6
| | | | | | | | | When two objects are being actively watched, it was possible for the watch context to complete before the second watch was associated. Fixes: http://tracker.ceph.com/issues/15352 Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: refetch active object before defaulting to new tagJason Dillaman2016-03-161-0/+9
| | | | | | | | If a live replay is in progress, it's possible that object offset 0 was pulled and a new tag is discovered before the current object is (re-)pulled to determine that the old tag still has entries remaining. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: reschedule watch if no entries available during live replayJason Dillaman2016-03-151-1/+3
| | | | Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* Merge pull request #7906 from dillaman/wip-14869Josh Durgin2016-03-091-3/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | journal: re-use common threads between journalers Conflicts: src/journal/JournalPlayer.cc src/librbd/Journal.cc src/test/rbd_mirror/image_replay.cc src/tools/rbd_mirror/ImageReplayer.h src/tools/rbd_mirror/Mirror.cc (merged interface changes to ImageReplayer, and reduced scope for change to JournalPlayer due to pr #7884 (wip-14663)). Reviewed-by: Josh Durgin <jdurgin@redhat.com>
| * journal: use provided work queue and timerJason Dillaman2016-03-081-7/+6
| | | | | | | | | | | | This avoids the need to open two threads per journaler. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* | journal: possible race condition during fetch playbackJason Dillaman2016-03-081-7/+13
| | | | | | | | Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* | journal: clean up playback notification handlingJason Dillaman2016-03-081-20/+31
| | | | | | | | Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* | journal: properly handle tag transitionJason Dillaman2016-03-081-57/+143
|/ | | | | | | | | Now that the tag concept has been re-used for delineating epochs for librbd, we need playback to properly handle the cases where the active playback tag abruptly ends and a newer tag is inserted in the first splay offset object. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: update JournalPlayer to support new commit trackingJason Dillaman2016-02-261-31/+58
| | | | Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: track commit position for each object splay offsetJason Dillaman2016-02-261-7/+11
| | | | | | | | It's possible, when delaying appends to the journal, that the current commit position might be in object set X while future events for a different offset might be in an object set < X. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: differentiate corruption vs missing entry errorsJason Dillaman2016-02-261-1/+1
| | | | | | | | | librbd should treat the corruption of the journal differently from missing journal entries. If entries are missing, it might be the result of a crash and the journal should just be replayed through the most recent, consistent entry. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: switched entry tags to use id instead of stringJason Dillaman2016-02-051-15/+19
| | | | | | | Later commits will add the ability to allocate tags and associate them with registered clients. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* make ctors with one argument explicitDanny Al-Gaaf2016-01-291-2/+2
| | | | | | | Use explicit keyword for constructors with one argument to prevent implicit usage as conversion functions. Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
* journal: fire replay complete event after reading last objectJason Dillaman2015-12-021-8/+18
| | | | | Fixes: #13924 Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: support replay passed skipped splay objectsJason Dillaman2015-11-231-99/+122
| | | | | | | It's possible for a splay object within a set to be skipped if the set is closed due to a full object within the set. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: update allocated tid when skipping committed entry in playerMykola Golub2015-11-121-0/+1
| | | | | | | | Otherwise, if on image open, there are no any uncommitted entries in journal, allocated tid is not updated to the latest commited and recording always starts from tid=0. Signed-off-by: Mykola Golub <mgolub@mirantis.com>
* journal: fix race condition with unwatch on shutdownJason Dillaman2015-11-061-0/+1
| | | | Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: simplified commit position trackingJason Dillaman2015-11-061-6/+8
| | | | | | | | | Now the journal player and recorder will allocate a tid to represent the associated journal entry. The order of these allocations are tracked so that the commit position can be moved only when all prior commits are safely on disk. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: fix issues discovered via valgrindJason Dillaman2015-11-061-10/+31
| | | | Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: JournalPlayer::process_state should support positive resultJason Dillaman2015-11-061-1/+1
| | | | Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* journal: signal playback complete via finisher threadJason Dillaman2015-11-061-9/+23
| | | | Signed-off-by: Jason Dillaman <dillaman@redhat.com>