|
OK, i can comprehend the reason. Thank you for your help.
|
|
Hey Claudio,
At this point we are not going to modify the API of BSONObj. There is simply too much code that depends on the current implementation to make that change. It is unfortunate that it was designed that way but unfortunately we must live with it in the current form until we decide to replace or introduce a new implementation in the future.
|
|
i think that this aspect of BSON need to be fixed because long long mean "at least 64 bit" int64_t mean "exactly 64 bit". Anyway tomorrow will try at office, and on LLVM (osx) it work perfectly
|
|
Yes we don't have an appendNum for int64_t unfortunately, just cast it to a long long so that it becomes unambiguous.
|
|
now i got this error:
/home/bisegni/source/chaos_bundle/chaosframework/ChaosDataService/index_system/MongoDBIndexDriver.cpp:569:139: error: call of overloaded ‘appendNumber(const char [10], int64_t)’ is ambiguous
|
index_builder.appendNumber(MONGO_DB_IDX_DATA_PACK_DATA_BLOCK_DST_OFFSET, (int64_t)getDataBlockOffsetFromFileLocation(index.dst_location));
|
^
|
/home/bisegni/source/chaos_bundle/chaosframework/ChaosDataService/index_system/MongoDBIndexDriver.cpp:569:139: note: candidates are:
|
In file included from /home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/db/jsobj.h:38:0,
|
from /home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/client/exceptions.h:21,
|
from /home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/client/dbclientinterface.h:29,
|
from /home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/client/connpool.h:22,
|
from /home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/client/dbclient.h:59,
|
from /home/bisegni/source/chaos_bundle/chaosframework/ChaosDataService/index_system/MongoDBHAConnectionManager.h:24,
|
from /home/bisegni/source/chaos_bundle/chaosframework/ChaosDataService/index_system/MongoDBIndexDriver.h:24,
|
from /home/bisegni/source/chaos_bundle/chaosframework/ChaosDataService/index_system/MongoDBIndexDriver.cpp:9:
|
/home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/bson/bsonobjbuilder.h:211:25: note: mongo::BSONObjBuilder& mongo::BSONObjBuilder::appendNumber(const mongo::StringData&, int)
|
BSONObjBuilder& appendNumber( const StringData& fieldName , int n ) {
|
^
|
/home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/bson/bsonobjbuilder.h:215:25: note: mongo::BSONObjBuilder& mongo::BSONObjBuilder::appendNumber(const mongo::StringData&, double)
|
BSONObjBuilder& appendNumber( const StringData& fieldName , double d ) {
|
^
|
/home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/bson/bsonobjbuilder.h:219:25: note: mongo::BSONObjBuilder& mongo::BSONObjBuilder::appendNumber(const mongo::StringData&, size_t)
|
BSONObjBuilder& appendNumber( const StringData& fieldName , size_t n ) {
|
^
|
/home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/bson/bsonobjbuilder.h:229:25: note: mongo::BSONObjBuilder& mongo::BSONObjBuilder::appendNumber(const mongo::StringData&, long long int)
|
BSONObjBuilder& appendNumber( const StringData& fieldName, long long llNumber ) {
|
^
|
make[2]: *** [bin/bin_chst/CMakeFiles/ChaosDataService.dir/index_system/MongoDBIndexDriver.cpp.o] Error 1
|
make[1]: *** [bin/bin_chst/CMakeFiles/ChaosDataService.dir/all] Error 2
|
|
|
Sorry its BSONObjBuilder::appendNumber(), I was thinking of the bufbuilder variant. Please use appendNumber instead.
|
|
i got this error during compilation:
class mongo::BSONObjBuilder’ has no member named ‘appendNum’
|
index_builder.appendNum(MONGO_DB_IDX_DATA_PACK_ACQ_TS_NUMERIC, (int64_t)index.acquisition_ts);
|
|
|
i have had some delay due to work, i have tried to use "<<" instead append and the issue is raised anyway. now i'll try with appendNum and i'll notify
|
|
Any updates?
|
|
the problem is that i vae cut the method that i have added and perhaps some blank line could be remained. Any way the method that give problem is append(const StringData& fieldName, OpTime optime).
shouldn't the gcc give the ambiguity error on the line where it is resolved? in the error i have posted above it is not mentioned any code line....
Any way, the version compiled before i have applied the "patch" is the "legacy-1.0.0-rc0",i have check one more time
Tomorrow, when i cam back to my office i'll try to apply your solution.
|
|
Ok, thank you. In your code can you try using appendNum() instead of append() for appending numbers to try and remove the ambiguity?
Also when viewing our code for legacy-1.0.0-rc0 line 386 in bsonobjbuilder.h is different than the line the compiler is complaining about. Is it possible you are using a different version than the code tagged at rc0?
|
|
sure, for the compiler i use:
gcc -v
|
Using built-in specs.
|
COLLECT_GCC=gcc
|
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
|
Target: x86_64-linux-gnu
|
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
|
Thread model: posix
|
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
|
for the mongodb driver i point to the tag "legacy-1.0.0-rc0"
|
|
Thanks Claudio, no worries, sometimes the comments need to be long.
I'm sorry for all the back and forth but can you tell me what version of the driver you are using and also how you are compiling it? What compiler/platform etc?
|
|
hi,
i'm sorry for the long comment. Below is the compilation error:
/home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/bson/bsonobjbuilder.h:386:25: note: no known conversion for argument 2 from ‘long int’ to ‘const mongo::StringData&’
|
In file included from /home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/db/jsobj.h:43:0,
|
from /home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/client/exceptions.h:21,
|
from /home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/client/dbclientinterface.h:29,
|
from /home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/client/connpool.h:22,
|
from /home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/client/dbclient.h:55,
|
from /home/bisegni/source/chaos_bundle/chaosframework/ChaosDataService/index_system/MongoDBHAConnectionManager.h:24,
|
from /home/bisegni/source/chaos_bundle/chaosframework/ChaosDataService/index_system/MongoDBIndexDriver.h:24,
|
from /home/bisegni/source/chaos_bundle/chaosframework/ChaosDataService/index_system/MongoDBIndexDriver.cpp:9:
|
/home/bisegni/source/chaos_bundle/chaosframework/usr/local/include/mongo/bson/bson_db.h:46:28: note: mongo::BSONObjBuilder& mongo::BSONObjBuilder::append(const mongo::StringData&, mongo::OpTime)
|
inline BSONObjBuilder& BSONObjBuilder::append(const StringData& fieldName, OpTime optime) {
|
in MongoDBIndexDriver.cpp:9 there is only the include to MongoDBIndexDriver.h. The compiler seems to go deeply in header before starting to check the cpp code
|
|
Hi Claudio,
You can click the more button and select "attach files" to provide the code. Please don't post anything proprietary (or with credentials).
Also, I'm more interested in a snippet of code that reproduces the error that you are receiving, and the text of the error message from the compiler exactly as it appears to you. Please don't post large sections of your client program as these will not help us get to the bottom of the problem (we can't possibly look through all the code anyway).
|
|
hi Tyler,
yes of course:
I have a my personal class to do an HA driver for mongodb (into c++ it is not still present) following is the header. Do you need also the cpp?
here is the code.
/*
|
* MongoDBHAConnection.h
|
* !CHOAS
|
* Created by Bisegni Claudio.
|
*
|
* Copyright 2012 INFN, National Institute of Nuclear Physics
|
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
* you may not use this file except in compliance with the License.
|
* You may obtain a copy of the License at
|
*
|
* http://www.apache.org/licenses/LICENSE-2.0
|
*
|
* Unless required by applicable law or agreed to in writing, software
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* See the License for the specific language governing permissions and
|
* limitations under the License.
|
*/
|
|
#ifndef __CHAOSFramework__MongoDBHAConnection__
|
#define __CHAOSFramework__MongoDBHAConnection__
|
|
#include "mongo/client/dbclient.h"
|
|
#include <vector>
|
#include <string>
|
#include <queue>
|
#include <map>
|
#include <boost/thread.hpp>
|
#include <boost/shared_ptr.hpp>
|
#include <chaos/common/data/CDataWrapper.h>
|
|
namespace chaos_data = chaos::common::data;
|
|
namespace chaos {
|
namespace data_service {
|
namespace db_system {
|
|
/*!
|
Class that encapsulat ethe mongodb conenction for safe deallocation
|
*/
|
class DriverScopedConnection : public mongo::ScopedDbConnection {
|
|
public:
|
DriverScopedConnection(mongo::ConnectionString _conn);
|
~DriverScopedConnection();
|
};
|
|
typedef DriverScopedConnection *MongoDBHAConnection;
|
|
class MongoAuthHook : public mongo::DBConnectionHook {
|
std::string user;
|
std::string pwd;
|
std::string db;
|
bool has_autentication;
|
void onCreate( mongo::DBClientBase * conn );
|
void onHandedOut( mongo::DBClientBase * conn );
|
void onDestroy( mongo::DBClientBase * conn );
|
public:
|
MongoAuthHook(std::map<string,string>& key_value_custom_param);
|
};
|
|
/*!
|
Implementation for the high availability with multiple
|
mongos router instance
|
*/
|
class MongoDBHAConnectionManager {
|
uint32_t server_number;
|
|
uint64_t next_retrive_intervall;
|
|
boost::shared_mutex mutext_queue;
|
std::queue< boost::shared_ptr<mongo::ConnectionString> > valid_connection_queue;
|
std::queue< boost::shared_ptr<mongo::ConnectionString> > offline_connection_queue;
|
|
inline bool canRetry();
|
|
bool getConnection(MongoDBHAConnection *connection_sptr);
|
|
public:
|
MongoDBHAConnectionManager(std::vector<std::string> monogs_routers_list, std::map<string,string>& key_value_custom_param);
|
~MongoDBHAConnectionManager();
|
|
int insert( const std::string &ns , mongo::BSONObj obj , int flags=0);
|
int findOne( mongo::BSONObj& result, const std::string &ns, const mongo::Query& query, const mongo::BSONObj *fieldsToReturn = 0, int queryOptions = 0);
|
void findN(std::vector<mongo::BSONObj>& out, const std::string& ns, mongo::Query query, int nToReturn, int nToSkip = 0, const mongo::BSONObj *fieldsToReturn = 0, int queryOptions = 0);
|
int runCommand( mongo::BSONObj& result, const std::string &ns, const mongo::BSONObj& comand, int queryOptions = 0);
|
int update( const std::string &ns, mongo::Query query, mongo::BSONObj obj, bool upsert = false, bool multi = false, const mongo::WriteConcern* wc=NULL );
|
int remove( const std::string &ns , mongo::Query q , bool justOne = 0, const mongo::WriteConcern* wc=NULL );
|
int ensureIndex( const std::string &database, const std::string &collection, mongo::BSONObj keys, bool unique = false, const std::string &name = "", bool dropDup = false, bool background = false, int v = -1, int ttl = 0 );
|
};
|
}
|
}
|
}
|
#endif /* defined(_CHAOSFrameworkMongoDBHAConnection_) */
i don't have found the attachment "button" for this issue so i have copied the code
|
|
Hi Claudio,
Thank you for filing a ticket. Would you mind attaching the code using BSONObjBuilder that is causing the error?
|
Generated at Wed Feb 07 21:58:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.