Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ Build-Depends:
libboost-thread-dev,
python-dev,
python-support,
handystats (>= 1.10.2)
handystats (>= 1.11.1)
Standards-Version: 3.8.0
Homepage: http://www.reverbrain.com/eblob/
Vcs-Git: git://github.com/reverbrain/eblob.git
Vcs-Browser: https://github.com/reverbrain/eblob

Package: eblob
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, handystats (>= 1.10.2)
Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, handystats (>= 1.11.1)
Description: BLOB data container
EBLOB is append data storage with fast indexes and comprehensive API

Expand Down
2 changes: 1 addition & 1 deletion eblob-bf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ BuildRequires: gcc44 gcc44-c++
BuildRequires: boost%{boost_ver}-devel, boost%{boost_ver}-filesystem, boost%{boost_ver}-iostreams, boost%{boost_ver}-python, boost%{boost_ver}-regex, boost%{boost_ver}-system, boost%{boost_ver}-thread
BuildRequires: cmake >= 2.6
BuildRequires: python-devel
BuildRequires: handystats >= 1.10.2
BuildRequires: handystats >= 1.11.1

%description
libeblob is a low-level IO library which stores data in huge blob files
Expand Down
48 changes: 24 additions & 24 deletions library/blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ void eblob_bctl_release(struct eblob_base_ctl *bctl)
static int eblob_writev_raw(struct eblob_key *key, struct eblob_write_control *wc,
const struct eblob_iovec *iov, uint16_t iovcnt)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.write.raw", wc->bctl->back->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.write.raw", wc->bctl->back->cfg.stat_id));
const uint64_t offset_min = wc->ctl_data_offset + sizeof(struct eblob_disk_control);
const uint64_t offset_max = wc->ctl_data_offset + wc->total_size;
const struct eblob_iovec *tmp;
Expand Down Expand Up @@ -1113,7 +1113,7 @@ static void eblob_wc_to_dc(const struct eblob_key *key, const struct eblob_write
static int eblob_commit_disk(struct eblob_backend *b, struct eblob_key *key,
struct eblob_write_control *wc, int remove)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.write.commit.ll", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.write.commit.ll", b->cfg.stat_id));

struct eblob_disk_control dc;
int err;
Expand Down Expand Up @@ -1412,7 +1412,7 @@ int eblob_splice_data(int fd_in, uint64_t off_in, int fd_out, uint64_t off_out,
static int eblob_fill_write_control_from_ram(struct eblob_backend *b, struct eblob_key *key,
struct eblob_write_control *wc, int for_write, struct eblob_ram_control *old)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.lookup", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.lookup", b->cfg.stat_id));

struct eblob_ram_control ctl;
struct eblob_disk_control dc;
Expand Down Expand Up @@ -1535,7 +1535,7 @@ static int eblob_write_prepare_disk_ll(struct eblob_backend *b, struct eblob_key
enum eblob_copy_flavour copy, uint64_t copy_offset,
struct eblob_ram_control *old)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.write.prepare.disk.ll", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.write.prepare.disk.ll", b->cfg.stat_id));

struct eblob_base_ctl *ctl = NULL;
ssize_t err = 0;
Expand Down Expand Up @@ -1697,7 +1697,7 @@ static int eblob_write_prepare_disk_ll(struct eblob_backend *b, struct eblob_key
else
err = eblob_copy_data(old->bctl->data_fd, off_in, wc->data_fd, off_out, size);

FORMATTED(HANDY_GAUGE_SET, ("eblob.%u.disk.write.move.size", b->cfg.stat_id), size);
HANDY_GAUGE_SET(("eblob.%u.disk.write.move.size", b->cfg.stat_id), size);

if (err == 0)
eblob_stat_inc(b->stat, EBLOB_GST_READ_COPY_UPDATE);
Expand Down Expand Up @@ -1757,7 +1757,7 @@ static int eblob_write_prepare_disk(struct eblob_backend *b, struct eblob_key *k
enum eblob_copy_flavour copy, uint64_t copy_offset, struct eblob_ram_control *old,
size_t defrag_generation)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.write.prepare.disk", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.write.prepare.disk", b->cfg.stat_id));

