Skip to content

Commit 07d83b8

Browse files
authored
[FIXED] Set AllowDirect for upgrades from prior to 2.9.x (#1213)
1 parent edb105c commit 07d83b8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kv.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,15 @@ func (js *js) CreateKeyValue(cfg *KeyValueConfig) (KeyValue, error) {
446446
// and we are now moving to a v2.7.2+. If that is the case
447447
// and the only difference is the discard policy, then update
448448
// the stream.
449+
// The same logic applies for KVs created pre 2.9.x and
450+
// the AllowDirect setting.
449451
if err == ErrStreamNameAlreadyInUse {
450452
if si, _ = js.StreamInfo(scfg.Name); si != nil {
451453
// To compare, make the server's stream info discard
452454
// policy same than ours.
453455
si.Config.Discard = scfg.Discard
456+
// Also need to set allow direct for v2.9.x+
457+
si.Config.AllowDirect = scfg.AllowDirect
454458
if reflect.DeepEqual(&si.Config, scfg) {
455459
si, err = js.UpdateStream(scfg)
456460
}

0 commit comments

Comments
 (0)