[MB-6295] brewery_beers view fails because map function emits keys that are too long (key_too_long) Created: 18/Aug/12  Updated: 10/Sep/12  Resolved: 28/Aug/12

Status: Closed
Project: Couchbase Server
Component/s: tools
Affects Version/s: None
Fix Version/s: 2.0-beta
Security Level: Public

Type: Bug Priority: Major
Reporter: Farshid Ghods (Inactive) Assignee: Bin Cui
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   
steps to repro:

load sample database during the setup wizard

for this map function:
function(doc, meta) {
  if (doc.geo) {
    emit([meta.id.replace('brewery_', '')], doc);
  } else if (doc.brewery && typeof doc.brewery === 'string') {
    emit([doc.brewery.replace(' ', '_'), meta.id.replace('beer_', '')], doc);
  }
}
which is the brewery_beers view
 then run this query

http://localhost:8092/beer-sample/_design/beer/_view/brewery_beers?stale=false&connection_timeout=60000&limit=10&skip=0

{"error":"error","reason":"{key_too_long,<<17,117,91,34,100,101,115,99,114,105,112,116,105,111,110,34,44,\n 34,65,108,108,97,103,97,115,104,32,66,114,101,119,105,110,103,\n 32,67,111,109,112,97,110,121,32,115,111,108,100,32,105,116,\n 115,32,102,105,114,115,116,32,98,97,116,99,104,32,111,102,32,\n 98,101,101,114,32,105,110,32,116,104,101,32,115,117,109,109,\n 101,114,32,111,102,32,49,57,57,53,46,32,84,104,101,32,65,108,\n 108,97,103,97,115,104,32,115,116,111,114,121,44,32,104,111,\n 119,101,118,101,114,44,32,104,97,115,32,114,111,111,116,115,\n 32,116,104,97,116,32,103,111,32,109,117,99,104,32,102,117,114,\n 116,104,101,114,32,98,97,99,107,32,116,104,101,110,32,116,104,\n 101,32,116,101,110,32,121,101,97,114,115,32,116,104,101,32,80,\n 111,114,116,108,97,110,100,44,32,77,97,105,110,101,32,98,114,\n 101,119,101,114,121,32,104,97,115,32,98,101,101,110,32,105,\n 110,32,111,112,101,114,97,116,105,111,110,46,32,84,104,101,32,\n 114,111,111,116,115,32,103,111,32,105,110,116,111,32,116,104,\n 101,32,101,97,114,108,121,32,49,57,57,48,39,115,32,119,104,\n 101,110,32,102,111,117,110,100,101,114,32,82,111,98,32,84,111,\n 100,32,115,97,119,32,115,111,109,101,116,104,105,110,103,32,\n 109,105,115,115,105,110,103,32,105,110,32,116,104,101,32,65,\n 109,101,114,105,99,97,110,32,98,101,101,114,32,109,97,114,107,\n 101,116,46,32,84,104,101,121,32,97,114,101,32,105,110,116,101,\n 114,119,111,118,101,110,32,105,110,32,116,104,101,32,99,114,\n 97,102,116,32,98,114,101,119,105,110,103,32,109,111,118,101,\n 109,101,110,116,32,116,104,97,116,32,104,97,115,32,97,108,108,\n 111,119,101,100,32,116,104,101,32,99,114,101,97,116,105,118,\n 105,116,121,32,111,102,32,98,114,101,119,101,114,115,32,116,\n 111,32,102,108,111,117,114,105,115,104,32,111,118,101,114,32,\n 116,104,101,32,108,97,115,116,32,116,119,101,110,116,121,32,\n 121,101,97,114,115,44,32,97,110,100,32,116,104,111,115,101,32,\n 115,97,109,101,32,114,111,111,116,115,32,104,97,118,101,32,\n 116,105,101,115,32,116,104,97,116,32,103,111,32,98,97,99,107,\n 32,99,101,110,116,117,114,105,101,115,45,116,111,32,116,104,\n 101,32,109,111,110,97,115,116,101,114,105,101,115,32,111,102,\n 32,66,101,108,103,105,117,109,44,32,119,104,111,115,101,32,\n 111,119,110,32,97,110,99,105,101,110,116,32,98,114,101,119,\n 105,110,103,32,109,101,116,104,111,100,115,32,97,114,101,32,\n 110,111,119,32,112,114,97,99,116,105,99,101,100,32,116,111,\n 100,97,121,32,98,121,32,116,104,101,32,98,114,101,119,101,114,\n 115,32,111,102,32,65,108,108,97,103,97,115,104,46,32,65,108,\n 108,97,103,97,115,104,32,98,101,103,97,110,32,97,115,32,97,32,\n 111,110,101,45,109,97,110,32,111,112,101,114,97,116,105,111,\n 110,44,32,119,105,116,104,32,84,111,100,32,97,115,115,117,109,\n 105,110,103,32,97,108,108,32,98,114,101,119,105,110,103,32,\n 100,117,116,105,101,115,32,105,110,32,97,32,115,109,97,108,\n 108,32,115,112,97,99,101,32,108,111,99,97,116,101,100,32,105,\n 110,32,97,32,98,117,105,108,100,105,110,103,32,111,110,32,116,\n 104,101,32,111,117,116,115,107,105,114,116,115,32,111,102,32,\n 116,104,101,32,109,97,114,105,116,105,109,101,32,99,105,116,\n 121,32,111,102,32,80,111,114,116,108,97,110,100,46,32,84,111,\n 100,32,104,97,100,32,119,111,114,107,101,100,32,105,110,32,98,\n 114,101,119,101,114,121,32,115,101,116,116,105,110,103,115,32,\n 98,101,102,111,114,101,32,97,110,100,32,114,101,99,111,103,\n 110,105,122,101,100,32,97,32,118,111,105,100,32,119,105,116,\n 104,105,110,32,116,104,101,32,99,114,97,102,116,32,98,114,101,\n 119,105,110,103,32,109,111,118,101,109,101,110,116,46,32,87,\n 104,105,108,101,32,98,111,116,104,32,71,101,114,109,97,110,32,\n 97,110,100,32,66,114,105,116,105,115,104,32,115,116,121,108,\n 101,115,32,104,97,100,32,98,101,99,111,109,101,32,112,114,101,\n 118,97,108,101,110,116,32,116,104,114,111,117,103,104,111,117,\n 116,32,116,104,101,32,85,46,83,46,44,32,116,104,101,32,101,\n 118,101,114,45,99,114,101,97,116,105,118,101,32,66,101,108,\n 103,105,97,110,45,115,116,121,108,101,115,32,119,101,114,101,\n 32,118,101,114,121,32,100,105,102,102,105,99,117,108,116,32,\n 116,111,32,102,105,110,100,46,32,84,104,114,111,117,103,104,\n 32,104,105,115,32,116,114,97,118,101,108,115,44,32,84,111,100,\n 32,104,97,100,32,115,97,109,112,108,101,100,32,109,97,110,121,\n 32,111,102,32,116,104,101,115,101,32,117,110,105,113,117,101,\n 32,98,101,101,114,115,32,97,110,100,32,102,101,108,116,32,116,\n 104,97,116,32,116,104,101,32,102,108,97,118,111,114,115,32,97,\n 110,100,32,116,114,97,100,105,116,105,111,110,115,32,111,102,\n 32,116,104,105,115,32,69,117,114,111,112,101,97,110,32,110,97,\n 116,105,111,110,32,110,101,101,100,101,100,32,116,111,32,98,\n 101,32,115,104,97,114,101,100,32,119,105,116,104,32,116,104,\n 101,32,65,109,101,114,105,99,97,110,32,100,114,105,110,107,\n 105,110,103,32,112,117,98,108,105,99,46,32,72,101,32,100,101,\n 115,105,103,110,101,100,32,97,32,115,109,97,108,108,32,49,53,\n 45,98,97,114,114,101,108,32,98,114,101,119,104,111,117,115,\n 101,32,115,112,101,99,105,102,105,99,97,108,108,121,32,116,\n 111,32,101,109,98,114,97,99,101,32,116,104,101,32,66,101,108,\n 103,105,97,110,32,116,114,97,100,105,116,105,111,110,32,111,\n 102,32,98,101,101,114,32,109,97,107,105,110,103,44,32,103,97,\n 116,104,101,114,101,100,32,116,104,101,32,102,105,110,101,115,\n 116,32,97,114,114,97,121,32,111,102,32,97,117,116,104,101,110,\n 116,105,99,32,114,97,119,32,109,97,116,101,114,105,97,108,115,\n 32,97,110,100,32,98,101,103,97,110,32,104,105,115,32,113,117,\n 101,115,116,32,116,111,119,97,114,100,115,32,116,104,101,32,\n 112,114,111,100,117,99,116,105,111,110,32,111,102,32,116,114,\n 97,100,105,116,105,111,110,97,108,32,66,101,108,103,105,97,\n 110,32,115,116,121,108,101,32,97,108,101,115,46,32,65,108,108,\n 97,103,97,115,104,32,98,101,103,97,110,32,119,105,116,104,32,\n 116,104,101,32,114,101,108,101,97,115,101,32,111,102,32,105,\n 116,115,32,65,108,108,97,103,97,115,104,32,87,104,105,116,101,\n 44,32,109,111,100,101,108,101,100,32,97,102,116,101,114,32,\n 116,104,101,32,116,114,97,100,105,116,105,111,110,97,108,32,\n 87,104,105,116,101,32,98,101,101,114,115,32,111,102,32,66,101,\n 108,103,105,117,109,46,32,65,108,115,111,32,114,101,102,101,\n 114,114,101,100,32,116,111,32,97,115,32,119,105,116,32,98,101,\n 101,114,115,44,32,116,104,101,121,32,103,101,116,32,116,104,\n 101,105,114,32,117,110,105,113,117,101,32,102,108,97,118,111,\n 114,32,102,114,111,109,32,116,104,101,32,117,115,101,32,111,\n 102,32,119,104,101,97,116,32,105,110,32,112,108,97,99,101,32,\n 111,102,32,98,97,114,108,101,121,44,32,67,117,114,97,99,97,\n 111,32,111,114,97,110,103,101,32,112,101,101,108,32,97,110,\n 100,32,116,104,101,32,99,97,114,101,102,117,108,32,115,112,\n 114,105,110,107,108,105,110,103,32,111,102,32,99,111,114,105,\n 97,110,100,101,114,32,97,110,100,32,111,116,104,101,114,32,\n 115,112,105,99,101,115,46,32,65,108,108,97,103,97,115,104,32,\n 99,111,109,98,105,110,101,100,32,116,104,101,115,101,32,105,\n 110,103,114,101,100,105,101,110,116,115,32,119,105,116,104,32,\n 116,104,101,105,114,32,118,101,114,121,32,111,119,110,32,112,\n 114,111,112,114,105,101,116,97,114,121,32,66,101,108,103,105,\n 97,110,32,121,101,97,115,116,32,115,116,114,97,105,110,32,116,\n 111,32,99,114,101,97,116,101,32,116,104,101,32,114,101,109,97,\n 114,107,97,98,108,121,32,117,110,105,113,117,101,32,97,110,\n 100,32,114,101,102,114,101,115,104,105,110,103,32,98,101,101,\n 114,32,116,104,97,116,32,105,115,32,116,111,100,97,121,32,116,\n 104,101,105,114,32,102,108,97,103,115,104,105,112,32,98,114,\n 97,110,100,46,32,65,108,108,97,103,97,115,104,32,87,104,105,\n 116,101,32,100,101,118,101,108,111,112,101,100,32,97,32,115,\n 116,114,111,110,103,32,99,117,108,116,32,102,111,108,108,111,\n 119,105,110,103,32,97,114,111,117,110,100,32,116,104,101,32,\n 80,111,114,116,108,97,110,100,32,97,114,101,97,32,119,104,101,\n 114,101,32,105,116,32,119,97,115,32,97,118,97,105,108,97,98,\n 108,101,32,97,116,32,115,101,108,101,99,116,101,100,32,100,\n 114,97,102,116,32,97,99,99,111,117,110,116,115,46,32,68,117,\n 101,32,116,111,32,105,116,115,32,105,109,109,101,100,105,97,\n 116,101,32,115,117,99,99,101,115,115,44,32,116,104,101,32,98,\n 101,101,114,32,119,97,115,32,115,111,111,110,32,109,97,100,\n 101,32,97,118,97,105,108,97,98,108,101,32,105,110,32,49,50,45,\n 111,117,110,99,101,32,115,105,120,45,112,97,99,107,115,32,116,\n 104,114,111,117,103,104,111,117,116,32,116,104,101,32,115,116,\n 97,116,101,32,111,102,32,77,97,105,110,101,46,32,87,105,116,\n 104,32,116,104,101,32,115,117,99,99,101,115,115,32,111,102,32,\n 116,104,101,32,102,105,114,115,116,32,98,114,97,110,100,44,32,\n 82,111,98,32,114,101,97,108,105,122,101,100,32,116,119,111,32,\n 116,104,105,110,103,115,58,32,84,104,101,32,112,117,98,108,\n 105,99,32,119,97,115,32,97,115,107,105,110,103,32,102,111,114,\n 32,115,111,109,101,32,110,101,119,32,115,116,121,108,101,115,\n 32,97,110,100,32,116,104,101,32,119,111,114,107,108,111,97,\n 100,32,119,97,115,32,103,101,116,116,105,110,103,32,116,111,\n 32,98,101,32,116,111,111,32,109,117,99,104,32,102,111,114,32,\n 111,110,101,32,112,101,114,115,111,110,46,32,83,111,111,110,\n 32,97,102,116,101,114,44,32,116,119,111,32,101,120,112,101,\n 114,105,101,110,99,101,100,32,98,114,101,119,101,114,115,32,\n 119,101,114,101,32,104,105,114,101,100,32,97,110,100,32,65,\n 108,108,97,103,97,115,104,32,114,101,108,101,97,115,101,100,\n 32,116,104,101,105,114,32,115,101,99,111,110,100,32,98,114,\n 101,119,44,32,65,108,108,97,103,97,115,104,32,68,111,117,98,\n 108,101,32,65,108,101,46,32,85,115,105,110,103,32,116,104,101,\n 32,112,104,105,108,111,115,111,112,104,121,32,97,110,100,32,\n 116,101,99,104,110,105,113,117,101,115,32,99,114,101,97,116,\n 101,100,32,98,121,32,116,104,101,32,84,114,97,112,112,105,115,\n 116,32,77,111,110,107,115,32,111,102,32,66,101,108,103,105,\n 117,109,32,99,101,110,116,117,114,105,101,115,32,97,103,111,\n 44,32,116,104,101,32,115,116,97,102,102,32,99,114,101,97,116,\n 101,100,32,116,104,105,115,32,98,101,101,114,32,117,115,105,\n 110,103,32,115,101,118,101,110,32,100,105,102,102,101,114,101,\n 110,116,32,109,97,108,116,115,44,32,97,32,116,114,97,100,105,\n 116,105,111,110,97,108,32,115,117,103,97,114,44,32,97,110,100,\n 32,116,104,101,105,114,32,111,119,110,32,66,101,108,103,105,\n 97,110,32,121,101,97,115,116,32,115,116,114,97,105,110,46,32,\n 84,104,101,32,114,101,115,117,108,116,32,119,97,115,32,97,110,\n 111,116,104,101,114,32,117,110,105,113,117,101,32,121,101,116,\n 32,98,97,108,97,110,99,101,100,32,98,101,101,114,32,99,114,97,\n 102,116,101,100,32,105,110,32,116,104,101,32,99,108,97,115,\n 115,105,99,32,66,101,108,103,105,97,110,32,115,116,121,108,\n 101,46,32,84,111,32,116,114,117,108,121,32,97,112,112,114,101,\n 99,105,97,116,101,32,116,104,101,32,99,108,97,115,115,105,99,\n 32,115,116,121,108,101,115,32,97,110,100,32,98,114,101,119,\n 105,110,103,32,116,114,97,100,105,116,105,111,110,115,32,111,\n 102,32,66,101,108,103,105,117,109,44,32,111,110,101,32,109,\n 117,115,116,32,101,120,112,101,114,105,101,110,99,101,32,98,\n 101,101,114,32,99,114,101,97,116,101,100,32,105,110,32,116,\n 104,101,32,99,108,97,115,115,105,99,32,66,101,108,103,105,97,\n 110,32,112,97,99,107,97,103,101,46,32,84,104,105,115,32,105,\n 115,32,119,104,121,32,65,108,108,97,103,97,115,104,44,32,97,\n 102,116,101,114,32,97,110,32,101,120,116,101,110,115,105,118,\n 101,32,112,101,114,105,111,100,32,111,102,32,114,101,115,101,\n 97,114,99,104,44,32,114,101,108,101,97,115,101,100,32,116,104,\n 101,105,114,32,100,105,115,116,105,110,99,116,105,118,101,32,\n 82,101,115,101,114,118,101,32,108,105,110,101,32,111,102,32,\n 99,111,114,107,32,102,105,110,105,115,104,101,100,32,55,53,48,\n 32,77,76,32,98,111,116,116,108,101,115,46,32,84,104,105,115,\n 32,117,110,105,113,117,101,32,108,105,110,101,32,101,109,112,\n 108,111,121,115,32,116,104,101,32,97,110,99,105,101,110,116,\n 32,116,114,97,100,105,116,105,111,110,32,114,101,102,101,114,\n 114,101,100,32,116,111,32,97,115,32,116,104,101,32,109,195,\n 131,194,169,116,104,111,100,101,32,99,104,97,109,112,101,110,\n 111,105,115,101,46,32,84,104,101,32,116,101,99,104,110,105,\n 113,117,101,32,99,97,108,108,115,32,102,111,114,32,116,119,\n 111,32,102,101,114,109,101,110,116,97,116,105,111,110,115,44,\n 32,111,110,101,32,105,110,32,116,104,101,32,66,114,101,119,\n 101,114,121,39,115,32,102,101,114,109,101,110,116,105,110,103,\n 32,116,97,110,107,115,32,97,110,100,32,116,104,101,32,115,101,\n 99,111,110,100,32,105,110,32,116,104,101,32,98,111,116,116,\n 108,101,32,105,116,115,101,108,102,46,32,73,116,32,105,115,32,\n 116,104,105,115,32,115,101,99,111,110,100,32,102,101,114,109,\n 101,110,116,97,116,105,111,110,32,116,104,97,116,32,112,114,\n 111,100,117,99,101,115,32,97,32,110,111,116,97,98,108,101,32,\n 105,110,99,114,101,97,115,101,32,105,110,32,99,97,114,98,111,\n 110,97,116,105,111,110,44,32,97,32,115,111,102,116,101,114,32,\n 109,111,117,116,104,102,101,101,108,44,32,97,110,100,32,98,\n 101,101,114,115,32,111,102,32,114,101,109,97,114,107,97,98,\n 108,101,32,99,111,109,112,108,101,120,105,116,121,46,32,84,\n 104,105,115,32,109,101,116,104,111,100,32,111,102,32,98,111,\n 116,116,108,101,32,99,111,110,100,105,116,105,111,110,105,110,\n 103,32,108,101,97,118,101,115,32,97,32,115,109,97,108,108,32,\n 97,109,111,117,110,116,32,111,102,32,121,101,97,115,116,32,\n 105,110,32,116,104,101,32,98,111,116,116,108,101,44,32,99,114,\n 101,97,116,105,110,103,32,119,104,97,116,32,105,115,32,107,\n 110,111,119,110,32,97,115,32,97,32,108,105,118,105,110,103,32,\n 98,101,101,114,46,32,65,115,32,97,32,114,101,115,117,108,116,\n 44,32,116,104,101,115,101,32,115,116,121,108,101,115,32,104,\n 97,118,101,32,97,32,103,114,101,97,116,108,121,32,101,110,104,\n 97,110,99,101,100,32,115,104,101,108,102,32,108,105,102,101,\n 32,97,110,100,32,115,111,109,101,32,115,116,121,108,101,115,\n 32,119,105,108,108,32,97,103,101,32,101,120,99,101,112,116,\n 105,111,110,97,108,108,121,44,32,109,117,99,104,32,108,105,\n 107,101,32,97,32,102,105,110,101,32,119,105,110,101,46,32,74,\n 117,115,116,32,97,115,32,116,104,101,32,115,116,121,108,101,\n 115,32,111,114,105,103,105,110,97,116,101,32,105,110,32,66,\n 101,108,103,105,117,109,44,32,115,111,32,100,111,101,115,32,\n 116,104,101,32,112,97,99,107,97,103,101,32,105,116,115,101,\n 108,102,46,32,84,111,32,105,110,115,117,114,101,32,97,117,116,\n 104,101,110,116,105,99,105,116,121,44,32,65,108,108,97,103,97,\n 115,104,32,105,109,112,111,114,116,115,32,116,104,101,32,98,\n 111,116,116,108,101,115,32,97,110,100,32,99,111,114,107,115,\n 32,100,105,114,101,99,116,108,121,32,102,114,111,109,32,116,\n 104,101,32,115,97,109,101,32,99,111,117,110,116,114,121,32,\n 116,104,97,116,32,100,101,115,105,103,110,101,100,32,116,104,\n 101,32,116,101,99,104,110,105,113,117,101,115,46,32,84,104,\n 105,115,32,101,110,97,98,108,101,115,32,116,104,101,32,98,101,\n 101,114,115,32,116,111,32,114,101,97,99,104,32,99,97,114,98,\n 111,110,97,116,105,111,110,32,108,101,118,101,108,115,32,115,\n 105,109,105,108,97,114,32,116,111,32,99,104,97,109,112,97,103,\n 110,101,32,119,104,105,108,101,32,97,108,108,111,119,105,110,\n 103,32,116,104,101,32,99,111,114,107,115,32,116,111,32,112,\n 111,112,32,99,104,97,114,97,99,116,101,114,105,115,116,105,99,\n 97,108,108,121,32,117,112,111,110,32,115,101,114,118,105,110,\n 103,46,32,84,111,100,97,121,44,32,65,108,108,97,103,97,115,\n 104,32,115,116,105,108,108,32,114,101,109,97,105,110,115,32,\n 111,110,101,32,111,102,32,118,101,114,121,32,102,101,119,32,\n 98,114,101,119,101,114,105,101,115,32,105,110,32,78,111,114,\n 116,104,32,65,109,101,114,105,99,97,32,117,115,105,110,103,32,\n 116,104,105,115,32,100,105,115,116,105,110,99,116,105,118,101,\n 32,112,97,99,107,97,103,101,46,32,70,114,111,109,32,116,104,\n 101,32,118,101,114,121,32,98,101,103,105,110,110,105,110,103,\n 44,32,65,108,108,97,103,97,115,104,32,104,97,115,32,115,116,\n 114,105,118,101,100,32,116,111,32,112,114,111,100,117,99,101,\n 32,116,104,101,32,102,105,110,101,115,116,32,66,101,108,103,\n 105,97,110,45,115,116,121,108,101,32,97,110,100,32,101,120,\n 112,101,114,105,109,101,110,116,97,108,32,97,108,101,115,32,\n 116,104,105,115,32,115,105,100,101,32,111,102,32,116,104,101,\n 32,65,116,108,97,110,116,105,99,46,32,73,116,32,98,101,103,97,\n 110,32,97,115,32,78,101,119,32,69,110,103,108,97,110,100,39,\n 115,32,111,114,105,103,105,110,97,108,32,66,101,108,103,105,\n 97,110,45,83,116,121,108,101,32,98,114,101,119,101,114,121,32,\n 97,110,100,32,104,97,115,32,103,114,111,119,110,32,105,110,\n 116,111,32,111,110,101,32,111,102,32,116,104,101,32,105,110,\n 100,117,115,116,114,121,39,115,32,109,111,115,116,32,100,105,\n 115,116,105,110,103,117,105,115,104,101,100,32,97,110,100,32,\n 119,101,108,108,45,114,101,115,112,101,99,116,101,100,32,98,\n 114,97,110,100,115,46,32,70,111,108,108,111,119,105,110,103,\n 32,116,104,101,32,116,105,109,101,45,116,101,115,116,101,100,\n 32,98,114,101,119,105,110,103,32,116,114,97,100,105,116,105,\n 111,110,115,32,111,102,32,97,110,99,105,101,110,116,32,66,101,\n 108,103,105,117,109,44,32,65,108,108,97,103,97,115,104,32,110,\n 111,119,32,112,114,111,100,117,99,101,115,32,97,32,98,114,111,\n 97,100,45,114,97,110,103,105,110,103,32,112,111,114,116,102,\n 111,108,105,111,32,111,102,32,97,114,116,105,115,97,110,97,\n 108,32,98,101,101,114,115,32,119,105,116,104,32,117,110,99,\n 111,109,112,114,111,109,105,115,105,110,103,32,113,117,97,108,\n 105,116,121,46,34,93,98,114,101,119,101,114,121,95,65,108,108,\n 97,103,97,115,104,95,66,114,101,119,105,110,103>>}"}


 Comments   
