Closed 825644691 closed 2 years ago
The root problem here is that you cannot set the client threads per version after you open your database, it must be done before. The fact that this triggers an assertion rather than a friendlier error is a bug, and we have an existing issue for this:
func main() { // Different API versions may expose different runtime behaviors. fdb.MustAPIVersion(630) op:=fdb.NetworkOptions{} err2 := op.SetExternalClientLibrary("/root/libfdb_c.so") fmt.Println(err2) err:= op.SetClientThreadsPerVersion(10) fmt.Println(err) db := fdb.MustOpenDatabase("/etc/foundationdb/fdb.cluster") fmt.Println(db) keyname := strings.Join([]string{"key", fmt.Sprintf("%d", rand.Intn(10000))}, ":") , err3 := db.Transact(func (tr fdb.Transaction) (ret interface{}, e error) { tr.Set(fdb.Key(key_name), []byte("asd")) return }) println(err3) }
ExternalClientLibrary means that libfdb_c? I also can't create multi network threads per second..
@sfc-gh-ajbeamon hello
func getFdbConnection() fdb.Database { fdb.MustAPIVersion(620) op:=fdb.NetworkOptions{} err2 := op.SetExternalClientLibrary("/root/libfdb_c.so") fmt.Println(err2) err:= op.SetClientThreadsPerVersion(40) fmt.Println(err) db := fdb.MustOpenDatabase("/apps/dbdat/foundationdb/fdb.cluster") return db
}
I use this method to create multi network threads . no errors but only 3 threads
[root@localhost ~]# netstat -lnap | grep fdb | wc -l 10
[root@localhost ~]# netstat -lnap | grep fdb | wc -l 13
func main() { // Different API versions may expose different runtime behaviors. fdb.MustAPIVersion(610) // Open the default database from the system cluster db := fdb.MustOpenDatabase("/etc/foundationdb/fdb.cluster") op:=fdb.NetworkOptions{} //op.SetExternalClientLibrary("false") //op.SetDisableMultiVersionClientApi() //print(err) op.SetClientThreadsPerVersion(10) fmt.Println(db) }
Assertion !networkStartSetup failed @ /root/src/oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOo/foundationdb/fdbclient/MultiVersionTransaction.actor.cpp 1536: addr2line -e libfdb_c.so-debug -p -C -f -i 0x4f8fa4 0x1a4140 0x179348 0xffff80668b3583dd {0xc00001a0b0}