Skip to content

Commit

Permalink
Revert "Move SharedArbitrator back to memory namespace for Alpha depe…
Browse files Browse the repository at this point in the history
…ndency (facebookincubator#8954)"

This reverts commit 07a1518.
  • Loading branch information
PHILO-HE committed Mar 7, 2024
1 parent d40b4b5 commit a3cfe7c
Show file tree
Hide file tree
Showing 13 changed files with 214 additions and 249 deletions.
1 change: 0 additions & 1 deletion velox/common/memory/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ add_library(
MemoryPool.cpp
MmapAllocator.cpp
MmapArena.cpp
SharedArbitrator.cpp
StreamArena.cpp)

target_link_libraries(
Expand Down
212 changes: 0 additions & 212 deletions velox/common/memory/SharedArbitrator.h

This file was deleted.

2 changes: 0 additions & 2 deletions velox/common/memory/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
include(GoogleTest)

add_executable(
velox_memory_test
AllocationTest.cpp
Expand All @@ -26,7 +25,6 @@ add_executable(
MemoryManagerTest.cpp
MemoryPoolTest.cpp
MockSharedArbitratorTest.cpp
SharedArbitratorTest.cpp
StreamArenaTest.cpp)

target_link_libraries(
Expand Down
8 changes: 4 additions & 4 deletions velox/common/memory/tests/MemoryArbitratorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "velox/common/memory/MallocAllocator.h"
#include "velox/common/memory/Memory.h"
#include "velox/common/memory/MemoryArbitrator.h"
#include "velox/common/memory/SharedArbitrator.h"
#include "velox/exec/SharedArbitrator.h"

using namespace ::testing;

Expand Down Expand Up @@ -112,8 +112,8 @@ TEST_F(MemoryArbitrationTest, queryMemoryCapacity) {
});
}
{
// Reserved memory is e`nforced when SharedMemoryArbitrator is used.
SharedArbitrator::registerFactory();
// Reserved memory is enforced when SharedMemoryArbitrator is used.
exec::SharedArbitrator::registerFactory();
MemoryManagerOptions options;
options.allocatorCapacity = 8L << 20;
options.arbitratorCapacity = 4L << 20;
Expand Down Expand Up @@ -147,7 +147,7 @@ TEST_F(MemoryArbitrationTest, queryMemoryCapacity) {
ASSERT_EQ(manager.arbitrator()->shrinkCapacity(leafPool.get(), 0), 2 << 20);
ASSERT_EQ(rootPool->capacity(), 0);
ASSERT_EQ(leafPool->capacity(), 0);
memory::SharedArbitrator::unregisterFactory();
exec::SharedArbitrator::unregisterFactory();
}
}

Expand Down
4 changes: 2 additions & 2 deletions velox/common/memory/tests/MemoryManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "velox/common/base/tests/GTestUtils.h"
#include "velox/common/memory/MallocAllocator.h"
#include "velox/common/memory/Memory.h"
#include "velox/common/memory/SharedArbitrator.h"
#include "velox/exec/SharedArbitrator.h"

DECLARE_int32(velox_memory_num_shared_leaf_pools);
DECLARE_bool(velox_enable_memory_usage_track_in_default_memory_pool);
Expand All @@ -43,7 +43,7 @@ MemoryManager& toMemoryManager(MemoryManager& manager) {
class MemoryManagerTest : public testing::Test {
protected:
static void SetUpTestCase() {
SharedArbitrator::registerFactory();
exec::SharedArbitrator::registerFactory();
}

inline static const std::string arbitratorKind_{"SHARED"};
Expand Down
4 changes: 2 additions & 2 deletions velox/common/memory/tests/MemoryPoolTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include "velox/common/memory/Memory.h"
#include "velox/common/memory/MemoryPool.h"
#include "velox/common/memory/MmapAllocator.h"
#include "velox/common/memory/SharedArbitrator.h"
#include "velox/common/testutil/TestValue.h"
#include "velox/exec/SharedArbitrator.h"

DECLARE_bool(velox_memory_leak_check_enabled);
DECLARE_bool(velox_memory_pool_debug_enabled);
Expand Down Expand Up @@ -76,7 +76,7 @@ class MemoryPoolTest : public testing::TestWithParam<TestParam> {
protected:
static constexpr uint64_t kDefaultCapacity = 8 * GB; // 8GB
static void SetUpTestCase() {
SharedArbitrator::registerFactory();
exec::SharedArbitrator::registerFactory();
FLAGS_velox_memory_leak_check_enabled = true;
TestValue::enable();
}
Expand Down
4 changes: 2 additions & 2 deletions velox/common/memory/tests/MockSharedArbitratorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include "velox/common/memory/MallocAllocator.h"
#include "velox/common/memory/Memory.h"
#include "velox/common/memory/MemoryArbitrator.h"
#include "velox/common/memory/SharedArbitrator.h"
#include "velox/common/testutil/TestValue.h"
#include "velox/exec/SharedArbitrator.h"
#include "velox/exec/tests/utils/PlanBuilder.h"
#include "velox/exec/tests/utils/TempDirectoryPath.h"

Expand Down Expand Up @@ -390,7 +390,7 @@ MockTask::~MockTask() {
class MockSharedArbitrationTest : public testing::Test {
protected:
static void SetUpTestCase() {
SharedArbitrator::registerFactory();
exec::SharedArbitrator::registerFactory();
FLAGS_velox_memory_leak_check_enabled = true;
TestValue::enable();
}
Expand Down
1 change: 1 addition & 0 deletions velox/exec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ add_library(
ProbeOperatorState.cpp
RowContainer.cpp
RowNumber.cpp
SharedArbitrator.cpp
SortBuffer.cpp
SortedAggregations.cpp
SortWindowBuild.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "velox/common/memory/SharedArbitrator.h"
#include "velox/exec/SharedArbitrator.h"

#include "velox/common/base/Counters.h"
#include "velox/common/base/Exceptions.h"
Expand All @@ -26,7 +26,7 @@

using facebook::velox::common::testutil::TestValue;

namespace facebook::velox::memory {
namespace facebook::velox::exec {

namespace {

Expand Down Expand Up @@ -708,4 +708,4 @@ void SharedArbitrator::registerFactory() {
void SharedArbitrator::unregisterFactory() {
MemoryArbitrator::unregisterFactory(kind_);
}
} // namespace facebook::velox::memory
} // namespace facebook::velox::exec
Loading

0 comments on commit a3cfe7c

Please sign in to comment.