irods / irods_capability_storage_tiering

BSD 3-Clause "New" or "Revised" License
5 stars 10 forks source link

implement preserve.replicas when restaging files #234

Closed cookie33 closed 9 months ago

cookie33 commented 10 months ago

Implement fix for: https://github.com/irods/irods_capability_storage_tiering/issues/233

cookie33 commented 10 months ago

We have to think about it. It works as follows for a restage:

cookie33 commented 9 months ago

Changed one query:

-            boost::format("SELECT META_DATA_ATTR_VALUE WHERE DATA_NAME = '%s' AND COLL_NAME = '%s' AND META_DATA_ATTR_NAME = '%s' AND META_DATA_ATTR_UNITS = '%s'")
+            boost::format("SELECT META_DATA_ATTR_VALUE WHERE DATA_NAME = '%s' AND COLL_NAME = '%s' AND META_DATA_ATTR_NAME = '%s' AND META_DATA_ATTR_UNITS >= '%s'")

This makes sure that the function get_group_name_by_replica_number will work even if the replica has a lower number than the unit in irods::storage_tiering::group

alanking commented 9 months ago

I left a comment in #232 regarding the query update: https://github.com/irods/irods_capability_storage_tiering/issues/232#issuecomment-1852808480

cookie33 commented 9 months ago

I made it a draft pull request. I will make some tests in bash and when that is OK I will convert it back to a real pull request again. The test will be similar like the automated tests from the irods consortium itself.

korydraughn commented 9 months ago

packaging/test_plugin_unified_storage_tiering.py contains all of our tests. All tests are expected to be implemented using Python.

We can also translate your bash tests into python if that helps.

cookie33 commented 9 months ago

I tried running the python tests on my system. But the first thing it does is stop the iRODS server :(

I will try to get it running in a similar fashion as the iRODS tests. This will make it easier to incorporate. After that I will update the official test_plugin_unified_storage_tiering.py with my updates after testing as much as possible.

But it will take some time to get some proper tests together. So please bear with me.

korydraughn commented 9 months ago

That's correct. The run_tests.py script restarts the server before launching the tests to make sure the environment is ready.

Tests which depend on the delay server (like this project) normally restart the server too.

We're happy to help you cross the finish line :-)

korydraughn commented 9 months ago

Forgot to mention that you can use the iRODS Development Environment to run the tests easier. See https://github.com/irods/irods_development_environment.

With that, you can use the plugin builder and plugin test runners to build and test.

cookie33 commented 9 months ago

Updated test_plugin_unified_storage_tiering_test .py in the class TestStorageTieringPluginPreserveReplica

Renamed one test to test_put because it did not do a get. Added 4 other tests where preserve_replicas is set to true. With some tests it now also checks if the replication number is the one which is expected.

tested:

$ time python3 run_tests.py --run_specific_test test_plugin_unified_storage_tiering > /tmp/test.txt
irods.test.test_plugin_unified_storage_tiering_test.TestStorageTieringPluginPreserveReplica.test_put ... ok
irods.test.test_plugin_unified_storage_tiering_test.TestStorageTieringPluginPreserveReplica.test_put_and_get_01 ... ok
irods.test.test_plugin_unified_storage_tiering_test.TestStorageTieringPluginPreserveReplica.test_put_and_get_02 ... ok
irods.test.test_plugin_unified_storage_tiering_test.TestStorageTieringPluginPreserveReplica.test_put_and_get_03 ... ok
irods.test.test_plugin_unified_storage_tiering_test.TestStorageTieringPluginPreserveReplica.test_put_and_get_04 ... ok

----------------------------------------------------------------------
Ran 5 tests in 308.318s

OK

real    5m8.492s
user    0m4.896s
sys     0m1.739s
alanking commented 9 months ago

Confirmed that tests are passing. Added #s. Merging.