Skip to content

Commit

Permalink
Fix unused and signedness in pumice_db.c
Browse files Browse the repository at this point in the history
  • Loading branch information
00pauln00 committed May 31, 2024
1 parent d7244fb commit ddfb552
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/include/raft.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#define RAFT_HEARTBEAT_FREQ_PER_ELECTION 10

#define RAFT_ENTRY_IDX_ANY -1LL
#define RAFT_TERM_ANY -1LL

#define RAFT_MIN_APPEND_ENTRY_IDX -1

Expand Down
17 changes: 11 additions & 6 deletions src/pumice_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ pmdb_obj_to_reply(const struct pmdb_object *obj, struct pmdb_msg *reply,
// if either term value is -1 then write_pending is false;
reply->pmdbrm_write_pending =
(obj->pmdb_obj_pending_term == current_raft_term &&
current_raft_term != ID_ANY_64bit) ? 1 : 0;
current_raft_term != RAFT_TERM_ANY) ? 1 : 0;
}

/**
Expand Down Expand Up @@ -415,7 +415,7 @@ pmdb_prep_raft_entry_write_obj(struct pmdb_object *obj, int64_t current_term)
* apply context. Otherwise, when called in write context, the object's
* pending-term must be less than the current-term.
*/
if (current_term != ID_ANY_64bit)
if (current_term != RAFT_TERM_ANY)
NIOVA_ASSERT(obj->pmdb_obj_pending_term < current_term);

obj->pmdb_obj_pending_term = current_term;
Expand Down Expand Up @@ -519,6 +519,8 @@ static void
pmdb_cowr_sub_app_put(struct pmdb_cowr_sub_app *sa,
const char *caller_func, const int caller_lineno)
{
(void)caller_func;
(void)caller_lineno;
SIMPLE_LOG_MSG(LL_DEBUG, "%s:%d", caller_func, caller_lineno);
RT_PUT(pmdb_cowr_sub_app_tree, &pmdb_cowr_sub_apps, sa);
}
Expand Down Expand Up @@ -565,6 +567,8 @@ pmdb_cowr_sub_app_add(const struct raft_net_client_user_id *rncui,
const char *caller_func, const int caller_lineno)
{
NIOVA_ASSERT(rncui);
(void)caller_func;
(void)caller_lineno;

struct pmdb_cowr_sub_app cowr = {0};
raft_net_client_user_id_copy(&cowr.pcwsa_rncui, rncui);
Expand Down Expand Up @@ -750,6 +754,9 @@ pmdb_range_read_req_add(const uint64_t seq_number,
const char *caller_func, const int caller_lineno)
{
// If there are any stale entries in range read req RB tree, release them all.
(void)caller_func;
(void)caller_lineno;

if (pmdb_range_read_tree_term != current_term)
pmdb_range_read_req_release_all();

Expand Down Expand Up @@ -933,7 +940,7 @@ pmdb_sm_handler_client_write(struct raft_net_client_request_handle *rncr)
* that write did not yet (or ever) commit.
*/
if (pmdb_req->pmdbrm_write_seqno <= obj.pmdb_obj_commit_seqno &&
obj.pmdb_obj_commit_seqno != ID_ANY_64bit)
obj.pmdb_obj_commit_seqno != RAFT_ENTRY_IDX_ANY)
{
raft_client_net_request_handle_error_set(rncr, -EALREADY, 0, 0);
}
Expand Down Expand Up @@ -1469,9 +1476,7 @@ PmdbGetRoptionsWithSnapshot(const uint64_t seq_number,


// Check if snapshot with the given seq_number is already created.
if (seq_number >= 0)
prrq = pmdb_range_read_req_lookup(seq_number, __func__, __LINE__);

prrq = pmdb_range_read_req_lookup(seq_number, __func__, __LINE__);
if (!prrq)
{
// Get the latest sequence number and create snapshot against it.
Expand Down

0 comments on commit ddfb552

Please sign in to comment.