回滚数据库更改

发布于 2024-09-05 00:37:20 字数 181 浏览 2 评论 0原文

我在使用工作流程管理工具的团队中工作。我面临一个挑战,用户应该能够将流程中随时所做的更改回滚到过去的某个点。当然,收费站可以处理它,但在这些活动期间可能进行的额外数据库调用必须手动回滚。

挑战在于存在多个并行路径以及外部数据库调用的不同排列。那么是否有一个框架或方法来跟踪这些数据库调用并回滚它们?

谢谢你, 贾斯汀

I work in team which uses Work flow management tool. I was presented with a challenge where the user should be able to roll back the changes made anytime during the flow to a certain point in the past. Surely the toll can handle it but the additional database calls that may have made during these activities have to be manually rolled back.

the challenge is that there are multiple parallel paths and there different permutations of external database calls. So is there a frame work or a way to keep track of these DB calls and rollback them?.

thank you,
Justin

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

陌伤ぢ 2024-09-12 00:37:21

嗯,我不这么认为。

例如,在实体框架中,您有TRANSACTIONSROLLBACK函数,但此ROLLBACK仅在此TRANSACTION中更改 从这个开始开始(START TRANSACTION - SQL 语句

然后您必须在多个并行路径中启动一个 TRANSACTION 并做出COMMITROLLBACK 更改的决定。但在COMMIT之前,其他并行实例将看不到其他尚未COMMITEDTRANSACTIONS中所做的更改。

我认为,您必须对您的应用程序/数据库进行一些重构,但这只是题外话的提示。

Hmm, i dont think so.

In Entity Framework for example you have TRANSACTIONS and ROLLBACK function but this ROLLBACK only changes in this TRANSACTION from begining of this start (START TRANSACTION - SQL Statement)

Then you will must have in multiple parallel paths start a TRANSACTION and take a decision of COMMIT or ROLLBACK changes. But before COMMIT other parallel instances will not see changes maded in other TRANSACTIONS who will not COMMITED yet.

I think, you must do some refactorization on your application/database, but this is only offtopic hint.

汐鸠 2024-09-12 00:37:21

提交到数据库的这些更改是否已处于中间状态?那会有问题的。由于其他用户可能已经根据提交的数据开始了操作。

我见过在提交之前支持 n 级撤消的系统(CSLA 就是这样做的),但这是在内存中的对象模型级别。

您不会无限期地保持数据库事务打开以等待用户操作。

Are these changes committed to the database already at an intermediate state? That's going to be problematic. Since other users may have started actions based on committed data.

I have seen systems which support n-level undo prior to commit (CSLA does this), but this is at the object model level in memory.

You would not hold a database transaction open indefinitely waiting for user action.

潜移默化 2024-09-12 00:37:21

是否需要回滚或者需要数据处于某种状态?我问,如果是后者,那么问题就是将您的记录设置回工作流程步骤 X 之前的值。

有一种设计模式称为 Momento 模式,按关键时间间隔拍摄对象快照,并将该数据保留在数据库中的“当前”数据之外。这种类型的事务可以存储为对象的序列化并进行记录,因此您需要为当前拥有的每个表创建一个历史表。

诀窍是从 Memento 事务中恢复您的对象,并将数据保存回您的标准表中。

Do you need to rollback or do you need the data to be in a certain state? I ask since if the latter is the case, then it is a matter or setting your record back to values that you had prior to Workflow step X.

There is a design pattern called the Momento Pattern that takes a snapshot of your objects at key intervals and persists that data in addition to the "current" data in your database. This type transaction could be stored as a serialization of your objects and recorded and hence you would need to create a history table for every table that you currently have.

The trick will be to restore your objects from the Memento transactions, the save the data back to you standard tables.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文