do not move altered inside capture

If we move altered inside this lambda, the next invocations of the outter
lambda will see a corrupted value. So in the case of smp, invoke_on_all will
invoke correctly in the first shard, but then see a bogus altered vector on
the subsequent ones.

Capturing a reference is fine, because the outer lambda will not be destroyed
until the inner one completes - so the object will live in the capture list.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This commit is contained in:
Glauber Costa
2015-06-25 14:13:51 -04:00
committed by Tomasz Grabiec
parent 90412a2b26
commit a0b5c5d13e

View File

@@ -579,7 +579,7 @@ std::vector<const char*> ALL { KEYSPACES, COLUMNFAMILIES, COLUMNS, TRIGGERS, USE
return do_for_each(created, [&db] (auto&& val) {
auto ksm = create_keyspace_from_schema_partition(val);
return db.create_keyspace(std::move(ksm));
}).then([altered = std::move(altered), &db] () mutable {
}).then([&altered, &db] () mutable {
for (auto&& name : altered) {
db.update_keyspace(name);
}