Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IMPALA-4410: Safer tear-down of RuntimeState
* Add RuntimeState::Close() which is guaranteed to release resources safely, rather than having PFE::Close() do the same piecemeal. * Fix for crash where PFE::Prepare() fails before descriptor table is created. * Remove some dead code from TestEnv, and rename some methods for clarity. Testing: Found by debug-actions, which has a reproducible test where PFE::Prepare() fails. Manually tested on master. Change-Id: Ie416e4d57240142bf685385299b749c3a6792c45 Reviewed-on: http://gerrit.cloudera.org:8080/4893 Tested-by: Internal Jenkins Reviewed-by: Henry Robinson <henry@cloudera.com>
- Loading branch information
Henry Robinson
committed
Nov 23, 2016
1 parent
bbf5255
commit 707f71b
Showing
10 changed files
with
111 additions
and
72 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
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,40 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you 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. | ||
|
||
#ifndef IMPALA_UTIL_SCOPE_EXIT_TRIGGER_H | ||
#define IMPALA_UTIL_SCOPE_EXIT_TRIGGER_H | ||
|
||
#include <functional> | ||
|
||
namespace impala { | ||
|
||
/// Utility class that calls a client-supplied function when it is destroyed. | ||
/// | ||
/// Use judiciously - scope exits can be hard to reason about, and this class should not | ||
/// act as proxy for work-performing d'tors, which we try to avoid. | ||
class ScopeExitTrigger { | ||
public: | ||
ScopeExitTrigger(const auto& trigger) : trigger_(trigger) {} | ||
|
||
~ScopeExitTrigger() { trigger_(); } | ||
|
||
private: | ||
std::function<void()> trigger_; | ||
}; | ||
} | ||
|
||
#endif |