Comment by Farshid Ghods (Inactive) [ 18/Aug/12 ]
i think this should be assigned to tools team . Filipe let me know if this needs to be handles in view-engine instead ?
Comment by Filipe Manana [ 18/Aug/12 ]
Our btrees (couchdb, couchstore) don't support keys that can't be represented with 12 bits (max key size is therefore 4096 bytes), because of performance and generally it doesn't make sense having so large keys.
Comment by Filipe Manana [ 18/Aug/12 ]
Here is the key that was emitted in the map function (an array key of 2 elements):

["description","Allagash Brewing Company sold its first batch of beer in the summer of 1995. The Allagash story, however, has roots that go much further back then the ten years the Portland, Maine brewery has been in operation. The roots go into the early 1990's when founder Rob Tod saw something missing in the American beer market. They are interwoven in the craft brewing movement that has allowed the creativity of brewers to flourish over the last twenty years, and those same roots have ties that go back centuries-to the monasteries of Belgium, whose own ancient brewing methods are now practiced today by the brewers of Allagash. Allagash began as a one-man operation, with Tod assuming all brewing duties in a small space located in a building on the outskirts of the maritime city of Portland. Tod had worked in brewery settings before and recognized a void within the craft brewing movement. While both German and British styles had become prevalent throughout the U.S., the ever-creative Belgian-styles were very difficult to find. Through his travels, Tod had sampled many of these unique beers and felt that the flavors and traditions of this European nation needed to be shared with the American drinking public. He designed a small 15-barrel brewhouse specifically to embrace the Belgian tradition of beer making, gathered the finest array of authentic raw materials and began his quest towards the production of traditional Belgian style ales. Allagash began with the release of its Allagash White, modeled after the traditional White beers of Belgium. Also referred to as wit beers, they get their unique flavor from the use of wheat in place of barley, Curacao orange peel and the careful sprinkling of coriander and other spices. Allagash combined these ingredients with their very own proprietary Belgian yeast strain to create the remarkably unique and refreshing beer that is today their flagship brand. Allagash White developed a strong cult following around the Portland area where it was available at selected draft accounts. Due to its immediate success, the beer was soon made available in 12-ounce six-packs throughout the state of Maine. With the success of the first brand, Rob realized two things: The public was asking for some new styles and the workload was getting to be too much for one person. Soon after, two experienced brewers were hired and Allagash released their second brew, Allagash Double Ale. Using the philosophy and techniques created by the Trappist Monks of Belgium centuries ago, the staff created this beer using seven different malts, a traditional sugar, and their own Belgian yeast strain. The result was another unique yet balanced beer crafted in the classic Belgian style. To truly appreciate the classic styles and brewing traditions of Belgium, one must experience beer created in the classic Belgian package. This is why Allagash, after an extensive period of research, released their distinctive Reserve line of cork finished 750 ML bottles. This unique line employs the ancient tradition referred to as the méthode champenoise. The technique calls for two fermentations, one in the Brewery's fermenting tanks and the second in the bottle itself. It is this second fermentation that produces a notable increase in carbonation, a softer mouthfeel, and beers of remarkable complexity. This method of bottle conditioning leaves a small amount of yeast in the bottle, creating what is known as a living beer. As a result, these styles have a greatly enhanced shelf life and some styles will age exceptionally, much like a fine wine. Just as the styles originate in Belgium, so does the package itself. To insure authenticity, Allagash imports the bottles and corks directly from the same country that designed the techniques. This enables the beers to reach carbonation levels similar to champagne while allowing the corks to pop characteristically upon serving. Today, Allagash still remains one of very few breweries in North America using this distinctive package. From the very beginning, Allagash has strived to produce the finest Belgian-style and experimental ales this side of the Atlantic. It began as New England's original Belgian-Style brewery and has grown into one of the industry's most distinguished and well-respected brands. Following the time-tested brewing traditions of ancient Belgium, Allagash now produces a broad-ranging portfolio of artisanal beers with uncompromising quality."]


