Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
cd4991b
Add support for raft repl dev replace member. (#546)
sanebay Sep 25, 2024
6338520
Generalize and introduce Sealer into CP.
xiaoxichen Sep 22, 2024
c4fcf70
Start data service after log replay done.
xiaoxichen Sep 27, 2024
e223283
Flushing log after data written.
xiaoxichen Sep 29, 2024
2c853a3
Add raft commit quorum for replace member if two members down. (#559)
sanebay Oct 2, 2024
67fe181
Add cert watcher
yuwmao Oct 15, 2024
5e9fe1d
fix nit
yuwmao Oct 16, 2024
d331d32
Fix read_io in dataservice test.
xiaoxichen Oct 18, 2024
90fd1a0
FIX wbcache for put and modify long running index (#567)
shosseinimotlagh Oct 22, 2024
69e621c
Count in ovf headers.
xiaoxichen Oct 21, 2024
e6cb8ea
Reduce logs (#571)
shosseinimotlagh Oct 23, 2024
6756e95
Change replace member api signature.
sanebay Oct 21, 2024
d0c4e2b
Add package version and show in log (#575)
shosseinimotlagh Oct 28, 2024
1054b00
add chunksize to vchunk interface (#572)
JacksonYao287 Oct 29, 2024
f6cd30f
Add index CR UT for basic merge (#556)
koujl Oct 29, 2024
b4da34e
Add additional tests for replace member (#574)
sanebay Nov 1, 2024
0a47df5
Add protection for concurrent access to m_down_buffers (#577)
koujl Nov 5, 2024
9f32203
Implement GC_REPL_REQ Based on DSN to Prevent Resource Leaks (#576)
xiaoxichen Nov 6, 2024
79820ad
Releasing data buf from memory after written to disk.
xiaoxichen Nov 7, 2024
28ea01c
add rollback on state machine add open Leader_Restart ut (#585)
Besroy Nov 11, 2024
a0b0910
PushData only pushed to active followers. (#584)
xiaoxichen Nov 13, 2024
6c748e8
Set min_log_gap_to_join to max_int32 and enabled new_joiner_type
xiaoxichen Nov 13, 2024
7807cce
handle nagtive log batch size returned by follower (#588)
JacksonYao287 Nov 13, 2024
dee5fed
Checking received data size and reject if not match.
xiaoxichen Nov 11, 2024
f7adb1e
Add application_hint into blk_alloc_hints (#591)
Hooper9973 Nov 14, 2024
a5d6d9b
Disable dynamic repl ut temporarily. (#593)
sanebay Nov 18, 2024
aebbe92
handle RemovedFromCluster event (#594)
JacksonYao287 Nov 25, 2024
58882a2
Fix grpc crash (#595)
Besroy Nov 26, 2024
e5bb0f7
Support flexible virtual device creation in `homestore::BlkDataServic…
Hooper9973 Nov 26, 2024
112c7dd
Support Baseline Resync (#596)
yuwmao Dec 4, 2024
68c7da0
Implement get_next_batch_size_hint_in_bytes()
xiaoxichen Dec 3, 2024
8dfc90c
Bump up nuraft_mesg to >=3.7
xiaoxichen Dec 4, 2024
512f303
Add on_repl_devs_init_completed cb.
xiaoxichen Dec 7, 2024
3249b35
Calling pre_commit for lsn > dc_lsn.
xiaoxichen Dec 11, 2024
06d0ec8
fix potential bug of home raft log store initialization
JacksonYao287 Dec 16, 2024
56c8f35
disable restart for destroy-pending repl-dev (#605)
JacksonYao287 Dec 17, 2024
bcf6f6e
fix twice call of leave
JacksonYao287 Dec 18, 2024
85c50e6
Add lock for log dev read api's. (#612)
sanebay Dec 18, 2024
4ff42fe
Ensure Consistent LSN Before Opening for Traffic in Raft Group
xiaoxichen Dec 12, 2024
9ef2c63
read_logical_snp_obj: pass user_ctx to prevent memleak (#617)
koujl Dec 20, 2024
c2eef30
1. fix handle_error and only trigger handle_error for timeout rreqs i…
Dec 10, 2024
ff4ae79
Duplication Handling (#611)
yuwmao Dec 23, 2024
b2ea924
Only call cp_flush for those consumer paticipated in this cp.
xiaoxichen Dec 19, 2024
e0fedf4
Fix Index recovery path for split(put) (#609)
shosseinimotlagh Dec 24, 2024
6b43edb
reset rreq time every time we reuse a rreq
Dec 23, 2024
7129358
fix HomeRaftLogStore::last_entry (#619)
JacksonYao287 Dec 24, 2024
9f17189
minor fix for homeobject's homestore_test
Besroy Dec 30, 2024
5d4828c
update last_commit_lsn in commit_config
Dec 31, 2024
ffe797e
Remove log store truncation from resource mgr.
Dec 26, 2024
824392f
Support async snapshot io config
yuwmao Jan 6, 2025
9aa07e9
Avoid replaying the last flushed log entry
yuwmao Jan 9, 2025
ee9d765
skip appending dummy logs to log dev
Jan 2, 2025
98bccc0
Adjust cp_io num_fiber to Prevent Deadlock (#630)
Hooper9973 Jan 16, 2025
9ece374
Ensure end_of_append_batch is Called for All Raft Log Types
Jan 16, 2025
da97daa
Fix logic for setting flush_ld_key while loading logs, makes it consi…
Jan 2, 2025
b21921e
Add flush meta for single log store
yuwmao Jan 22, 2025
3634a2f
Rename apply_snp_resync_data to save_snp_resync_data
yuwmao Jan 23, 2025
2294ac7
Fix bugs in snapshot transmission (#632)
koujl Jan 24, 2025
727becd
Change long index setting (#640)
shosseinimotlagh Feb 4, 2025
3ff623e
Persist logstore superblock when logdev truncation is unnecessary
Feb 8, 2025
e68db54
Add timeout cfg for snapshot sync context
yuwmao Feb 8, 2025
7ae04ce
Remove snapshot creation when add_member done
yuwmao Feb 11, 2025
02af6cb
Add function to support purging existing logs. (#643)
Besroy Feb 12, 2025
4447575
Improve active peer determination logic
yuwmao Feb 13, 2025
895fe55
Remove optimization on blk free operation
Feb 11, 2025
ee6d347
Return grpc error if a non originator receives fetch data request
Feb 13, 2025
a3a36f9
Modify snapshot_context structure for persistency (#650)
koujl Feb 21, 2025
5924c1b
fix dead lock in graceful shutdown (#652)
JacksonYao287 Feb 24, 2025
108a028
Minor fixs
Feb 24, 2025
29b0c5f
Fix missing fields in RaftReplDev::save_state (#654)
koujl Feb 27, 2025
4ca6f5b
Add event callbacks into listener for upper layer (#657)
JacksonYao287 Mar 12, 2025
b85d5a7
Destroy upper resources after Raft server shutdown (#658)
Besroy Mar 12, 2025
6201f99
Fixes on gc repl devs.
Mar 13, 2025
e3d35d6
Send response if failed to save pushed_data
Mar 17, 2025
8f5a92f
issue: 667 Enable on_repl_devs_init_completed callback on SoloReplSer…
yamingk Mar 19, 2025
22483e5
Add Disk Layout Diagram for device layer
yamingk Mar 21, 2025
d8f287b
issue: 669 update physical superblk's mgaic and product_name to disti…
yamingk Mar 25, 2025
15f2eca
Use an atomic in crash simulator to wait for the crash only if the fl…
Mar 24, 2025
a6db05b
retain the default behaviour of the method wait_for_crash_recovery to…
Mar 25, 2025
e5272ea
Async IO metrics for physical dev.
xiaoxichen Mar 21, 2025
1457b11
update conan.
xiaoxichen Mar 26, 2025
2a78255
Fix baseline resync corner cases.
Mar 26, 2025
bed045a
Support blk reservation
yuwmao Apr 2, 2025
ff6cb3c
Adding group_id to RD_LOG
xiaoxichen Apr 1, 2025
d9614a5
Add traceID into repl_key
xiaoxichen Apr 2, 2025
235ebaa
Adopt traceID for all RD_LOG
xiaoxichen Apr 2, 2025
36e00d9
bump version
xiaoxichen Apr 2, 2025
de3cd1a
Fix NPE
xiaoxichen Apr 2, 2025
2fe4400
Support custom rdev name
yuwmao Apr 7, 2025
cc7aa0b
add grpc message size as config
Apr 8, 2025
c0ad259
add metric for blk usage
Apr 9, 2025
347c9cc
Fix solo repl dev log flush and graceful shutdown.
sanebay Apr 9, 2025
fc768eb
Support handling no_space_left error in raft channel (#682)
JacksonYao287 Apr 17, 2025
f8f6a24
Adjust grpc message size according to fetch data limit as well (#691)
Besroy Apr 18, 2025
d25e679
Add additional on_commit repldev listener api's. (#692)
sanebay Apr 21, 2025
1455adc
reduce io number in simulate_no_space_left and disable_leader_push_da…
JacksonYao287 Apr 22, 2025
c3292a4
Fix nightly Jenkins project (#697)
shosseinimotlagh Apr 22, 2025
a1e6367
fix repl lsn (#699)
JacksonYao287 Apr 23, 2025
ba4553c
Make a single on_commit listener function. (#700)
sanebay Apr 24, 2025
e344d4e
Add unit test to trigger eviction
Apr 21, 2025
3bcb2ff
Use the index_buffer.is_clean() to determine if it is safe to evict a…
Apr 24, 2025
7e8316a
Issue 696 Support remove_repl_dev for solo repl dev (#698)
yamingk Apr 25, 2025
91442fd
Set priority when create RaftReplDev (#695)
yuwmao Apr 25, 2025
f07eca2
add traceid for replace member
Apr 25, 2025
7ba29b7
adopt api signature change
yamingk Apr 28, 2025
1a669fe
support handling config rollback and add periodical notification of t…
JacksonYao287 Apr 29, 2025
58586c4
fix: init rkey with trace id
Apr 28, 2025
3d87d6c
Bump up hub.tess.io/sds/sds_develop in DockerFile (#709)
shosseinimotlagh Apr 30, 2025
30f6b68
Move sanitizer builds to its own location. (#710)
szmyd Apr 30, 2025
7e64bd5
Add async_write, alloc blks for solo repl dev. (#706)
sanebay May 1, 2025
9428bb6
Revert btree config file (#711)
shosseinimotlagh May 1, 2025
0a40669
Issue 713: Fix index table destroy race with wb_cache cp flush (#714)
yamingk May 6, 2025
cee9bac
Issue 716: Fix log periodic cancelt_imer issue and solo repl dev init…
yamingk May 8, 2025
a302aa6
Issue 717: expose data service drive type (#718)
yamingk May 12, 2025
f46994b
Fix occupied_size for prefix (#719)
shosseinimotlagh May 13, 2025
b8b1a6d
add long running test with put and remove
May 7, 2025
2be54cd
Fix prefix - reload compactbitset after updating node phys buffer (#724)
shosseinimotlagh May 16, 2025
8c61a8a
[Solo repl dev] Fix log dev flush timer cancel race (#723)
yamingk May 17, 2025
417929e
Add submit_io_batch api in repl dev. (#725)
sanebay May 20, 2025
f254520
Redesign replacemember API
yuwmao May 15, 2025
156e0ab
Add a reaper thread to check and complete replace member
yuwmao May 28, 2025
be10be4
Fix replace_member
yuwmao May 29, 2025
a05b089
fix bug in get_replication_status
yuwmao May 30, 2025
f300348
The usage of EVP_DigestInit_ex2 in meta_blk test requires openssl3.x …
szmyd Jun 2, 2025
aa28554
Fix prefix merge and enable long running (#729)
shosseinimotlagh Jun 3, 2025
f0b5159
Fix overlapping range and enable index crash recovery for prefix (#735)
shosseinimotlagh Jun 3, 2025
79cf8b9
COWBtree and Multi Index support. (#1)
hkadayam Apr 4, 2025
baf4ef2
Improvements2 (#4)
hkadayam May 27, 2025
8f1649c
Update build_commit.yml to do merge build
hkadayam May 27, 2025
14156c0
Merge with main fork and also made replication as an optional support
hkadayam Aug 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ jobs:

- name: Code Coverage Run
run: |
du -sh ~/.conan2/p/*
df -h
conan build \
-o "sisl/*:prerelease=${{ inputs.prerelease }}" \
-o "sisl/*:malloc_impl=${{ inputs.malloc-impl }}" \
Expand Down
2 changes: 1 addition & 1 deletion .jenkins/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ########## ####### ############
FROM hub.tess.io/sds/sds_develop:4.x-latest
FROM hub.tess.io/sds/sds_develop:7.x-latest
LABEL description="Automated HomeStore compilation"

WORKDIR /output
Expand Down
38 changes: 22 additions & 16 deletions .jenkins/jenkinsfile_nightly
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pipeline {
agent { label 'sds-builder-2204' }
agent { label 'sds-builder-v5' }
triggers {
cron('TZ=US/Pacific\nH H(0-2) * * *')
}
Expand All @@ -8,7 +8,7 @@ pipeline {
ORG = 'sds'
ECR_URL = 'hub.tess.io'
ARTIFACTORY_PASS = credentials('ARTIFACTORY_PASS')
CONAN_USER = 'sds'
CONAN_USER = 'oss'
failed_stage = ""
}
stages {
Expand All @@ -26,6 +26,7 @@ pipeline {
VER = sh(script: "grep -m 1 ' version =' conanfile.py | awk '{print \$3}' | tr -d '\n' | tr -d '\"'", returnStdout: true)
NIGHTLY_TAG = "master-nightly-debug-4.0"
ECR_PATH = "${ECR_URL}/${ORG}/${PROJECT}"
CONAN_FLAGS="--name ${PROJECT} --user ${CONAN_USER} --channel ${NIGHTLY_TAG}"
failed_stage = ""
}
}
Expand All @@ -40,20 +41,25 @@ pipeline {
}
stage("Build") {
steps {
sh "conan create --build missing -o homestore:sanitize=True -pr debug . ${PROJECT}/${VER}@"
sh "find ${CONAN_USER_HOME} -type f -wholename '*tests/test_index_btree' -exec cp {} .jenkins/test_index_btree \\;"
sh "find ${CONAN_USER_HOME} -type f -wholename '*tests/test_index_crash_recovery' -exec cp {} .jenkins/test_index_crash_recovery \\;"
sh "find ${CONAN_USER_HOME} -type f -wholename '*tests/test_meta_blk_mgr' -exec cp {} .jenkins/test_meta_blk_mgr \\;"
sh "find ${CONAN_USER_HOME} -type f -wholename '*tests/test_log_store' -exec cp {} .jenkins/test_log_store \\;"
sh "find ${CONAN_USER_HOME} -type f -wholename '*tests/test_home_raft_logstore' -exec cp {} .jenkins/test_home_raft_logstore \\;"
sh "find ${CONAN_USER_HOME} -type f -wholename '*tests/test_log_store_long_run' -exec cp {} .jenkins/test_log_store_long_run \\;"
sh "find ${CONAN_USER_HOME} -type f -wholename '*tests/test_data_service' -exec cp {} .jenkins/test_data_service \\;"
sh "find ${CONAN_USER_HOME} -type f -wholename '*tests/test_raft_repl_dev' -exec cp {} .jenkins/test_raft_repl_dev \\;"
sh "find ${CONAN_USER_HOME} -type f -wholename '*tests/test_solo_repl_dev' -exec cp {} .jenkins/test_solo_repl_dev \\;"
sh "find ${CONAN_USER_HOME} -type f -wholename '*bin/scripts/index_test.py' -exec install -Dm755 {} .jenkins/index_test.py \\; "
sh "find ${CONAN_USER_HOME} -type f -wholename '*bin/scripts/log_meta_test.py' -exec install -Dm755 {} .jenkins/log_meta_test.py \\; "
sh "find ${CONAN_USER_HOME} -type f -wholename '*bin/scripts/data_test.py' -exec install -Dm755 {} .jenkins/data_test.py \\; "
sh "find ${CONAN_USER_HOME} -type f -wholename '*bin/scripts/long_running.py' -exec install -Dm755 {} .jenkins/long_running.py \\; "
sh '''
hostname
echo $NODE_NAME
conan create --build missing -s:h build_type=Debug -o ${PROJECT}/*:sanitize=True ${CONAN_FLAGS} .

find /home/jenkins -type f -wholename '*/test_index_btree' -exec cp {} .jenkins/test_index_btree \\;
find /home/jenkins -type f -wholename '*/test_index_crash_recovery' -exec cp {} .jenkins/test_index_crash_recovery \\;
find /home/jenkins -type f -wholename '*/test_meta_blk_mgr' -exec cp {} .jenkins/test_meta_blk_mgr \\;
find /home/jenkins -type f -wholename '*/test_log_store' -exec cp {} .jenkins/test_log_store \\;
find /home/jenkins -type f -wholename '*/test_home_raft_logstore' -exec cp {} .jenkins/test_home_raft_logstore \\;
find /home/jenkins -type f -wholename '*/test_log_store_long_run' -exec cp {} .jenkins/test_log_store_long_run \\;
find /home/jenkins -type f -wholename '*/test_data_service' -exec cp {} .jenkins/test_data_service \\;
find /home/jenkins -type f -wholename '*/test_raft_repl_dev' -exec cp {} .jenkins/test_raft_repl_dev \\;
find /home/jenkins -type f -wholename '*/test_solo_repl_dev' -exec cp {} .jenkins/test_solo_repl_dev \\;
find /home/jenkins -type f -wholename '*/test_scripts/index_test.py' -exec install -Dm755 {} .jenkins/index_test.py \\;
find /home/jenkins -type f -wholename '*/test_scripts/log_meta_test.py' -exec install -Dm755 {} .jenkins/log_meta_test.py \\;
find /home/jenkins -type f -wholename '*/test_scripts/data_test.py' -exec install -Dm755 {} .jenkins/data_test.py \\;
find /home/jenkins -type f -wholename '*/test_scripts/long_running.py' -exec install -Dm755 {} .jenkins/long_running.py \\;
'''
}
post {
failure {
Expand Down
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ endif ()
add_flags("-DPACKAGE_NAME=\\\"${PROJECT_NAME}\\\"")
add_flags("-DPACKAGE_VERSION=\\\"${PACKAGE_REVISION}\\\"")

# add replication flag
if (DEFINED REPLICATION)
if (${REPLICATION} STREQUAL "ON")
add_flags("-DREPLICATION_SUPPORT")
message(STATUS "Building with REPLICATION enabled")
else()
message(STATUS "Building with REPLICATION disabled")
endif()
else()
message(STATUS "Building with REPLICATION disabled")
endif()

if(UNIX)
# enable proper pread/pwrite and large file
add_flags("-D_POSIX_C_SOURCE=200809L -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE")
Expand Down
6 changes: 6 additions & 0 deletions cmake/test_mode.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ if (DEFINED TEST_TARGET)
set(${ret} true)
endif()
endmacro()
macro(can_build_repl_tests ret)
set(${ret} false)
endmacro()
else()
macro(can_build_io_tests ret)
set(${ret} false)
Expand All @@ -55,4 +58,7 @@ else()
macro(can_build_epoll_io_tests ret)
set(${ret} false)
endmacro()
macro(can_build_repl_tests ret)
set(${ret} false)
endmacro()
endif()
23 changes: 20 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "5.2.2"
version = "5.3.1"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand All @@ -25,13 +25,15 @@ class HomestoreConan(ConanFile):
"coverage": ['True', 'False'],
"sanitize": ['True', 'False'],
"testing" : ['full', 'min', 'off', 'epoll_mode', 'spdk_mode'],
"replication" : ['off', 'on'],
}
default_options = {
'shared': False,
'fPIC': True,
'coverage': False,
'sanitize': False,
'testing': 'epoll_mode',
'replication': 'off',
}

exports_sources = "cmake/*", "src/*", "CMakeLists.txt", "test_wrap.sh", "LICENSE"
Expand All @@ -54,18 +56,27 @@ def build_requirements(self):
def requirements(self):
self.requires("iomgr/[^12.1]@oss/master", transitive_headers=True)
self.requires("sisl/[^13.3]@oss/master", transitive_headers=True)
self.requires("nuraft_mesg/[^4.1]@oss/main", transitive_headers=True)
if str(self.options.replication) == "on":
self.requires("nuraft_mesg/[^4.1]@oss/main", transitive_headers=True)

self.requires("farmhash/cci.20190513@", transitive_headers=True)
if self.settings.arch in ['x86', 'x86_64']:
self.requires("isa-l/2.30.0", transitive_headers=True)

# Tests require OpenSSL 3.x
self.requires("openssl/[^3.1]", override=True)

def imports(self):
self.copy(root_package="sisl", pattern="*", dst="bin/scripts/python/flip/", src="bindings/flip/python/", keep_path=False)

def layout(self):
self.folders.source = "."
self.folders.build = join("build", str(self.settings.build_type))
if self.options.get_safe("sanitize"):
self.folders.build = join("build", "Sanitized")
elif self.options.get_safe("coverage"):
self.folders.build = join("build", "Coverage")
else:
self.folders.build = join("build", str(self.settings.build_type))
self.folders.generators = join(self.folders.build, "generators")

self.cpp.source.includedirs = ["src/include"]
Expand Down Expand Up @@ -94,6 +105,12 @@ def generate(self):
tc.variables['BUILD_COVERAGE'] = 'ON'
elif self.options.get_safe("sanitize"):
tc.variables['MEMORY_SANITIZER_ON'] = 'ON'
tc.variables["CONAN_PACKAGE_NAME"] = self.name
tc.variables["CONAN_PACKAGE_VERSION"] = self.version
if str(self.options.replication) == "on":
tc.variables["REPLICATION"] = "ON"
else:
tc.variables["REPLICATION"] = "OFF"
tc.generate()

# This generates "boost-config.cmake" and "grpc-config.cmake" etc in self.generators_folder
Expand Down
Binary file added docs/imgs/HomeStore_Disk_Layout2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 29 additions & 14 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,27 @@ find_package(isa-l QUIET)
find_package(iomgr QUIET REQUIRED)
find_package(farmhash QUIET REQUIRED)
find_package(GTest QUIET REQUIRED)
find_package(NuraftMesg QUIET REQUIRED)
if (DEFINED REPLICATION)
if (${REPLICATION} STREQUAL "ON")
find_package(NuraftMesg QUIET REQUIRED)
endif()
endif()

list(APPEND COMMON_DEPS
iomgr::iomgr
farmhash::farmhash
nuraft_mesg::proto
nuraft::nuraft
sisl::sisl
)

if (DEFINED REPLICATION)
if (${REPLICATION} STREQUAL "ON")
list(APPEND COMMON_DEPS
nuraft_mesg::proto
nuraft::nuraft
)
endif()
endif()

if (${isa-l_FOUND})
list(APPEND COMMON_DEPS isa-l::isa-l)
else ()
Expand All @@ -42,7 +54,11 @@ add_subdirectory(lib/logstore)
add_subdirectory(lib/meta)
add_subdirectory(lib/index)
add_subdirectory(lib/blkdata_svc/)
add_subdirectory(lib/replication/)
if (DEFINED REPLICATION)
if (${REPLICATION} STREQUAL "ON")
add_subdirectory(lib/replication/)
endif()
endif()

if(NOT DEFINED BUILD_TESTING OR BUILD_TESTING)
add_subdirectory(tests)
Expand All @@ -59,20 +75,19 @@ set(HOMESTORE_OBJECTS
$<TARGET_OBJECTS:hs_mem_btree>
$<TARGET_OBJECTS:hs_cow_btree>
$<TARGET_OBJECTS:hs_datasvc>
$<TARGET_OBJECTS:hs_replication>
lib/homestore.cpp
lib/crc.cpp
)
#target_link_libraries(homestore_objs ${COMMON_DEPS})
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_library(homestore STATIC
${HOMESTORE_OBJECTS}
)
else()
add_library(homestore STATIC
${HOMESTORE_OBJECTS}
)

if (DEFINED REPLICATION)
if (${REPLICATION} STREQUAL "ON")
list(APPEND HOMESTORE_OBJECTS $<TARGET_OBJECTS:hs_replication>)
endif()
endif()
#target_link_libraries(homestore_objs ${COMMON_DEPS})

add_library(homestore STATIC
${HOMESTORE_OBJECTS}
)
target_compile_definitions (homestore PRIVATE LOG_MODS_V2_SUPPORT)
target_link_libraries(homestore PRIVATE ${COMMON_DEPS})
9 changes: 7 additions & 2 deletions src/include/homestore/blk.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,14 @@ VENUM(BlkAllocStatus, uint32_t,

struct blk_alloc_hints {
blk_temp_t desired_temp{0}; // Temperature hint for the device
std::optional< uint32_t > pdev_id_hint{std::nullopt}; // which physical device to pick (hint if any)
std::optional< chunk_num_t > chunk_id_hint{std::nullopt}; // any specific chunk id to pick for this allocation
std::optional< uint32_t > reserved_blks{std::nullopt}; // Reserved blks in a chunk
std::optional< uint32_t > pdev_id_hint{std::nullopt}; // which physical device to pick (hint if any)
std::optional< chunk_num_t > chunk_id_hint{std::nullopt}; // any specific chunk id to pick for this allocation
std::optional< MultiBlkId > committed_blk_id{
std::nullopt}; // blk id indicates the blk was already allocated and committed, don't allocate and commit again
std::optional< stream_id_t > stream_id_hint{std::nullopt}; // any specific stream to pick
std::optional< uint64_t > application_hint{
std::nullopt}; // hints in uint64 what will be passed opaque to select_chunk
bool can_look_for_other_chunk{true}; // If alloc on device not available can I pick other device
bool is_contiguous{true}; // Should the entire allocation be one contiguous block
bool partial_alloc_ok{false}; // ok to allocate only portion of nblks? Mutually exclusive with is_contiguous
Expand Down
66 changes: 62 additions & 4 deletions src/include/homestore/blkdata_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,19 @@ class BlkDataService {

/**
* @brief Creates a new virtual device with the specified size and block size, using the specified
* block allocator and chunk selector types. The virtual device will be composed of the specified
* number of chunks.
* block allocator and chunk selector types. The virtual device will be composed of a number of chunks.
* Either `num_chunks` or `chunk_size` must be specified.
* Prioritize `num_chunks` over `chunk_size` if both are provided.
*
* @param size The size of the virtual device, in bytes.
* @param blk_size The size of each block in the virtual device, in bytes.
* @param alloc_type The type of block allocator to use for the virtual device.
* @param chunk_sel_type The type of chunk selector to use for the virtual device.
* @param num_chunks The number of chunks to use for the virtual device.
* @param chunk_size The size of chunks to use for the virtual device, in bytes.
*/
void create_vdev(uint64_t size, HSDevType devType, uint32_t blk_size, blk_allocator_type_t alloc_type,
chunk_selector_type_t chunk_sel_type, uint32_t num_chunks);
chunk_selector_type_t chunk_sel_type, uint32_t num_chunks, uint32_t chunk_size);

/**
* @brief Opens a virtual device with the specified virtual device information.
Expand Down Expand Up @@ -112,6 +114,18 @@ class BlkDataService {
folly::Future< std::error_code > async_write(sisl::sg_list const& sgs, MultiBlkId const& in_blkids,
bool part_of_batch = false);

/**
* @brief : asynchronous write with input block ids;
*
* @param sgs : the data buffer that needs to be written
* @param hints : blk alloc hints
* @param in_blkids : input block ids that this write should be written to;
* @param cb : callback that will be triggered after write completes
* @param part_of_batch : is this write part of a batch;
*/
folly::Future< std::error_code > async_write(sisl::sg_list const& sgs, std::vector< MultiBlkId > const& in_blkids,
bool part_of_batch = false);

/**
* @brief Asynchronously reads data from the specified block ID into the provided buffer.
*
Expand All @@ -137,6 +151,13 @@ class BlkDataService {
folly::Future< std::error_code > async_read(MultiBlkId const& bid, sisl::sg_list& sgs, uint32_t size,
bool part_of_batch = false);

/**
* @brief Submit the io batch, which is a mandatory method to be called if read/write are issued with part_of_batch
* is set to true. In those cases, without this method, IOs might not be even issued. No-op if previous io requests
* are not part of batch.
* */
void submit_io_batch();

/**
* @brief Commits the block with the given MultiBlkId.
*
Expand All @@ -145,7 +166,8 @@ class BlkDataService {
BlkAllocStatus commit_blk(MultiBlkId const& bid);

/**
* @brief Allocates a contiguous block of disk space of the given size.
* @brief Allocates a contiguous block of disk space of the given size. This API should be called that when consumer
* is expecting blks only allocated on same chunk.
*
* @param size The size of the block to allocate, in bytes.
* @param hints Hints for how to allocate the block.
Expand All @@ -154,6 +176,17 @@ class BlkDataService {
*/
BlkAllocStatus alloc_blks(uint32_t size, blk_alloc_hints const& hints, MultiBlkId& out_blkids);

/**
* @brief Allocates blocks of disk space of the given size.This API should be called when consumer is expecting blk
* allocation happen on different chunks is possible and acceptable.
*
* @param size The size of the block to allocate, in bytes.
* @param hints Hints for how to allocate the block.
* @param out_blkids Output parameter that will be filled with the IDs of the allocated blocks.
* @return The status of the block allocation attempt.
*/
BlkAllocStatus alloc_blks(uint32_t size, blk_alloc_hints const& hints, std::vector< BlkId >& out_blkids);

/**
* @brief Asynchronously frees the specified block IDs.
* It is asynchronous because it might need to wait for pending read to complete if same block is being read and not
Expand Down Expand Up @@ -194,10 +227,35 @@ class BlkDataService {
*/
void start();

/**
* @brief Gets the total capacity of the block data service.
*
* This function returns the total capacity of the block data service, in bytes.
*
* @return The total capacity of the block data service, in bytes.
*/
uint64_t get_total_capacity() const;

/**
* @brief Gets the used capacity of the block data service.
*
* This function returns the used capacity of the block data service, in bytes.
*
* @return The used capacity of the block data service, in bytes.
*/
uint64_t get_used_capacity() const;

/**
* @brief Gets the drive type of the data service.
*
* Data Service doesn't support mixed drive types.
*
* @return The drive type of the data service, HDD or NVME.
*/
HSDevType get_dev_type() const;

void stop();

private:
/**
* @brief Initializes the block data service.
Expand Down
Loading
Loading