-
Notifications
You must be signed in to change notification settings - Fork 3
ci: merge staging to master #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- `@matrixai/db` 5.0.2 supports `ToString` lock requests
This was needed for the very specific case where `_open` was used to create a file during an existing transaction.
fix: `tests/inodes/INodeManager.test.ts` change to using `await expect().rejects.toThrow`
This just adds some tests that hit the API with a bunch of concurrent operations with random order. This is to check for any db transaction errors.
…`tests/utils.ts`
Updating js-db to 5.x.x (integrating RocksDB and DB-native concurrency control)
Pipeline Attempt on 617546516 for a3ec495 https://gitlab.com/MatrixAI/open-source/js-encryptedfs/-/pipelines/617546516 |
👇 Click on the image for a new way to code review
Legend |
Benchmarking and docs update. |
There is mac and windows failures to be addressed here. |
Pipeline Attempt on 617565977 for f1b5400 https://gitlab.com/MatrixAI/open-source/js-encryptedfs/-/pipelines/617565977 |
Pipeline Attempt on 617588642 for d0c5b18 https://gitlab.com/MatrixAI/open-source/js-encryptedfs/-/pipelines/617588642 |
Need to remember to use `utils.pathJoin` for EFS file paths and not `path.join` or `pathNode.join`.
Pipeline Attempt on 617614664 for 870e14d https://gitlab.com/MatrixAI/open-source/js-encryptedfs/-/pipelines/617614664 |
So a possible problem is that Now why would a transaction still exist? Especially one that is actually already committed. It could be due to the write stream/read stream closing the fd, which triggers a transactional GC operation. This closing operation however is an orphaned/dangling promise. It's not awaited for because the write/read streams are callback oriented but also written before alot of change to the EFS. So the transaction is probably being committed, and in the process of being destroyed. But at the same time a There are several possible solutions here. The main idea is that A quick solution might be remove the transaction from the transaction references as soon as This sort of means it's possible that the DB lifecycle is stopped BEFORE the tranaction is fully committed or rollbacked. I'm not entirely sure if this is an error. Another alternative is to change how the |
Let's try the second solution, change @ready(new errors.ErrorDBTransactionDestroyed())
public async rollback(e?: Error): Promise<void> { To: @ready(new errors.ErrorDBTransactionDestroyed(), true)
public async rollback(e?: Error): Promise<void> { And it should work fine... And also remove it from the transaction references after |
Do the same for |
I think there's a problem with the write and read stream implementation that is part if the root cause here. In our implementation of the It's annoying to test if any solution works since this is a hisenbug. |
Actually it's a bit more complicated than this. It's possible to have a transaction that is neither committed nor rollbacked but only because the transaction hasn't finished yet. It is truly a pending transaction. In this situation, we end up calling Now the DB itself is actually already stopped at this point, so this is a legitimate error. Furthermore I cannot use ready blocking on |
It's possible fixing this might fix #72. |
This is a possible bug leading to issues with #72?
Pipeline Attempt on 617727260 for 11bdc64 https://gitlab.com/MatrixAI/open-source/js-encryptedfs/-/pipelines/617727260 |
Looking at the streams API. It's more proper to await the I'm going to fix this in all of the tests. |
Pipeline Attempt on 619103821 for 3baad53 https://gitlab.com/MatrixAI/open-source/js-encryptedfs/-/pipelines/619103821 |
One test failed on the mac tests. Thankfully no failures was due to the already committed error so I think that's resolved now. Pushing up a quick fix for the failing test. |
Pipeline Attempt on 619111746 for b632511 https://gitlab.com/MatrixAI/open-source/js-encryptedfs/-/pipelines/619111746 |
The benchmarks here actually don't bench the EFS at all. So you should remove the New EFS benchmarks can be written in a new PR. Can do this later. |
Looks like we're still getting a transaction already committed error but this one is different,
This one doesn't seem to be related to the streaming. Looks like the commonality here is file/inode creation? I'll need to do some digging. |
That messages comes from the C++ code, not from the JS code. It appears it's not actually wrapped in an error. There's a code for this that I'm not catching in the js-db cause I didn't expect to see these errors. The error code is #define ASSERT_TRANSACTION_READY_CB(env, transaction, callback) \
if (transaction->isCommitting_ || transaction->hasCommitted_) { \
napi_value callback_error = CreateCodeError( \
env, "TRANSACTION_COMMITTED", "Transaction is already committed"); \
NAPI_STATUS_THROWS(CallFunction(env, callback, 1, &callback_error)); \
NAPI_RETURN_UNDEFINED(); \
} \
if (transaction->isRollbacking_ || transaction->hasRollbacked_) { \
napi_value callback_error = CreateCodeError( \
env, "TRANSACTION_ROLLBACKED", "Transaction is already rollbacked"); \
NAPI_STATUS_THROWS(CallFunction(env, callback, 1, &callback_error)); \
NAPI_RETURN_UNDEFINED(); \
}
#define ASSERT_TRANSACTION_READY(env, transaction) \
if (transaction->isCommitting_ || transaction->hasCommitted_) { \
napi_throw_error(env, "TRANSACTION_COMMITTED", \
"Transaction is already committed"); \
NAPI_RETURN_UNDEFINED(); \
} \
if (transaction->isRollbacking_ || transaction->hasRollbacked_) { \
napi_throw_error(env, "TRANSACTION_ROLLBACKED", \
"Transaction is already rollbacked"); \
NAPI_RETURN_UNDEFINED(); \
} |
See that I'm not even catching that:
The only code I expect at 484 is How did you manage to try to call |
I think I see that you're getting during garbage collection. Do note that garbage collection transaction should be independent from any user created filesystem operation. |
You might want to review the GC logic again, cause I wrote that back when the DB didn't have fully consistent reads and writes. Might have missed something when updating to the new DB. |
Pipeline Attempt on 619126074 for 84e74f8 https://gitlab.com/MatrixAI/open-source/js-encryptedfs/-/pipelines/619126074 |
This was odd since it should've been caught by linting.
Pipeline Attempt on 619131619 for 679abce https://gitlab.com/MatrixAI/open-source/js-encryptedfs/-/pipelines/619131619 |
Probably worthwhile to also catch those errors and rethrow as JS errors since it appears to be possible if an asynchronous function is called with a reference to the transaction and the transaction gets committed. This sort of happens due to |
Pipeline Succeeded on 619131619 for 679abce https://gitlab.com/MatrixAI/open-source/js-encryptedfs/-/pipelines/619131619 |
Ok we have it working now. Changing to the native promise as the species actually makes the coder simpler since I can rely on
Also the usage of |
The docs for |
This is an automatic PR generated by the pipeline CI/CD. This will be automatically fast-forward merged if successful.