...
  View open merge request
Commits (21)
......@@ -20,7 +20,7 @@ typedef struct {
/**
* Persistent, opaque identifier for a region within a BAKE target.
*/
#define BAKE_REGION_ID_DATA_SIZE 16
#define BAKE_REGION_ID_DATA_SIZE 32
typedef struct {
uint32_t type;
char data[BAKE_REGION_ID_DATA_SIZE];
......@@ -38,6 +38,7 @@ typedef struct {
#define BAKE_ERR_OUT_OF_BOUNDS (-9) /* Attempting an out of bound access */
#define BAKE_ERR_REMI (-10) /* Error related to REMI */
#define BAKE_ERR_OP_UNSUPPORTED (-11) /* Operation not supported */
#define BAKE_ERR_IO (-12) /* I/O error */
/**
* Print bake errors in human-friendly form
......@@ -47,6 +48,16 @@ typedef struct {
*/
void bake_perror(char *s, int ret);
/**
* Convert region id into printable string for debugging purposes
*
* @param[in] str string to fill in
* @param[in] size length of string, not including terminator. If rid
* string is longer than this it will be truncated.
* @param[in] rid region_id
*/
void bake_print_dbg_region_id_t(char *str, size_t size, bake_region_id_t rid);
#ifdef __cplusplus
}
#endif
......
......@@ -286,6 +286,7 @@ int bake_shutdown_service(bake_client_t client, hg_addr_t addr)
return margo_shutdown_remote_instance(client->mid, addr);
}
#if 0
static int bake_eager_write(
bake_provider_handle_t provider,
bake_region_id_t rid,
......@@ -342,6 +343,7 @@ finish:
return ret;
}
#endif
int bake_write(
bake_provider_handle_t provider,
......@@ -357,8 +359,11 @@ int bake_write(
bake_write_out_t out;
int ret;
/* no eager for now, because it complicates file I/O alignment */
#if 0
if(buf_size <= provider->eager_limit)
return(bake_eager_write(provider, rid, region_offset, buf, buf_size));
#endif
TIMERS_INITIALIZE("bulk_create", "forward", "end");
......@@ -1064,6 +1069,7 @@ int bake_noop(bake_provider_handle_t provider)
return BAKE_SUCCESS;
}
#if 0
static int bake_eager_read(
bake_provider_handle_t provider,
bake_region_id_t rid,
......@@ -1128,6 +1134,7 @@ finish:
return(ret);
}
#endif
int bake_read(
bake_provider_handle_t provider,
......@@ -1144,8 +1151,11 @@ int bake_read(
bake_read_out_t out;
int ret;
/* no eager path with file backend */
#if 0
if(buf_size <= provider->eager_limit)
return(bake_eager_read(provider, rid, region_offset, buf, buf_size, bytes_read));
#endif
TIMERS_INITIALIZE("bulk_create","forward","end");
......
......@@ -36,16 +36,21 @@ int main(int argc, char **argv)
char* local_region;
int region_fd;
uint64_t size;
uint64_t offset = 0;
char region_str[128];
if(argc != 6)
if(argc != 6 && argc != 7)
{
fprintf(stderr, "Usage: bake-copy-from <server addr> <mplex id> <identifier file> <output file> <size>\n");
fprintf(stderr, "Usage: bake-copy-from <server addr> <mplex id> <identifier file> <output file> <size> [optional_offset]\n");
fprintf(stderr, " Example: ./bake-copy-from tcp://localhost:1234 3 /tmp/bb-copy-rid.0GjOlu /tmp/output.dat 256\n");
fprintf(stderr, " NOTE: if optional_offset is specified, then data will be read from that offset within the source region.\n");
return(-1);
}
svr_addr_str = argv[1];
mplex_id = atoi(argv[2]);
size = atol(argv[5]);
if(argc == 7)
offset = atol(argv[6]);
/* initialize Margo using the transport portion of the server
* address (i.e., the part before the first : character if present)
......@@ -111,6 +116,9 @@ int main(int argc, char **argv)
}
close(region_fd);
bake_print_dbg_region_id_t(region_str, 127, rid);
printf("# will read bake region %s\n", region_str);
#ifdef USE_SIZECHECK_HEADERS
uint64_t check_size;
ret = bake_get_size(bph, rid, &check_size);
......@@ -173,7 +181,7 @@ int main(int argc, char **argv)
ret = bake_read(
bph,
rid,
0,
offset,
local_region,
size,
&bytes_read);
......
......@@ -38,6 +38,7 @@ int main(int argc, char **argv)
char* local_region;
int region_fd;
char region_file[128];
char region_str[128];
#ifdef USE_SIZECHECK_HEADERS
uint64_t check_size;
#endif
......@@ -162,6 +163,9 @@ int main(int argc, char **argv)
return(-1);
}
bake_print_dbg_region_id_t(region_str, 127, rid);
printf("# created bake region %s\n", region_str);
/* transfer data */
ret = bake_write(
bph,
......
This diff is collapsed.
......@@ -7,6 +7,8 @@
#include "bake-config.h"
#include "bake.h"
#include <stdio.h>
#include <inttypes.h>
#include <libpmemobj.h>
static char * bake_err_str(int ret)
{
......@@ -47,6 +49,9 @@ static char * bake_err_str(int ret)
case BAKE_ERR_OP_UNSUPPORTED:
return "Operation not supported";
break;
case BAKE_ERR_IO:
return "I/O error";
break;
default:
return "Unknown error";
break;
......@@ -64,3 +69,14 @@ void bake_perror(char *s, int err)
fprintf(stderr, "%s\n", error_string);
}
void bake_print_dbg_region_id_t(char *str, size_t size, bake_region_id_t rid)
{
PMEMoid *oid;
/* NOTE: this is fragile. Would break if pmemobj format changes. */
oid = (PMEMoid *)rid.data;
snprintf(str, size, "%u:%" PRIu64 ":%" PRIu64, rid.type, oid->pool_uuid_lo, oid->off);
return;
}
......@@ -28,11 +28,11 @@ wait
# check that the underlying pool is empty since we removed the object during the test
# XXX note this assumes pmem pools -- may want to write our
# own wrapper for this functionality at some point
num_objs=`pmempool info -ns $TMPBASE/svr-1.dat | grep "Number of objects" | head -n 1 | cut -d: -f2 | awk '{$1=$1};1'`
if [ $num_objs -ne 0 ]; then
echo "Expected the BAKE pool to be empty"
exit 1
fi
# num_objs=`pmempool info -ns $TMPBASE/svr-1.dat | grep "Number of objects" | head -n 1 | cut -d: -f2 | awk '{$1=$1};1'`
# if [ $num_objs -ne 0 ]; then
# echo "Expected the BAKE pool to be empty"
# exit 1
# fi
echo cleaning up $TMPBASE
rm -rf $TMPBASE
......
......@@ -28,11 +28,11 @@ wait
# check that the underlying pool has the object we created
# XXX note this assumes pmem pools -- may want to write our
# own wrapper for this functionality at some point
num_objs=`pmempool info -ns $TMPBASE/svr-1.dat | grep "Number of objects" | head -n 1 | cut -d: -f2 | awk '{$1=$1};1'`
if [ $num_objs -ne 1 ]; then
echo "Invalid number of objects in BAKE pool"
exit 1
fi
# num_objs=`pmempool info -ns $TMPBASE/svr-1.dat | grep "Number of objects" | head -n 1 | cut -d: -f2 | awk '{$1=$1};1'`
# if [ $num_objs -ne 1 ]; then
# echo "Invalid number of objects in BAKE pool"
# exit 1
# fi
echo cleaning up $TMPBASE
rm -rf $TMPBASE
......
......@@ -12,7 +12,7 @@ if [ -z "$MKTEMP" ] ; then
exit 1
fi
TMPDIR=/dev/shm
TMPDIR=/tmp
export TMPDIR
mkdir -p $TMPDIR
TMPBASE=$(${MKTEMP} --tmpdir -d test-XXXXXX)
......