Seems silly, doesn't it? How useful, and realistic, is it to have such a key?
Comment by Farshid Ghods (Inactive) [ 18/Aug/12 ]
Steve,
map function can be adjusted for this and other views in beer dataset to have keys that are shorter
Comment by Aleksey Kondratenko [ 18/Aug/12 ]
Looks like some views bug instead. I fail to see how this code can emit such a long key.

I've seen it myself too and assume that's 100% reproducible. But I haven't yet had time to fully dig.

Note in order to reproduce you may have to:

*) load samples either manually or through settings UI (not in wizard)

*) increase samples loading timeout in menelaus_web.erl
Comment by Aleksey Kondratenko [ 18/Aug/12 ]
Sorry. Broken map function is this:


       "by_key_value": {
           "map": "function (doc, meta) {\n for (var k in doc) {\n if (k[0] !== '_') {\n var value = String(doc[k]);\n emit([k, value], 1);\n } else {\n continue;\n }\n }\n}",
           "reduce": "_count"
       },

Who owns this stuff ? Really Steve's team?
Comment by Filipe Manana [ 18/Aug/12 ]
Unless you have full evidence, please don't assign it to me.
Comment by Farshid Ghods (Inactive) [ 18/Aug/12 ]
Aliaksey,

I assigned this ticket to Steve team and Bin was looking at this and he has already uploaded a fix for this
http://review.membase.org/#change,19834

