Skip to content

Instantly share code, notes, and snippets.

View cbodley's full-sized avatar

Casey Bodley cbodley

  • Red Hat
  • Ann Arbor, MI
View GitHub Profile
@cbodley
cbodley / gist:95cf7d809f22985f0fe91f2a90e18341
Created January 28, 2019 20:22
repair_olh() with rgw_override_bucket_index_max_shards=4
2019-01-28 15:15:30.725 7f2e7422f700 1 -- v2:10.17.151.111:0/3494253670 --> [v2:10.17.151.111:6808/32473,v1:10.17.151.111:6809/32473] -- osd_op(unknown.0.0:183 5.4 5:37a55eaa:::.dir.cc0a453e-e99d-41d2-8231-8dc498033b02.4146.1.1:head [call rgw.guard_bucket_resharding,call rgw.bucket_link_olh] snapc 0=[] ondisk+write+known_if_redirected e19) v8 -- 0x56156cb8c000 con 0x56156c330880
2019-01-28 15:15:30.728 7f2e89c6c700 1 -- v2:10.17.151.111:0/3494253670 <== osd.0 v2:10.17.151.111:6808/32473 183 ==== osd_op_reply(183 .dir.cc0a453e-e99d-41d2-8231-8dc498033b02.4146.1.1 [call,call] v19'15 uv14 ondisk = -125 ((125) Operation canceled)) v8 ==== 236+0+0 (4034947892 0 0) 0x56156cb8c000 con 0x56156c330880
2019-01-28 15:15:30.728 7f2e7422f700 20 cls_rgw_bucket_link_olh() returned r=-125
2019-01-28 15:15:30.728 7f2e7422f700 20 bucket_index_link_olh() target_obj=uxpygt-1:obj delete_marker=0 returned -125
2019
@cbodley
cbodley / rgw_rados.cc
Last active September 22, 2018 03:08
RGWRados factory with dependency injection
RGWRados *RGWStoreManager::init_storage_provider(CephContext *cct, bool use_cache)
{
// service factory functions return unique_ptr and take dependencies as raw pointers,
// or as unique_ptr&& to transfer ownership. errors are thrown as std::system_errors
try {
auto rados = create_rados(cct);
auto core = create_sysobj_core(cct, rados.get());
auto sysobj = create_sysobj(cct, rados.get(), core.get());
auto sync = create_sync_modules(cct);
#!/usr/bin/python
# create a bucket and enable versioning
import boto3
import sys
# bucket name as first argument
bucketname = sys.argv[1]
#!/usr/bin/python
import argparse
import socket
parser = argparse.ArgumentParser()
parser.add_argument('hostname', help='Hostname of the http server')
parser.add_argument('port', type=int, help='Port number of the http server')
args = parser.parse_args()
$ g++ main.cc -std=c++17 -lboost_system -lpthread -lboost_context -lboost_coroutine -lboost_thread -lboost_chrono
In file included from /home/cbodley/scratch/boost/libs/asio/include/boost/asio/spawn.hpp:336:0,
from main.cc:5:
/home/cbodley/scratch/boost/libs/asio/include/boost/asio/impl/spawn.hpp: In instantiation of ‘boost::asio::async_result<boost::asio::basic_yield_context<Handler>, ReturnType(boost::system::error_code, Arg2)>::async_result(typename boost::asio::detail::coro_async_result<Handler, typename std::decay<WriteHandler>::type>::completion_handler_type&) [with Handler = boost::asio::executor_binder<void (*)(), boost::asio::executor>; ReturnType = void; Arg2 = std::unique_ptr<int>&&; typename boost::asio::detail::coro_async_result<Handler, typename std::decay<WriteHandler>::type>::completion_handler_type = boost::asio::detail::coro_handler<boost::asio::executor_binder<void (*)(), boost::asio::executor>, std::unique_ptr<int> >]’:
/home/cbodley/scratch/boost/libs/asio/include/boost/a
#include <boost/asio.hpp>
#define BOOST_COROUTINES_NO_DEPRECATION_WARNING
#include <boost/asio/spawn.hpp>
#include <iostream>
#include <memory>
using boost::system::error_code;
// use a move-only result type
using result_type = std::unique_ptr<int>;
@cbodley
cbodley / pytest_runner.py
Created May 4, 2017 15:04
run pytest.main() against already-imported modules
import pytest
from rgw_multi import tests
def run_tests(realm, user):
tests.init_multi(realm, user) # inject dependencies
test_modules = [tests] # more in future
args = ['-s', '-v', '--pyargs']
for mod in test_modules:
/// streaming message body interface
struct streaming_body {
using value_type = boost::asio::mutable_buffer;
class reader {
value_type& buffer;
public:
using mutable_buffers_type = boost::asio::mutable_buffers_1;
struct crypt_sanitize_header {
boost::string_ref name;
boost::string_ref value;
crypt_sanitize_header(boost::string_ref name, boost::string_ref value)
: name(name), value(value) {}
};
std::ostream& operator<<(std::ostream& out, const crypt_sanitize_header& h) {
out << h.name << '=';
@cbodley
cbodley / gist:7f409438da92e0ba3a9cf309174b5073
Created September 6, 2016 19:47
wip_rgw_compression s3test failure
from teuthology.log: http://qa-proxy.ceph.com/teuthology/cbodley-2016-09-06_10:26:26-rgw-wip_rgw_compression---basic-mira/402146/teuthology.log
2016-09-06T14:54:34.128 INFO:teuthology.orchestra.run.mira110.stderr:======================================================================
2016-09-06T14:54:34.128 INFO:teuthology.orchestra.run.mira110.stderr:ERROR: s3tests.functional.test_s3.test_region_copy_object
2016-09-06T14:54:34.128 INFO:teuthology.orchestra.run.mira110.stderr:----------------------------------------------------------------------
2016-09-06T14:54:34.128 INFO:teuthology.orchestra.run.mira110.stderr:Traceback (most recent call last):
2016-09-06T14:54:34.128 INFO:teuthology.orchestra.run.mira110.stderr: File "/home/ubuntu/cephtest/s3-tests/virtualenv/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
2016-09-06T14:54:34.128 INFO:teuthology.orchestra.run.mira110.stderr: self.test(*self.arg)
2016-09-06T14:54:34.128 INFO:teuthology.orchestra.run.mira110.stderr: File "/home/ub