ssize_t err = 0;
uint64_t size;
Expand Down Expand Up @@ -1805,7 +1805,7 @@ static int eblob_write_prepare_disk(struct eblob_backend *b, struct eblob_key *k
int eblob_write_prepare(struct eblob_backend *b, struct eblob_key *key,
uint64_t size, uint64_t flags)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.write.prepare", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.write.prepare", b->cfg.stat_id));
struct eblob_write_control wc = { .offset = 0 };
struct eblob_ram_control old;
int err;
Expand Down Expand Up @@ -1857,7 +1857,7 @@ int eblob_write_prepare(struct eblob_backend *b, struct eblob_key *key,
int eblob_hash(struct eblob_backend *b, void *dst,
unsigned int dsize __attribute_unused__, const void *src, uint64_t size)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.hash", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.hash", b->cfg.stat_id));
sha512_buffer(src, size, dst);
return 0;
}
Expand All @@ -1868,7 +1868,7 @@ int eblob_hash(struct eblob_backend *b, void *dst,
static int eblob_file_hash(struct eblob_backend *b __attribute_unused__, void *dst,
unsigned int dsize __attribute_unused__, int fd, off_t offset, uint64_t size)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.file_hash", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.file_hash", b->cfg.stat_id));
int err = sha512_file(fd, offset, size, dst);
return err;
}
Expand All @@ -1883,7 +1883,7 @@ static int eblob_file_hash(struct eblob_backend *b __attribute_unused__, void *d
static int eblob_csum(struct eblob_backend *b, void *dst, unsigned int dsize,
struct eblob_write_control *wc)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.csum", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.csum", b->cfg.stat_id));
off_t off = wc->ctl_data_offset + sizeof(struct eblob_disk_control);
int err = eblob_file_hash(b, dst, dsize, wc->data_fd, off, wc->total_data_size);
return err;
Expand All @@ -1896,7 +1896,7 @@ static int eblob_csum(struct eblob_backend *b, void *dst, unsigned int dsize,
static int eblob_write_commit_footer(struct eblob_backend *b, struct eblob_key *key,
struct eblob_write_control *wc)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.write.footer", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.write.footer", b->cfg.stat_id));
off_t offset = wc->ctl_data_offset + wc->total_size - sizeof(struct eblob_disk_footer);
struct eblob_disk_footer f;
int err = 0;
Expand Down Expand Up @@ -1949,7 +1949,7 @@ static int eblob_write_commit_footer(struct eblob_backend *b, struct eblob_key *
static int eblob_write_commit_nolock(struct eblob_backend *b, struct eblob_key *key,
struct eblob_write_control *wc)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.write.commit", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.write.commit", b->cfg.stat_id));

int err;

Expand Down Expand Up @@ -2205,7 +2205,7 @@ int eblob_plain_writev(struct eblob_backend *b, struct eblob_key *key,
eblob_dump_id(key->id), __func__, wc.data_fd, wc.size,
wc.data_offset + wc.offset, err);
if (err) {
FORMATTED(HANDY_COUNTER_INCREMENT, ("eblob.%u.disk.write.plain.errors.%zd", b->cfg.stat_id, -err), 1);
HANDY_COUNTER_INCREMENT(("eblob.%u.disk.write.plain.errors.%zd", b->cfg.stat_id, -err), 1);
}
return err;
}
Expand Down Expand Up @@ -2278,7 +2278,7 @@ int eblob_writev_return(struct eblob_backend *b, struct eblob_key *key,
const struct eblob_iovec *iov, uint16_t iovcnt, uint64_t flags,
struct eblob_write_control *wc)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.write", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.write", b->cfg.stat_id));