It would be good to let other component owners have a look at the issues when assigned to them before the bug is passed around again.

please assign it back to me or Peter if you think the assignee is incorrect and we will re-assign the bug

Comment by Dipti Borkar [ 20/Aug/12 ]
"Our btrees (couchdb, couchstore) don't support keys that can't be represented with 12 bits (max key size is therefore 4096 bytes)"

If this is a hard limit with the view engine, we should document it.
Filipe, is this a hard limit?
Comment by Filipe Manana [ 20/Aug/12 ]
See my comment above, it's a limit in storage and view engines, common code betweem both, Damien wrote it.
Comment by Filipe Manana [ 20/Aug/12 ]
Added a change (http://review.couchbase.org/#change,19868) to return a more friendly error message, such as:

[Mon, 20 Aug 2012 12:07:43 GMT] [error] [<0.419.0>] Bucket `default`, main group `_design/test`, key emitted for document `doc1` is too long: "doc1doc1doc1doc1doc1doc1doc1doc1doc1dc1doc1doc1doc1doc1doc1doc1doc1doc1doc1doc1doc1doc1doc1doc1doc1doc1doc...

Only logs the first 100 characters of the too long key.
Comment by MC Brown (Inactive) [ 20/Aug/12 ]
Added a note to the limitations appendix and views chapter
Comment by Thuan Nguyen [ 20/Aug/12 ]
Integrated in github-couchdb-preview #485 (See [http://qa.hq.northscale.net/job/github-couchdb-preview/485/])
    MB-6295 More explicit error message when keys are too long (Revision b2686aed6cf28aba105a9d48357fcd1e71e8bbcd)

     Result = SUCCESS
Filipe David Borba Manana :
Files :
* src/couch_set_view/src/couch_set_view_updater.erl
* src/couch_set_view/test/12-errors.t
Comment by Abhinav Dangeti [ 10/Sep/12 ]
Verified fix on build 1705.
Generated at Tue Jul 29 01:27:23 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.