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 <[email protected]>
  • Loading branch information
Cyber-SiKu committed Aug 9, 2023
1 parent ac1941c commit 05993a9
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 20 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
5 changes: 4 additions & 1 deletion docker/debian11/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM debian:11
ENV TZ=Asia/Shanghai
ENV TZ=Asia/Shanghai \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
sed -i 's|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list && \
apt-get clean && \
Expand All @@ -24,6 +26,7 @@ RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
libnl-3-200 \
libnl-genl-3-200 \
libjemalloc2 \
libjemalloc-dev \
libsnappy1v5 \
liblz4-1 \
zlib1g \
Expand Down
11 changes: 7 additions & 4 deletions docker/debian11/compile/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
FROM debian:11
ENV TZ=Asia/Shanghai
ENV GITHUB_PROXY=https://ghproxy.com/
ENV VERSION_ETCD=v3.4.0 \
ENV TZ=Asia/Shanghai \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
GITHUB_PROXY=https://ghproxy.com/ \
VERSION_ETCD=v3.4.0 \
DOWNLOAD_ETCD_URL=${GITHUB_PROXY}https://github.com/etcd-io/etcd/releases/download \
GOPROXY=https://goproxy.io,direct \
PROTOC_VERSION=21.8 \
GO_INSTALL_VERSION=1.19.6 \
PROTOC_GEN_GO_VERSION=v1.28 \
PROTOC_GEN_GO_GRPC_VERSION=v1.2
PROTOC_GEN_GO_GRPC_VERSION=v1.2 \
BAZELISK_BASE_URL=https://repo.huaweicloud.com/bazel
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
sed -i 's|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list && \
apt clean && \
Expand Down
2 changes: 1 addition & 1 deletion src/mds/nameserver2/file_lock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void FileLockManager::LockInternal(const std::string& path,
bthread_rwlock_rdlock(&entry->rwLock_);
} else {
// get write lock
bthread_rwlock_unlock(&entry->rwLock_);
bthread_rwlock_wrlock(&entry->rwLock_);
}
}

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

############################ GLOBAL VARIABLES
``
g_os="debian11"
g_ci=0
g_docker_opts=(
"-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 +42,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 +51,10 @@ get_options() {
g_os=$2
shift 2
;;
-c|--ci)
g_ci=$2
shift 2
;;
-h)
usage
exit 1
Expand All @@ -54,7 +73,16 @@ 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")
g_docker_opts+=("-v $(pwd):$(pwd)")
g_docker_opts+=("-w $(pwd)")
else
g_docker_opts+=("-v $(pwd):/var/lib/jenkins/workspace/curve/curve_multijob/")
g_docker_opts+=("-w /var/lib/jenkins/workspace/curve/curve_multijob/")
fi

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

############################ MAIN()
Expand Down
1 change: 1 addition & 0 deletions util/ut_in_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ulimit -c unlimited
ulimit -a

# start minio
sudo pkill minio || true
sudo MINIO_ROOT_USER=admin MINIO_ROOT_PASSWORD=password MINIO_BROWSER=off minio server /data/minio --address ":9999" &

ps -ef | grep chunkserver | grep -v grep | grep -v gcc | awk '{print $2}' | sudo xargs kill -9 || true
Expand Down

0 comments on commit 05993a9

Please sign in to comment.