struct eblob_iovec_bounds bounds;
struct eblob_ram_control old;
Expand Down Expand Up @@ -2306,7 +2306,7 @@ int eblob_writev_return(struct eblob_backend *b, struct eblob_key *key,
err = eblob_try_overwritev(b, key, iov, iovcnt, wc, &old, &defrag_generation);
if (err == 0) {
/* We have overwritten old data - bail out */
FORMATTED(HANDY_COUNTER_INCREMENT, ("eblob.%u.disk.write.rewrites", b->cfg.stat_id), 1);
HANDY_COUNTER_INCREMENT(("eblob.%u.disk.write.rewrites", b->cfg.stat_id), 1);
goto err_out_exit;
} else if (!(err == -E2BIG || err == -ENOENT || err == -EROFS)) {
/* Unknown error occurred during rewrite */
Expand Down Expand Up @@ -2364,7 +2364,7 @@ int eblob_writev_return(struct eblob_backend *b, struct eblob_key *key,
err_out_exit:
eblob_dump_wc(b, key, wc, "eblob_writev: finished", err);
if (err) {
FORMATTED(HANDY_COUNTER_INCREMENT, ("eblob.%u.disk.write.errors.%d", b->cfg.stat_id, -err), 1);
HANDY_COUNTER_INCREMENT(("eblob.%u.disk.write.errors.%d", b->cfg.stat_id, -err), 1);
}
return err;
}
Expand All @@ -2374,7 +2374,7 @@ int eblob_writev_return(struct eblob_backend *b, struct eblob_key *key,
*/
int eblob_remove(struct eblob_backend *b, struct eblob_key *key)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.remove", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.remove", b->cfg.stat_id));
struct eblob_ram_control ctl;
int err, disk;

Expand All @@ -2399,7 +2399,7 @@ int eblob_remove(struct eblob_backend *b, struct eblob_key *key)

err_out_exit:
if (err && err != -ENOENT) {
FORMATTED(HANDY_COUNTER_INCREMENT, ("eblob.%u.disk.remove.errors.%d", b->cfg.stat_id, -err), 1);
HANDY_COUNTER_INCREMENT(("eblob.%u.disk.remove.errors.%d", b->cfg.stat_id, -err), 1);
}
return err;
}
Expand All @@ -2409,7 +2409,7 @@ int eblob_remove(struct eblob_backend *b, struct eblob_key *key)
*/
static int eblob_csum_ok(struct eblob_backend *b, struct eblob_write_control *wc)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.csum.ok", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.csum.ok", b->cfg.stat_id));
struct eblob_disk_footer f;
unsigned char csum[EBLOB_ID_SIZE];
off_t off;
Expand Down Expand Up @@ -2463,7 +2463,7 @@ static int eblob_csum_ok(struct eblob_backend *b, struct eblob_write_control *wc
static int _eblob_read_ll(struct eblob_backend *b, struct eblob_key *key,
enum eblob_read_flavour csum, struct eblob_write_control *wc)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.read", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.read", b->cfg.stat_id));
int err;
struct timeval start, end;
long csum_time;
Expand Down Expand Up @@ -2511,7 +2511,7 @@ static int _eblob_read_ll(struct eblob_backend *b, struct eblob_key *key,

err_out_exit:
if (err && err != -ENOENT) {
FORMATTED(HANDY_COUNTER_INCREMENT, ("eblob.%u.disk.read.errors.%d", b->cfg.stat_id, -err), 1);
HANDY_COUNTER_INCREMENT(("eblob.%u.disk.read.errors.%d", b->cfg.stat_id, -err), 1);
}
return err;
}
Expand Down Expand Up @@ -2576,7 +2576,7 @@ int eblob_read_return(struct eblob_backend *b, struct eblob_key *key,
static int eblob_read_data_ll(struct eblob_backend *b, struct eblob_key *key,
uint64_t offset, char **dst, uint64_t *size, enum eblob_read_flavour csum)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.read_data", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.read_data", b->cfg.stat_id));
int err, fd;
void *data;
uint64_t record_offset, record_size;
Expand Down Expand Up @@ -2618,7 +2618,7 @@ static int eblob_read_data_ll(struct eblob_backend *b, struct eblob_key *key,
free(data);
err_out_exit:
if (err && err != -ENOENT) {
FORMATTED(HANDY_COUNTER_INCREMENT, ("eblob.%u.disk.read_data.errors.%d", b->cfg.stat_id, -err), 1);
HANDY_COUNTER_INCREMENT(("eblob.%u.disk.read_data.errors.%d", b->cfg.stat_id, -err), 1);
}
return err;
}
Expand Down Expand Up @@ -2714,7 +2714,7 @@ int eblob_periodic(struct eblob_backend *b)
if (err != 0) {
EBLOB_WARNC(b->cfg.log, EBLOB_LOG_ERROR, -err,
"eblob_stat_commit: FAILED");
FORMATTED(HANDY_COUNTER_INCREMENT, ("eblob.%u.disk.stat_commit.errors.%d", b->cfg.stat_id, -err), 1);
HANDY_COUNTER_INCREMENT(("eblob.%u.disk.stat_commit.errors.%d", b->cfg.stat_id, -err), 1);
}

