Description
When testing multi-collection source for Eventing if we pass the wrong keyspace to bucket binding the processing can stall with a script timeout (default 60 sec.)
Given:
Listen To Location source.*.*
|
bucket alias: alias_ro source.myscope.* (read-only)
|
Say we get a document from "source._default._default" and apply the meta object to alias_ro which does not cover the keyspace
function OnUpdate(doc, meta) {
|
var tst_ro = couchbase.get(alias_ro,meta);
|
We will get a timeout and an error and the processing thread will stall.
running a test script (which makes two buckets loads some documents and imports/deploys an Eventing function mgr_test.json
./test_MB_52548.sh
Couchbase Server 7.1.1-3127 (EE)
|
#====================================
|
# test as admin or eventing admin on a new/blank cluster
|
#
|
# Will make 2 buckets and 4 collections total
|
# Source: source._default._default
|
# Source: source.myscope.mycol1
|
# Source: source.myscope.mycol2
|
# Metadata: eventing._default._default
|
# Will make 3 documnets 1 in each collection in source
|
# source._default._default KEY doc0 DATA {"data": "doc0"}
|
# source.myscope.mycol1 KEY doc1 DATA {"data": "doc1"}
|
# source.myscope.mycol2 KEY doc2 DATA {"data": "doc2"}
|
#------------------------------------
|
SUCCESS: Bucket created
|
SUCCESS: Scope created
|
SUCCESS: Collection created
|
SUCCESS: Collection created
|
SUCCESS: Bucket created
|
SUCCESS: Events imported
|
mgr_test
|
Status: undeployed
|
Source: source.*.*
|
Metadata: eventing._default._default
|
planet/_default/convert
|
Status: undeployed
|
Source: planet._default.chile
|
Metadata: planet._default._default
|
sleep 5
|
# done with ensuring setup .... (ignore errors above)
|
doc0 Stored. CAS=0x16f89078393e0000
|
SYNCTOKEN=642,251380766529812,4
|
doc1 Stored. CAS=0x16f890783a840000
|
SYNCTOKEN=389,203397901096801,4
|
doc2 Stored. CAS=0x16f890783bca0000
|
SYNCTOKEN=140,104573765957842,4
|
# done loading documets
|
|
DEPLOY mgr_test
|
{
|
"code": 0,
|
"info": "Function: mgr_test is deploying"
|
}
|
LET RUN FOR about 80 seconds, then do a ^C after you see and "exception"
|
tail -f /opt/couchbase/var/lib/couchbase/data/@eventing/mgr_test.log
|
2022-06-14T11:39:06.573-07:00 [INFO] "A IN" {"data":"doc2"} {"cas":"1655231934813700096","id":"doc2","expiration":0,"flags":0,"vb":140,"seq":5,"datatype":"json","keyspace":{"bucket_name":"source","scope_name":"myscope","collection_name":"mycol2"},"cid":9} 2022-06-14T11:39:06.575-07:00 [INFO] "B TST_ro" "doc2" "gives" {"doc":{"data":"doc2"},"meta":{"id":"doc2","cas":"1655231934813700096","datatype":"json"},"success":true} 2022-06-14T11:39:07.096-07:00 [INFO] "A IN" {"data":"doc1"} {"cas":"1655231934796005376","id":"doc1","expiration":0,"flags":0,"vb":389,"seq":5,"datatype":"json","keyspace":{"bucket_name":"source","scope_name":"myscope","collection_name":"mycol1"},"cid":8} 2022-06-14T11:39:07.097-07:00 [INFO] "B TST_ro" "doc1" "gives" {"doc":{"data":"doc1"},"meta":{"id":"doc1","cas":"1655231934796005376","datatype":"json"},"success":true} 2022-06-14T11:39:07.728-07:00 [INFO] "A IN" {"data":"doc0"} {"cas":"1655231934771625984","id":"doc0","expiration":0,"flags":0,"vb":642,"seq":5,"datatype":"json","keyspace":{"bucket_name":"source","scope_name":"_default","collection_name":"_default"},"cid":0}
|
we show in the UI
success failure backlog timeout
|
2 0 0 0
|
now we "stall" for the script timeout 60 seconds and print two more messages
2022-06-14T11:40:09.949-07:00 [INFO] {"exception":"","file":"mgr_test.js","line":23,"srcLine":"var tst_ro = couchbase.get(alias_ro,meta);","stack":""}
|
2022-06-14T11:40:11.149-07:00 [INFO] {"count":1,"exception":"","file":"mgr_test.js","line":23,"since":"2022-06-14T11:40:09","srcLine":"var tst_ro = couchbase.get(alias_ro,meta);","stack":""}
|
we show in the UI
success failure backlog timeout
|
3 2 0 1
|