Facing issue with FDB API version


(Sakthivel) #1

Hi,
I have created a C client and configured FDB API version as 20. It is working fine.

I have cross verified the actual version of FDB library and it is 610. I have confirmed this version by calling the FDB API fdb_get_max_api_version() and it returns 610. Passed current FDB API version to fdb_select_api_version().

fdb_select_api_version(fdb_get_max_api_version());

Got run time error “Error (2202): API version not valid

Why I’m not able to set current FDB API version in client ?


(Ryan Worl) #2

The currently released API version is 600. Unless you’ve compiled from source and you’re testing the 6.1 series, you should use 600. If that doesn’t work that would be a different issue to post about :grinning:


(A.J. Beamon) #3

Another thing you can check is that your application isn’t defining a smaller version like so:

#define FDB_API_VERSION 600

Instead, this header version must be at least as large as the version you choose when calling fdb_select_api_version.


(Sakthivel) #4

@ryanworl,
I have set the FDB API version as 600 but facing some compilation issues. I have tried to solve it but it doesn’t. Error says “fdb_future_is_error()” function taking 0 arguments but taking 1 argument. I have compiled removing the argument, still facing same issue.
It’s working fine when I set the API version as 20.

How to solve this issues with latest API version ?

fdb_client.c: In function ‘waitAndCheckError’:
fdb_client.c:22:34: error: macro "This_FoundationDB_API_function_is_removed_at_this_FDB_API_VERSION" passed 1 arguments, but takes just 0
     if(fdb_future_is_error(future))
                                  ^
In file included from fdb_client.c:7:0:
../foundationdb/bindings/c/foundationdb/fdb_c.h:53:30: error: ‘This_FoundationDB_API_function_is_removed_at_this_FDB_API_VERSION’ undeclared (first use in this function)
 #define FDB_REMOVED_FUNCTION This_FoundationDB_API_function_is_removed_at_this_FDB_API_VERSION(0)
                              ^
../foundationdb/bindings/c/foundationdb/fdb_c.h:292:36: note: in expansion of macro ‘FDB_REMOVED_FUNCTION’
     #define fdb_future_is_error(x) FDB_REMOVED_FUNCTION
                                    ^
fdb_client.c:22:8: note: in expansion of macro ‘fdb_future_is_error’
     if(fdb_future_is_error(future))
        ^
../foundationdb/bindings/c/foundationdb/fdb_c.h:53:30: note: each undeclared identifier is reported only once for each function it appears in
 #define FDB_REMOVED_FUNCTION This_FoundationDB_API_function_is_removed_at_this_FDB_API_VERSION(0)
                              ^
../foundationdb/bindings/c/foundationdb/fdb_c.h:292:36: note: in expansion of macro ‘FDB_REMOVED_FUNCTION’
     #define fdb_future_is_error(x) FDB_REMOVED_FUNCTION
                                    ^
fdb_client.c:22:8: note: in expansion of macro ‘fdb_future_is_error’
     if(fdb_future_is_error(future))
        ^
fdb_client.c: In function ‘createData’:
fdb_client.c:72:44: error: macro "This_FoundationDB_API_function_is_removed_at_this_FDB_API_VERSION" passed 1 arguments, but takes just 0
         if(fdb_future_is_error(commitFuture)) {
                                            ^
In file included from fdb_client.c:7:0:
../foundationdb/bindings/c/foundationdb/fdb_c.h:53:30: error: ‘This_FoundationDB_API_function_is_removed_at_this_FDB_API_VERSION’ undeclared (first use in this function)
 #define FDB_REMOVED_FUNCTION This_FoundationDB_API_function_is_removed_at_this_FDB_API_VERSION(0)
                              ^
../foundationdb/bindings/c/foundationdb/fdb_c.h:292:36: note: in expansion of macro ‘FDB_REMOVED_FUNCTION’
     #define fdb_future_is_error(x) FDB_REMOVED_FUNCTION
                                    ^
fdb_client.c:72:12: note: in expansion of macro ‘fdb_future_is_error’
         if(fdb_future_is_error(commitFuture)) {

Thanks in advance


(A.J. Beamon) #5

fdb_future_is_error is a function that was removed from the API quite a while ago in version 23. You won’t be able to use it with any modern version, but you can use fdb_future_get_error or just any of the future get methods to determine the error state of a future.

In general, it shouldn’t be assumed that a program written for one API version will work correctly in another unmodified. Sometimes there will be changes to the available methods or their signatures, and other times there could be changes to behavior that may not result in compile-time failures. To see what has changed in a version with respect to the API, you can consult the release notes.

Lastly, when writing a new program from scratch, it is recommended that you use the latest API version unless you have a specific need to do otherwise. That way you can use the newest features without having to go through multiple versions worth of changes.


(Sakthivel) #6

Thanks @ajbeamon for your continuous support.

Going to write a new client using latest API calls.