Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

Commit 4b65f78

Browse files
committed
grab some forgotten fixes from old ingest-support branch
1 parent ff1a15c commit 4b65f78

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

client.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -1042,9 +1042,9 @@ func (c *Client) httpRequest(method string, path string, data []byte, headers ma
10421042
var response *http.Response
10431043
var err error
10441044
for i := 0; i < maxHosts; i++ {
1045-
host, err := c.host(useCoordinator)
1046-
if err != nil {
1047-
return nil, nil, err
1045+
host, herr := c.host(useCoordinator)
1046+
if herr != nil {
1047+
return nil, nil, errors.Wrapf(herr, "getting host, previous err: %v", err)
10481048
}
10491049
response, err = c.doRequest(host, method, path, c.augmentHeaders(headers), data)
10501050
if err == nil {
@@ -1056,14 +1056,15 @@ func (c *Client) httpRequest(method string, path string, data []byte, headers ma
10561056
c.coordinatorURI = nil
10571057
c.coordinatorLock.Unlock()
10581058
} else {
1059+
c.logger.Printf("removing host due to '%v'\n", err)
10591060
c.cluster.RemoveHost(host)
10601061
}
10611062
}
10621063
// TODO: exponential backoff
10631064
time.Sleep(1 * time.Second)
10641065
}
10651066
if response == nil {
1066-
return nil, nil, ErrTriedMaxHosts
1067+
return nil, nil, errors.Wrap(err, ErrTriedMaxHosts.Error())
10671068
}
10681069
defer response.Body.Close()
10691070
warning := response.Header.Get("warning")
@@ -1693,10 +1694,10 @@ func (co *ClientOptions) withDefaults() (updated *ClientOptions) {
16931694
updated.ConnectTimeout = time.Second * 60
16941695
}
16951696
if updated.PoolSizePerRoute <= 0 {
1696-
updated.PoolSizePerRoute = 10
1697+
updated.PoolSizePerRoute = 50
16971698
}
16981699
if updated.TotalPoolSize <= 0 {
1699-
updated.TotalPoolSize = 100
1700+
updated.TotalPoolSize = 500
17001701
}
17011702
if updated.TLSConfig == nil {
17021703
updated.TLSConfig = &tls.Config{}

gpexp/importbatch.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ func (b *Batch) Add(rec Row) error {
306306
}
307307

308308
handleStringID := func(rid string) error {
309+
if rid == "" {
310+
return errors.Errorf("record identifier cannot be an empty string")
311+
}
309312
if colID, ok, err := b.transCache.GetCol(b.index.Name(), rid); err != nil {
310313
return errors.Wrap(err, "translating column")
311314
} else if ok {
@@ -610,7 +613,7 @@ func (b *Batch) doTranslation() error {
610613
// translate keys from Pilosa
611614
ids, err := b.client.TranslateRowKeys(b.headerMap[fieldName], keys)
612615
if err != nil {
613-
return errors.Wrap(err, "translating row keys")
616+
return errors.Wrap(err, "translating row keys (sets)")
614617
}
615618
if err := b.transCache.AddRows(b.index.Name(), fieldName, keys, ids); err != nil {
616619
return errors.Wrap(err, "adding rows to cache")

0 commit comments

Comments
 (0)