From 6429953a652041de343a382cfa6e33c6291bf283 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Fri, 24 Jan 2020 03:56:46 -0500 Subject: [PATCH] ut/blob: do not check for success on power failure UT g_bserrno from blob deletion or snapshot creation, should not be checked. It is implementation dependent whether the error (or success) from those calls actually means that enough data was persisted on disk. This test case should work even if we set the threshold high enough that no failed opperations occur. On the other hand some parts of those calls do cleanup in them, meanwhile there is enough metadata data on disk already. Such as cleaning up unused clusters or pages issue writes, but at that point the blobs already are in expected state. Thus removed assert for g_bserrno, as failure is not indicative of impossibility to recover. While here, removed the spdk_bs_unload(). This UT are for testing power fail safety. Never should it be the case that enough writes occured in create/delete, but blobs are not in the expected state. When such bug would be introduced, it could be covered up by spdk_bs_unload() cleanly closing up the blobstore. Signed-off-by: Tomasz Zawadzki Change-Id: Ic69c3061f2cc1fe04bf895632cdb11efb2fe6912 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482660 Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Paul Luse Tested-by: SPDK CI Jenkins --- test/unit/lib/blob/blob.c/blob_ut.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/unit/lib/blob/blob.c/blob_ut.c b/test/unit/lib/blob/blob.c/blob_ut.c index 45e7bd8be..14bd86ccf 100644 --- a/test/unit/lib/blob/blob.c/blob_ut.c +++ b/test/unit/lib/blob/blob.c/blob_ut.c @@ -6484,10 +6484,10 @@ blob_delete_snapshot_power_failure(void) spdk_bs_delete_blob(bs, snapshotid, blob_op_complete, NULL); poll_threads(); - CU_ASSERT(g_bserrno != 0); - spdk_bs_unload(g_bs, bs_op_complete, NULL); - poll_threads(); + /* Do not shut down cleanly. Assumption is that after snapshot deletion + * reports success, changes to both blobs should already persisted. */ + _spdk_bs_free(bs); dev_reset_power_failure_event(); @@ -6594,11 +6594,11 @@ blob_create_snapshot_power_failure(void) /* Create snapshot */ spdk_bs_create_snapshot(bs, blobid, NULL, blob_op_with_id_complete, NULL); poll_threads(); - CU_ASSERT(g_bserrno != 0); snapshotid = g_blobid; - spdk_bs_unload(g_bs, bs_op_complete, NULL); - poll_threads(); + /* Do not shut down cleanly. Assumption is that after create snapshot + * reports success, both blobs should be power-fail safe. */ + _spdk_bs_free(bs); dev_reset_power_failure_event();