Skip to content

Cannot delete Compare Exchange Items #290

@slidwell44

Description

@slidwell44

After following this example on creating Compare Exchange Items, I have a workflow where I then need to delete it after the work is done.

To delete_compare_exchange_value I could do something like:

def remove_compare_exchange_item(self) -> None:
    with self.document_store.open_session(
        session_options=SessionOptions(
            transaction_mode=TransactionMode.CLUSTER_WIDE
        )
    ) as session:
        current_lock: CompareExchangeValue[DocumentsCompareExchangeItem] | None = (
            session.advanced.cluster_transaction.get_compare_exchange_value(
                key=self.compare_exchange_key,
                object_type=DocumentsCompareExchangeItem,
            )
        )
    
        if current_lock is None:
            logger.info(
                "No compare exchange item found to remove",
                key=self.compare_exchange_key,
            )
            return
    
        session.advanced.cluster_transaction.delete_compare_exchange_value(
            current_lock
        )
        session.save_changes()

Or a combination of:

session.advanced.cluster_transaction.delete_compare_exchange_value(
    item_or_key=current_lock.key, index=current_lock.index
)

Lastly:

session.advanced.cluster_transaction.delete_compare_exchange_value(
    item_or_key=current_lock, index=current_lock.index
)

However, no matter how I format the arguments to session.advanced.cluster_transaction.delete_compare_exchange_value(), the Compare Exchange Item is not removed from RavenDB Server. There are no errors thrown during this process.

Edit:

  • This is using ravendb client version 7.2.0
  • This is using ravendb server version 7.2.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions