From d44d62e8039acfb174fdc2dbfea86430f71720cb Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Wed, 10 Mar 2021 16:23:13 -0500 Subject: [PATCH] remove prefix matching [from PR GH-10158] --- nomad/state/state_store.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nomad/state/state_store.go b/nomad/state/state_store.go index f4738e2d70d5..e6a6bf5f6d58 100644 --- a/nomad/state/state_store.go +++ b/nomad/state/state_store.go @@ -2126,20 +2126,20 @@ func (s *StateStore) CSIVolumes(ws memdb.WatchSet) (memdb.ResultIterator, error) func (s *StateStore) CSIVolumeByID(ws memdb.WatchSet, namespace, id string) (*structs.CSIVolume, error) { txn := s.db.ReadTxn() - watchCh, obj, err := txn.FirstWatch("csi_volumes", "id_prefix", namespace, id) + obj, err := txn.First("csi_volumes", "id", namespace, id) if err != nil { - return nil, fmt.Errorf("volume lookup failed: %s %v", id, err) + return nil, fmt.Errorf("volume lookup failed: %s: %v", id, err) } - - ws.Add(watchCh) - if obj == nil { return nil, nil } + vol, ok := obj.(*structs.CSIVolume) + if !ok { + return nil, fmt.Errorf("volume row conversion error") + } // we return the volume with the plugins denormalized by default, // because the scheduler needs them for feasibility checking - vol := obj.(*structs.CSIVolume) return s.CSIVolumeDenormalizePluginsTxn(txn, vol.Copy()) }