Skip to content

Instantly share code, notes, and snippets.

@yuvalif
Last active March 20, 2024 12:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuvalif/26ff6c115a8386d1d47f2ed4e38cfd39 to your computer and use it in GitHub Desktop.
Save yuvalif/26ff6c115a8386d1d47f2ed4e38cfd39 to your computer and use it in GitHub Desktop.

From RADOS to REDIS

Background

Bucket notifications are important building block in the object storage ecosystem. And persistent bucket notifications in particular, as they let the system overcome broker outages. However, since the persistent notifications are backed with a RADOS queue, they have a cost. Both in the extra load on the RADOS cluster, and with the inability to operate in environemnts where there is no RADOS backend. In this project, we would like to implement persistent bucket notifications in the RADOS Gateway using a Redis Queue. Combined with the "zipper" project we would be able to enjoy bucket notifications with backends like posix, dbstore, daos etc.

Note that on top of using RADOS for the notification queue, our code is depended with RADOS with its implementation of a distributed lock (to make sure that one and only one RGW serve a queue at a given point in time). as well as the fact that topic and notification configuration stored inside RADOS objets.

Evaluation Stage

Step 1 - Build Ceph and Test Bucket Notifications

First would be to have a linux based development environment, as a minimum you would need a 4 CPU machine, with 8G RAM and 50GB disk. Unless you already have a linux distro you like, I would recommend choosing from:

  • Fedora (38/39) - my favorite!
  • Ubuntu (22.04 LTS)
  • WSL (Windows Subsystem for Linux), though it would probably take much longer...
  • RHEL9/Centos9
  • Other Linux distros - try at your own risk :-)

