Skip to content

Commit 61c7bc0

Browse files
Merge remote-tracking branch 'couchbase/trinity'
|\ | * 497365f Abhinav Dangeti | MB-60816: Upgrade bleve/v2, zapx/v16, go-faiss for fix | * 231a2f6 Abhinav Dangeti | MB-60819: Check return value of malloc_info | * 054e69a Abhinav Dangeti | MB-60842: Upgrade bleve/v2 for fix Change-Id: I7023691e0e33c9cd46b0aa40b73cbd04eeec2444
2 parents 8fc0618 + 497365f commit 61c7bc0

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

c_heap_mem_usage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extern "C" {
1616
size_t get_total_heap_bytes();
1717
#else
1818
size_t get_total_heap_bytes() {
19-
return(size_t)0L;
19+
return (size_t)0L;
2020
}
2121
#endif
2222

c_heap_mem_usage_linux.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ size_t get_attribute_value(const char *str, const char *first_substr, const char
5252
}
5353

5454

55-
size_t get_total_heap_bytes(){
55+
size_t get_total_heap_bytes() {
5656
// ref: https://gist.github.com/tadeu/95013963c64da4cd74a2c6f4fa4fd553
5757
// There are three functions in Linux libc API to retrieve heap
5858
// information: `malloc_stats`, `mallinfo` and `malloc_info`.
@@ -72,11 +72,20 @@ size_t get_total_heap_bytes(){
7272
size_t buf_size = 0;
7373

7474
FILE* f = open_memstream(&buf, &buf_size);
75+
if (f == NULL) {
76+
return (size_t)0;
77+
}
78+
7579
// this doesn't include the golang or the other process's stats
7680
// as per local testing
77-
malloc_info(0, f);
81+
int rv = malloc_info(0, f);
7882
fclose(f);
7983

84+
// https://man7.org/linux/man-pages/man3/malloc_info.3.html
85+
if ((rv != 0) || (buf == NULL)) {
86+
return (size_t)0;
87+
}
88+
8089
// We are only interested in totals, so we skip everything until the
8190
// closing of the <heap>...</heap> block.
8291
const char* pos = strstr(buf, "</heap>");
@@ -96,6 +105,7 @@ size_t get_total_heap_bytes(){
96105

97106
free(buf);
98107
buf = NULL;
108+
99109
return allocated_mem;
100110
}
101111
#endif

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ go 1.21
55
require (
66
github.com/aws/aws-sdk-go v1.48.1
77
github.com/blevesearch/bleve-mapping-ui v0.5.2
8-
github.com/blevesearch/bleve/v2 v2.3.11-0.20240215163640-2d3c3ebf7a5b
8+
github.com/blevesearch/bleve/v2 v2.3.11-0.20240222010232-dd801ce5a88b
99
github.com/blevesearch/bleve_index_api v1.1.6
1010
github.com/blevesearch/zapx/v11 v11.3.10
1111
github.com/blevesearch/zapx/v12 v12.3.10
1212
github.com/blevesearch/zapx/v13 v13.3.10
1313
github.com/blevesearch/zapx/v14 v14.3.10
1414
github.com/blevesearch/zapx/v15 v15.3.13
15-
github.com/blevesearch/zapx/v16 v16.0.8
15+
github.com/blevesearch/zapx/v16 v16.0.10
1616
github.com/buger/jsonparser v1.1.1
1717
github.com/cloudfoundry/gosigar v1.3.4
1818
github.com/couchbase/cbauth v0.1.11
@@ -42,7 +42,7 @@ require (
4242
github.com/beorn7/perks v1.0.1 // indirect
4343
github.com/bits-and-blooms/bitset v1.2.2 // indirect
4444
github.com/blevesearch/geo v0.1.20 // indirect
45-
github.com/blevesearch/go-faiss v1.0.10 // indirect
45+
github.com/blevesearch/go-faiss v1.0.13 // indirect
4646
github.com/blevesearch/go-porterstemmer v1.0.3 // indirect
4747
github.com/blevesearch/goleveldb v1.0.1 // indirect
4848
github.com/blevesearch/gtreap v0.1.1 // indirect

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ github.com/bits-and-blooms/bitset v1.2.2 h1:J5gbX05GpMdBjCvQ9MteIg2KKDExr7DrgK+Y
5757
github.com/bits-and-blooms/bitset v1.2.2/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
5858
github.com/blevesearch/bleve-mapping-ui v0.5.2 h1:L6Irz3B14+L2WxIEVtkTi25Aps+uydKNAyt7IAlZOeE=
5959
github.com/blevesearch/bleve-mapping-ui v0.5.2/go.mod h1:D/HnjXhQdlSi0GU/xOWrh0LL/0XfmTSVuJZNQCy/Mqs=
60-
github.com/blevesearch/bleve/v2 v2.3.11-0.20240215163640-2d3c3ebf7a5b h1:41EVlTbqGA7ho3//GXmby2oN1sbhXYWSLJ+qjfXy+jw=
61-
github.com/blevesearch/bleve/v2 v2.3.11-0.20240215163640-2d3c3ebf7a5b/go.mod h1:783Nsvy8kfTldbs9SkiW0GiOzIvgwKaXmeRptn+tq4w=
60+
github.com/blevesearch/bleve/v2 v2.3.11-0.20240222010232-dd801ce5a88b h1:QRn0azq//mSVtWlENeA5O3xtlnv1HU61sndMtU4Fafc=
61+
github.com/blevesearch/bleve/v2 v2.3.11-0.20240222010232-dd801ce5a88b/go.mod h1:rATfMtFBaraojrNPA4gEC4qdUBbRHPW8+w/ineiVCNU=
6262
github.com/blevesearch/bleve_index_api v1.1.6 h1:orkqDFCBuNU2oHW9hN2YEJmet+TE9orml3FCGbl1cKk=
6363
github.com/blevesearch/bleve_index_api v1.1.6/go.mod h1:PbcwjIcRmjhGbkS/lJCpfgVSMROV6TRubGGAODaK1W8=
6464
github.com/blevesearch/geo v0.1.20 h1:paaSpu2Ewh/tn5DKn/FB5SzvH0EWupxHEIwbCk/QPqM=
6565
github.com/blevesearch/geo v0.1.20/go.mod h1:DVG2QjwHNMFmjo+ZgzrIq2sfCh6rIHzy9d9d0B59I6w=
66-
github.com/blevesearch/go-faiss v1.0.10 h1:LKt+/9yILFNlhcTwW8IMx0EewNgkD4hLnmdJFGOuA34=
67-
github.com/blevesearch/go-faiss v1.0.10/go.mod h1:jrxHrbl42X/RnDPI+wBoZU8joxxuRwedrxqswQ3xfU8=
66+
github.com/blevesearch/go-faiss v1.0.13 h1:zfFs7ZYD0NqXVSY37j0JZjZT1BhE9AE4peJfcx/NB4A=
67+
github.com/blevesearch/go-faiss v1.0.13/go.mod h1:jrxHrbl42X/RnDPI+wBoZU8joxxuRwedrxqswQ3xfU8=
6868
github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo=
6969
github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M=
7070
github.com/blevesearch/goleveldb v1.0.1 h1:iAtV2Cu5s0GD1lwUiekkFHe2gTMCCNVj2foPclDLIFI=
@@ -96,8 +96,8 @@ github.com/blevesearch/zapx/v14 v14.3.10 h1:SG6xlsL+W6YjhX5N3aEiL/2tcWh3DO75Bnz7
9696
github.com/blevesearch/zapx/v14 v14.3.10/go.mod h1:qqyuR0u230jN1yMmE4FIAuCxmahRQEOehF78m6oTgns=
9797
github.com/blevesearch/zapx/v15 v15.3.13 h1:6EkfaZiPlAxqXz0neniq35my6S48QI94W/wyhnpDHHQ=
9898
github.com/blevesearch/zapx/v15 v15.3.13/go.mod h1:Turk/TNRKj9es7ZpKK95PS7f6D44Y7fAFy8F4LXQtGg=
99-
github.com/blevesearch/zapx/v16 v16.0.8 h1:xiujW3MH3jDFJwh6TtN8X94wsTeBGQzIIY6HYqbASx0=
100-
github.com/blevesearch/zapx/v16 v16.0.8/go.mod h1:GkU8sUj2czc3syX4OwvouA74J68/e2banQ//9ufk2SM=
99+
github.com/blevesearch/zapx/v16 v16.0.10 h1:JuH32x4LEK+QwVRT89C+wDGWbX75tGJ0DdNq64Rla9A=
100+
github.com/blevesearch/zapx/v16 v16.0.10/go.mod h1:fN9n4RlFI8kST69yUeSSKJf/zZzZfP5bpcjmoRinKrk=
101101
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
102102
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
103103
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=

0 commit comments

Comments
 (0)