visibility_store.go ×5

Frontier kind: Code frontier

unlabeled · c_663d9e365146

6 tests · 2216 LOC · 94 files · introduces 0 tests · 34 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges34 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
364 ranges2216 lines · 94 files · Browse complete extent
All tests (intent)
6 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 34 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/visibility/store/elasticsearch/visibility_store.go 21 introduced LOC · 5 ranges

Open complete file

329 bulkRequest *client.BulkableRequest,
330 visibilityTaskKey string,
331 > ) error { visibility_store.go
332 > s.checkProcessor()
333 >
334 > // Add method is blocking. If bulk processor is busy flushing previous bulk, request will wait here.
335 > ackF := s.processor.Add(bulkRequest, visibilityTaskKey)
336 >
337 > // processorAckTimeout is a maximum duration for bulk processor to commit the bulk and unblock the `ackF`.
338 > // The default value is 30s, and this timeout should never have happened,
339 > // because Elasticsearch must process a bulk within the 30s.
340 > // Parent context is not respected here because it has shorter timeout (3s),
341 > // which might already expired here due to wait at Add method above.
342 > ctx, cancel := context.WithTimeout(context.Background(), s.processorAckTimeout())
343 > defer cancel()
344 > ack, err := ackF.Get(ctx)
345 >
346 > if err != nil {
347 if errors.Is(err, context.DeadlineExceeded) {
348 return &persistence.TimeoutError{Msg: fmt.Sprintf("visibility task timed out waiting for ACK after %v", s.processorAckTimeout())}
353 }
354
355 > if !ack { visibility_store.go
356 // Returns retryable Unavailable error here because NACK from bulk processor
357 // means that this request wasn't processed successfully and needs to be retried.
359 return serviceerror.NewUnavailable("visibility task received NACK")
360 }
361 > return nil visibility_store.go
362 }
363
364 > func (s *VisibilityStore) checkProcessor() { visibility_store.go
365 > if s.processor == nil {
366 // must be a bug, check history setup
367 panic("Elasticsearch processor is nil")
368 }
369 > if s.processorAckTimeout == nil { visibility_store.go
370 // must be a bug, check history setup
371 panic("config.ESProcessorAckTimeout is nil")
go.temporal.io/server/common/persistence/visibility/store/elasticsearch/processor_mock.go 13 introduced LOC · 3 ranges

Open complete file

38
39 // EXPECT returns an object that allows the caller to indicate expected use.
40 > func (m *MockProcessor) EXPECT() *MockProcessorMockRecorder { processor_mock.go
41 > return m.recorder
42 > }
43
44 // Add mocks base method.
45 > func (m *MockProcessor) Add(request *client.BulkableRequest, visibilityTaskKey string) *future.FutureImpl[bool] { processor_mock.go
46 > m.ctrl.T.Helper()
47 > ret := m.ctrl.Call(m, "Add", request, visibilityTaskKey)
48 > ret0, _ := ret[0].(*future.FutureImpl[bool])
49 > return ret0
50 > }
51
52 // Add indicates an expected call of Add.
53 > func (mr *MockProcessorMockRecorder) Add(request, visibilityTaskKey any) *gomock.Call { processor_mock.go
54 > mr.mock.ctrl.T.Helper()
55 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Add", reflect.TypeOf((*MockProcessor)(nil).Add), request, visibilityTaskKey)
56 > }
57
58 // Start mocks base method.