Skip to content

Commit

Permalink
[feat] upgeade curvefs base image
Browse files Browse the repository at this point in the history
Signed-off-by: Cyber-SiKu <Cyber-SiKu@outlook.com>
  • Loading branch information
Cyber-SiKu committed Aug 4, 2023
1 parent 31678a2 commit 4a45ec5
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ test:
@bash util/test.sh $(stor) $(only)

docker:
@bash util/docker.sh $(os)
@bash util/docker.sh --os=$(os) --ci=$(ci)
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM opencurvedocker/curve-base:debian9
COPY entrypoint.sh /
COPY curvefs /curvefs
FROM opencurvedocker/curve-base:debian11
COPY libmemcached.so libmemcached.so.11 libhashkit.so.2 /usr/lib/
COPY curvefs /curvefs
RUN mkdir -p /etc/curvefs /core /etc/curve && chmod a+x /entrypoint.sh \
&& cp /curvefs/tools/sbin/curvefs_tool /usr/bin \
&& cp /curvefs/tools-v2/sbin/curve /usr/bin/
ENTRYPOINT ["/entrypoint.sh"]
File renamed without changes.
7 changes: 4 additions & 3 deletions curvefs/src/client/s3/client_s3_cache_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1595,13 +1595,14 @@ void ChunkCacheManager::ReleaseCache() {
s3ClientAdaptor_->GetFsCacheManager()->FlushSignal();
}
WriteLockGuard writeLockGuard(rwLockRead_);
auto iter = dataRCacheMap_.begin();
for (; iter != dataRCacheMap_.end(); iter++) {
for (auto iter = dataRCacheMap_.begin(); iter != dataRCacheMap_.end();) {
if (s3ClientAdaptor_->GetFsCacheManager()->Delete(iter->second)) {
g_s3MultiManagerMetric->readDataCacheNum << -1;
g_s3MultiManagerMetric->readDataCacheByte
<< -1 * (*(iter->second))->GetActualLen();
dataRCacheMap_.erase(iter);
iter = dataRCacheMap_.erase(iter);
} else {
++iter;
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions curvefs/test/client/common/test_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ TEST(TestInitVolumeOption, Common) {
conf.SetUInt64Value("volume.bitmapAllocator.sizePerBit",
4ULL * 1024 * 1024);
conf.SetDoubleValue("volume.bitmapAllocator.smallAllocProportion", 0.0);
conf.SetDoubleValue("volume.space.useThreshold", 0.95);
conf.SetDoubleValue("volume.space.releaseInterSec", 300);

ASSERT_NO_FATAL_FAILURE({ InitVolumeOption(&conf, &volopt); });
}
Expand Down
7 changes: 5 additions & 2 deletions curvefs/test/client/test_disk_cache_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <sys/stat.h>
#include "curvefs/test/client/mock_client_s3.h"

#include "curvefs/test/client/mock_disk_cache_write.h"
Expand Down Expand Up @@ -467,10 +468,12 @@ TEST_F(TestDiskCacheManager, TrimCache_exceed) {
diskCacheManager_->AddCache("test02");
diskCacheManager_->AddCache("test03");
diskCacheManager_->AddCache("test04");
EXPECT_CALL(*wrapper, stat(NotNull(), NotNull()))
struct stat rf;
rf.st_size = 0;
EXPECT_CALL(*wrapper, stat(NotNull(), _))
.Times(2)
.WillOnce(Return(-1))
.WillOnce(Return(0));
.WillOnce(DoAll(SetArgPointee<1>(rf), Return(0)));
diskCacheManager_->TrimRun();
diskCacheManager_->InitMetrics("test");
sleep(6);
Expand Down
7 changes: 5 additions & 2 deletions curvefs/test/mds/mds_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,11 @@ class MdsTest : public ::testing::Test {
std::string(" --name curve_fs_test_mds");

LOG(INFO) << "start etcd: " << cmd;

ASSERT_EQ(0, execl("/bin/sh", "sh", "-c", cmd.c_str(), nullptr));
ASSERT_EQ(0,
execlp("etcd", "etcd", "--advertise-client-urls",
"http://localhost:20032", "--listen-client-urls",
"http://localhost:20032", "--name",
"curve_fs_test_mds", nullptr));
exit(0);
}

Expand Down
29 changes: 27 additions & 2 deletions util/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,24 @@
# Copyright (C) 2021 Jingli Chen (Wine93), NetEase Inc.

############################ GLOBAL VARIABLES
``
g_os="debian11"
g_ci=0
g_docker_opts=(
"-w $(pwd)"
"-v $(pwd):$(pwd)"
"-v ${HOME}:${HOME}"
"--user $(id -u ${USER}):$(id -g ${USER})"
"-v /etc/passwd:/etc/passwd:ro"
"-v /etc/group:/etc/group:ro"
"-v /etc/sudoers.d/:/etc/sudoers.d/"
"-v /etc/sudoers:/etc/sudoers:ro"
"-v /etc/shadow:/etc/shadow:ro"
"-v /var/run/docker.sock:/var/run/docker.sock"
"-v /root/.docker:/root/.docker"
"--ulimit core=-1"
"--privileged"
)

############################ BASIC FUNCTIONS
msg() {
Expand All @@ -27,7 +44,7 @@ print_title() {
############################ FUNCTIONS

get_options() {
local args=`getopt -o ldorh --long os: -n "$0" -- "$@"`
local args=`getopt -o ldorh --long os:,ci: -n "$0" -- "$@"`
eval set -- "${args}"
while true
do
Expand All @@ -36,6 +53,10 @@ get_options() {
g_os=$2
shift 2
;;
-c|--ci)
g_ci=$2
shift 2
;;
-h)
usage
exit 1
Expand All @@ -54,7 +75,11 @@ get_options() {
main() {
get_options "$@"

sudo docker run -it --rm -w $(pwd) -v $(pwd):$(pwd) -v ${HOME}:${HOME} --user $(id -u ${USER}):$(id -g ${USER}) -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v /etc/sudoers.d/:/etc/sudoers.d/ -v /etc/sudoers:/etc/sudoers:ro -v /etc/shadow:/etc/shadow:ro -v /var/run/docker.sock:/var/run/docker.sock -v /root/.docker:/root/.docker --ulimit core=-1 --privileged opencurvedocker/curve-base:build-$g_os bash
if [ $g_ci -eq 0 ]; then
g_docker_opts+=("--rm")
fi

sudo docker run -it ${g_docker_opts[@]} opencurvedocker/curve-base:build-$g_os bash
}

############################ MAIN()
Expand Down

0 comments on commit 4a45ec5

Please sign in to comment.