Skip to content

Commit fd86465

Browse files
committed
remove shared-DM from keep-alive piggy-back; expire locally
* part-one commit of the two-part sequence to fix: - #316 * remove SDM from fast-keepalive (=> primary) and stream-toggle (by primary) * rewrite the logic to track local SDM activity - in particular,use both `last` time _and_ in-flight ref-count ---- * separately, node-state alerts: classify keep-alive errors as a _warning_ Signed-off-by: Alex Aizman <alex.aizman@gmail.com>
1 parent a07c0c8 commit fd86465

12 files changed

Lines changed: 125 additions & 170 deletions

File tree

ais/htrun.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,7 +2385,7 @@ func (h *htrun) regTo(url string, psi *meta.Snode, tout time.Duration, htext hte
23852385
}
23862386

23872387
// (fast path: nodes => primary)
2388-
func (h *htrun) fastKalive(smap *smapX, timeout time.Duration, ecActive, dmActive bool) (string /*pid*/, http.Header, error) {
2388+
func (h *htrun) fastKalive(smap *smapX, timeout time.Duration, ecActive bool) (string /*pid*/, http.Header, error) {
23892389
if nlog.Stopping() {
23902390
return "", http.Header{}, h.errStopping()
23912391
}
@@ -2399,15 +2399,12 @@ func (h *htrun) fastKalive(smap *smapX, timeout time.Duration, ecActive, dmActiv
23992399
cargs.req = cmn.HreqArgs{Method: http.MethodPost, Base: primaryURL, Path: apc.URLPathCluKalive.Join(h.SID())}
24002400
cargs.timeout = timeout
24012401
}
2402-
if ecActive || dmActive {
2402+
if ecActive {
24032403
// (target => primary)
24042404
hdr := make(http.Header, 1)
24052405
if ecActive {
24062406
hdr.Set(apc.HdrActiveEC, "true")
24072407
}
2408-
if dmActive {
2409-
hdr.Set(apc.HdrActiveDM, "true")
2410-
}
24112408
cargs.req.Header = hdr
24122409
}
24132410

ais/kalive.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"github.com/NVIDIA/aistore/ec"
2222
"github.com/NVIDIA/aistore/stats"
2323
"github.com/NVIDIA/aistore/sys"
24-
"github.com/NVIDIA/aistore/transport/bundle"
2524
)
2625

2726
const (
@@ -140,7 +139,7 @@ func (tkr *talive) sendKalive(smap *smapX, timeout time.Duration, _ int64, fast
140139
}
141140
if fast {
142141
debug.Assert(ec.ECM != nil)
143-
pid, _, err = t.fastKalive(smap, timeout, ec.ECM.IsActive(), bundle.SDM.IsActive())
142+
pid, _, err = t.fastKalive(smap, timeout, ec.ECM.IsActive())
144143
return pid, 0, err
145144
}
146145
return t.slowKalive(smap, tkr.t, timeout)
@@ -198,18 +197,12 @@ func (pkr *palive) sendKalive(smap *smapX, timeout time.Duration, now int64, fas
198197
debug.Assert(!smap.isPrimary(pkr.p.si))
199198

200199
if fast {
201-
last, dmActive := pkr.p.dm.nonpResetActive()
202-
pid, hdr, err := pkr.p.fastKalive(smap, timeout, false, dmActive /*shared streams*/)
200+
pid, hdr, err := pkr.p.fastKalive(smap, timeout, false)
203201
if err == nil {
204202
// (shared streams; EC streams)
205203
if pkr.p.ec.isActive(hdr) {
206204
pkr.p.ec.setActive(now)
207205
}
208-
if pkr.p.dm.isActive(hdr) {
209-
pkr.p.dm.setActive(now)
210-
}
211-
} else if dmActive {
212-
pkr.p.dm.nonpUndo(last) // (unlikely)
213206
}
214207
return pid, 0, err
215208
}

ais/ml.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/NVIDIA/aistore/cmn/archive"
1717
"github.com/NVIDIA/aistore/cmn/cos"
1818
"github.com/NVIDIA/aistore/cmn/debug"
19-
"github.com/NVIDIA/aistore/cmn/mono"
2019
"github.com/NVIDIA/aistore/cmn/nlog"
2120
"github.com/NVIDIA/aistore/core/meta"
2221
"github.com/NVIDIA/aistore/transport/bundle"
@@ -217,11 +216,6 @@ func (p *proxy) httpmlget(w http.ResponseWriter, r *http.Request) {
217216
nlog.Infoln(p.String(), apc.Moss, "DT", tsi.String(), "xid", xid, "wid", wid, "[", hreq.Path, hreq.Method, "]")
218217
}
219218

220-
// toggle SDM (fast-kalive => primary)
221-
if !smap.isPrimary(p.si) {
222-
p.dm.nonpSetActive(mono.NanoTime())
223-
}
224-
225219
// phase 2: redirect user's GET => DT
226220
r.URL.Path = path
227221
started := time.Now()

ais/proxy.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ type (
5757
lstca lstca
5858
rproxy reverseProxy
5959
ec ecToggle
60-
dm dmToggle
6160

6261
htrun // common w/ target
6362

@@ -128,7 +127,6 @@ func (p *proxy) init(config *cmn.Config) {
128127

129128
// shared streams
130129
p.ec.init()
131-
p.dm.init()
132130
}
133131

134132
func initPID(config *cmn.Config) string {

ais/prxclu.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,11 +674,9 @@ func (p *proxy) fastKaliveRsp(w http.ResponseWriter, r *http.Request, smap *smap
674674
if si.IsTarget() {
675675
// (target kalive => primary)
676676
p.ec.recvKalive(p, r.Header, now, p.ec.timeout())
677-
p.dm.recvKalive(p, r.Header, now, p.dm.timeout())
678677
} else {
679678
// (primary kalive response => non-primary)
680679
p.ec.respKalive(w.Header(), now, p.ec.timeout())
681-
p.dm.respKalive(w.Header(), now, p.dm.timeout())
682680
}
683681
return
684682
}

ais/prxec.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ func (p *proxy) ecHandler(w http.ResponseWriter, r *http.Request) {
2424

2525
// +gen:endpoint POST /v1/ec/open-ec-streams
2626
// +gen:endpoint POST /v1/ec/close-ec-streams
27-
// +gen:endpoint POST /v1/ec/open-shared-dm
28-
// +gen:endpoint POST /v1/ec/close-shared-dm
29-
// Enable or disable erasure coding and shared data management
27+
// Enable or disable erasure coding
3028
func (p *proxy) httpecpost(w http.ResponseWriter, r *http.Request) {
3129
apiItems, err := p.parseURL(w, r, apc.URLPathEC.L, 1, false)
3230
if err != nil {
@@ -38,13 +36,6 @@ func (p *proxy) httpecpost(w http.ResponseWriter, r *http.Request) {
3836
p.ec.setActive(mono.NanoTime())
3937
case apc.ActCloseEC:
4038
p.ec.setActive(0)
41-
42-
// TODO: refactor as post-toggle-shared-streams
43-
case apc.ActOpenSDM:
44-
p.dm.setActive(mono.NanoTime())
45-
case apc.ActCloseSDM:
46-
p.dm.setActive(0)
47-
4839
default:
4940
p.writeErr(w, r, errActEc(action))
5041
}

ais/streams_toggle.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ type (
4040
ecToggle struct {
4141
streamsToggle
4242
}
43-
dmToggle struct {
44-
streamsToggle
45-
}
4643
)
4744

4845
func (f *ecToggle) init() {
@@ -53,41 +50,12 @@ func (f *ecToggle) init() {
5350

5451
func (*ecToggle) timeout() time.Duration { return cmn.Rom.EcStreams() }
5552

56-
func (f *dmToggle) init() {
57-
f.hdrActive = apc.HdrActiveDM
58-
f.actOn = apc.ActOpenSDM
59-
f.actOff = apc.ActCloseSDM
60-
}
61-
62-
func (*dmToggle) timeout() time.Duration { return cmn.SharedStreamsDflt } // see also: sharedDM.getActive
63-
6453
func (f *streamsToggle) isActive(h http.Header) bool { _, ok := h[f.hdrActive]; return ok }
6554

6655
func (f *streamsToggle) setActive(now int64) {
6756
f.last.Store(uint64(now))
6857
}
6958

70-
// non-primary: executed user call requiring SDM
71-
func (f *streamsToggle) nonpSetActive(now int64) {
72-
debug.Assert(now > 0, "invalid timestamp: ", now)
73-
f.last.Store((uint64(now) & nonpMask) | nonpBit)
74-
}
75-
76-
// non-primary: fast-keepalive => primary
77-
func (f *streamsToggle) nonpResetActive() (uint64, bool) {
78-
last := f.last.Load()
79-
if last&nonpBit == 0 {
80-
return last, false
81-
}
82-
last = f.last.Swap(0)
83-
return last, true
84-
}
85-
86-
// non-primary: fast-keepalive => primary
87-
func (f *streamsToggle) nonpUndo(last uint64) {
88-
_ = f.last.CAS(0, last)
89-
}
90-
9159
// target => primary keep-alive
9260
func (f *streamsToggle) recvKalive(p *proxy, hdr http.Header, now int64, tout time.Duration) {
9361
if _, ok := hdr[f.hdrActive]; ok {

ais/tgtec.go

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"github.com/NVIDIA/aistore/core/meta"
2121
"github.com/NVIDIA/aistore/ec"
2222
"github.com/NVIDIA/aistore/hk"
23-
"github.com/NVIDIA/aistore/transport/bundle"
2423
"github.com/NVIDIA/aistore/xact/xreg"
2524
)
2625

@@ -75,9 +74,8 @@ func (t *target) sendECMetafile(w http.ResponseWriter, r *http.Request, bck *met
7574

7675
func (t *target) httpecpost(w http.ResponseWriter, r *http.Request) {
7776
const (
78-
hknameEC = apc.ActCloseEC + hk.NameSuffix
79-
hknameSDM = apc.ActCloseSDM + hk.NameSuffix
80-
postpone = time.Minute
77+
hknameEC = apc.ActCloseEC + hk.NameSuffix
78+
postpone = time.Minute
8179
)
8280
items, err := t.parseURL(w, r, apc.URLPathEC.L, 1, false)
8381
if err != nil {
@@ -136,8 +134,6 @@ func (t *target) httpecpost(w http.ResponseWriter, r *http.Request) {
136134
core.FreeLOM(lom)
137135
}
138136

139-
// TODO [minor]: consider reusing ais/streams_toggle or otherwise reducing copy/paste
140-
141137
case apc.ActOpenEC:
142138
hk.UnregIf(hknameEC, closeEc) // just in case, a no-op most of the time
143139
ec.ECM.OpenStreams(false /*with refc*/)
@@ -152,23 +148,6 @@ func (t *target) httpecpost(w http.ResponseWriter, r *http.Request) {
152148
nlog.Infoln(t.String(), "hk-postpone", action)
153149
hk.Reg(hknameEC, closeEc, postpone)
154150

155-
case apc.ActOpenSDM:
156-
// NOTE:
157-
// Unlike EC, SDM is opened on-demand by the GetBatch/x-moss 3-phase protocol.
158-
// This action exists only to cancel a pending idle-close (HK) and to allow
159-
// the primary to track cluster-wide SDM activity time.
160-
hk.UnregIf(hknameSDM, closeSDM)
161-
case apc.ActCloseSDM:
162-
if !t.ensureIntraControl(w, r, true /* from primary */) {
163-
return
164-
}
165-
if bundle.SDM.IsActive() {
166-
t.writeErr(w, r, _errOff(bundle.SDMName))
167-
return
168-
}
169-
nlog.Infoln(t.String(), "hk-postpone", action)
170-
hk.Reg(hknameSDM, closeSDM, postpone)
171-
172151
default:
173152
t.writeErr(w, r, errActEc(action))
174153
}
@@ -185,15 +164,6 @@ func closeEc(int64) time.Duration {
185164
return hk.UnregInterval
186165
}
187166

188-
func closeSDM(int64) time.Duration {
189-
if bundle.SDM.IsActive() {
190-
nlog.Warningln("hk-cb:", _errOff(bundle.SDMName))
191-
} else if err := bundle.SDM.Close(); err != nil {
192-
nlog.Errorln(err)
193-
}
194-
return hk.UnregInterval
195-
}
196-
197167
func errActEc(act string) error {
198168
return fmt.Errorf(fmtErrInvaldAction, act, []string{apc.ActOpenEC, apc.ActCloseEC})
199169
}

api/apc/actmsg.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,6 @@ const (
156156
NodeDecommission = "decommission"
157157
)
158158

159-
const (
160-
ActOpenSDM = "open-shared-dm"
161-
ActCloseSDM = "close-shared-dm"
162-
)
163-
164159
const (
165160
ActOpenEC = "open-ec-streams"
166161
ActCloseEC = "close-ec-streams"

api/apc/headers.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ const (
139139

140140
// shared streams
141141
HdrActiveEC = aisPrefix + "Ec"
142-
HdrActiveDM = aisPrefix + "Dm"
143142

144143
// (ais/psetforce; advanced use)
145144
HdrReadyToJoinClu = aisPrefix + "Ready-Join-Clu"

0 commit comments

Comments
 (0)