Once you have that up and running, you should clone the Ceph repo from github (https://github.com/ceph/ceph). If you don’t know what github and git are, this is the right time to close these gaps :-) And yes, you should have a github account, so you can later share your work on the project.

Install any missing system dependencies use:

./install-deps.sh

Note that, the first build may take long time, so the following cmake parameter could be used to minimize the build time. With a fresh ceph clone use the following:

./do_cmake.sh -DBOOST_J=$(nproc) -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWITH_MGR_DASHBOARD_FRONTEND=OFF \
  -DWITH_DPDK=OFF -DWITH_SPDK=OFF -DWITH_SEASTAR=OFF -DWITH_CEPHFS=OFF -DWITH_RBD=OFF -DWITH_KRBD=OFF -DWITH_CCACHE=OFF

if the build directory already exists, you can rebuild the ninja files by using (from build):

cmake -DBOOST_J=$(nproc) -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWITH_MGR_DASHBOARD_FRONTEND=OFF \
  -DWITH_DPDK=OFF -DWITH_SPDK=OFF -DWITH_SEASTAR=OFF -DWITH_CEPHFS=OFF -DWITH_RBD=OFF -DWITH_KRBD=OFF -DWITH_CCACHE=OFF ..

then invoke the build process (using ninja) from within the build directory (created by do_cmake.sh). Assuming the build was completed successfully, you can run the unit tests (see: https://github.com/ceph/ceph#running-unit-tests).

Now you are ready to run the ceph processes, as explained here: https://github.com/ceph/ceph#running-a-test-cluster You probably would also like to check the developer guide (https://docs.ceph.com/docs/master/dev/developer_guide/) and learn more on how to build Ceph and run it locally (https://docs.ceph.com/docs/master/dev/quick_guide/). Ceph's bucket noptification documentation:

Run bucket notification tests for persistent notifications using an HTTP endpoint:

  • start the vtsart cluster:
$ MON=1 OSD=1 MDS=0 MGR=0 RGW=1 ../src/vstart.sh -n -d
  • on a separate terminal start an HTTP endpoint:
$ wget https://gist.githubusercontent.com/mdonkers/63e115cc0c79b4f6b8b3a6b797e485c7/raw/a6a1d090ac8549dac8f2bd607bd64925de997d40/server.py
$ python server.py 10900
  • install the awc cli tool
  • configure the tool according to the access and secret keys showing in the output of the vstart.sh command
  • set the region to default
  • create a persistent topic pointing to the above HTTP endpoint:
$ aws --endpoint-url http://localhost:8000 sns create-topic --name=fishtopic \
  --attributes='{"push-endpoint": "http://localhost:10900", "persistent": "true"}'
  • create a bucket:
$ aws --endpoint-url http://localhost:8000 s3 mb s3://fish
  • create a notification on that bucket, pointing to the above topic:
$ aws --endpoint-url http://localhost:8000 s3api put-bucket-notification-configuration  --bucket fish \
  --notification-configuration='{"TopicConfigurations": [{"Id": "notif1", "TopicArn": "arn:aws:sns:default::fishtopic", "Events": []}]}'

Leaving the event list empty is equivalent to setting it to ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]

  • create a file, and upload it:
$ head -c 512 </dev/urandom > myfile
$ aws --endpoint-url http://localhost:8000 s3 cp myfile s3://fish
  • on the HTTP terminal, see the JSON output of the notifications

Step 2 - Build Test Tools

using the boost Redis client:

  • write a standalone client that pushes to the Redis Queue (input could be stdin, or any other option)
  • write a standalone client that pull from the Redis Queue (output could be stdout, or any other option)

Note that currently Ceph as a Redis cpp client that we have as a submodule, but this will be changed soon in favor of boost Redis.

  • optional: using gtest write a unit test that excersite the above clients

Project Goals

  • create an abstraction layer that could be implemented using cls_2pc_queue or a REDIS client
  • use this abstraction layer in the bucket notification code and break its dependency with RADOS
  • implement using boost redis client (that soon will be incorporated as a submodule in the Ceph source tree)
  • add a config option to select the implementation used in runtime
  • add test and setup instructions when using RADOS backend

Stretch Goal

  • create an abstraction layer for cls lock
  • use this abstraction layer in the bucket notification code
  • implement using our cpp redis submodule. see: redis distributed lock
  • move rgw_notify.cc outside of the driver/rados directory
  • test and setup instructions when using a non-RADOS backend (e.g. posix)
@9401adarsh
Copy link

9401adarsh commented Mar 5, 2024

Hello there, this is Adarsh here. You mentioned downloading the awc cli tool as part of the steps to run bucket notifications tests for persistent notifications using a HTTP endpoint, but the closest I could find on Google is the aws-cli tool (https://github.com/aws/aws-cli). Could you please confirm if this what I'd have to download ?

@9401adarsh
Copy link

9401adarsh commented Mar 5, 2024

Hello again, I have been trying to build ceph as per the steps given above. When I try to run the unit tests using ninja, I get the following error where it terminates at building rocksdb_ext.

[2/1503] Performing build step for 'rocksdb_ext'
FAILED: src/rocksdb_ext-prefix/src/rocksdb_ext-stamp/rocksdb_ext-build src/rocksdb/librocksdb.a /home/adarsh9401/ceph-essentials/ceph/build/src/rocksdb_ext-prefix/src/rocksdb_ext-stamp/rocksdb_ext-build /home/adarsh9401/ceph-essentials/ceph/build/src/rocksdb/librocksdb.a
cd /home/adarsh9401/ceph-essentials/ceph/build/src/rocksdb && /usr/bin/cmake --build /home/adarsh9401/ceph-essentials/ceph/build/src/rocksdb --target rocksdb && /usr/bin/cmake -E touch /home/adarsh9401/ceph-essentials/ceph/build/src/rocksdb_ext-prefix/src/rocksdb_ext-stamp/rocksdb_ext-build
[1/259] Building CXX object CMakeFiles/rocksdb.dir/db/malloc_stats.cc.o
[2/259] Building CXX object CMakeFiles/rocksdb.dir/db/merge_operator.cc.o
[3/259] Building CXX object CMakeFiles/rocksdb.dir/db/output_validator.cc.o
[4/259] Building CXX object CMakeFiles/rocksdb.dir/db/periodic_task_scheduler.cc.o
[5/259] Building CXX object CMakeFiles/rocksdb.dir/db/log_writer.cc.o
[6/259] Building CXX object CMakeFiles/rocksdb.dir/db/merge_helper.cc.o
[7/259] Building CXX object CMakeFiles/rocksdb.dir/db/snapshot_impl.cc.o
[8/259] Building CXX object CMakeFiles/rocksdb.dir/db/range_tombstone_fragmenter.cc.o
[9/259] Building CXX object CMakeFiles/rocksdb.dir/db/range_del_aggregator.cc.o
[10/259] Building CXX object CMakeFiles/rocksdb.dir/db/memtable.cc.o
[11/259] Building CXX object CMakeFiles/rocksdb.dir/db/seqno_to_time_mapping.cc.o
[12/259] Building CXX object CMakeFiles/rocksdb.dir/db/table_properties_collector.cc.o
[13/259] Building CXX object CMakeFiles/rocksdb.dir/db/db_iter.cc.o
[14/259] Building CXX object CMakeFiles/rocksdb.dir/db/table_cache.cc.o
[15/259] Building CXX object CMakeFiles/rocksdb.dir/db/trim_history_scheduler.cc.o
[16/259] Building CXX object CMakeFiles/rocksdb.dir/db/transaction_log_impl.cc.o
[17/259] Building CXX object CMakeFiles/rocksdb.dir/db/repair.cc.o
[18/259] Building CXX object CMakeFiles/rocksdb.dir/db/wal_edit.cc.o
[19/259] Building CXX object CMakeFiles/rocksdb.dir/db/wide/wide_columns.cc.o
[20/259] Building CXX object CMakeFiles/rocksdb.dir/db/memtable_list.cc.o
[21/259] Building CXX object CMakeFiles/rocksdb.dir/db/version_edit.cc.o
[22/259] Building CXX object CMakeFiles/rocksdb.dir/db/write_batch_base.cc.o
[23/259] Building CXX object CMakeFiles/rocksdb.dir/db/wide/wide_column_serialization.cc.o
[24/259] Building CXX object CMakeFiles/rocksdb.dir/db/write_controller.cc.o
[25/259] Building CXX object CMakeFiles/rocksdb.dir/db/version_builder.cc.o
[26/259] Building CXX object CMakeFiles/rocksdb.dir/db/db_impl/db_impl.cc.o
FAILED: CMakeFiles/rocksdb.dir/db/db_impl/db_impl.cc.o
/usr/bin/g++-11 -DHAVE_PCLMUL -DHAVE_SSE42 -DLZ4 -DOS_LINUX -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_IOURING_PRESENT -DROCKSDB_LIB_IO_POSIX -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_NO_DYNAMIC_EXTENSION -DROCKSDB_PLATFORM_POSIX -DROCKSDB_PORTABLE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DSNAPPY -DZLIB -I/home/adarsh9401/ceph-essentials/ceph/src/rocksdb -I/home/adarsh9401/ceph-essentials/ceph/src/rocksdb/include -isystem /home/adarsh9401/ceph-essentials/ceph/src/rocksdb/third-party/gtest-1.8.1/fused-src -isystem /home/adarsh9401/ceph-essentials/ceph/build/src/liburing/src/include -Wno-deprecated-copy -Wno-pessimizing-move -W -Wextra -Wall -pthread -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-strict-aliasing -Wno-invalid-offsetof -fno-builtin-memcmp -g -DROCKSDB_USE_RTTI -fPIC -MD -MT CMakeFiles/rocksdb.dir/db/db_impl/db_impl.cc.o -MF CMakeFiles/rocksdb.dir/db/db_impl/db_impl.cc.o.d -o CMakeFiles/rocksdb.dir/db/db_impl/db_impl.cc.o -c /home/adarsh9401/ceph-essentials/ceph/src/rocksdb/db/db_impl/db_impl.cc
g++-11: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[27/259] Building CXX object CMakeFiles/rocksdb.dir/env/env_chroot.cc.o
[28/259] Building CXX object CMakeFiles/rocksdb.dir/env/composite_env.cc.o
[29/259] Building CXX object CMakeFiles/rocksdb.dir/db/write_thread.cc.o
[30/259] Building CXX object CMakeFiles/rocksdb.dir/db/wal_manager.cc.o
[31/259] Building CXX object CMakeFiles/rocksdb.dir/env/env_encryption.cc.o
[32/259] Building CXX object CMakeFiles/rocksdb.dir/env/env.cc.o
[33/259] Building CXX object CMakeFiles/rocksdb.dir/db/write_batch.cc.o
[34/259] Building CXX object CMakeFiles/rocksdb.dir/db/version_edit_handler.cc.o
[35/259] Building CXX object CMakeFiles/rocksdb.dir/db/version_set.cc.o
ninja: build stopped: subcommand failed.
[3/1503] Performing install step for 'Boost'
Performing configuration checks

    - default address-model    : 64-bit (cached) [1]
    - default architecture     : x86 (cached) [1]
    - compiler supports SSE2   : yes [2]
    - compiler supports SSE4.1 : yes [2]
    - has std::atomic_ref      : no [2]
    - has -Wl,--no-undefined   : yes [2]
    - has statx                : yes [2]
    - has init_priority attribute : yes [2]
    - has stat::st_blksize     : yes [2]
    - has stat::st_mtim        : yes [2]
    - has stat::st_mtimensec   : no [2]
    - has stat::st_mtimespec   : no [2]
    - has stat::st_birthtim    : no [2]
    - has stat::st_birthtimensec : no [2]
    - has stat::st_birthtimespec : no [2]
    - has fdopendir(O_NOFOLLOW) : yes [2]
    - has POSIX *at APIs       : yes [2]
    - zlib                     : yes
    - bzip2                    : yes
    - lzma                     : yes
    - zstd                     : yes
    - has_lzma_cputhreads builds : yes [2]
    - has_icu builds           : yes [2]
    - lockfree boost::atomic_flag : yes [2]
    - compiler supports SSE2   : yes [3]
    - compiler supports SSE4.1 : yes [3]
    - has std::atomic_ref      : no [3]
    - has statx                : yes [3]
    - has init_priority attribute : yes [3]
    - has stat::st_blksize     : yes [3]
    - has stat::st_mtim        : yes [3]
    - has stat::st_mtimensec   : no [3]
    - has stat::st_mtimespec   : no [3]
    - has stat::st_birthtim    : no [3]
    - has stat::st_birthtimensec : no [3]
    - has stat::st_birthtimespec : no [3]
    - has fdopendir(O_NOFOLLOW) : yes [3]
    - has POSIX *at APIs       : yes [3]
    - zlib                     : yes (cached) [4]
    - bzip2                    : yes (cached) [4]
    - lzma                     : yes (cached) [4]
    - zstd                     : yes (cached) [4]
    - has_lzma_cputhreads builds : yes [3]
    - has_icu builds           : yes [3]
    - lockfree boost::atomic_flag : yes [3]

[1] gcc-11
[2] gcc-11/release/python-3.10/threadapi-pthread/threading-multi/visibility-hidden
[3] gcc-11/release/link-static/python-3.10/threadapi-pthread/threading-multi/visibility-hidden
[4] link-static

Component configuration:

    - atomic                   : building
    - chrono                   : building
    - container                : building
    - context                  : building
    - contract                 : not building
    - coroutine                : building
    - date_time                : building
    - exception                : not building
    - fiber                    : not building
    - filesystem               : building
    - graph                    : not building
    - graph_parallel           : not building
    - headers                  : not building
    - iostreams                : building
    - json                     : not building
    - locale                   : not building
    - log                      : not building
    - math                     : not building
    - mpi                      : not building
    - nowide                   : not building
    - program_options          : building
    - python                   : building
    - random                   : building
    - regex                    : building
    - serialization            : not building
    - stacktrace               : not building
    - system                   : building
    - test                     : not building
    - thread                   : building
    - timer                    : not building
    - type_erasure             : not building
    - url                      : not building
    - wave                     : not building

ninja: build stopped: subcommand failed

When I tried searching for the error on the documentation and stackoverflow.com, it suggested to limit the no. of cores to be utilized by ninja to less than the max no. So I tried the same with -j [4, 3, 2] to no avail.

I am currently trying to build ceph on a Windows machine with WSL2 installed. The machine has 8 GB and runs on Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz 1.80 GHz.

Would really appreciate some inputs regarding the same.

@yuvalif
Copy link
Author

yuvalif commented Mar 6, 2024

Hello there, this is Adarsh here. You mentioned downloading the awc cli tool as part of the steps to run bucket notifications tests for persistent notifications using a HTTP endpoint, but the closest I could find on Google is the aws-cli tool (https://github.com/aws/aws-cli). Could you please confirm if this what I'd have to download ?

yes. thanks for the comment, will clarify in the gist.

@yuvalif
Copy link
Author

yuvalif commented Mar 6, 2024

Hello again, I have been trying to build ceph as per the steps given above. When I try to run the unit tests using ninja, I get the following error where it terminates at building rocksdb_ext.

[2/1503] Performing build step for 'rocksdb_ext'
FAILED: src/rocksdb_ext-prefix/src/rocksdb_ext-stamp/rocksdb_ext-build src/rocksdb/librocksdb.a /home/adarsh9401/ceph-essentials/ceph/build/src/rocksdb_ext-prefix/src/rocksdb_ext-stamp/rocksdb_ext-build /home/adarsh9401/ceph-essentials/ceph/build/src/rocksdb/librocksdb.a
cd /home/adarsh9401/ceph-essentials/ceph/build/src/rocksdb && /usr/bin/cmake --build /home/adarsh9401/ceph-essentials/ceph/build/src/rocksdb --target rocksdb && /usr/bin/cmake -E touch /home/adarsh9401/ceph-essentials/ceph/build/src/rocksdb_ext-prefix/src/rocksdb_ext-stamp/rocksdb_ext-build
[1/259] Building CXX object CMakeFiles/rocksdb.dir/db/malloc_stats.cc.o
[2/259] Building CXX object CMakeFiles/rocksdb.dir/db/merge_operator.cc.o
[3/259] Building CXX object CMakeFiles/rocksdb.dir/db/output_validator.cc.o
[4/259] Building CXX object CMakeFiles/rocksdb.dir/db/periodic_task_scheduler.cc.o
[5/259] Building CXX object CMakeFiles/rocksdb.dir/db/log_writer.cc.o
[6/259] Building CXX object CMakeFiles/rocksdb.dir/db/merge_helper.cc.o
[7/259] Building CXX object CMakeFiles/rocksdb.dir/db/snapshot_impl.cc.o
[8/259] Building CXX object CMakeFiles/rocksdb.dir/db/range_tombstone_fragmenter.cc.o
[9/259] Building CXX object CMakeFiles/rocksdb.dir/db/range_del_aggregator.cc.o
[10/259] Building CXX object CMakeFiles/rocksdb.dir/db/memtable.cc.o
[11/259] Building CXX object CMakeFiles/rocksdb.dir/db/seqno_to_time_mapping.cc.o
[12/259] Building CXX object CMakeFiles/rocksdb.dir/db/table_properties_collector.cc.o
[13/259] Building CXX object CMakeFiles/rocksdb.dir/db/db_iter.cc.o
[14/259] Building CXX object CMakeFiles/rocksdb.dir/db/table_cache.cc.o
[15/259] Building CXX object CMakeFiles/rocksdb.dir/db/trim_history_scheduler.cc.o
[16/259] Building CXX object CMakeFiles/rocksdb.dir/db/transaction_log_impl.cc.o
[17/259] Building CXX object CMakeFiles/rocksdb.dir/db/repair.cc.o
[18/259] Building CXX object CMakeFiles/rocksdb.dir/db/wal_edit.cc.o
[19/259] Building CXX object CMakeFiles/rocksdb.dir/db/wide/wide_columns.cc.o
[20/259] Building CXX object CMakeFiles/rocksdb.dir/db/memtable_list.cc.o
[21/259] Building CXX object CMakeFiles/rocksdb.dir/db/version_edit.cc.o
[22/259] Building CXX object CMakeFiles/rocksdb.dir/db/write_batch_base.cc.o
[23/259] Building CXX object CMakeFiles/rocksdb.dir/db/wide/wide_column_serialization.cc.o
[24/259] Building CXX object CMakeFiles/rocksdb.dir/db/write_controller.cc.o
[25/259] Building CXX object CMakeFiles/rocksdb.dir/db/version_builder.cc.o
[26/259] Building CXX object CMakeFiles/rocksdb.dir/db/db_impl/db_impl.cc.o
FAILED: CMakeFiles/rocksdb.dir/db/db_impl/db_impl.cc.o
/usr/bin/g++-11 -DHAVE_PCLMUL -DHAVE_SSE42 -DLZ4 -DOS_LINUX -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_IOURING_PRESENT -DROCKSDB_LIB_IO_POSIX -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_NO_DYNAMIC_EXTENSION -DROCKSDB_PLATFORM_POSIX -DROCKSDB_PORTABLE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DSNAPPY -DZLIB -I/home/adarsh9401/ceph-essentials/ceph/src/rocksdb -I/home/adarsh9401/ceph-essentials/ceph/src/rocksdb/include -isystem /home/adarsh9401/ceph-essentials/ceph/src/rocksdb/third-party/gtest-1.8.1/fused-src -isystem /home/adarsh9401/ceph-essentials/ceph/build/src/liburing/src/include -Wno-deprecated-copy -Wno-pessimizing-move -W -Wextra -Wall -pthread -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-strict-aliasing -Wno-invalid-offsetof -fno-builtin-memcmp -g -DROCKSDB_USE_RTTI -fPIC -MD -MT CMakeFiles/rocksdb.dir/db/db_impl/db_impl.cc.o -MF CMakeFiles/rocksdb.dir/db/db_impl/db_impl.cc.o.d -o CMakeFiles/rocksdb.dir/db/db_impl/db_impl.cc.o -c /home/adarsh9401/ceph-essentials/ceph/src/rocksdb/db/db_impl/db_impl.cc
g++-11: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[27/259] Building CXX object CMakeFiles/rocksdb.dir/env/env_chroot.cc.o
[28/259] Building CXX object CMakeFiles/rocksdb.dir/env/composite_env.cc.o
[29/259] Building CXX object CMakeFiles/rocksdb.dir/db/write_thread.cc.o
[30/259] Building CXX object CMakeFiles/rocksdb.dir/db/wal_manager.cc.o
[31/259] Building CXX object CMakeFiles/rocksdb.dir/env/env_encryption.cc.o
[32/259] Building CXX object CMakeFiles/rocksdb.dir/env/env.cc.o
[33/259] Building CXX object CMakeFiles/rocksdb.dir/db/write_batch.cc.o
[34/259] Building CXX object CMakeFiles/rocksdb.dir/db/version_edit_handler.cc.o
[35/259] Building CXX object CMakeFiles/rocksdb.dir/db/version_set.cc.o
ninja: build stopped: subcommand failed.
[3/1503] Performing install step for 'Boost'
Performing configuration checks

    - default address-model    : 64-bit (cached) [1]
    - default architecture     : x86 (cached) [1]
    - compiler supports SSE2   : yes [2]
    - compiler supports SSE4.1 : yes [2]
    - has std::atomic_ref      : no [2]
    - has -Wl,--no-undefined   : yes [2]
    - has statx                : yes [2]
    - has init_priority attribute : yes [2]
    - has stat::st_blksize     : yes [2]
    - has stat::st_mtim        : yes [2]
    - has stat::st_mtimensec   : no [2]
    - has stat::st_mtimespec   : no [2]
    - has stat::st_birthtim    : no [2]
    - has stat::st_birthtimensec : no [2]
    - has stat::st_birthtimespec : no [2]
    - has fdopendir(O_NOFOLLOW) : yes [2]
    - has POSIX *at APIs       : yes [2]
    - zlib                     : yes
    - bzip2                    : yes
    - lzma                     : yes
    - zstd                     : yes
    - has_lzma_cputhreads builds : yes [2]
    - has_icu builds           : yes [2]
    - lockfree boost::atomic_flag : yes [2]
    - compiler supports SSE2   : yes [3]
    - compiler supports SSE4.1 : yes [3]
    - has std::atomic_ref      : no [3]
    - has statx                : yes [3]
    - has init_priority attribute : yes [3]
    - has stat::st_blksize     : yes [3]
    - has stat::st_mtim        : yes [3]
    - has stat::st_mtimensec   : no [3]
    - has stat::st_mtimespec   : no [3]
    - has stat::st_birthtim    : no [3]
    - has stat::st_birthtimensec : no [3]
    - has stat::st_birthtimespec : no [3]
    - has fdopendir(O_NOFOLLOW) : yes [3]
    - has POSIX *at APIs       : yes [3]
    - zlib                     : yes (cached) [4]
    - bzip2                    : yes (cached) [4]
    - lzma                     : yes (cached) [4]
    - zstd                     : yes (cached) [4]
    - has_lzma_cputhreads builds : yes [3]
    - has_icu builds           : yes [3]
    - lockfree boost::atomic_flag : yes [3]

[1] gcc-11
[2] gcc-11/release/python-3.10/threadapi-pthread/threading-multi/visibility-hidden
[3] gcc-11/release/link-static/python-3.10/threadapi-pthread/threading-multi/visibility-hidden
[4] link-static

Component configuration:

    - atomic                   : building
    - chrono                   : building
    - container                : building
    - context                  : building
    - contract                 : not building
    - coroutine                : building
    - date_time                : building
    - exception                : not building
    - fiber                    : not building
    - filesystem               : building
    - graph                    : not building
    - graph_parallel           : not building
    - headers                  : not building
    - iostreams                : building
    - json                     : not building
    - locale                   : not building
    - log                      : not building
    - math                     : not building
    - mpi                      : not building
    - nowide                   : not building
    - program_options          : building
    - python                   : building
    - random                   : building
    - regex                    : building
    - serialization            : not building
    - stacktrace               : not building
    - system                   : building
    - test                     : not building
    - thread                   : building
    - timer                    : not building
    - type_erasure             : not building
    - url                      : not building
    - wave                     : not building

ninja: build stopped: subcommand failed

When I tried searching for the error on the documentation and stackoverflow.com, it suggested to limit the no. of cores to be utilized by ninja to less than the max no. So I tried the same with -j [4, 3, 2] to no avail.

I am currently trying to build ceph on a Windows machine with WSL2 installed. The machine has 8 GB and runs on Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz 1.80 GHz.

Would really appreciate some inputs regarding the same.

could be that you ran out of memory. WSL would probably require a stronger machine. or use native linux

@9401adarsh
Copy link

Hello, thanks for your inputs. Some people on Slack gave me a few other alternatives to try the build. If it doesn't work, I will dual boot my system with Fedora and give it a go again.

From what I understood, the second task is independent of the first task. Could you please confirm ?

@yuvalif
Copy link
Author

yuvalif commented Mar 6, 2024

Hello, thanks for your inputs. Some people on Slack gave me a few other alternatives to try the build. If it doesn't work, I will dual boot my system with Fedora and give it a go again.

From what I understood, the second task is independent of the first task. Could you please confirm ?

yes, you can do the 2nd one without the first.
please note that in order to do the actual project you must eb able to build and run ceph.

@9401adarsh
Copy link

Yes, understood.

@dynamic-entropy
Copy link

dynamic-entropy commented Mar 6, 2024

Hello @yuvalif
I have a couple of possible corrections from my experience with the notification demo and some comments that could potentially be helpful for others.

Corrections

  • In the notification configuration command you provide above
$ aws --region=default --endpoint-url http://localhost:8000 s3api put-bucket-notification-configuration  --bucket fish \
  --notification-configuration='{"TopicConfigurations": [{"Id": "notif1", "TopicArn": "arn:aws:sns:default::fishtopic", "Events": []}]}'

The Events key points to an empty list; because of which, one won't see any notification sent to the server listening on 90100.
It seems like it should list event types define here.
So for this particular example s3:ObjectCreated:* should be enough.
Kindly correct me if that is not the case and an empty list has a different meaning.

For me using the above event type helped.

aws --region=default --endpoint-url http://localhost:8000 s3api put-bucket-notification-configuration  --bucket mybucket \
--notification-configuration='{"TopicConfigurations": [{"Id": "notif1", "TopicArn": "arn:aws:sns:default::mytopic", "Events": ["s3:ObjectCreated:*"]}]}'
  • Also maybe this point,

create a persistent notification pointing to the above HTTP endpoint:

should be changed to create a topic with a listener at above HTTP endpoint?

Comments for other people trying this too

  • The aws-cli needs to be configured as described here https://github.com/aws/aws-cli?tab=readme-ov-file#configuration before you can use it. The access_id and access_key will be displayed when the cluster starts.
    Now, the issue is it doesn't tell you a region to use (perhaps @yuvalif can say something) and the default is None.
  • Perhaps due to some misconfiguration on my end, the bucket creation does work without specifying the region.
aws --endpoint-url http://localhost:8000 s3 mb s3://fish
make_bucket failed: s3://fish An error occurred (InvalidLocationConstraint) when calling the CreateBucket operation: The specified location-constraint is not valid

You can add --region=default for this to work if that is the case for you too.

@yuvalif
Copy link
Author

yuvalif commented Mar 7, 2024

@dynamic-entropy thanks for the comments!
I will incoporate them in the gist.
just one note, keeping the event list empty should work in the case of ceph - it should imply all "create" and "delete" events.

@ancjainil
Copy link

@9401adarsh were you able to bootstrap it on Fedora ?

@9401adarsh
Copy link

9401adarsh commented Mar 10, 2024

Hello @yuvalif, I have completed the first task as per the steps given above. This was the final output the server.py file spit out, when I uploaded a file into the aws bucket. I have gone through videos on the Ceph YT channel to get a big picture understanding of how Ceph works. I'll be moving on to the second task soon, and go through the links shared above to understand the problem statement better.

P.S: Could you also confirm if this the expected result for the first task ?

Thanks again.

INFO:root:POST request,
Path: /
Headers:
Host: localhost:10900
Accept: */*
Content-Type: application/json
Content-Length: 815



Body:
{"Records":[{"eventVersion":"2.2","eventSource":"ceph:s3","awsRegion":"default","eventTime":"2024-03-10T18:06:20.868899Z","eventName":"ObjectCreated:Put","userIdentity":{"principalId":"testid"},"requestParameters":{"sourceIPAddress":""},"responseElements":{"x-amz-request-id":"9747ed93-82e7-44c1-ba6b-8717aabe1fdc.4143.2164335928963890032","x-amz-id-2":"4143-default-default"},"s3":{"s3SchemaVersion":"1.0","configurationId":"notif1","bucket":{"name":"fish","ownerIdentity":{"principalId":"testid"},"arn":"arn:aws:s3:default::fish","id":"9747ed93-82e7-44c1-ba6b-8717aabe1fdc.4143.1"},"object":{"key":"myfile","size":512,"eTag":"e62b64454e66c2e53484c85359b828ed","versionId":"","sequencer":"9CF6ED65B04D1335","metadata":[],"tags":[]}},"eventId":"1710093980.890457.e62b64454e66c2e53484c85359b828ed","opaqueData":""}]}

127.0.0.1 - - [10/Mar/2024 23:36:20] "POST / HTTP/1.1" 200 -

@9401adarsh
Copy link

@ancjainil I was able to bootstrap Ceph on Ubuntu 22.04 LTS. However, I did encounter some errors while doing the complete build, for completing the first task I just built vstart, and it worked fine. I don't have the error logs I encountered for the entire build currently, will run another build and share them here soon.

@ancjainil
Copy link

Hello @yuvalif
I found a demo Redis push script on the internet.

#include
#include <boost/asio.hpp>

using namespace std;
using namespace boost::asio;

int main() {
io_service io;
ip::tcp::socket socket(io);
ip::tcp::resolver resolver(io);

try {
    // Connect to Redis server
    ip::tcp::resolver::query query("localhost", "6379");
    auto endpoint_iterator = resolver.resolve(query);
    connect(socket, endpoint_iterator);

    // Send command to push data to Redis queue
    string data_to_push = "Hello, Redis!";
    string command = "LPUSH myqueue " + to_string(data_to_push.size()) + "\r\n" + data_to_push + "\r\n";
    write(socket, buffer(command));

    cout << "Data pushed to Redis queue successfully." << endl;
} catch (exception& e) {
    cerr << "Error: " << e.what() << endl;
}

return 0;

}

is this what I have to do further?

@ancjainil
Copy link

ancjainil commented Mar 11, 2024

  • he issue

Yes , the AWS configurations are needed before we use this.
To do these configurations, one can use the following commands

Configure AWS CLI with S3 User Info and set the default region

aws configure set aws_access_key_id " "
aws configure set aws_secret_access_key " "
aws configure set region default

(p.s : Please use your respective key_id and secret_access_key )
@yuvalif

@ancjainil
Copy link

@ancjainil I was able to bootstrap Ceph on Ubuntu 22.04 LTS. However, I did encounter some errors while doing the complete build, for completing the first task I just built vstart, and it worked fine. I don't have the error logs I encountered for the entire build currently, will run another build and share them here soon.

I tried it on Ubuntu and Fedora, and so far, Fedora is giving lightning-fast build results (with just deprecation warnings). Just in case you wanna give it a try.

@9401adarsh
Copy link

Sure thank you, I'll give it a go again.

@yuvalif
Copy link
Author

yuvalif commented Mar 11, 2024

Hello @yuvalif, I have completed the first task as per the steps given above. This was the final output the server.py file spit out, when I uploaded a file into the aws bucket. I have gone through videos on the Ceph YT channel to get a big picture understanding of how Ceph works. I'll be moving on to the second task soon, and go through the links shared above to understand the problem statement better.

P.S: Could you also confirm if this the expected result for the first task ?

Thanks again.

INFO:root:POST request,
Path: /
Headers:
Host: localhost:10900
Accept: */*
Content-Type: application/json
Content-Length: 815



Body:
{"Records":[{"eventVersion":"2.2","eventSource":"ceph:s3","awsRegion":"default","eventTime":"2024-03-10T18:06:20.868899Z","eventName":"ObjectCreated:Put","userIdentity":{"principalId":"testid"},"requestParameters":{"sourceIPAddress":""},"responseElements":{"x-amz-request-id":"9747ed93-82e7-44c1-ba6b-8717aabe1fdc.4143.2164335928963890032","x-amz-id-2":"4143-default-default"},"s3":{"s3SchemaVersion":"1.0","configurationId":"notif1","bucket":{"name":"fish","ownerIdentity":{"principalId":"testid"},"arn":"arn:aws:s3:default::fish","id":"9747ed93-82e7-44c1-ba6b-8717aabe1fdc.4143.1"},"object":{"key":"myfile","size":512,"eTag":"e62b64454e66c2e53484c85359b828ed","versionId":"","sequencer":"9CF6ED65B04D1335","metadata":[],"tags":[]}},"eventId":"1710093980.890457.e62b64454e66c2e53484c85359b828ed","opaqueData":""}]}

127.0.0.1 - - [10/Mar/2024 23:36:20] "POST / HTTP/1.1" 200 -

@9401adarsh, yes, this is great

@yuvalif
Copy link
Author

yuvalif commented Mar 11, 2024

ancjainil

@ancjainil, it would be great if you can prepare a small repo with the code fro the redis producer and consumer of the queue.
together with a readme that would allow me to build, run your code and test it.
as an optiona task, you can create a gtest based unit test that run it as well.

@ancjainil
Copy link

@yuvalif, here is the demo code repository for the Redis queue including a gtest that runs it as well. Let me know if you have any doubts and do let me know any next tasks.

Thanks

Repo link: https://github.com/ancjainil/Redis-producer-consumer/tree/master

@9401adarsh
Copy link

9401adarsh commented Mar 13, 2024

Hello @yuvalif, I am currently facing errors when I try to run an example file from the Boost.redis repository. I had to download Boost 1.84.0 from source and I built them under the home directory, as Boost.redis is automatically present in Boost 1.84.0.

Build Output:

The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /home/adarsh9401/boost_1_84_0

The following directory should be added to linker library paths:

    /home/adarsh9401/boost_1_84_0/stage/lib

Now, in order to test if my source installation was valid I ran the following boost-version.cpp file to test if the installation was successful.

#include <boost/version.hpp>
#include <iostream>
#include <iomanip>

int main()
{
    std::cout << "Boost version: " 
          << BOOST_VERSION / 100000
          << "."
          << BOOST_VERSION / 100 % 1000
          << "."
          << BOOST_VERSION % 100 
          << std::endl;
    return 0;
}

I compiled this file as follows:

g++  boost-version.cpp -o boost-version.exe -I /home/adarsh9401/boost_1_84_0

This file successfully compiled, and gave the following output.

Boost version: 1.84.0

Now, when I compiled this example file (https://github.com/boostorg/redis/blob/develop/example/cpp17_intro.cpp) from the Boost Redis repository using the following command - (I have named the file as boost-redis-test.cpp on my local)

g++ boost-redis-test.cpp -o boost-redis.exe -I /home/adarsh9401/boost_1_84_0

I get the following errors:

/usr/bin/ld: /tmp/cc4ct3eW.o: in function `main':
boost-redis-test.cpp:(.text+0x377): undefined reference to `boost::redis::connection::connection(boost::asio::io_context&, boost::asio::ssl::context_base::method, unsigned long)'
/usr/bin/ld: /tmp/cc4ct3eW.o: in function `auto main::{lambda(auto:1, auto:2)#1}::operator()<boost::system::error_code, unsigned long>(boost::system::error_code, unsigned long) const':
boost-redis-test.cpp:(.text+0x1094): undefined reference to `boost::redis::connection::cancel(boost::redis::operation)'
/usr/bin/ld: /tmp/cc4ct3eW.o: in function `boost::redis::request::check_cmd(std::basic_string_view<char, std::char_traits<char> >)':
boost-redis-test.cpp:(.text._ZN5boost5redis7request9check_cmdESt17basic_string_viewIcSt11char_traitsIcEE[_ZN5boost5redis7request9check_cmdESt17basic_string_viewIcSt11char_traitsIcEE]+0x43): undefined reference to `boost::redis::detail::has_response(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: /tmp/cc4ct3eW.o: in function `boost::asio::error::detail::ssl_category::message[abi:cxx11](int) const':
boost-redis-test.cpp:(.text._ZNK5boost4asio5error6detail12ssl_category7messageB5cxx11Ei[_ZNK5boost4asio5error6detail12ssl_category7messageB5cxx11Ei]+0x1d): undefined reference to `ERR_reason_error_string'
/usr/bin/ld: boost-redis-test.cpp:(.text._ZNK5boost4asio5error6detail12ssl_category7messageB5cxx11Ei[_ZNK5boost4asio5error6detail12ssl_category7messageB5cxx11Ei]+0x39): undefined reference to `ERR_lib_error_string'
/usr/bin/ld: /tmp/cc4ct3eW.o: in function `boost::asio::ssl::context::~context()':
boost-redis-test.cpp:(.text._ZN5boost4asio3ssl7contextD2Ev[_ZN5boost4asio3ssl7contextD5Ev]+0x27): undefined reference to `SSL_CTX_get_default_passwd_cb_userdata'
/usr/bin/ld: boost-redis-test.cpp:(.text._ZN5boost4asio3ssl7contextD2Ev[_ZN5boost4asio3ssl7contextD5Ev]+0x66): undefined reference to `SSL_CTX_set_default_passwd_cb_userdata'
/usr/bin/ld: boost-redis-test.cpp:(.text._ZN5boost4asio3ssl7contextD2Ev[_ZN5boost4asio3ssl7contextD5Ev]+0x7a): undefined reference to `SSL_CTX_get_ex_data'
/usr/bin/ld: boost-redis-test.cpp:(.text._ZN5boost4asio3ssl7contextD2Ev[_ZN5boost4asio3ssl7contextD5Ev]+0x98): undefined reference to `SSL_CTX_get_ex_data'
/usr/bin/ld: boost-redis-test.cpp:(.text._ZN5boost4asio3ssl7contextD2Ev[_ZN5boost4asio3ssl7contextD5Ev]+0xcd): undefined reference to `SSL_CTX_set_ex_data'
/usr/bin/ld: boost-redis-test.cpp:(.text._ZN5boost4asio3ssl7contextD2Ev[_ZN5boost4asio3ssl7contextD5Ev]+0xdc): undefined reference to `SSL_CTX_free'
/usr/bin/ld: /tmp/cc4ct3eW.o: in function `boost::asio::ssl::detail::engine::~engine()':
boost-redis-test.cpp:(.text._ZN5boost4asio3ssl6detail6engineD2Ev[_ZN5boost4asio3ssl6detail6engineD5Ev]+0x28): undefined reference to `SSL_get_ex_data'
/usr/bin/ld: boost-redis-test.cpp:(.text._ZN5boost4asio3ssl6detail6engineD2Ev[_ZN5boost4asio3ssl6detail6engineD5Ev]+0x51): undefined reference to `SSL_get_ex_data'
/usr/bin/ld: boost-redis-test.cpp:(.text._ZN5boost4asio3ssl6detail6engineD2Ev[_ZN5boost4asio3ssl6detail6engineD5Ev]+0x7e): undefined reference to `SSL_set_ex_data'
/usr/bin/ld: boost-redis-test.cpp:(.text._ZN5boost4asio3ssl6detail6engineD2Ev[_ZN5boost4asio3ssl6detail6engineD5Ev]+0x9b): undefined reference to `BIO_free'
/usr/bin/ld: boost-redis-test.cpp:(.text._ZN5boost4asio3ssl6detail6engineD2Ev[_ZN5boost4asio3ssl6detail6engineD5Ev]+0xb6): undefined reference to `SSL_free'
/usr/bin/ld: /tmp/cc4ct3eW.o: in function `boost::system::error_code::error_code<boost::redis::error>(boost::redis::error, boost::system::detail::enable_if<boost::system::is_error_code_enum<boost::redis::error>::value||std::is_error_code_enum<boost::redis::error>::value, void>::type*)':
boost-redis-test.cpp:(.text._ZN5boost6system10error_codeC2INS_5redis5errorEEET_PNS0_6detail9enable_ifIXoosrNS0_18is_error_code_enumIS5_EE5valuesrSt18is_error_code_enumIS5_E5valueEvE4typeE[_ZN5boost6system10error_codeC5INS_5redis5errorEEET_PNS0_6detail9enable_ifIXoosrNS0_18is_error_code_enumIS5_EE5valuesrSt18is_error_code_enumIS5_E5valueEvE4typeE]+0x47): undefined reference to `boost::redis::make_error_code(boost::redis::error)'
/usr/bin/ld: /tmp/cc4ct3eW.o: in function `void boost::redis::request::push<char [12]>(std::basic_string_view<char, std::char_traits<char> >, char const (&) [12])':
boost-redis-test.cpp:(.text._ZN5boost5redis7request4pushIJA12_cEEEvSt17basic_string_viewIcSt11char_traitsIcEEDpRKT_[_ZN5boost5redis7request4pushIJA12_cEEEvSt17basic_string_viewIcSt11char_traitsIcEEDpRKT_]+0x3f): undefined reference to `boost::redis::resp3::add_header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, boost::redis::resp3::type, unsigned long)'
/usr/bin/ld: /tmp/cc4ct3eW.o: in function `auto boost::redis::connection::async_run<boost::asio::detached_t>(boost::redis::config const&, boost::redis::logger, boost::asio::detached_t)::{lambda(auto:1, boost::redis::connection*, boost::redis::config const*, boost::redis::logger)#1}::operator()<boost::asio::detail::detached_handler>(boost::asio::detail::detached_handler, boost::redis::connection*, boost::redis::config const*, boost::redis::logger) const':
boost-redis-test.cpp:(.text._ZZN5boost5redis10connection9async_runINS_4asio10detached_tEEEDaRKNS0_6configENS0_6loggerET_ENKUlS9_PS1_PS6_S8_E_clINS3_6detail16detached_handlerEEEDaS9_SA_SB_S8_[_ZZN5boost5redis10connection9async_runINS_4asio10detached_tEEEDaRKNS0_6configENS0_6loggerET_ENKUlS9_PS1_PS6_S8_E_clINS3_6detail16detached_handlerEEEDaS9_SA_SB_S8_]+0x6d): undefined reference to `boost::redis::connection::async_run_impl(boost::redis::config const&, boost::redis::logger, boost::asio::any_completion_handler<void (boost::system::error_code)>)'
/usr/bin/ld: /tmp/cc4ct3eW.o: in function `boost::redis::resp3::add_bulk_impl<std::basic_string_view<char, std::char_traits<char> > >::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string_view<char, std::char_traits<char> > const&)':
boost-redis-test.cpp:(.text._ZN5boost5redis5resp313add_bulk_implISt17basic_string_viewIcSt11char_traitsIcEEE3addERNSt7__cxx1112basic_stringIcS5_SaIcEEERKS6_[_ZN5boost5redis5resp313add_bulk_implISt17basic_string_viewIcSt11char_traitsIcEEE3addERNSt7__cxx1112basic_stringIcS5_SaIcEEERKS6_]+0x26): undefined reference to `boost::redis::resp3::boost_redis_to_bulk(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: /tmp/cc4ct3eW.o: in function `auto boost::redis::resp3::add_bulk_impl<std::tuple<char const (&) [12]> >::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::tuple<char const (&) [12]> const&)::{lambda((auto:1 const&)...)#1}::operator()<char [12]>(char const (&) [12]) const':
boost-redis-test.cpp:(.text._ZZN5boost5redis5resp313add_bulk_implISt5tupleIJRA12_KcEEE3addERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_ENKUlDpRKT_E_clIJA12_cEEEDaSL_[_ZZN5boost5redis5resp313add_bulk_implISt5tupleIJRA12_KcEEE3addERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_ENKUlDpRKT_E_clIJA12_cEEEDaSL_]+0x39): undefined reference to `boost::redis::resp3::boost_redis_to_bulk(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string_view<char, std::char_traits<char> >)'
collect2: error: ld returned 1 exit status

After going through stackoverflow, I compiled with the following, which did reduce the errors:

 g++ boost-redis-test.cpp -o boost-redis.exe -I /home/adarsh9401/boost_1_84_0 -lboost_system -lboost_thread -lpthread -lssl -lcrypto

On Compilation:


/usr/bin/ld: /tmp/cccwGPW7.o: in function `main':
boost-redis-test.cpp:(.text+0x377): undefined reference to `boost::redis::connection::connection(boost::asio::io_context&, boost::asio::ssl::context_base::method, unsigned long)'
/usr/bin/ld: /tmp/cccwGPW7.o: in function `auto main::{lambda(auto:1, auto:2)#1}::operator()<boost::system::error_code, unsigned long>(boost::system::error_code, unsigned long) const':
boost-redis-test.cpp:(.text+0x1094): undefined reference to `boost::redis::connection::cancel(boost::redis::operation)'
/usr/bin/ld: /tmp/cccwGPW7.o: in function `boost::redis::request::check_cmd(std::basic_string_view<char, std::char_traits<char> >)':
boost-redis-test.cpp:(.text._ZN5boost5redis7request9check_cmdESt17basic_string_viewIcSt11char_traitsIcEE[_ZN5boost5redis7request9check_cmdESt17basic_string_viewIcSt11char_traitsIcEE]+0x43): undefined reference to `boost::redis::detail::has_response(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: /tmp/cccwGPW7.o: in function `boost::system::error_code::error_code<boost::redis::error>(boost::redis::error, boost::system::detail::enable_if<boost::system::is_error_code_enum<boost::redis::error>::value||std::is_error_code_enum<boost::redis::error>::value, void>::type*)':
boost-redis-test.cpp:(.text._ZN5boost6system10error_codeC2INS_5redis5errorEEET_PNS0_6detail9enable_ifIXoosrNS0_18is_error_code_enumIS5_EE5valuesrSt18is_error_code_enumIS5_E5valueEvE4typeE[_ZN5boost6system10error_codeC5INS_5redis5errorEEET_PNS0_6detail9enable_ifIXoosrNS0_18is_error_code_enumIS5_EE5valuesrSt18is_error_code_enumIS5_E5valueEvE4typeE]+0x47): undefined reference to `boost::redis::make_error_code(boost::redis::error)'
/usr/bin/ld: /tmp/cccwGPW7.o: in function `void boost::redis::request::push<char [12]>(std::basic_string_view<char, std::char_traits<char> >, char const (&) [12])':
boost-redis-test.cpp:(.text._ZN5boost5redis7request4pushIJA12_cEEEvSt17basic_string_viewIcSt11char_traitsIcEEDpRKT_[_ZN5boost5redis7request4pushIJA12_cEEEvSt17basic_string_viewIcSt11char_traitsIcEEDpRKT_]+0x3f): undefined reference to `boost::redis::resp3::add_header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, boost::redis::resp3::type, unsigned long)'
/usr/bin/ld: /tmp/cccwGPW7.o: in function `auto boost::redis::connection::async_run<boost::asio::detached_t>(boost::redis::config const&, boost::redis::logger, boost::asio::detached_t)::{lambda(auto:1, boost::redis::connection*, boost::redis::config const*, boost::redis::logger)#1}::operator()<boost::asio::detail::detached_handler>(boost::asio::detail::detached_handler, boost::redis::connection*, boost::redis::config const*, boost::redis::logger) const':
boost-redis-test.cpp:(.text._ZZN5boost5redis10connection9async_runINS_4asio10detached_tEEEDaRKNS0_6configENS0_6loggerET_ENKUlS9_PS1_PS6_S8_E_clINS3_6detail16detached_handlerEEEDaS9_SA_SB_S8_[_ZZN5boost5redis10connection9async_runINS_4asio10detached_tEEEDaRKNS0_6configENS0_6loggerET_ENKUlS9_PS1_PS6_S8_E_clINS3_6detail16detached_handlerEEEDaS9_SA_SB_S8_]+0x6d): undefined reference to `boost::redis::connection::async_run_impl(boost::redis::config const&, boost::redis::logger, boost::asio::any_completion_handler<void (boost::system::error_code)>)'
/usr/bin/ld: /tmp/cccwGPW7.o: in function `boost::redis::resp3::add_bulk_impl<std::basic_string_view<char, std::char_traits<char> > >::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string_view<char, std::char_traits<char> > const&)':
boost-redis-test.cpp:(.text._ZN5boost5redis5resp313add_bulk_implISt17basic_string_viewIcSt11char_traitsIcEEE3addERNSt7__cxx1112basic_stringIcS5_SaIcEEERKS6_[_ZN5boost5redis5resp313add_bulk_implISt17basic_string_viewIcSt11char_traitsIcEEE3addERNSt7__cxx1112basic_stringIcS5_SaIcEEERKS6_]+0x26): undefined reference to `boost::redis::resp3::boost_redis_to_bulk(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: /tmp/cccwGPW7.o: in function `auto boost::redis::resp3::add_bulk_impl<std::tuple<char const (&) [12]> >::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::tuple<char const (&) [12]> const&)::{lambda((auto:1 const&)...)#1}::operator()<char [12]>(char const (&) [12]) const':
boost-redis-test.cpp:(.text._ZZN5boost5redis5resp313add_bulk_implISt5tupleIJRA12_KcEEE3addERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_ENKUlDpRKT_E_clIJA12_cEEEDaSL_[_ZZN5boost5redis5resp313add_bulk_implISt5tupleIJRA12_KcEEE3addERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_ENKUlDpRKT_E_clIJA12_cEEEDaSL_]+0x39): undefined reference to `boost::redis::resp3::boost_redis_to_bulk(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string_view<char, std::char_traits<char> >)'
collect2: error: ld returned 1 exit status

Could you suggest on how to proceed ?

@dynamic-entropy
Copy link

The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

/home/adarsh9401/boost_1_84_0

The following directory should be added to linker library paths:

/home/adarsh9401/boost_1_84_0/stage/lib

Hi Adarsh
I believe you also need to add /home/adarsh9401/boost_1_84_0/stage/lib to your linkers search path.
This would be done with the -L flag (similar to -I for adding files to your compiler's search path).

You can also try removing the -lboost_system and other additional flags which uses the systems boost library as opposed to the one you installed. (Note the l in the -lboost_system).

Cheers

@9401adarsh
Copy link

@dynamic-entropy , thanks for the reply!

I tried compiling the file using the following command:

g++ boost-redis-test.cpp -o boost-redis-test.exe -I /home/adarsh9401/boost_1_84_0 -L /home/adarsh9401/boost_1_84_0/stage/lib -l ssl -l pthread -l crypto

I got the following error, the same as before.

/usr/bin/ld: /tmp/ccXgT0a9.o: in function `main':
boost-redis-test.cpp:(.text+0x377): undefined reference to `boost::redis::connection::connection(boost::asio::io_context&, boost::asio::ssl::context_base::method, unsigned long)'
/usr/bin/ld: /tmp/ccXgT0a9.o: in function `auto main::{lambda(auto:1, auto:2)#1}::operator()<boost::system::error_code, unsigned long>(boost::system::error_code, unsigned long) const':
boost-redis-test.cpp:(.text+0x1094): undefined reference to `boost::redis::connection::cancel(boost::redis::operation)'
/usr/bin/ld: /tmp/ccXgT0a9.o: in function `boost::redis::request::check_cmd(std::basic_string_view<char, std::char_traits<char> >)':
boost-redis-test.cpp:(.text._ZN5boost5redis7request9check_cmdESt17basic_string_viewIcSt11char_traitsIcEE[_ZN5boost5redis7request9check_cmdESt17basic_string_viewIcSt11char_traitsIcEE]+0x43): undefined reference to `boost::redis::detail::has_response(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: /tmp/ccXgT0a9.o: in function `boost::system::error_code::error_code<boost::redis::error>(boost::redis::error, boost::system::detail::enable_if<boost::system::is_error_code_enum<boost::redis::error>::value||std::is_error_code_enum<boost::redis::error>::value, void>::type*)':
boost-redis-test.cpp:(.text._ZN5boost6system10error_codeC2INS_5redis5errorEEET_PNS0_6detail9enable_ifIXoosrNS0_18is_error_code_enumIS5_EE5valuesrSt18is_error_code_enumIS5_E5valueEvE4typeE[_ZN5boost6system10error_codeC5INS_5redis5errorEEET_PNS0_6detail9enable_ifIXoosrNS0_18is_error_code_enumIS5_EE5valuesrSt18is_error_code_enumIS5_E5valueEvE4typeE]+0x47): undefined reference to `boost::redis::make_error_code(boost::redis::error)'
/usr/bin/ld: /tmp/ccXgT0a9.o: in function `void boost::redis::request::push<char [12]>(std::basic_string_view<char, std::char_traits<char> >, char const (&) [12])':
boost-redis-test.cpp:(.text._ZN5boost5redis7request4pushIJA12_cEEEvSt17basic_string_viewIcSt11char_traitsIcEEDpRKT_[_ZN5boost5redis7request4pushIJA12_cEEEvSt17basic_string_viewIcSt11char_traitsIcEEDpRKT_]+0x3f): undefined reference to `boost::redis::resp3::add_header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, boost::redis::resp3::type, unsigned long)'
/usr/bin/ld: /tmp/ccXgT0a9.o: in function `auto boost::redis::connection::async_run<boost::asio::detached_t>(boost::redis::config const&, boost::redis::logger, boost::asio::detached_t)::{lambda(auto:1, boost::redis::connection*, boost::redis::config const*, boost::redis::logger)#1}::operator()<boost::asio::detail::detached_handler>(boost::asio::detail::detached_handler, boost::redis::connection*, boost::redis::config const*, boost::redis::logger) const':
boost-redis-test.cpp:(.text._ZZN5boost5redis10connection9async_runINS_4asio10detached_tEEEDaRKNS0_6configENS0_6loggerET_ENKUlS9_PS1_PS6_S8_E_clINS3_6detail16detached_handlerEEEDaS9_SA_SB_S8_[_ZZN5boost5redis10connection9async_runINS_4asio10detached_tEEEDaRKNS0_6configENS0_6loggerET_ENKUlS9_PS1_PS6_S8_E_clINS3_6detail16detached_handlerEEEDaS9_SA_SB_S8_]+0x6d): undefined reference to `boost::redis::connection::async_run_impl(boost::redis::config const&, boost::redis::logger, boost::asio::any_completion_handler<void (boost::system::error_code)>)'
/usr/bin/ld: /tmp/ccXgT0a9.o: in function `boost::redis::resp3::add_bulk_impl<std::basic_string_view<char, std::char_traits<char> > >::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string_view<char, std::char_traits<char> > const&)':
boost-redis-test.cpp:(.text._ZN5boost5redis5resp313add_bulk_implISt17basic_string_viewIcSt11char_traitsIcEEE3addERNSt7__cxx1112basic_stringIcS5_SaIcEEERKS6_[_ZN5boost5redis5resp313add_bulk_implISt17basic_string_viewIcSt11char_traitsIcEEE3addERNSt7__cxx1112basic_stringIcS5_SaIcEEERKS6_]+0x26): undefined reference to `boost::redis::resp3::boost_redis_to_bulk(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: /tmp/ccXgT0a9.o: in function `auto boost::redis::resp3::add_bulk_impl<std::tuple<char const (&) [12]> >::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::tuple<char const (&) [12]> const&)::{lambda((auto:1 const&)...)#1}::operator()<char [12]>(char const (&) [12]) const':
boost-redis-test.cpp:(.text._ZZN5boost5redis5resp313add_bulk_implISt5tupleIJRA12_KcEEE3addERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_ENKUlDpRKT_E_clIJA12_cEEEDaSL_[_ZZN5boost5redis5resp313add_bulk_implISt5tupleIJRA12_KcEEE3addERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_ENKUlDpRKT_E_clIJA12_cEEEDaSL_]+0x39): undefined reference to `boost::redis::resp3::boost_redis_to_bulk(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string_view<char, std::char_traits<char> >)'
collect2: error: ld returned 1 exit status

@dynamic-entropy
Copy link

Apologies, I did not intend to say that you add a space after -l.
I wanted to point to the fact that those flags are asking the linker to link those libraries. You may remove the space.

The -L would tell your linker the path to search in. But it won't link those libraries.
You will also need to explicitly add -lboost_redis. (And possibly others, for e.g. boost_asio too).

Try doing a ls in /home/adarsh9401/boost_1_84_0/stage/lib.
You will see the file names to use.
Hope this helps.

Cheers

@9401adarsh
Copy link

9401adarsh commented Mar 13, 2024

@dynamic-entropy as suggested, I ran the following commands

adarsh9401@fedora:~/Desktop/Dev/scripts/cpp1$ ls -a /home/adarsh9401/boost_1_84_0/stage/lib | grep redis
adarsh9401@fedora:~/Desktop/Dev/scripts/cpp1$ ls -a /home/adarsh9401/boost_1_84_0/stage/lib | grep asio

For which there were no outputs, which makes sense atleast in the case of Boost.asio, which is a header-only library.

The same error persists, even while ignoring the space for -l and keeping -L flag as per your recommendation.

adarsh9401@fedora:~/Desktop/Dev/scripts/cpp1$ g++ boost-redis-test.cpp -o boost-redis-test.exe -I/home/adarsh9401/boost_1_84_0 -L/home/adarsh9401/boost_1_84_0/stage/lib -lpthread -lssl -lcrypto -lboost_system -lboost_thread

Error log:

/usr/bin/ld: /tmp/ccmIdN9x.o: in function `main':
boost-redis-test.cpp:(.text+0x377): undefined reference to `boost::redis::connection::connection(boost::asio::io_context&, boost::asio::ssl::context_base::method, unsigned long)'
/usr/bin/ld: /tmp/ccmIdN9x.o: in function `auto main::{lambda(auto:1, auto:2)#1}::operator()<boost::system::error_code, unsigned long>(boost::system::error_code, unsigned long) const':
boost-redis-test.cpp:(.text+0x1094): undefined reference to `boost::redis::connection::cancel(boost::redis::operation)'
/usr/bin/ld: /tmp/ccmIdN9x.o: in function `boost::redis::request::check_cmd(std::basic_string_view<char, std::char_traits<char> >)':
boost-redis-test.cpp:(.text._ZN5boost5redis7request9check_cmdESt17basic_string_viewIcSt11char_traitsIcEE[_ZN5boost5redis7request9check_cmdESt17basic_string_viewIcSt11char_traitsIcEE]+0x43): undefined reference to `boost::redis::detail::has_response(std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: /tmp/ccmIdN9x.o: in function `boost::system::error_code::error_code<boost::redis::error>(boost::redis::error, boost::system::detail::enable_if<boost::system::is_error_code_enum<boost::redis::error>::value||std::is_error_code_enum<boost::redis::error>::value, void>::type*)':
boost-redis-test.cpp:(.text._ZN5boost6system10error_codeC2INS_5redis5errorEEET_PNS0_6detail9enable_ifIXoosrNS0_18is_error_code_enumIS5_EE5valuesrSt18is_error_code_enumIS5_E5valueEvE4typeE[_ZN5boost6system10error_codeC5INS_5redis5errorEEET_PNS0_6detail9enable_ifIXoosrNS0_18is_error_code_enumIS5_EE5valuesrSt18is_error_code_enumIS5_E5valueEvE4typeE]+0x47): undefined reference to `boost::redis::make_error_code(boost::redis::error)'
/usr/bin/ld: /tmp/ccmIdN9x.o: in function `void boost::redis::request::push<char [12]>(std::basic_string_view<char, std::char_traits<char> >, char const (&) [12])':
boost-redis-test.cpp:(.text._ZN5boost5redis7request4pushIJA12_cEEEvSt17basic_string_viewIcSt11char_traitsIcEEDpRKT_[_ZN5boost5redis7request4pushIJA12_cEEEvSt17basic_string_viewIcSt11char_traitsIcEEDpRKT_]+0x3f): undefined reference to `boost::redis::resp3::add_header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, boost::redis::resp3::type, unsigned long)'
/usr/bin/ld: /tmp/ccmIdN9x.o: in function `auto boost::redis::connection::async_run<boost::asio::detached_t>(boost::redis::config const&, boost::redis::logger, boost::asio::detached_t)::{lambda(auto:1, boost::redis::connection*, boost::redis::config const*, boost::redis::logger)#1}::operator()<boost::asio::detail::detached_handler>(boost::asio::detail::detached_handler, boost::redis::connection*, boost::redis::config const*, boost::redis::logger) const':
boost-redis-test.cpp:(.text._ZZN5boost5redis10connection9async_runINS_4asio10detached_tEEEDaRKNS0_6configENS0_6loggerET_ENKUlS9_PS1_PS6_S8_E_clINS3_6detail16detached_handlerEEEDaS9_SA_SB_S8_[_ZZN5boost5redis10connection9async_runINS_4asio10detached_tEEEDaRKNS0_6configENS0_6loggerET_ENKUlS9_PS1_PS6_S8_E_clINS3_6detail16detached_handlerEEEDaS9_SA_SB_S8_]+0x6d): undefined reference to `boost::redis::connection::async_run_impl(boost::redis::config const&, boost::redis::logger, boost::asio::any_completion_handler<void (boost::system::error_code)>)'
/usr/bin/ld: /tmp/ccmIdN9x.o: in function `boost::redis::resp3::add_bulk_impl<std::basic_string_view<char, std::char_traits<char> > >::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string_view<char, std::char_traits<char> > const&)':
boost-redis-test.cpp:(.text._ZN5boost5redis5resp313add_bulk_implISt17basic_string_viewIcSt11char_traitsIcEEE3addERNSt7__cxx1112basic_stringIcS5_SaIcEEERKS6_[_ZN5boost5redis5resp313add_bulk_implISt17basic_string_viewIcSt11char_traitsIcEEE3addERNSt7__cxx1112basic_stringIcS5_SaIcEEERKS6_]+0x26): undefined reference to `boost::redis::resp3::boost_redis_to_bulk(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string_view<char, std::char_traits<char> >)'
/usr/bin/ld: /tmp/ccmIdN9x.o: in function `auto boost::redis::resp3::add_bulk_impl<std::tuple<char const (&) [12]> >::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::tuple<char const (&) [12]> const&)::{lambda((auto:1 const&)...)#1}::operator()<char [12]>(char const (&) [12]) const':
boost-redis-test.cpp:(.text._ZZN5boost5redis5resp313add_bulk_implISt5tupleIJRA12_KcEEE3addERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_ENKUlDpRKT_E_clIJA12_cEEEDaSL_[_ZZN5boost5redis5resp313add_bulk_implISt5tupleIJRA12_KcEEE3addERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_ENKUlDpRKT_E_clIJA12_cEEEDaSL_]+0x39): undefined reference to `boost::redis::resp3::boost_redis_to_bulk(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string_view<char, std::char_traits<char> >)'
collect2: error: ld returned 1 exit status

@dynamic-entropy
Copy link

The "space" wasn't the actual recommendation to solve the issue (it was a comment about with and without space being the same thing).

What's confusing is that ls -a /home/adarsh9401/boost_1_84_0/stage/lib should not have returned nothing, but instead, library files to link.

@9401adarsh
Copy link

9401adarsh commented Mar 14, 2024

Ah my apologies, for misunderstanding about the "space",

From what I have understood, the only libraries which have to be linked are those that are earmarked by Boost to be built separately and only those object files are present in the /path/to/boost/stage/lib folder.

I have also raised an issue on the Boost.redis repository, to get some help. Will keep you posted in case of any movement.

@9401adarsh
Copy link

9401adarsh commented Mar 14, 2024

@yuvalif @dynamic-entropy
I have found the fix. I forgot to add the #include <boost/redis/src.hpp> as mentioned in the docs. I forgot I was trying to compile a single file, and hence the header wasn't included.

The file successfully compiles with the following:

g++ boost-redis-test.cpp -o boost-redis.exe -I /home/adarsh9401/boost_1_84_0 -lpthread -lcrypto -lssl

@dynamic-entropy
Copy link

Great!! Glad that you found it.

@9401adarsh
Copy link

@yuvalif I have completed the mandatory deliverables for the second tasks. The files can be found here on this repo: https://github.com/9401adarsh/ceph-redis-push-popper/.

I'll be moving on to the optional task now. Could you suggest what to do next after the second task is done ?

@Neelaksh-Singh
Copy link

@yuvalif I have shared my draft proposal with you. Could u suggest any changes to it (if necessary).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment