-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CXXCBC-448: Expose hooks for fork() scenarious (#536)
* CXXCBC-448: Expose hooks for fork() scenarious In order to gracefully survive fork() syscall, the library should be able to move itself into stable and predictable state. In particular ASIO should not have any pending work, and all IO thread should be stopped. After the fork() the parent process retains control over all file descriptors, but the child have to reconnect them (ASIO does it in its hooks), and also the SDK should restart all the IO workers. At the moment, the only worker thread that the library controls is the one that in charge of the transactions cleanup, but later once the public API will hide ASIO context, it will become in charge of the restarting IO threads. In case of the wrappers, that use core API directly, they must be able to stop all IO threads before fork(), wait for work completion, then perform the syscall and restart IO threads and contexts in both child and parent later. See example in test/test_integration_examples.cxx * do not run tests for servers without collections support * disable test for capella as it cannot load sample buckets
- Loading branch information
Showing
8 changed files
with
318 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ | ||
/* | ||
* Copyright 2020-Present Couchbase, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
namespace couchbase | ||
{ | ||
enum class fork_event { | ||
/** | ||
* Notify the cluster that the process is about to fork. | ||
*/ | ||
prepare, | ||
|
||
/** | ||
* Notify the context that the process has forked and is the parent. | ||
*/ | ||
parent, | ||
|
||
/** | ||
* Notify the context that the process has forked and is the child. | ||
*/ | ||
child, | ||
}; | ||
|
||
} // namespace couchbase |
Oops, something went wrong.