diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index ad781d0c..38c77787 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -113,6 +113,24 @@ jobs: echo "" done + test_cas_imm: + runs-on: ubuntu-latest + needs: build + container: ${{env.TEST_IMAGE}}:${{github.sha}} + steps: + - name: Run test + id: test + timeout-minutes: 3 + run: IMMEDIATE_COMMIT=1 /root/vitastor/tests/test_cas.sh + - name: Print logs + if: always() && steps.test.outcome == 'failure' + run: | + for i in /root/vitastor/testdata/*.log /root/vitastor/testdata/*.txt; do + echo "-------- $i --------" + cat $i + echo "" + done + test_change_pg_count: runs-on: ubuntu-latest needs: build diff --git a/src/client/cluster_client.cpp b/src/client/cluster_client.cpp index a67dca19..38e4e7ba 100644 --- a/src/client/cluster_client.cpp +++ b/src/client/cluster_client.cpp @@ -925,7 +925,7 @@ void cluster_client_t::execute_cas(cluster_op_t *op, bool nosync) cb(op); return; } - if (!(op->flags & OP_IMMEDIATE_COMMIT) && !nosync && + if ((!(op->flags & OP_IMMEDIATE_COMMIT) || enable_writeback) && !nosync && wb->has_dirty(op->inode, op->offset, op->len)) { cluster_op_t *sync_op = new cluster_op_t; @@ -1322,7 +1322,7 @@ resume_2: op->retval = op->len / pool_cfg.bitmap_granularity; } } - if (op->flush_id) + if (op->flush_id && !(op->flags & OP_IMMEDIATE_COMMIT)) { wb->mark_flush_written(op->inode, op->offset, op->len, op->flush_id); } diff --git a/tests/run_tests.sh b/tests/run_tests.sh index caac41b7..28abe6ba 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -6,6 +6,7 @@ cd $(dirname $0) ./test_add_osd.sh ./test_cas.sh +IMMEDIATE_COMMIT=1 ./test_cas.sh ./test_change_pg_count.sh SCHEME=ec ./test_change_pg_count.sh