Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge latest internal to OSS #720

Merged
merged 62 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
4fe4b23
add docker build
zliang-sc Aug 9, 2023
3536958
fix the working dir in Dockerfile
zliang-sc Aug 9, 2023
7bce881
add release publish docker image
zliang-sc Aug 10, 2023
7a496d3
address intentation and use default release
zliang-sc Aug 10, 2023
db3fb7e
migrate keydb_modstatsd to keydb-internal
zliang-sc Aug 11, 2023
c94560f
rm
zliang-sc Aug 11, 2023
6e1fbb2
add submodule cpp-statsd-client
zliang-sc Aug 11, 2023
6e03058
include trigger keydb_modstatsd Makefile in modules Makefile
zliang-sc Aug 11, 2023
289df10
update
zliang-sc Aug 11, 2023
4d56a1c
have clean also trigger keydb_modstatsd clean
zliang-sc Aug 11, 2023
cb147de
Merge pull request #212 from Snapchat/migrate-keydb_modstatsd
zliang-sc Aug 11, 2023
12bf618
Merge branch 'main' into machamp-release-publish-image
zliang-sc Aug 11, 2023
b820879
move cpp-statsd-client to deps
zliang-sc Aug 14, 2023
68ce12a
checkout to a06a5b9359f31d946fe163b9038586982971ae49
zliang-sc Aug 14, 2023
a055da3
update relative path in compilation
zliang-sc Aug 14, 2023
b51f267
remove submodule instead use the source
zliang-sc Aug 14, 2023
deb48fb
Merge pull request #213 from Snapchat/move-cpp-statsd-client-to-dep
zliang-sc Aug 14, 2023
b6f91e4
include building keydb statsd module
zliang-sc Aug 14, 2023
8cbb53e
Merge branch 'main' into machamp-release-publish-image
zliang-sc Aug 14, 2023
7d96689
fix check in Dockerfile docker-entrypoint.sh
zliang-sc Aug 14, 2023
e15a2b6
fix
zliang-sc Aug 14, 2023
70f2a74
fix the comment caused stuck docker build
zliang-sc Aug 15, 2023
a1b55ed
Merge pull request #211 from Snapchat/machamp-release-publish-image
zliang-sc Aug 15, 2023
df9039d
use commit hash as tag template
zliang-sc Aug 15, 2023
94b40af
fix
zliang-sc Aug 15, 2023
9cbc571
test tag
zliang-sc Aug 15, 2023
76fec1c
Revert "test tag"
zliang-sc Aug 15, 2023
222776e
Merge pull request #214 from Snapchat/update-docker-build-tag
zliang-sc Aug 15, 2023
426eabe
make docker build independent
zliang-sc Aug 15, 2023
7a00a43
add new build to ci
zliang-sc Aug 15, 2023
abd6e77
Merge pull request #215 from Snapchat/make-docker-build-independent
zliang-sc Aug 16, 2023
6fa696b
emit system free metrics with '/proc/meminfo'
zliang-sc Aug 18, 2023
eb14f42
have emit system free memory within metrics_time_taken_us and also ad…
zliang-sc Aug 18, 2023
80dcbad
Merge pull request #216 from Snapchat/add-free-memory-and-shard-num-m…
zliang-sc Aug 18, 2023
ffac552
Remove Expireset (#217)
Aug 21, 2023
813bf15
update MemFree to MemAvailable in keydb statsd
zliang-sc Aug 21, 2023
bf29926
Merge pull request #218 from Snapchat/change-memfree-to-memavailable
zliang-sc Aug 21, 2023
6375e91
add metric emit for non-empty primary with less than 2 connected repl…
zliang-sc Aug 22, 2023
cec570f
address comments
zliang-sc Aug 22, 2023
c97f696
Merge pull request #219 from Snapchat/emit-non-empty-shard-less-repli…
zliang-sc Aug 22, 2023
8b755ae
Multiply CPU percent metric by 100
acope-sc Aug 22, 2023
f435218
Fix memory leaks
JohnSully Aug 25, 2023
820482b
Fix slow to free when low lock contention
JohnSully Aug 25, 2023
c20af57
fix nodename metricsname
zliang-sc Aug 31, 2023
e31533b
fix unnecessary replace
zliang-sc Aug 31, 2023
7d4f461
Make propagating before freeing module context optional (#225)
msotheeswaran-sc Sep 8, 2023
ace783a
Flash expiration (#197)
msotheeswaran-sc Sep 8, 2023
a55c687
Emit more aggregate metrics in modstatsd (#223)
acope-sc Sep 11, 2023
98e306c
Merge branch 'main' into remove-dot-in-nodename-metrics
zliang-sc Sep 11, 2023
7b7c0ba
Merge pull request #224 from Snapchat/remove-dot-in-nodename-metrics
zliang-sc Sep 11, 2023
9251f1c
Permit keys of differing slots as long as they are served by this clu…
JohnSully Sep 14, 2023
c6e20ea
Fix over pessimistic checks that prevent replicas from serving mget
JohnSully Sep 20, 2023
cfe257a
Fix logic bug
JohnSully Sep 20, 2023
68d7510
async rehash is preventing rehashing during RDB load after a db flush…
JohnSully Sep 23, 2023
570bcb5
make async rehash configurable
JohnSully Sep 23, 2023
596c513
only use internal locks when multithreaded (#205)
msotheeswaran-sc Sep 25, 2023
025b707
Fix crossslot error migrating batches of keys
JohnSully Sep 26, 2023
e7f90f0
Fix bug where we erroneously answer queries belonging to another shard
JohnSully Sep 27, 2023
e60133f
Merge remote-tracking branch 'internal/main' into merge_internal
msotheeswaran-sc Sep 27, 2023
8f61819
fix mac compile
msotheeswaran-sc Sep 28, 2023
dfcc848
enable level_compaction_dynamic_level_bytes after flush, and flush ex…
msotheeswaran-sc Sep 28, 2023
08b0716
Merge remote-tracking branch 'internal/main' into merge_internal
msotheeswaran-sc Sep 28, 2023
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
24 changes: 23 additions & 1 deletion build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 1
machamp:
keydb-build:
# Optional - build counter is linked to the build def
tag_template: 0.0.%build.counter%
tag_template: "0.0.%build.counter%-%sha%"
# Optional - value in seconds before a build is terminated, default is 3600 seconds
timeout: 3600
# Optional - update ghe or not, default to true
Expand Down Expand Up @@ -46,3 +46,25 @@ machamp:
# https://github.sc-corp.net/Snapchat/img/tree/master/keydb/ubuntu-20-04
builder_image: us.gcr.io/snapchat-build-artifacts/prod/snapchat/img/keydb/keydb-ubuntu-20-04@sha256:cf869a3f5d1de1e1d976bb906689c37b7031938eb68661b844a38c532f27248c
command: ./runtest-rotation
keydb-docker-build:
# Optional - build counter is linked to the build def
tag_template: "%sha%"
# Optional - value in seconds before a build is terminated, default is 3600 seconds
timeout: 3600
# Optional - update ghe or not, default to true
update_ghe: true
code_coverage: false
# Required
steps:
# to ensure a clearer docker build env
code-checkout:
type: cmd
command: echo checkout
# default machamp builder image does not work for multi arch
builder_image: us.gcr.io/snapchat-build-artifacts/prod/snapchat/img/ubuntu/ubuntu-23-04@sha256:bd43177a80e6ce1c3583e8ea959b88a9081c0f56b765ec9c5a157c27a637c23b
docker:
parent: code-checkout
type: docker # published images can be found in https://console.cloud.google.com/gcr/images/machamp-prod/global/keydb
dockerfile: machamp_scripts/Dockerfile
image_name: keydb # git commit sha will be deafult tag in the final image
workspace_context: ./ # This is the workspace context that your Dockerfile will use to move files around. <Root of checkout repository>/<Workspace Context>/<Dockerfile> If the workspace context is just the root of the repository, you can just use "./".
31 changes: 25 additions & 6 deletions ci.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
# Doc: https://wiki.sc-corp.net/display/TOOL/ci.yaml+User+Guide
version: 1
on:
# https://wiki.sc-corp.net/display/TOOL/Onboard+Machamp+Build+By+ci.yaml+Configuration
# on pull_request is used for any pr build
pull_request:
- workflows:
# All builds that use machamp should use the defined `backend_workflow`
- workflow_type: backend_workflow
# references a build defined in build.yaml
build_name: keydb-build
arch_types: ["amd64", "arm64"]
- branches: ['!!main', '*'] # this branch pattern means any branch but not main branch will trigger this pr build
workflows:
# All builds that use machamp should use the defined `backend_workflow`
- workflow_type: backend_workflow
# references a build defined in build.yaml
build_name: keydb-build
arch_types: ["amd64", "arm64"]
- workflow_type: backend_workflow
# references a build defined in build.yaml
build_name: keydb-docker-build
arch_types: ["amd64", "arm64"]
# on push is used for release branch, meaning: trigger this build when there is commit pushed to this branch
push:
- branches: [main]
workflows:
- workflow_type: backend_workflow
build_name: keydb-build
arch_types: ["amd64", "arm64"]
- workflow_type: backend_workflow
# references a build defined in build.yaml
build_name: keydb-docker-build
arch_types: ["amd64", "arm64"]

# below defines which branch is release branch / release tag
machamp:
releases:
# Note: machamp will only respect the ci.yaml file from default branch for "release branch" definition (most repositories using master/main as default branch)
# https://wiki.sc-corp.net/display/TOOL/Onboard+Machamp+Build+By+ci.yaml+Configuration
- branch_name: ^main$
105 changes: 105 additions & 0 deletions deps/cpp-statsd-client/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
AccessModifierOffset: -4
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: Empty
BinPackArguments: false
BinPackParameters: false
ColumnLimit: 120
IndentCaseLabels: false
IndentWidth: 4

---
Language: Cpp
# BasedOnStyle: Google
#AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
#AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
#AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
#BinPackArguments: true
#BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
#ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
#IndentCaseLabels: true
#IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
...

30 changes: 30 additions & 0 deletions deps/cpp-statsd-client/.github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Coverage

on: [push, pull_request]
jobs:
coverage:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y -qq make cmake gcc g++ lcov bc
- name: build
shell: bash
run: |
export LD_LIBRARY_PATH=.:$(cat /etc/ld.so.conf.d/* | grep -vF "#" | tr "\\n" ":" | sed -e "s/:$//g")
cmake . -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=On
make all -j$(nproc)
- name: coverage
shell: bash
run: |
make coverage
lines=$(lcov --summary coverage.info | grep -F lines | awk '{print $2}' | sed -e "s/%//g")
if (( $(echo "${lines} < ${COVERAGE_THRESHOLD}" | bc -l) )); then
echo "Line coverage dropped below ${COVERAGE_THRESHOLD}% to ${lines}%"
exit 1
fi
env:
COVERAGE_THRESHOLD: 85.0
13 changes: 13 additions & 0 deletions deps/cpp-statsd-client/.github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Lint

on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: lint
uses: DoozyX/[email protected]
with:
clangFormatVersion: 12
source: './include/cpp-statsd-client ./tests'
23 changes: 23 additions & 0 deletions deps/cpp-statsd-client/.github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Linux

on: [push, pull_request]
jobs:
linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y -qq make cmake gcc g++
- name: build
shell: bash
run: |
export LD_LIBRARY_PATH=.:$(cat /etc/ld.so.conf.d/* | grep -vF "#" | tr "\\n" ":" | sed -e "s/:$//g")
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_SANITIZERS=On
make all -j$(nproc)
- name: test
shell: bash
run: |
make test
18 changes: 18 additions & 0 deletions deps/cpp-statsd-client/.github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Windows

on: [push, pull_request]
jobs:
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: dependencies
run: |
choco install cmake
- name: build
run: |
cmake -S . -B build -G "Visual Studio 16 2019" -A x64
cmake --build build --target ALL_BUILD --config Release
- name: test
run: |
cmake --build build --target RUN_TESTS --config Release
1 change: 1 addition & 0 deletions deps/cpp-statsd-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin
85 changes: 85 additions & 0 deletions deps/cpp-statsd-client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Basic project setup
cmake_minimum_required(VERSION 3.5)
project(cpp-statsd-client
VERSION 1.0.2
LANGUAGES CXX
DESCRIPTION "A header-only StatsD client implemented in C++"
HOMEPAGE_URL "https://github.com/vthiery/cpp-statsd-client")

option(CPP_STATSD_STANDALONE "Allows configuration of targets for verifying library functionality" ON)
option(ENABLE_TESTS "Build tests" ON)
option(ENABLE_COVERAGE "Build with coverage instrumentalisation" OFF)

if(NOT CPP_STATSD_STANDALONE)
set(ENABLE_TESTS OFF)
set(ENABLE_COVERAGE OFF)
endif()

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
find_package(Threads)

# Optional code coverage targets
if(ENABLE_COVERAGE)
set(COVERAGE_EXCLUDES /usr/*)
include(${PROJECT_SOURCE_DIR}/cmake/CodeCoverage.cmake)
APPEND_COVERAGE_COMPILER_FLAGS()
SETUP_TARGET_FOR_COVERAGE_LCOV(NAME coverage
EXECUTABLE testStatsdClient
DEPENDENCIES ${PROJECT_NAME}
)
endif()

# The library target
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(
${PROJECT_NAME}
INTERFACE $<BUILD_INTERFACE:${${PROJECT_NAME}_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_link_libraries(${PROJECT_NAME} INTERFACE Threads::Threads)
if(WIN32)
target_link_libraries(${PROJECT_NAME} INTERFACE ws2_32)
endif()

# The installation and pkg-config-like cmake config
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}_Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
install(EXPORT ${PROJECT_NAME}_Targets
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include DESTINATION include)

if(ENABLE_TESTS)
# The test targets
add_executable(testStatsdClient ${CMAKE_CURRENT_SOURCE_DIR}/tests/testStatsdClient.cpp)
if(WIN32)
target_compile_options(testStatsdClient PRIVATE -W4 -WX /external:W0)
else()
target_compile_options(testStatsdClient PRIVATE -Wall -Wextra -pedantic -Werror)
endif()
target_include_directories(testStatsdClient PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests)
target_link_libraries(testStatsdClient ${PROJECT_NAME})

set_property(TARGET testStatsdClient PROPERTY CXX_STANDARD 11)
set_property(TARGET testStatsdClient PROPERTY CXX_EXTENSIONS OFF)

# The test suite
enable_testing()
add_test(ctestTestStatsdClient testStatsdClient)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS testStatsdClient)
endif()
9 changes: 9 additions & 0 deletions deps/cpp-statsd-client/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2017 Vincent Thiery

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 changes: 22 additions & 0 deletions deps/cpp-statsd-client/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# simple makefile to build, test and clean

BUILD_MODE ?= Release
ENABLE_COVERAGE ?= On

build: clean
@echo "Build in ${BUILD_MODE} mode"
mkdir -p bin/${BUILD_MODE}
@cd bin/${BUILD_MODE}; cmake ../../ -DCMAKE_BUILD_TYPE=${BUILD_MODE} -DENABLE_COVERAGE=${ENABLE_COVERAGE}
@cd bin/${BUILD_MODE}; make

test: build
@cd bin/${BUILD_MODE}; make test

coverage: build
@cd bin/${BUILD_MODE}; make coverage

install: build
@cd bin/${BUILD_MODE}; make install

clean:
@rm -rf bin
Loading
Loading