Thanks for the fixes! See 4 comments below.
11-12:
diff --git a/test/reload_evolution/storage_1_a.lua
b/test/reload_evolution/storage_1_a.lua
new file mode 100755
index 0000000..3e03f8f
--- /dev/null
+++ b/test/reload_evolution/storage_1_a.lua
@@ -0,0 +1,144 @@
+#!/usr/bin/env tarantool
11. Just use a symbolic link to the existing storage_1_a. Same
for other storages.
diff --git a/test/reload_evolution/suite.ini b/test/reload_evolution/suite.ini
new file mode 100644
index 0000000..bb5435b
--- /dev/null
+++ b/test/reload_evolution/suite.ini
12. You do not need a new test suite for one storage test. Please,
put it into test/storage/
I have modified storage_1_a to change luapath.
It is important to change path here, because the default Vshard initialization
is performed here.
But it is not a version. Version is a git tag.
diff --git a/vshard/storage/init.lua b/vshard/storage/init.lua
index bf560e6..1740c98 100644
--- a/vshard/storage/init.lua
+++ b/vshard/storage/init.lua
@@ -105,6 +110,11 @@ if not M then
-- a destination replicaset must drop already received
-- data.
rebalancer_sending_bucket = 0,
+
+ ------------------------- Reload -------------------------
+ -- Version of the loaded module. This number is used on
+ -- reload to determine which upgrade scripts to run.
+ reload_evolution_version = reload_evolution.version,
13. Use 'version' name.
We already have module_version and git tag. To make everything clear I would
like to
name the variable in that or similar way.
fixed
}
end
diff --git a/vshard/storage/reload_evolution.lua
b/vshard/storage/reload_evolution.lua
new file mode 100644
index 0000000..cfac888
--- /dev/null
+++ b/vshard/storage/reload_evolution.lua
@@ -0,0 +1,58 @@
+--
+-- This module is used to upgrade the vshard.storage on the fly.
+-- It updates internal Lua structures in case they are changed
+-- in a commit.
+--
+local log = require('log')
+
+--
+-- Array of upgrade functions.
+-- magrations[version] = function which upgrades module version
14. Typo: magrations.
Disagree. That would make us to
+-- from `version` to `version + 1`.
15. Not +1. I think, we should use real version numbers:
0.1.1, 0.1.2, etc similar to tarantool.
1. Tag commit each time M is changed
2. Maintain identical git tags and reload_evolution_version names.
In the introduced all you need to do is just to append callback to the
`migrations` array.