Fix spelling: commited -> committed (#6481)

Summary:
In most places in the code the variable names are spelled correctly as
COMMITTED but in a couple places not. This fixes them and ensures the
variable is always called COMMITTED everywhere.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6481

Differential Revision: D20306776

Pulled By: pdillinger

fbshipit-source-id: b6c1bfe41db559b4bc6955c530934460c07f7022
main
Otto Kekäläinen 5 years ago committed by Facebook Github Bot
parent e171a219d5
commit f6c2777d95
  1. 3
      HISTORY.md
  2. 3
      include/rocksdb/utilities/transaction.h
  3. 2
      java/rocksjni/transaction.cc
  4. 8
      java/src/main/java/org/rocksdb/Transaction.java
  5. 2
      java/src/test/java/org/rocksdb/TransactionTest.java
  6. 16
      utilities/transactions/pessimistic_transaction.cc

@ -1,5 +1,8 @@
# Rocksdb Change Log
## Unreleased
### Public API Change
* Fix spelling so that API now has correctly spelled transaction state name `COMMITTED`, while the old misspelled `COMMITED` is still available as an alias.
### Bug Fixes
* Fix a bug where range tombstone blocks in ingested files were cached incorrectly during ingestion. If range tombstones were read from those incorrectly cached blocks, the keys they covered would be exposed.
* Fix a data race that might cause crash when calling DB::GetCreationTimeOfOldestFile() by a small chance. The bug was introduced in 6.6 Release.

@ -491,7 +491,8 @@ class Transaction {
AWAITING_PREPARE = 1,
PREPARED = 2,
AWAITING_COMMIT = 3,
COMMITED = 4,
COMMITTED = 4,
COMMITED = COMMITTED, // old misspelled name
AWAITING_ROLLBACK = 5,
ROLLEDBACK = 6,
LOCKS_STOLEN = 7,

@ -1605,7 +1605,7 @@ jbyte Java_org_rocksdb_Transaction_getState(JNIEnv* /*env*/, jobject /*jobj*/,
case ROCKSDB_NAMESPACE::Transaction::TransactionState::AWAITING_COMMIT:
return 0x3;
case ROCKSDB_NAMESPACE::Transaction::TransactionState::COMMITED:
case ROCKSDB_NAMESPACE::Transaction::TransactionState::COMMITTED:
return 0x4;
case ROCKSDB_NAMESPACE::Transaction::TransactionState::AWAITING_ROLLBACK:

@ -1788,11 +1788,17 @@ public class Transaction extends RocksObject {
AWAITING_PREPARE((byte)1),
PREPARED((byte)2),
AWAITING_COMMIT((byte)3),
COMMITED((byte)4),
COMMITTED((byte)4),
AWAITING_ROLLBACK((byte)5),
ROLLEDBACK((byte)6),
LOCKS_STOLEN((byte)7);
/*
* Keep old misspelled variable as alias
* Tip from https://stackoverflow.com/a/37092410/454544
*/
public static final TransactionState COMMITED = COMMITTED;
private final byte value;
TransactionState(final byte value) {

@ -209,7 +209,7 @@ public class TransactionTest extends AbstractTransactionTest {
.isSameAs(Transaction.TransactionState.STARTED);
txn.commit();
assertThat(txn.getState())
.isSameAs(Transaction.TransactionState.COMMITED);
.isSameAs(Transaction.TransactionState.COMMITTED);
}
try(final Transaction txn = dbContainer.beginTransaction()) {

@ -95,7 +95,7 @@ PessimisticTransaction::~PessimisticTransaction() {
if (expiration_time_ > 0) {
txn_db_impl_->RemoveExpirableTransaction(txn_id_);
}
if (!name_.empty() && txn_state_ != COMMITED) {
if (!name_.empty() && txn_state_ != COMMITTED) {
txn_db_impl_->UnregisterTransaction(this);
}
}
@ -108,7 +108,7 @@ void PessimisticTransaction::Clear() {
void PessimisticTransaction::Reinitialize(
TransactionDB* txn_db, const WriteOptions& write_options,
const TransactionOptions& txn_options) {
if (!name_.empty() && txn_state_ != COMMITED) {
if (!name_.empty() && txn_state_ != COMMITTED) {
txn_db_impl_->UnregisterTransaction(this);
}
TransactionBaseImpl::Reinitialize(txn_db->GetRootDB(), write_options);
@ -156,7 +156,7 @@ Status PessimisticTransaction::CommitBatch(WriteBatch* batch) {
txn_state_.store(AWAITING_COMMIT);
s = CommitBatchInternal(batch);
if (s.ok()) {
txn_state_.store(COMMITED);
txn_state_.store(COMMITTED);
}
} else if (txn_state_ == LOCKS_STOLEN) {
s = Status::Expired();
@ -209,7 +209,7 @@ Status PessimisticTransaction::Prepare() {
s = Status::Expired();
} else if (txn_state_ == PREPARED) {
s = Status::InvalidArgument("Transaction has already been prepared.");
} else if (txn_state_ == COMMITED) {
} else if (txn_state_ == COMMITTED) {
s = Status::InvalidArgument("Transaction has already been committed.");
} else if (txn_state_ == ROLLEDBACK) {
s = Status::InvalidArgument("Transaction has already been rolledback.");
@ -307,7 +307,7 @@ Status PessimisticTransaction::Commit() {
}
Clear();
if (s.ok()) {
txn_state_.store(COMMITED);
txn_state_.store(COMMITTED);
}
}
} else if (commit_prepared) {
@ -330,10 +330,10 @@ Status PessimisticTransaction::Commit() {
txn_db_impl_->UnregisterTransaction(this);
Clear();
txn_state_.store(COMMITED);
txn_state_.store(COMMITTED);
} else if (txn_state_ == LOCKS_STOLEN) {
s = Status::Expired();
} else if (txn_state_ == COMMITED) {
} else if (txn_state_ == COMMITTED) {
s = Status::InvalidArgument("Transaction has already been committed.");
} else if (txn_state_ == ROLLEDBACK) {
s = Status::InvalidArgument("Transaction has already been rolledback.");
@ -423,7 +423,7 @@ Status PessimisticTransaction::Rollback() {
}
// prepare couldn't have taken place
Clear();
} else if (txn_state_ == COMMITED) {
} else if (txn_state_ == COMMITTED) {
s = Status::InvalidArgument("This transaction has already been committed.");
} else {
s = Status::InvalidArgument(

Loading…
Cancel
Save