From a0b5c5d13e2f33615522240fb6542faeb3f2df8a Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Thu, 25 Jun 2015 14:13:51 -0400 Subject: [PATCH] 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 --- db/legacy_schema_tables.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/legacy_schema_tables.cc b/db/legacy_schema_tables.cc index 34e8ed8f9e..c5a9e95dea 100644 --- a/db/legacy_schema_tables.cc +++ b/db/legacy_schema_tables.cc @@ -579,7 +579,7 @@ std::vector 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); }