diff --git a/agent/consul/state/kvs_oss.go b/agent/consul/state/kvs_oss.go index 096d019f9..54387e0d9 100644 --- a/agent/consul/state/kvs_oss.go +++ b/agent/consul/state/kvs_oss.go @@ -120,3 +120,7 @@ func kvsDeleteWithEntry(tx WriteTxn, entry *structs.DirEntry, idx uint64) error func partitionedIndexEntryName(entry string, _ string) string { return entry } + +func partitionedAndNamespacedIndexEntryName(entry string, _ *structs.EnterpriseMeta) string { + return entry +} diff --git a/agent/consul/state/session.go b/agent/consul/state/session.go index eb9af32f6..043d86f80 100644 --- a/agent/consul/state/session.go +++ b/agent/consul/state/session.go @@ -296,8 +296,7 @@ func (s *Store) SessionGet(ws memdb.WatchSet, tx := s.db.Txn(false) defer tx.Abort() - // Get the table index. - idx := sessionMaxIndex(tx, entMeta) + idx := maxIndexTxnSessions(tx, entMeta) // Look up the session by its ID if entMeta == nil { @@ -324,7 +323,7 @@ func (s *Store) NodeSessions(ws memdb.WatchSet, nodeID string, entMeta *structs. defer tx.Abort() // Get the table index. - idx := sessionMaxIndex(tx, entMeta) + idx := maxIndexTxnSessions(tx, entMeta) // Get all of the sessions which belong to the node result, err := nodeSessionsTxn(tx, ws, nodeID, entMeta) diff --git a/agent/consul/state/session_oss.go b/agent/consul/state/session_oss.go index 478cd5b0f..2955a598b 100644 --- a/agent/consul/state/session_oss.go +++ b/agent/consul/state/session_oss.go @@ -183,3 +183,7 @@ func (s *Store) SessionList(ws memdb.WatchSet, entMeta *structs.EnterpriseMeta) return idx, result, nil } + +func maxIndexTxnSessions(tx *memdb.Txn, _ *structs.EnterpriseMeta) uint64 { + return maxIndexTxn(tx, tableSessions) +} diff --git a/agent/consul/state/session_test.go b/agent/consul/state/session_test.go index daeefc491..2e841500a 100644 --- a/agent/consul/state/session_test.go +++ b/agent/consul/state/session_test.go @@ -72,7 +72,7 @@ func TestStateStore_SessionCreate_SessionGet(t *testing.T) { if err := s.SessionCreate(2, sess); err != nil { t.Fatalf("err: %s", err) } - if idx := s.maxIndex("sessions"); idx != 2 { + if idx := s.maxIndex(partitionedAndNamespacedIndexEntryName(tableSessions, &sess.EnterpriseMeta)); idx != 2 { t.Fatalf("bad index: %s", err) } if !watchFired(ws) { @@ -379,7 +379,7 @@ func TestStateStore_SessionDestroy(t *testing.T) { } // Check that the index was updated - if idx := s.maxIndex("sessions"); idx != 3 { + if idx := s.maxIndex(partitionedAndNamespacedIndexEntryName(tableSessions, &sess.EnterpriseMeta)); idx != 3 { t.Fatalf("bad index: %d", idx) }