b->stat_file_time = t;
Expand Down
4 changes: 2 additions & 2 deletions library/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static int eblob_find_on_disk(struct eblob_backend *b,
int (* callback)(struct eblob_disk_control *sorted, struct eblob_disk_control *dc),
struct eblob_disk_search_stat *st)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.lookup.one", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.lookup.one", b->cfg.stat_id));

struct eblob_disk_control *sorted, *end, *sorted_orig, *found = NULL;
struct eblob_disk_control *hdr_block, *search_start, *search_end;
Expand Down Expand Up @@ -862,7 +862,7 @@ static char *eblob_dump_search_stat(const struct eblob_disk_search_stat *st, int
int eblob_disk_index_lookup(struct eblob_backend *b, struct eblob_key *key,
struct eblob_ram_control *rctl)
{
FORMATTED(HANDY_TIMER_SCOPE, ("eblob.%u.disk.lookup", b->cfg.stat_id));
HANDY_TIMER_SCOPE(("eblob.%u.disk.lookup", b->cfg.stat_id));

struct eblob_base_ctl *bctl;
struct eblob_disk_control dc = { .key = *key, };
Expand Down
6 changes: 1 addition & 5 deletions library/measure_points.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
#else
#include <handystats/measuring_points.h>
#endif

#define __HANDY_NAME_USE BOOST_PP_CAT(__C_HANDY_NAME_BUF_, __LINE__)
#define __HANDY_NAME_SET(...) char __HANDY_NAME_USE[255]; snprintf(__HANDY_NAME_USE, (sizeof(__HANDY_NAME_USE) - 1), __VA_ARGS__)
#define FORMATTED(MACRO, NAME_ARGS, ...) __HANDY_NAME_SET NAME_ARGS; MACRO(__HANDY_NAME_USE, ##__VA_ARGS__)
#else
#include "monitor/handystats/stubs.h"
#include "handystats/stubs.h"
#endif

#endif /* __MEASURE_POINTS_H */
8 changes: 4 additions & 4 deletions library/mobjects.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ int eblob_cache_insert(struct eblob_backend *b, struct eblob_key *key,
/* Bump counters only if entry was added and not replaced */
if (err == 0 && replaced == 0) {
eblob_stat_add(b->stat, EBLOB_GST_CACHED, entry_size);
FORMATTED(HANDY_COUNTER_INCREMENT, ("eblob.%u.cache.size", b->cfg.stat_id), 1);
HANDY_COUNTER_INCREMENT(("eblob.%u.cache.size", b->cfg.stat_id), 1);
}

err_out_exit:
Expand All @@ -677,7 +677,7 @@ int eblob_cache_remove_nolock(struct eblob_backend *b, struct eblob_key *key)

if (err == 0) {
eblob_stat_sub(b->stat, EBLOB_GST_CACHED, entry_size);
FORMATTED(HANDY_COUNTER_DECREMENT, ("eblob.%u.cache.size", b->cfg.stat_id), 1);
HANDY_COUNTER_DECREMENT(("eblob.%u.cache.size", b->cfg.stat_id), 1);
}

return err;
Expand All @@ -698,7 +698,7 @@ int eblob_cache_lookup(struct eblob_backend *b, struct eblob_key *key,
{
int err = 1, disk = 0;

FORMATTED(HANDY_TIMER_START, ("eblob.%u.cache.lookup", b->cfg.stat_id), (uint64_t)key);
HANDY_TIMER_START(("eblob.%u.cache.lookup", b->cfg.stat_id), (uint64_t)key);
pthread_rwlock_rdlock(&b->hash.root_lock);
if (b->cfg.blob_flags & EBLOB_L2HASH) {
/* If l2hash is enabled - look in it */
Expand All @@ -708,7 +708,7 @@ int eblob_cache_lookup(struct eblob_backend *b, struct eblob_key *key,
err = eblob_hash_lookup_nolock(&b->hash, key, res);
}
pthread_rwlock_unlock(&b->hash.root_lock);
FORMATTED(HANDY_TIMER_STOP, ("eblob.%u.cache.lookup", b->cfg.stat_id), (uint64_t)key);
HANDY_TIMER_STOP(("eblob.%u.cache.lookup", b->cfg.stat_id), (uint64_t)key);

if (err == -ENOENT) {
/* Look on disk */
Expand Down