亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Couchbase gocb 批量操作提供部分為空的結果

Couchbase gocb 批量操作提供部分為空的結果

Go
qq_笑_17 2023-05-15 10:06:32
在我們使用 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
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號