Skip to content

Commit

Permalink
Merge pull request #185 from leil-io/release/v4.5.0
Browse files Browse the repository at this point in the history
Main changes for Release v4.5.0:
* fix(mount): Set default cacheExpirationTime to 0 (#180)
* feat(mount): Add readcachemaxsize option (#145)
* feat(master): Add empty reserved files option (#176)
* fix(mount): Fix random case option parsing (#135)
* feat(chunkserver): Add IDiskManager::getDiskForGC (#169)
* test: Improve `stop_ganesha()` function (#168)
* fix(ci): Modify timeout from env (#165)
* ci: Fix tests behavior (#172)
* fix(uraft): Fix missing floating ip address
* fix(mount): Fix create time (Windows) (#167)
* feat(admin): Add list-disk-groups command (#155)
* ci: Abort previous concurrent tests
* ci: Update de base docker image on build
* fix(tests): Fix typo in setup-machine script
* fix(tests): Amend upgrade tests (#146)
* fix: Update services to wait for network (#151)
* fix: Update uraft service to restart on failure (#153)
* fix: Release compilation on GCC 14 (#148)
* feat(chunkserver): Extend IDiskManager interface (#143)
* test: Verify master loading legacy metadata
* feat: Load legacy metadata file
* fix: Allow legacy sessions download
* fix: Allow legacy metadata download
  • Loading branch information
lgsilva3087 authored Sep 9, 2024
2 parents 000e1bb + c2c96cd commit e0a39ef
Show file tree
Hide file tree
Showing 80 changed files with 1,048 additions and 99 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ endif()
project(saunafs)

if(NOT PACKAGE_VERSION)
set(DEFAULT_MIN_VERSION "4.4.0")
set(DEFAULT_MIN_VERSION "4.5.0")
execute_process(COMMAND "git" "rev-parse" "--short" "HEAD"
OUTPUT_VARIABLE GIT_SHA1_SHORT RESULT_VARIABLE GIT_SHA1_SHORT_RETURN_VALUE
OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pipeline {
ansiColor("xterm")
parallelsAlwaysFailFast()
preserveStashes(buildCount: 2)
disableConcurrentBuilds(abortPrevious: true)
}
stages {
stage('Build Images') {
Expand Down
25 changes: 25 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
This file lists noteworthy changes in SaunaFS.

* SaunaFS (4.5.0) (2024-09-05)
- fix(mount): Set default cacheExpirationTime to 0 (#180)
- feat(mount): Add readcachemaxsize option (#145)
- feat(master): Add empty reserved files option (#176)
- fix(mount): Fix random case option parsing (#135)
- feat(chunkserver): Add IDiskManager::getDiskForGC (#169)
- test: Improve `stop_ganesha()` function (#168)
- fix(ci): Modify timeout from env (#165)
- ci: Fix tests behavior (#172)
- fix(uraft): Fix missing floating ip address
- fix(mount): Fix create time (Windows) (#167)
- feat(admin): Add list-disk-groups command (#155)
- ci: Abort previous concurrent tests
- ci: Update de base docker image on build
- fix(tests): Fix typo in setup-machine script
- fix(tests): Amend upgrade tests (#146)
- fix: Update services to wait for network (#151)
- fix: Update uraft service to restart on failure (#153)
- fix: Release compilation on GCC 14 (#148)
- feat(chunkserver): Extend IDiskManager interface (#143)
- test: Verify master loading legacy metadata
- feat: Load legacy metadata file
- fix: Allow legacy sessions download
- fix: Allow legacy metadata download

* SaunaFS (4.4.0) (2024-07-31)
- ci(.github): Add check for Conventional Commits (#131)
- feat(metrics): Add initial prometheus support (#98)
Expand Down
27 changes: 27 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
saunafs (4.5.0) stable; urgency=medium
* fix(mount): Set default cacheExpirationTime to 0 (#180)
* feat(mount): Add readcachemaxsize option (#145)
* feat(master): Add empty reserved files option (#176)
* fix(mount): Fix random case option parsing (#135)
* feat(chunkserver): Add IDiskManager::getDiskForGC (#169)
* test: Improve `stop_ganesha()` function (#168)
* fix(ci): Modify timeout from env (#165)
* ci: Fix tests behavior (#172)
* fix(uraft): Fix missing floating ip address
* fix(mount): Fix create time (Windows) (#167)
* feat(admin): Add list-disk-groups command (#155)
* ci: Abort previous concurrent tests
* ci: Update de base docker image on build
* fix(tests): Fix typo in setup-machine script
* fix(tests): Amend upgrade tests (#146)
* fix: Update services to wait for network (#151)
* fix: Update uraft service to restart on failure (#153)
* fix: Release compilation on GCC 14 (#148)
* feat(chunkserver): Extend IDiskManager interface (#143)
* test: Verify master loading legacy metadata
* feat: Load legacy metadata file
* fix: Allow legacy sessions download
* fix: Allow legacy metadata download

-- SaunaFS Team <[email protected]> Thu, 05 Sep 2024 14:23:04 +0000

saunafs (4.4.0) stable; urgency=medium
* ci(.github): Add check for Conventional Commits (#131)
* feat(metrics): Add initial prometheus support (#98)
Expand Down
10 changes: 8 additions & 2 deletions doc/sfsmount.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,17 @@ operation in milliseconds (default: 2000).

*-o cacheexpirationtime=*'MSEC'::
Set timeout for read cache entries to be considered valid in milliseconds. 0
disables cache (default: 0).
disables cache (default: 0). Due to a bug, this can sometimes result in invalid
data being returned if reading the mount point from multiple processes/threads
and it's not disabled. Verify data being sent using a checksum if using this
feature.

*-o readaheadmaxwindowsize=*'KB'::
Set max value of readahead window per single descriptor in kibibytes (default: 16384).

*-o readcachemaxsize=*'MB'::
Set max value of read cache size in mebibytes (default: 16384).

*-o readworkers=*'N'::
Define number of read workers (default: 30).

Expand Down Expand Up @@ -192,7 +198,7 @@ new session is created without password.
Specify number of retries before I/O error is returned (default: 30).

*-o sfsreportreservedperiod=*'N'::
Specify interval of reporting reserved inodes in seconds (default: 60).
Specify interval for reporting reserved inodes in seconds (default: 30).

*-o sfsiolimits=*'PATH'::
Specify local I/O limiting configuration file (default: no I/O limiting).
Expand Down
2 changes: 1 addition & 1 deletion rpm/service-files/saunafs-cgiserv.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=SaunaFS CGI server daemon
Documentation=man:saunafs-cgiserver
After=network.target
After=network-online.target network.target

[Service]
Environment=BIND_HOST=0.0.0.0
Expand Down
2 changes: 1 addition & 1 deletion rpm/service-files/saunafs-chunkserver.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=SaunaFS chunkserver daemon
Documentation=man:sfschunkserver
After=network.target
After=network-online.target network.target

[Service]
Type=forking
Expand Down
2 changes: 1 addition & 1 deletion rpm/service-files/saunafs-ha-master.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=SaunaFS master server daemon
After=syslog.target network.target
After=syslog.target network-online.target network.target
PartOf=saunafs-uraft.service

[Service]
Expand Down
2 changes: 1 addition & 1 deletion rpm/service-files/saunafs-master.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=SaunaFS master server daemon
Documentation=man:sfsmaster
After=network.target
After=network-online.target network.target

[Service]
Type=forking
Expand Down
2 changes: 1 addition & 1 deletion rpm/service-files/saunafs-metalogger.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=SaunaFS metalogger server daemon
Documentation=man:sfsmetalogger
After=network.target
After=network-online.target network.target

[Service]
Type=forking
Expand Down
5 changes: 3 additions & 2 deletions rpm/service-files/saunafs-uraft.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=SaunaFS uraft high availability daemon
Requires=saunafs-ha-master.service
After=network.target
After=network-online.target network.target
After=saunafs-ha-master.service

[Service]
Expand All @@ -10,7 +10,8 @@ PIDFile=/var/run/saunafs-uraft.pid
TimeoutSec=0
ExecStart=/usr/sbin/saunafs-uraft
ExecStopPost=/usr/sbin/saunafs-uraft-helper demote
Restart=no
Restart=on-failure
RestartSec=60
User=saunafs

[Install]
Expand Down
98 changes: 98 additions & 0 deletions src/admin/list_disk_groups_command.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
Copyright 2023 Leil Storage OÜ
This file is part of SaunaFS.
SaunaFS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
SaunaFS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SaunaFS. If not, see <http://www.gnu.org/licenses/>.
*/

#include "common/platform.h"

#include <yaml-cpp/yaml.h>
#include <iostream>

#include "admin/list_chunkservers_command.h"
#include "admin/list_disk_groups_command.h"
#include "common/saunafs_version.h"
#include "common/serialization.h"
#include "common/server_connection.h"

std::string ListDiskGroupsCommand::name() const { return "list-disk-groups"; }

void ListDiskGroupsCommand::usage() const {
std::cerr << name() << " <master ip> <master port>\n";
std::cerr << " Prints disk groups configuration in chunkservers.\n";
}

void ListDiskGroupsCommand::run(const Options &options) const {
if (options.arguments().size() != 2) {
throw WrongUsageException(
"Expected <master ip> and <master port> for " + name());
}

auto chunkservers = ListChunkserversCommand::getChunkserversList(
options.argument(0), options.argument(1));

YAML::Emitter yaml;
yaml << YAML::BeginMap; // start root map

yaml << YAML::Key << "chunkservers";
yaml << YAML::Value << YAML::BeginSeq; // start chunkservers list

for (const auto &chunkserver : chunkservers) {
if (chunkserver.version == kDisconnectedChunkserverVersion) {
continue; // skip disconnected chunkservers
}

std::vector<uint8_t> request;
std::vector<uint8_t> response;
serializeLegacyPacket(request, CLTOCS_ADMIN_LIST_DISK_GROUPS);

auto csAddress =
NetworkAddress(chunkserver.servip, chunkserver.servport);
ServerConnection connection(csAddress);
response = connection.sendAndReceive(request,
CSTOCL_ADMIN_LIST_DISK_GROUPS);

std::string info;

try {
deserializeAllLegacyPacketDataNoHeader(response, info);
} catch (const IncorrectDeserializationException &e) {
std::cerr << e.what() << "\n";
continue;
}

yaml << YAML::BeginMap; // start chunkserver map
yaml << YAML::Key << "chunkserver";
yaml << YAML::Value << csAddress.toString();

static constexpr const char *kDiskGroupsKey = "disk_groups";
yaml << YAML::Key << kDiskGroupsKey;

YAML::Node diskGroups = YAML::Load(info);

if (diskGroups.IsMap() && diskGroups[kDiskGroupsKey]) {
yaml << YAML::Value << diskGroups[kDiskGroupsKey];
} else {
yaml << YAML::Value << info;
}

yaml << YAML::EndMap; // end chunkserver map
}

yaml << YAML::EndSeq; // end chunkservers list
yaml << YAML::EndMap; // end root map

std::cout << yaml.c_str() << "\n";
}
30 changes: 30 additions & 0 deletions src/admin/list_disk_groups_command.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Copyright 2023 Leil Storage OÜ
This file is part of SaunaFS.
SaunaFS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
SaunaFS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SaunaFS. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "common/platform.h"

#include "admin/saunafs_admin_command.h"

class ListDiskGroupsCommand : public SaunaFsAdminCommand {
public:
std::string name() const override;
void usage() const override;
void run(const Options& options) const override;
};
2 changes: 2 additions & 0 deletions src/admin/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "admin/list_chunkservers_command.h"
#include "admin/list_defective_files_command.h"
#include "admin/list_disks_command.h"
#include "admin/list_disk_groups_command.h"
#include "admin/list_goals_command.h"
#include "admin/list_metadataservers_command.h"
#include "admin/list_mounts_command.h"
Expand Down Expand Up @@ -58,6 +59,7 @@ int main(int argc, const char** argv) {
new ListChunkserversCommand(),
new ListDefectiveFilesCommand(),
new ListDisksCommand(),
new ListDiskGroupsCommand(),
new ListGoalsCommand(),
new ListMountsCommand(),
new ListMetadataserversCommand(),
Expand Down
28 changes: 28 additions & 0 deletions src/chunkserver/chunkserver-common/default_disk_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,31 @@ IDisk *DefaultDiskManager::getDiskForNewChunk(

return bestDisk;
}

IDisk *DefaultDiskManager::getDiskForGC() {
TRACETHIS();
IDisk *bestDisk = DiskNotFound;

std::lock_guard disksLockGuard(gDisksMutex);

if (gDisks.empty()) {
return DiskNotFound;
}

auto diskCount = gDisks.size();

for (size_t i = 0; i < diskCount; ++i) {
size_t index = (nextDiskIndexForGC_ + i) % diskCount;
const auto &disk = gDisks[index];

if (!disk->isZonedDevice() || !disk->isSelectableForNewChunk()) {
continue;
}

bestDisk = disk.get();
nextDiskIndexForGC_ = (index + 1) % diskCount;
break;
}

return bestDisk;
}
20 changes: 20 additions & 0 deletions src/chunkserver/chunkserver-common/default_disk_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class DefaultDiskManager : public IDiskManager {
/// Virtual destructor needed for correct polymorphism
virtual ~DefaultDiskManager() = default;

/// Reload the configuration from the configuration file.
/// No need to reload the configuration so far for this implementation.
void reloadConfiguration() override {};

/// Parse a configuration line for a disk.
virtual int parseCfgLine(std::string hddCfgLine);

/// Reload the disks from the configuration and populates the gDisks vector.
Expand All @@ -60,4 +65,19 @@ class DefaultDiskManager : public IDiskManager {
*/
IDisk *getDiskForNewChunk(
[[maybe_unused]] const ChunkPartType &chunkType) override;

/// Update the space usage of the disks.
/// No need to update the space usage here for this implementation.
void updateSpaceUsage() override {};

/// Gets the disk groups information.
/// Not supported by the default disk manager.
std::string getDiskGroupsInfo() override { return "Not supported"; }

/// Selects the disk to use for GC.
IDisk *getDiskForGC() override;

private:
/// Next disk index for GC. Helps in the round-robin strategy.
uint32_t nextDiskIndexForGC_ = 0;
};
Loading

0 comments on commit e0a39ef

Please sign in to comment.