Skip to content

Commit

Permalink
wip: ovsdb-idl: Rename ovsdb_txn_abort() as ovsdb_txn_hard_stop()
Browse files Browse the repository at this point in the history
Recently OVS adopted a policy of using the inclusive naming word list v1
[1, 2].

This patch addresses the name of the term abort within the scope of
functions. The functions ovsdb_txn_abort(), ovsdb_idl_txn_abort_all(),
and ovsdb_txn_row_abort() by renaming them as ovsdb_txn_hard_stop(),
ovsdb_idl_txn_hard_stop_all(), and ovsdb_txn_row_hard_stop().

[1] df5e5cf ("Documentation: Add section on inclusive language.")
[2] https://inclusivenaming.org/word-lists/

Signed-off-by: Simon Horman <[email protected]>
  • Loading branch information
Simon Horman committed Feb 2, 2024
1 parent 6ffe9f9 commit ecf715d
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 50 deletions.
16 changes: 8 additions & 8 deletions lib/ovsdb-idl.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static void ovsdb_idl_row_track_change(struct ovsdb_idl_row *,
static void ovsdb_idl_row_untrack_change(struct ovsdb_idl_row *);
static void ovsdb_idl_row_clear_changeseqno(struct ovsdb_idl_row *);

static void ovsdb_idl_txn_abort_all(struct ovsdb_idl *);
static void ovsdb_idl_txn_hard_stop_all(struct ovsdb_idl *);
static bool ovsdb_idl_txn_extract_mutations(struct ovsdb_idl_row *,
struct json *);
static void ovsdb_idl_txn_add_map_op(struct ovsdb_idl_row *,
Expand Down Expand Up @@ -347,7 +347,7 @@ ovsdb_idl_destroy(struct ovsdb_idl *idl)
if (idl) {
ovs_assert(!idl->txn);

ovsdb_idl_txn_abort_all(idl);
ovsdb_idl_txn_hard_stop_all(idl);
hmap_destroy(&idl->outstanding_txns);

ovsdb_idl_clear(idl);
Expand Down Expand Up @@ -451,7 +451,7 @@ ovsdb_idl_run(struct ovsdb_idl *idl)
LIST_FOR_EACH_POP (event, list_node, &events) {
switch (event->type) {
case OVSDB_CS_EVENT_TYPE_RECONNECT:
ovsdb_idl_txn_abort_all(idl);
ovsdb_idl_txn_hard_stop_all(idl);
break;

case OVSDB_CS_EVENT_TYPE_LOCKED:
Expand Down Expand Up @@ -2597,7 +2597,7 @@ ovsdb_idl_next_row(const struct ovsdb_idl_row *row)
* Various kinds of changes can invalidate the returned value: writing to the
* same 'column' in 'row' (e.g. with ovsdb_idl_txn_write()), deleting 'row'
* (e.g. with ovsdb_idl_txn_delete()), or completing an ongoing transaction
* (e.g. with ovsdb_idl_txn_commit() or ovsdb_idl_txn_abort()). If the
* (e.g. with ovsdb_idl_txn_commit() or ovsdb_idl_txn_hard_stop()). If the
* returned value is needed for a long time, it is best to make a copy of it
* with ovsdb_datum_clone(). */
const struct ovsdb_datum *
Expand Down Expand Up @@ -2807,7 +2807,7 @@ ovsdb_idl_txn_destroy(struct ovsdb_idl_txn *txn)
hmap_remove(&txn->idl->outstanding_txns, &txn->hmap_node);
}
json_destroy(txn->request_id);
ovsdb_idl_txn_abort(txn);
ovsdb_idl_txn_hard_stop(txn);
ds_destroy(&txn->comment);
free(txn->error);
HMAP_FOR_EACH_SAFE (insert, hmap_node, &txn->inserted_rows) {
Expand Down Expand Up @@ -3156,7 +3156,7 @@ ovsdb_idl_txn_extract_mutations(struct ovsdb_idl_row *row,
*
* TXN_ABORTED:
*
* The caller previously called ovsdb_idl_txn_abort().
* The caller previously called ovsdb_idl_txn_hard_stop().
*
* TXN_SUCCESS:
*
Expand Down Expand Up @@ -3498,7 +3498,7 @@ ovsdb_idl_txn_get_increment_new_value(const struct ovsdb_idl_txn *txn)
* Aborting a transaction doesn't free its memory. Use
* ovsdb_idl_txn_destroy() to do that. */
void
ovsdb_idl_txn_abort(struct ovsdb_idl_txn *txn)
ovsdb_idl_txn_hard_stop(struct ovsdb_idl_txn *txn)
{
ovsdb_idl_txn_disassemble(txn);
if (txn->status == TXN_UNCOMMITTED || txn->status == TXN_INCOMPLETE) {
Expand Down Expand Up @@ -3860,7 +3860,7 @@ ovsdb_idl_txn_insert_persist_uuid(struct ovsdb_idl_txn *txn,
}

static void
ovsdb_idl_txn_abort_all(struct ovsdb_idl *idl)
ovsdb_idl_txn_hard_stop_all(struct ovsdb_idl *idl)
{
struct ovsdb_idl_txn *txn;

Expand Down
6 changes: 3 additions & 3 deletions lib/ovsdb-idl.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ bool ovsdb_idl_row_is_synthetic(const struct ovsdb_idl_row *);
*
* When a transaction is complete, which must be before the next call to
* ovsdb_idl_run() on 'idl', call ovsdb_idl_txn_commit() or
* ovsdb_idl_txn_abort().
* ovsdb_idl_txn_hard_stop().
*
* The life-cycle of a transaction looks like this:
*
Expand Down Expand Up @@ -323,7 +323,7 @@ enum ovsdb_idl_txn_status {
TXN_UNCOMMITTED, /* Not yet committed or aborted. */
TXN_UNCHANGED, /* Transaction didn't include any changes. */
TXN_INCOMPLETE, /* Commit in progress, please wait. */
TXN_ABORTED, /* ovsdb_idl_txn_abort() called. */
TXN_ABORTED, /* ovsdb_idl_txn_hard_stop() called. */
TXN_SUCCESS, /* Commit successful. */
TXN_TRY_AGAIN, /* Commit failed because a "verify" operation
* reported an inconsistency, due to a network
Expand All @@ -347,7 +347,7 @@ void ovsdb_idl_txn_destroy(struct ovsdb_idl_txn *);
void ovsdb_idl_txn_wait(const struct ovsdb_idl_txn *);
enum ovsdb_idl_txn_status ovsdb_idl_txn_commit(struct ovsdb_idl_txn *);
enum ovsdb_idl_txn_status ovsdb_idl_txn_commit_block(struct ovsdb_idl_txn *);
void ovsdb_idl_txn_abort(struct ovsdb_idl_txn *);
void ovsdb_idl_txn_hard_stop(struct ovsdb_idl_txn *);

const char *ovsdb_idl_txn_get_error(const struct ovsdb_idl_txn *);

Expand Down
6 changes: 3 additions & 3 deletions ovsdb/execution.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ ovsdb_execute_compose(struct ovsdb *db, const struct ovsdb_session *session,

exit:
if (error) {
ovsdb_txn_abort(x.txn);
ovsdb_txn_hard_stop(x.txn);
x.txn = NULL;

ovsdb_error_destroy(error);
Expand Down Expand Up @@ -777,8 +777,8 @@ ovsdb_execute_wait(struct ovsdb_execution *x, struct ovsdb_parser *parser,
}

if (!ovsdb_row_hash_insert(&expected, row)) {
/* XXX Perhaps we should abort with an error or log a
* warning. */
/* XXX Perhaps we should perform a hard stop
* with an error or log a warning. */
ovsdb_row_destroy(row);
}
}
Expand Down
6 changes: 3 additions & 3 deletions ovsdb/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ ovsdb_file_txn_from_json(struct ovsdb *db, const struct json *json,
return NULL;

error:
ovsdb_txn_abort(txn);
ovsdb_txn_hard_stop(txn);
return error;
}

Expand Down Expand Up @@ -393,7 +393,7 @@ ovsdb_convert(const struct ovsdb *src, const struct ovsdb_schema *new_schema,

error = ovsdb_txn_replay_commit(txn);
if (error) {
txn = NULL; /* ovsdb_txn_replay_commit() already aborted. */
txn = NULL; /* ovsdb_txn_replay_commit() already hard stopped. */
goto error;
}

Expand All @@ -403,7 +403,7 @@ ovsdb_convert(const struct ovsdb *src, const struct ovsdb_schema *new_schema,
error:
ovsdb_destroy(dst);
if (txn) {
ovsdb_txn_abort(txn);
ovsdb_txn_hard_stop(txn);
}
*dstp = NULL;
return error;
Expand Down
2 changes: 1 addition & 1 deletion ovsdb/relay.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ ovsdb_relay_parse_update__(struct ovsdb *db,

exit:
if (error) {
ovsdb_txn_abort(txn);
ovsdb_txn_hard_stop(txn);
return error;
} else {
if (uuid_is_zero(last_id)) {
Expand Down
2 changes: 1 addition & 1 deletion ovsdb/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ process_notification(struct json *table_updates, struct ovsdb *db)
}

if (error) {
ovsdb_txn_abort(txn);
ovsdb_txn_hard_stop(txn);
return error;
} else {
/* Commit transaction. */
Expand Down
29 changes: 15 additions & 14 deletions ovsdb/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ ovsdb_txn_free(struct ovsdb_txn *txn)
}

static struct ovsdb_error *
ovsdb_txn_row_abort(struct ovsdb_txn *txn OVS_UNUSED,
struct ovsdb_txn_row *txn_row)
ovsdb_txn_row_hard_stop(struct ovsdb_txn *txn OVS_UNUSED,
struct ovsdb_txn_row *txn_row)
{
struct ovsdb_row *old = txn_row->old;
struct ovsdb_row *new = txn_row->new;
Expand Down Expand Up @@ -222,9 +222,9 @@ ovsdb_row_from_index_node(struct hmap_node *index_node,
}

void
ovsdb_txn_abort(struct ovsdb_txn *txn)
ovsdb_txn_hard_stop(struct ovsdb_txn *txn)
{
ovsdb_error_assert(for_each_txn_row(txn, ovsdb_txn_row_abort));
ovsdb_error_assert(for_each_txn_row(txn, ovsdb_txn_row_hard_stop));
ovsdb_txn_free(txn);
}

Expand Down Expand Up @@ -858,7 +858,7 @@ determine_changes(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)

if (!changed) {
/* Nothing actually changed in this row, so drop it. */
ovsdb_txn_row_abort(txn, txn_row);
ovsdb_txn_row_hard_stop(txn, txn_row);
}
} else {
bitmap_set_multiple(txn_row->changed, 0,
Expand Down Expand Up @@ -1086,11 +1086,11 @@ ovsdb_txn_precommit(struct ovsdb_txn *txn)
{
struct ovsdb_error *error;

/* Figure out what actually changed, and abort early if the transaction
* was really a no-op. */
/* Figure out what actually changed, and perform a hard stop early
* if the transaction was really a no-op. */
error = for_each_txn_row(txn, determine_changes);
if (error) {
ovsdb_txn_abort(txn);
ovsdb_txn_hard_stop(txn);
return OVSDB_WRAP_BUG("can't happen", error);
}
if (ovs_list_is_empty(&txn->txn_tables)) {
Expand Down Expand Up @@ -1248,7 +1248,7 @@ ovsdb_txn_replay_commit(struct ovsdb_txn *txn)
{
struct ovsdb_error *error = ovsdb_txn_precommit(txn);
if (error) {
ovsdb_txn_abort(txn);
ovsdb_txn_hard_stop(txn);
} else {
ovsdb_txn_add_to_history(txn);
ovsdb_txn_complete(txn);
Expand Down Expand Up @@ -1338,8 +1338,8 @@ ovsdb_txn_propose_commit(struct ovsdb_txn *txn, bool durable)
/* Proposes 'txn' for commitment and then waits for the commit to succeed or
* fail. Returns null if successful, otherwise the error.
*
* **In addition**, this function also completes or aborts the transaction if
* the transaction succeeded or failed, respectively. */
* **In addition**, this function also completes or performs a hard stop of
* the transaction if the transaction succeeded or failed, respectively. */
struct ovsdb_error * OVS_WARN_UNUSED_RESULT
ovsdb_txn_propose_commit_block(struct ovsdb_txn *txn, bool durable)
{
Expand All @@ -1352,7 +1352,7 @@ ovsdb_txn_propose_commit_block(struct ovsdb_txn *txn, bool durable)
ovsdb_txn_progress_destroy(p);

if (error) {
ovsdb_txn_abort(txn);
ovsdb_txn_hard_stop(txn);
} else {
ovsdb_txn_complete(txn);
}
Expand Down Expand Up @@ -1644,8 +1644,9 @@ ovsdb_txn_table_destroy(struct ovsdb_txn_table *txn_table)
}

/* Calls 'cb' for every txn_row within 'txn'. If 'cb' returns nonnull, this
* aborts the iteration and for_each_txn_row() passes the error up. Otherwise,
* returns a null pointer after iteration is complete.
* performs a hard stop of the iteration and for_each_txn_row() passes the
* error up. Otherwise, returns a null pointer after iteration is
* complete.
*
* 'cb' may insert new txn_rows and new txn_tables into 'txn'. It may delete
* the txn_row that it is passed in, or txn_rows in txn_tables other than the
Expand Down
2 changes: 1 addition & 1 deletion ovsdb/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct uuid;
struct ovsdb_txn *ovsdb_txn_create(struct ovsdb *);
void ovsdb_txn_set_txnid(const struct uuid *, struct ovsdb_txn *);
const struct uuid *ovsdb_txn_get_txnid(const struct ovsdb_txn *);
void ovsdb_txn_abort(struct ovsdb_txn *);
void ovsdb_txn_hard_stop(struct ovsdb_txn *);

bool ovsdb_txn_precheck_prereq(const struct ovsdb *db);
struct ovsdb_error *ovsdb_txn_replay_commit(struct ovsdb_txn *)
Expand Down
9 changes: 5 additions & 4 deletions ovsdb/trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ ovsdb_trigger_try(struct ovsdb_trigger *t, long long int now)

if (forwarding_needed) {
/* Transaction is good, but we don't need it. */
ovsdb_txn_abort(txn);
ovsdb_txn_hard_stop(txn);
json_destroy(result);
/* Transition to "forwarding" state. */
t->txn_forward = ovsdb_txn_forward_create(t->db, t->request);
Expand Down Expand Up @@ -360,10 +360,11 @@ ovsdb_trigger_try(struct ovsdb_trigger *t, long long int now)
}

/* Fall through to the general handling for the "committing" state. We
* abort the transaction--if and when it eventually commits, we'll read
* it back from storage and replay it locally. */
* perform a hard stop on the transaction--if and when it
* eventually commits, we'll read it back from storage and replay
* it locally. */
if (txn) {
ovsdb_txn_abort(txn);
ovsdb_txn_hard_stop(txn);
}
}

Expand Down
6 changes: 3 additions & 3 deletions python/ovs/db/idl.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def run(self):
seqno = self._session.get_seqno()
if seqno != self._last_seqno:
self._last_seqno = seqno
self.__txn_abort_all()
self.__txn_hard_stop_all()
self.restart_fsm()
if self.lock_name:
self.__send_lock_request()
Expand Down Expand Up @@ -1205,7 +1205,7 @@ def __create_row(self, table, uuid):
def __error(self):
self._session.force_reconnect()

def __txn_abort_all(self):
def __txn_hard_stop_all(self):
while self._outstanding_txns:
txn = self._outstanding_txns.popitem()[1]
txn._status = Transaction.TRY_AGAIN
Expand Down Expand Up @@ -1650,7 +1650,7 @@ class Transaction(object):
UNCHANGED = "unchanged"
# Commit in progress, please wait.
INCOMPLETE = "incomplete"
# ovsdb_idl_txn_abort() called.
# ovsdb_idl_txn_hard_stop() called.
ABORTED = "aborted"
# Commit successful.
SUCCESS = "success"
Expand Down
6 changes: 3 additions & 3 deletions tests/test-ovsdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@ do_transact_commit(struct ovs_cmdl_context *ctx OVS_UNUSED)
static void
do_transact_abort(struct ovs_cmdl_context *ctx OVS_UNUSED)
{
ovsdb_txn_abort(do_transact_txn);
ovsdb_txn_hard_stop(do_transact_txn);
do_transact_txn = NULL;
}

Expand Down Expand Up @@ -1918,7 +1918,7 @@ do_transact(struct ovs_cmdl_context *ctx)
free(args);
json_destroy(command);
}
ovsdb_txn_abort(do_transact_txn);
ovsdb_txn_hard_stop(do_transact_txn);
ovsdb_destroy(do_transact_db); /* Also destroys 'schema'. */
}

Expand Down Expand Up @@ -2529,7 +2529,7 @@ idl_set(struct ovsdb_idl *idl, char *commands, int step)
false);
increment = true;
} else if (!strcmp(name, "abort")) {
ovsdb_idl_txn_abort(txn);
ovsdb_idl_txn_hard_stop(txn);
ovsdb_idl_check_consistency(idl);
break;
} else if (!strcmp(name, "destroy")) {
Expand Down
6 changes: 3 additions & 3 deletions utilities/ovs-vsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3055,7 +3055,7 @@ do_vsctl(const char *args, struct ctl_command *commands, size_t n_commands,
OVS_NOT_REACHED();

case TXN_ABORTED:
/* Should not happen--we never call ovsdb_idl_txn_abort(). */
/* Should not happen--we never call ovsdb_idl_txn_hard_stop(). */
ctl_fatal("transaction aborted");

case TXN_UNCHANGED:
Expand Down Expand Up @@ -3141,7 +3141,7 @@ do_vsctl(const char *args, struct ctl_command *commands, size_t n_commands,
try_again:
/* Our transaction needs to be rerun, or a prerequisite was not met. Free
* resources and return so that the caller can try again. */
ovsdb_idl_txn_abort(txn);
ovsdb_idl_txn_hard_stop(txn);
ovsdb_idl_txn_destroy(txn);
the_idl_txn = NULL;

Expand All @@ -3164,7 +3164,7 @@ static void
vsctl_exit(int status)
{
if (the_idl_txn) {
ovsdb_idl_txn_abort(the_idl_txn);
ovsdb_idl_txn_hard_stop(the_idl_txn);
ovsdb_idl_txn_destroy(the_idl_txn);
}
ovsdb_idl_destroy(the_idl);
Expand Down
6 changes: 3 additions & 3 deletions vtep/vtep-ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static void
vtep_ctl_exit(int status)
{
if (the_idl_txn) {
ovsdb_idl_txn_abort(the_idl_txn);
ovsdb_idl_txn_hard_stop(the_idl_txn);
ovsdb_idl_txn_destroy(the_idl_txn);
}
ovsdb_idl_destroy(the_idl);
Expand Down Expand Up @@ -2366,7 +2366,7 @@ do_vtep_ctl(const char *args, struct ctl_command *commands,
OVS_NOT_REACHED();

case TXN_ABORTED:
/* Should not happen--we never call ovsdb_idl_txn_abort(). */
/* Should not happen--we never call ovsdb_idl_txn_hard_stop(). */
ctl_fatal("transaction aborted");

case TXN_UNCHANGED:
Expand Down Expand Up @@ -2434,7 +2434,7 @@ do_vtep_ctl(const char *args, struct ctl_command *commands,
/* Our transaction needs to be rerun, or a prerequisite was not met. Free
* resources and return so that the caller can try again. */
if (txn) {
ovsdb_idl_txn_abort(txn);
ovsdb_idl_txn_hard_stop(txn);
ovsdb_idl_txn_destroy(txn);
}
ovsdb_symbol_table_destroy(symtab);
Expand Down

0 comments on commit ecf715d

Please sign in to comment.