在我們使用 gocb 的 go 代碼中,我們正在查詢一個返回 32k id 的視圖。然后我們執行批量查詢(參見下面的代碼),如CouchBase 博客文章中所述。但是,我們只能得到部分結果。我們可以看到ruleset, _ := items[i].(*gocb.GetOp).Value.(*RuleSet)只返回前 2048 個 id 的值。然后 ids 2049 - 11322 不包含值等等。我們的結果看起來像這樣:Line 1 Key: 12345678901234567890123456789012, Value: map[0.0.0.0/0:map[jsona:valueofjsona]]...Line 2018 Key: 12345678901234567890123456712345, Value: map[0.0.0.0/0:map[jsona:valueofjsona]]Line 2019 Key: 12345678901234567890123456712345, Value: map[]...Line 11323 Key: 12345678901234567890123456712347, Value: map[jsonb:valueofjsonb]](以上幾行是簡化的,鍵與實際數據不匹配,值也不匹配。)很大一部分請求的數據實際上并沒有返回:CB# grep '\[\]' result.out |wc -l27042CB# wc -l result.out31988 rdmp.outbucket.do在完成所有查詢處理之前是否返回?我們查看了 API 代碼,但找不到解釋。知道如何解決這個問題嗎?type RuleSet struct { Rules map[string]interface{} "json:\"rules,\""}func DiffViaBulkQuery() { var items []gocb.BulkOp var row interface{} var cnt int = 0 bucket := cbase.MyBucket()// [...]// add 600k entries to itemsget in a loop like // itemsGet = append(itemsGet, &gocb.GetOp{Key: key + "_" + strconv.Itoa(i), Value: &Doc{}})// Perform the bulk operation to Get all documents err = bucket.Do(itemsGet) if err != nil { fmt.Println("ERRROR PERFORMING BULK GET:", err) }// Print the output for i := 0; i < len(itemsGet); i++ { fmt.Println(itemsGet[i].(*gocb.GetOp).Key, itemsGet[i].(*gocb.GetOp).Value.(*Doc).Item) }提前致謝, Torsten
- 0 回答
- 0 關注
- 152 瀏覽
添加回答
舉報
0/150
提交
取消