From a4be4c49e8ca5d28c6ab6f7c22a56503f00f4475 Mon Sep 17 00:00:00 2001 From: Tamo Date: Mon, 23 Jan 2023 23:58:03 +0100 Subject: [PATCH] Update index-scheduler/src/batch.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clément Renault --- index-scheduler/src/batch.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index b52d3d495..97fc14e44 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -1001,17 +1001,14 @@ impl IndexScheduler { if let Some(primary_key) = primary_key { match index.primary_key(index_wtxn)? { - // if a primary key was set AND had already be defined in the index - // but to a different value then we can make the whole batch fail. - Some(pk) if primary_key != pk => { + // if a primary key was set AND had already been defined in the index + // but to a different value, we can make the whole batch fail. + Some(pk) => if primary_key != pk { return Err(milli::Error::from( milli::UserError::PrimaryKeyCannotBeChanged(pk.to_string()), ) .into()); } - // if the primary key was set and equal to the one already set for - // the index then there is nothing to do. - Some(_) => (), // if the primary key was set and there was no primary key set for this index // we set it to the received value before starting the indexing process. None => {