diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-07-30 11:58:31 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-07-30 11:58:31 +0300 |
commit | cab228435bde1b5496522c03a4ce9840f2ef3701 (patch) | |
tree | 2c37b65d176e2de097603333f4de071c31eeff3d /db/libdb_java | |
parent | 2d07882d45e9e575c00f8f402d4c7271bb65cfe9 (diff) | |
download | librpm-tizen-cab228435bde1b5496522c03a4ce9840f2ef3701.tar.gz librpm-tizen-cab228435bde1b5496522c03a4ce9840f2ef3701.tar.bz2 librpm-tizen-cab228435bde1b5496522c03a4ce9840f2ef3701.zip |
Update internal BDB to version 4.6.18.
Diffstat (limited to 'db/libdb_java')
-rw-r--r-- | db/libdb_java/db.i | 122 | ||||
-rw-r--r-- | db/libdb_java/db_java.i | 121 | ||||
-rw-r--r-- | db/libdb_java/db_java_wrap.c | 801 | ||||
-rw-r--r-- | db/libdb_java/java_callbacks.i | 154 | ||||
-rw-r--r-- | db/libdb_java/java_except.i | 16 | ||||
-rw-r--r-- | db/libdb_java/java_stat.i | 1 | ||||
-rw-r--r-- | db/libdb_java/java_stat_auto.c | 41 | ||||
-rw-r--r-- | db/libdb_java/java_typemaps.i | 10 | ||||
-rw-r--r-- | db/libdb_java/java_util.i | 163 |
9 files changed, 1123 insertions, 306 deletions
diff --git a/db/libdb_java/db.i b/db/libdb_java/db.i index 92001d02c..8f1d3307c 100644 --- a/db/libdb_java/db.i +++ b/db/libdb_java/db.i @@ -144,8 +144,9 @@ struct Db self->errx(self, message); } - int_bool get_transactional() { - return self->get_transactional(self); + JAVA_EXCEPT(DB_RETOK_EXISTS, DB2JDBENV) + int exists(DB_TXN *txnid, DBT *key, u_int32_t flags) { + return self->exists(self, txnid, key, flags); } #ifndef SWIGJAVA @@ -270,6 +271,12 @@ struct Db return ret; } + DB_CACHE_PRIORITY get_priority() { + DB_CACHE_PRIORITY ret; + errno = self->get_priority(self, &ret); + return ret; + } + u_int32_t get_re_len() { u_int32_t ret = 0; errno = self->get_re_len(self, &ret); @@ -294,6 +301,16 @@ struct Db return ret; } + JAVA_EXCEPT_NONE + int_bool get_multiple() { + return self->get_multiple(self); + } + + int_bool get_transactional() { + return self->get_transactional(self); + } + + JAVA_EXCEPT_ERRNO(DB_RETOK_STD, DB2JDBENV) DBTYPE get_type() { DBTYPE type = (DBTYPE)0; errno = self->get_type(self, &type); @@ -396,6 +413,11 @@ struct Db return self->set_flags(self, flags); } + db_ret_t set_h_compare( + int (*h_compare_fcn)(DB *, const DBT *, const DBT *)) { + return self->set_h_compare(self, h_compare_fcn); + } + db_ret_t set_h_ffactor(u_int32_t h_ffactor) { return self->set_h_ffactor(self, h_ffactor); } @@ -429,6 +451,10 @@ struct Db } #endif /* SWIGJAVA */ + db_ret_t set_priority(DB_CACHE_PRIORITY priority) { + return self->set_priority(self, priority); + } + db_ret_t set_re_delim(int re_delim) { return self->set_re_delim(self, re_delim); } @@ -498,40 +524,53 @@ struct Dbc %extend { JAVA_EXCEPT(DB_RETOK_STD, NULL) db_ret_t close() { - return self->c_close(self); + return self->close(self); } JAVA_EXCEPT_ERRNO(DB_RETOK_STD, DBC2JDBENV) db_recno_t count(u_int32_t flags) { db_recno_t count = 0; - errno = self->c_count(self, &count, flags); + errno = self->count(self, &count, flags); return count; } JAVA_EXCEPT(DB_RETOK_DBCDEL, DBC2JDBENV) int del(u_int32_t flags) { - return self->c_del(self, flags); + return self->del(self, flags); } JAVA_EXCEPT_ERRNO(DB_RETOK_STD, DBC2JDBENV) DBC *dup(u_int32_t flags) { DBC *newcurs = NULL; - errno = self->c_dup(self, &newcurs, flags); + errno = self->dup(self, &newcurs, flags); return newcurs; } JAVA_EXCEPT(DB_RETOK_DBCGET, DBC2JDBENV) int get(DBT* key, DBT *data, u_int32_t flags) { - return self->c_get(self, key, data, flags); + return self->get(self, key, data, flags); } + JAVA_EXCEPT_ERRNO(DB_RETOK_STD, DBC2JDBENV) + DB_CACHE_PRIORITY get_priority() { + DB_CACHE_PRIORITY ret; + errno = self->get_priority(self, &ret); + return ret; + } + + JAVA_EXCEPT(DB_RETOK_DBCGET, DBC2JDBENV) int pget(DBT* key, DBT* pkey, DBT *data, u_int32_t flags) { - return self->c_pget(self, key, pkey, data, flags); + return self->pget(self, key, pkey, data, flags); } JAVA_EXCEPT(DB_RETOK_DBCPUT, DBC2JDBENV) int put(DBT* key, DBT *data, u_int32_t flags) { - return self->c_put(self, key, data, flags); + return self->put(self, key, data, flags); + } + + JAVA_EXCEPT_ERRNO(DB_RETOK_STD, DBC2JDBENV) + db_ret_t set_priority(DB_CACHE_PRIORITY priority) { + return self->set_priority(self, priority); } } }; @@ -575,6 +614,12 @@ struct DbEnv } #ifndef SWIGJAVA + u_int32_t get_thread_count() { + u_int32_t ret; + errno = self->get_thread_count(self, &ret); + return ret; + } + pid_t getpid() { pid_t ret; db_threadid_t junk; @@ -708,6 +753,12 @@ struct DbEnv (u_int32_t)(bytes % GIGABYTE), ncache); } + db_ret_t set_cache_max(jlong bytes) { + return self->set_cache_max(self, + (u_int32_t)(bytes / GIGABYTE), + (u_int32_t)(bytes % GIGABYTE)); + } + db_ret_t set_data_dir(const char *dir) { return self->set_data_dir(self, dir); } @@ -745,7 +796,7 @@ struct DbEnv return self->set_mp_max_openfd(self, maxopenfd); } - db_ret_t set_mp_max_write(int maxwrite, int maxwrite_sleep) { + db_ret_t set_mp_max_write(int maxwrite, db_timeout_t maxwrite_sleep) { return self->set_mp_max_write(self, maxwrite, maxwrite_sleep); } @@ -1017,6 +1068,12 @@ struct DbEnv return ret; } + jlong get_cache_max() { + u_int32_t gbytes, bytes; + errno = self->get_cache_max(self, &gbytes, &bytes); + return (jlong)gbytes * GIGABYTE + bytes; + } + int get_mp_max_openfd() { int ret; errno = self->get_mp_max_openfd(self, &ret); @@ -1024,15 +1081,17 @@ struct DbEnv } int get_mp_max_write() { - int ret, junk; - errno = self->get_mp_max_write(self, &ret, &junk); - return ret; + int maxwrite; + db_timeout_t sleep; + errno = self->get_mp_max_write(self, &maxwrite, &sleep); + return maxwrite; } - int get_mp_max_write_sleep() { - int ret, junk; - errno = self->get_mp_max_write(self, &junk, &ret); - return ret; + db_timeout_t get_mp_max_write_sleep() { + int maxwrite; + db_timeout_t sleep; + errno = self->get_mp_max_write(self, &maxwrite, &sleep); + return sleep; } size_t get_mp_mmapsize() { @@ -1173,14 +1232,13 @@ struct DbEnv return (jlong)gbytes * GIGABYTE + bytes; } - int rep_elect(int nsites, int nvotes, u_int32_t flags) { - int id; - errno = self->rep_elect(self, nsites, nvotes, &id, flags); - return id; + JAVA_EXCEPT(DB_RETOK_STD, JDBENV) + db_ret_t rep_elect(int nsites, int nvotes, u_int32_t flags) { + return self->rep_elect(self, nsites, nvotes, flags); } - + JAVA_EXCEPT(DB_RETOK_REPPMSG, JDBENV) - int rep_process_message(DBT *control, DBT *rec, int *envid, + int rep_process_message(DBT *control, DBT *rec, int envid, DB_LSN *ret_lsn) { return self->rep_process_message(self, control, rec, envid, ret_lsn); @@ -1195,6 +1253,10 @@ struct DbEnv return self->rep_set_config(self, which, onoff); } + db_ret_t rep_set_lease(u_int32_t clock_scale_factor, u_int32_t flags) { + return self->rep_set_lease(self, clock_scale_factor, flags); + } + db_ret_t rep_start(DBT *cdata, u_int32_t flags) { return self->rep_start(self, cdata, flags); } @@ -1302,6 +1364,13 @@ struct DbEnv return self->repmgr_start(self, nthreads, flags); } + JAVA_EXCEPT_ERRNO(DB_RETOK_STD, JDBENV) + DB_REPMGR_STAT *repmgr_stat(u_int32_t flags) { + DB_REPMGR_STAT *statp = NULL; + errno = self->repmgr_stat(self, &statp, flags); + return statp; + } + /* Convert DB errors to strings */ JAVA_EXCEPT_NONE static const char *strerror(int error) { @@ -1349,6 +1418,13 @@ struct DbLogc int get(DB_LSN *lsn, DBT *data, u_int32_t flags) { return self->get(self, lsn, data, flags); } + + JAVA_EXCEPT_ERRNO(DB_RETOK_STD, NULL) + u_int32_t version(u_int32_t flags) { + u_int32_t result; + errno = self->version(self, &result, flags); + return result; + } } }; diff --git a/db/libdb_java/db_java.i b/db/libdb_java/db_java.i index dd4ff939c..bc9ff29b3 100644 --- a/db/libdb_java/db_java.i +++ b/db/libdb_java/db_java.i @@ -71,6 +71,7 @@ import java.util.Comparator; private ReplicationTransport rep_transport_handler; private java.io.OutputStream error_stream; private java.io.OutputStream message_stream; + private ThreadLocal errMsg; public static class RepProcessMessage { public int envid; @@ -82,6 +83,7 @@ import java.util.Comparator; */ void initialize() { dbenv_ref = db_java.initDbEnvRef0(this, this); + errMsg = new ThreadLocal(); /* Start with System.err as the default error stream. */ set_error_stream(System.err); set_message_stream(System.out); @@ -102,8 +104,8 @@ import java.util.Comparator; } private final int handle_app_dispatch(DatabaseEntry dbt, - LogSequenceNumber lsn, - int recops) { + LogSequenceNumber lsn, + int recops) { return app_dispatch_handler.handleLogRecord(wrapper, dbt, lsn, RecoveryOperation.fromFlag(recops)); } @@ -112,8 +114,36 @@ import java.util.Comparator; return app_dispatch_handler; } - private final int handle_event_notify(int event) { - return event_notify_handler.handleEvent(EventType.fromInt(event)); + private final void handle_panic_event_notify() { + event_notify_handler.handlePanicEvent(); + } + + private final void handle_rep_client_event_notify() { + event_notify_handler.handleRepClientEvent(); + } + + private final void handle_rep_elected_event_notify() { + event_notify_handler.handleRepElectedEvent(); + } + + private final void handle_rep_master_event_notify() { + event_notify_handler.handleRepMasterEvent(); + } + + private final void handle_rep_new_master_event_notify(int envid) { + event_notify_handler.handleRepNewMasterEvent(envid); + } + + private final void handle_rep_perm_failed_event_notify() { + event_notify_handler.handleRepPermFailedEvent(); + } + + private final void handle_rep_startup_done_event_notify() { + event_notify_handler.handleRepStartupDoneEvent(); + } + + private final void handle_write_failed_event_notify(int errno) { + event_notify_handler.handleWriteFailedEvent(errno); } public EventHandler get_event_notify() { @@ -139,9 +169,29 @@ import java.util.Comparator; } private final void handle_error(String msg) { + StringBuffer tbuf = (StringBuffer) errMsg.get(); + /* + * Populate the errMsg ThreadLocal on demand, since the + * callback can be made from different threads. + */ + if (tbuf == null) { + tbuf = new StringBuffer(); + errMsg.set(tbuf); + } + tbuf.append(msg); error_handler.error(wrapper, this.errpfx, msg); } + private final String get_err_msg(String orig_msg) { + String ret = null; + StringBuffer tbuf = (StringBuffer) errMsg.get(); + if (tbuf != null) { + ret = tbuf.toString(); + tbuf.delete(0, tbuf.length()); + } + return orig_msg + ": " + ret; + } + public ErrorHandler get_errcall() { return error_handler; } @@ -163,20 +213,20 @@ import java.util.Comparator; } private final int handle_rep_transport(DatabaseEntry control, - DatabaseEntry rec, - LogSequenceNumber lsn, - int envid, int flags) + DatabaseEntry rec, + LogSequenceNumber lsn, + int envid, int flags) throws DatabaseException { return rep_transport_handler.send(wrapper, control, rec, lsn, envid, (flags & DbConstants.DB_REP_NOBUFFER) != 0, - (flags & DbConstants.DB_REP_PERMANENT) != 0, - (flags & DbConstants.DB_REP_ANYWHERE) != 0, - (flags & DbConstants.DB_REP_REREQUEST) != 0); + (flags & DbConstants.DB_REP_PERMANENT) != 0, + (flags & DbConstants.DB_REP_ANYWHERE) != 0, + (flags & DbConstants.DB_REP_REREQUEST) != 0); } public void lock_vec(/*u_int32_t*/ int locker, int flags, - LockRequest[] list, int offset, int count) + LockRequest[] list, int offset, int count) throws DatabaseException { db_javaJNI.DbEnv_lock_vec(swigCPtr, locker, flags, list, offset, count); @@ -209,7 +259,6 @@ import java.util.Comparator; return error_stream; } - public void set_message_stream(java.io.OutputStream stream) { message_stream = stream; final java.io.PrintWriter pw = new java.io.PrintWriter(stream); @@ -248,8 +297,10 @@ import java.util.Comparator; private BtreePrefixCalculator bt_prefix_handler; private Comparator dup_compare_handler; private FeedbackHandler db_feedback_handler; + private Comparator h_compare_handler; private Hasher h_hash_handler; private SecondaryKeyCreator seckey_create_handler; + private SecondaryMultiKeyCreator secmultikey_create_handler; /* Called by the Db constructor */ private void initialize(DbEnv dbenv) { @@ -305,7 +356,7 @@ import java.util.Comparator; } private final int handle_bt_prefix(DatabaseEntry dbt1, - DatabaseEntry dbt2) { + DatabaseEntry dbt2) { return bt_prefix_handler.prefix(wrapper, dbt1, dbt2); } @@ -325,6 +376,14 @@ import java.util.Comparator; return db_feedback_handler; } + private final int handle_h_compare(byte[] arr1, byte[] arr2) { + return h_compare_handler.compare(arr1, arr2); + } + + public Comparator get_h_compare() { + return h_compare_handler; + } + private final int handle_dup_compare(byte[] arr1, byte[] arr2) { return dup_compare_handler.compare(arr1, arr2); } @@ -341,19 +400,43 @@ import java.util.Comparator; return h_hash_handler; } - private final int handle_seckey_create(DatabaseEntry key, - DatabaseEntry data, - DatabaseEntry result) + private final DatabaseEntry[] handle_seckey_create( + DatabaseEntry key, + DatabaseEntry data) throws DatabaseException { - return seckey_create_handler.createSecondaryKey( - (SecondaryDatabase)wrapper, key, data, result) ? - 0 : DbConstants.DB_DONOTINDEX; + + if (secmultikey_create_handler != null) { + java.util.HashSet keySet = new java.util.HashSet(); + secmultikey_create_handler.createSecondaryKeys( + (SecondaryDatabase)wrapper, key, data, keySet); + if (!keySet.isEmpty()) + return (DatabaseEntry[])keySet.toArray( + new DatabaseEntry[keySet.size()]); + } else { + DatabaseEntry result = new DatabaseEntry(); + if (seckey_create_handler.createSecondaryKey( + (SecondaryDatabase)wrapper, key, data, result)) { + DatabaseEntry[] results = { result }; + return results; + } + } + + return null; } public SecondaryKeyCreator get_seckey_create() { return seckey_create_handler; } + public SecondaryMultiKeyCreator get_secmultikey_create() { + return secmultikey_create_handler; + } + + public void get_secmultikey_create( + SecondaryMultiKeyCreator secmultikey_create_handler) { + this.secmultikey_create_handler = secmultikey_create_handler; + } + public synchronized void remove(String file, String database, int flags) throws DatabaseException, java.io.FileNotFoundException { try { diff --git a/db/libdb_java/db_java_wrap.c b/db/libdb_java/db_java_wrap.c index 14253433b..7e047e52e 100644 --- a/db/libdb_java/db_java_wrap.c +++ b/db/libdb_java/db_java_wrap.c @@ -205,13 +205,14 @@ static jclass keyrange_class; static jclass bt_stat_class, compact_class, h_stat_class, lock_stat_class; static jclass log_stat_class, mpool_stat_class, mpool_fstat_class; static jclass mutex_stat_class, qam_stat_class, rep_stat_class; -static jclass rephost_class, seq_stat_class, txn_stat_class; +static jclass repmgr_stat_class, rephost_class, seq_stat_class, txn_stat_class; static jclass txn_active_class; -static jclass lock_class, lockreq_class, rep_processmsg_class; +static jclass lock_class, lockreq_class; static jclass dbex_class, deadex_class, lockex_class, memex_class; static jclass repdupmasterex_class, rephandledeadex_class; -static jclass repholdelectionex_class, repjoinfailex_class, replockoutex_class; -static jclass repunavailex_class; +static jclass repholdelectionex_class, repjoinfailex_class; +static jclass repleaseexpiredex_class, repleasetimeoutex_class; +static jclass replockoutex_class, repunavailex_class; static jclass runrecex_class, versionex_class; static jclass filenotfoundex_class, illegalargex_class, outofmemerr_class; static jclass bytearray_class, string_class, outputstream_class; @@ -224,7 +225,6 @@ static jfieldID kr_less_fid, kr_equal_fid, kr_greater_fid; static jfieldID lock_cptr_fid; static jfieldID lockreq_op_fid, lockreq_modeflag_fid, lockreq_timeout_fid; static jfieldID lockreq_obj_fid, lockreq_lock_fid; -static jfieldID rep_processmsg_envid_fid; static jfieldID rephost_port_fid, rephost_host_fid, rephost_eid_fid; static jfieldID rephost_status_fid; @@ -234,6 +234,7 @@ static jfieldID bt_stat_bt_version_fid; static jfieldID bt_stat_bt_metaflags_fid; static jfieldID bt_stat_bt_nkeys_fid; static jfieldID bt_stat_bt_ndata_fid; +static jfieldID bt_stat_bt_pagecnt_fid; static jfieldID bt_stat_bt_pagesize_fid; static jfieldID bt_stat_bt_minkey_fid; static jfieldID bt_stat_bt_re_len_fid; @@ -263,6 +264,7 @@ static jfieldID h_stat_hash_version_fid; static jfieldID h_stat_hash_metaflags_fid; static jfieldID h_stat_hash_nkeys_fid; static jfieldID h_stat_hash_ndata_fid; +static jfieldID h_stat_hash_pagecnt_fid; static jfieldID h_stat_hash_pagesize_fid; static jfieldID h_stat_hash_ffactor_fid; static jfieldID h_stat_hash_buckets_fid; @@ -280,9 +282,9 @@ static jfieldID lock_stat_st_maxlocks_fid; static jfieldID lock_stat_st_maxlockers_fid; static jfieldID lock_stat_st_maxobjects_fid; static jfieldID lock_stat_st_nmodes_fid; +static jfieldID lock_stat_st_nlockers_fid; static jfieldID lock_stat_st_nlocks_fid; static jfieldID lock_stat_st_maxnlocks_fid; -static jfieldID lock_stat_st_nlockers_fid; static jfieldID lock_stat_st_maxnlockers_fid; static jfieldID lock_stat_st_nobjects_fid; static jfieldID lock_stat_st_maxnobjects_fid; @@ -297,19 +299,26 @@ static jfieldID lock_stat_st_locktimeout_fid; static jfieldID lock_stat_st_nlocktimeouts_fid; static jfieldID lock_stat_st_txntimeout_fid; static jfieldID lock_stat_st_ntxntimeouts_fid; +static jfieldID lock_stat_st_objs_wait_fid; +static jfieldID lock_stat_st_objs_nowait_fid; +static jfieldID lock_stat_st_lockers_wait_fid; +static jfieldID lock_stat_st_lockers_nowait_fid; +static jfieldID lock_stat_st_locks_wait_fid; +static jfieldID lock_stat_st_locks_nowait_fid; static jfieldID lock_stat_st_region_wait_fid; static jfieldID lock_stat_st_region_nowait_fid; +static jfieldID lock_stat_st_hash_len_fid; static jfieldID lock_stat_st_regsize_fid; static jfieldID log_stat_st_magic_fid; static jfieldID log_stat_st_version_fid; static jfieldID log_stat_st_mode_fid; static jfieldID log_stat_st_lg_bsize_fid; static jfieldID log_stat_st_lg_size_fid; +static jfieldID log_stat_st_wc_bytes_fid; +static jfieldID log_stat_st_wc_mbytes_fid; static jfieldID log_stat_st_record_fid; static jfieldID log_stat_st_w_bytes_fid; static jfieldID log_stat_st_w_mbytes_fid; -static jfieldID log_stat_st_wc_bytes_fid; -static jfieldID log_stat_st_wc_mbytes_fid; static jfieldID log_stat_st_wcount_fid; static jfieldID log_stat_st_wcount_fill_fid; static jfieldID log_stat_st_rcount_fid; @@ -320,9 +329,9 @@ static jfieldID log_stat_st_cur_file_fid; static jfieldID log_stat_st_cur_offset_fid; static jfieldID log_stat_st_disk_file_fid; static jfieldID log_stat_st_disk_offset_fid; -static jfieldID log_stat_st_regsize_fid; static jfieldID log_stat_st_maxcommitperflush_fid; static jfieldID log_stat_st_mincommitperflush_fid; +static jfieldID log_stat_st_regsize_fid; static jfieldID mpool_fstat_file_name_fid; static jfieldID mpool_fstat_st_pagesize_fid; static jfieldID mpool_fstat_st_map_fid; @@ -334,11 +343,12 @@ static jfieldID mpool_fstat_st_page_out_fid; static jfieldID mpool_stat_st_gbytes_fid; static jfieldID mpool_stat_st_bytes_fid; static jfieldID mpool_stat_st_ncache_fid; -static jfieldID mpool_stat_st_regsize_fid; +static jfieldID mpool_stat_st_max_ncache_fid; static jfieldID mpool_stat_st_mmapsize_fid; static jfieldID mpool_stat_st_maxopenfd_fid; static jfieldID mpool_stat_st_maxwrite_fid; static jfieldID mpool_stat_st_maxwrite_sleep_fid; +static jfieldID mpool_stat_st_pages_fid; static jfieldID mpool_stat_st_map_fid; static jfieldID mpool_stat_st_cache_hit_fid; static jfieldID mpool_stat_st_cache_miss_fid; @@ -348,7 +358,6 @@ static jfieldID mpool_stat_st_page_out_fid; static jfieldID mpool_stat_st_ro_evict_fid; static jfieldID mpool_stat_st_rw_evict_fid; static jfieldID mpool_stat_st_page_trickle_fid; -static jfieldID mpool_stat_st_pages_fid; static jfieldID mpool_stat_st_page_clean_fid; static jfieldID mpool_stat_st_page_dirty_fid; static jfieldID mpool_stat_st_hash_buckets_fid; @@ -370,6 +379,7 @@ static jfieldID mpool_stat_st_alloc_max_buckets_fid; static jfieldID mpool_stat_st_alloc_pages_fid; static jfieldID mpool_stat_st_alloc_max_pages_fid; static jfieldID mpool_stat_st_io_wait_fid; +static jfieldID mpool_stat_st_regsize_fid; static jfieldID mutex_stat_st_mutex_align_fid; static jfieldID mutex_stat_st_mutex_tas_spins_fid; static jfieldID mutex_stat_st_mutex_cnt_fid; @@ -392,6 +402,8 @@ static jfieldID qam_stat_qs_re_pad_fid; static jfieldID qam_stat_qs_pgfree_fid; static jfieldID qam_stat_qs_first_recno_fid; static jfieldID qam_stat_qs_cur_recno_fid; +static jfieldID rep_stat_st_log_queued_fid; +static jfieldID rep_stat_st_startup_complete_fid; static jfieldID rep_stat_st_status_fid; static jfieldID rep_stat_st_next_lsn_fid; static jfieldID rep_stat_st_waiting_lsn_fid; @@ -410,7 +422,6 @@ static jfieldID rep_stat_st_client_svc_miss_fid; static jfieldID rep_stat_st_gen_fid; static jfieldID rep_stat_st_egen_fid; static jfieldID rep_stat_st_log_duplicated_fid; -static jfieldID rep_stat_st_log_queued_fid; static jfieldID rep_stat_st_log_queued_max_fid; static jfieldID rep_stat_st_log_queued_total_fid; static jfieldID rep_stat_st_log_records_fid; @@ -429,8 +440,8 @@ static jfieldID rep_stat_st_outdated_fid; static jfieldID rep_stat_st_pg_duplicated_fid; static jfieldID rep_stat_st_pg_records_fid; static jfieldID rep_stat_st_pg_requested_fid; -static jfieldID rep_stat_st_startup_complete_fid; static jfieldID rep_stat_st_txns_applied_fid; +static jfieldID rep_stat_st_startsync_delayed_fid; static jfieldID rep_stat_st_elections_fid; static jfieldID rep_stat_st_elections_won_fid; static jfieldID rep_stat_st_election_cur_winner_fid; @@ -444,6 +455,11 @@ static jfieldID rep_stat_st_election_tiebreaker_fid; static jfieldID rep_stat_st_election_votes_fid; static jfieldID rep_stat_st_election_sec_fid; static jfieldID rep_stat_st_election_usec_fid; +static jfieldID repmgr_stat_st_perm_failed_fid; +static jfieldID repmgr_stat_st_msgs_queued_fid; +static jfieldID repmgr_stat_st_msgs_dropped_fid; +static jfieldID repmgr_stat_st_connection_drop_fid; +static jfieldID repmgr_stat_st_connect_fail_fid; static jfieldID seq_stat_st_wait_fid; static jfieldID seq_stat_st_nowait_fid; static jfieldID seq_stat_st_current_fid; @@ -453,6 +469,7 @@ static jfieldID seq_stat_st_min_fid; static jfieldID seq_stat_st_max_fid; static jfieldID seq_stat_st_cache_size_fid; static jfieldID seq_stat_st_flags_fid; +static jfieldID txn_stat_st_nrestores_fid; static jfieldID txn_stat_st_last_ckp_fid; static jfieldID txn_stat_st_time_ckp_fid; static jfieldID txn_stat_st_last_txnid_fid; @@ -462,7 +479,6 @@ static jfieldID txn_stat_st_nbegins_fid; static jfieldID txn_stat_st_ncommits_fid; static jfieldID txn_stat_st_nactive_fid; static jfieldID txn_stat_st_nsnapshot_fid; -static jfieldID txn_stat_st_nrestores_fid; static jfieldID txn_stat_st_maxnactive_fid; static jfieldID txn_stat_st_maxnsnapshot_fid; static jfieldID txn_stat_st_txnarray_fid; @@ -483,18 +499,19 @@ static jfieldID txn_active_name_fid; static jmethodID dbenv_construct, dbt_construct, dblsn_construct; static jmethodID dbpreplist_construct, dbtxn_construct; -static jmethodID bt_stat_construct, h_stat_construct; +static jmethodID bt_stat_construct, get_err_msg_method, h_stat_construct; static jmethodID lock_stat_construct, log_stat_construct; static jmethodID mpool_stat_construct, mpool_fstat_construct; static jmethodID mutex_stat_construct, qam_stat_construct; -static jmethodID rep_stat_construct, seq_stat_construct; +static jmethodID rep_stat_construct, repmgr_stat_construct, seq_stat_construct; static jmethodID txn_stat_construct, txn_active_construct; static jmethodID dbex_construct, deadex_construct, lockex_construct; static jmethodID memex_construct, memex_update_method; static jmethodID repdupmasterex_construct, rephandledeadex_construct; static jmethodID repholdelectionex_construct, repjoinfailex_construct; -static jmethodID rephost_construct; -static jmethodID replockoutex_construct, repunavailex_construct; +static jmethodID rephost_construct, repleaseexpiredex_construct; +static jmethodID repleasetimeoutex_construct, replockoutex_construct; +static jmethodID repunavailex_construct; static jmethodID runrecex_construct, versionex_construct; static jmethodID filenotfoundex_construct, illegalargex_construct; static jmethodID outofmemerr_construct; @@ -502,11 +519,17 @@ static jmethodID lock_construct; static jmethodID app_dispatch_method, errcall_method, env_feedback_method; static jmethodID msgcall_method, paniccall_method, rep_transport_method; -static jmethodID event_notify_method; +static jmethodID panic_event_notify_method, rep_client_event_notify_method; +static jmethodID rep_elected_event_notify_method; +static jmethodID rep_master_event_notify_method; +static jmethodID rep_new_master_event_notify_method; +static jmethodID rep_perm_failed_event_notify_method; +static jmethodID rep_startup_done_event_notify_method; +static jmethodID write_failed_event_notify_method; static jmethodID append_recno_method, bt_compare_method, bt_prefix_method; -static jmethodID db_feedback_method, dup_compare_method, h_hash_method; -static jmethodID seckey_create_method; +static jmethodID db_feedback_method, dup_compare_method, h_compare_method; +static jmethodID h_hash_method, seckey_create_method; static jmethodID outputstream_write_method; @@ -532,6 +555,7 @@ const struct { { &mutex_stat_class, DB_PKG "MutexStats" }, { &qam_stat_class, DB_PKG "QueueStats" }, { &rep_stat_class, DB_PKG "ReplicationStats" }, + { &repmgr_stat_class, DB_PKG "ReplicationManagerStats" }, { &seq_stat_class, DB_PKG "SequenceStats" }, { &txn_stat_class, DB_PKG "TransactionStats" }, { &txn_active_class, DB_PKG "TransactionStats$Active" }, @@ -539,8 +563,6 @@ const struct { { &keyrange_class, DB_PKG "KeyRange" }, { &lock_class, DB_PKG "internal/DbLock" }, { &lockreq_class, DB_PKG "LockRequest" }, - { &rep_processmsg_class, DB_PKG "internal/DbEnv$RepProcessMessage" }, - { &rep_processmsg_class, DB_PKG "internal/DbEnv$RepProcessMessage" }, { &dbex_class, DB_PKG "DatabaseException" }, { &deadex_class, DB_PKG "DeadlockException" }, @@ -551,6 +573,8 @@ const struct { { &repholdelectionex_class, DB_PKG "ReplicationHoldElectionException" }, { &rephost_class, DB_PKG "ReplicationHostAddress" }, { &repjoinfailex_class, DB_PKG "ReplicationJoinFailureException" }, + { &repleaseexpiredex_class, DB_PKG "ReplicationLeaseExpiredException" }, + { &repleasetimeoutex_class, DB_PKG "ReplicationLeaseTimeoutException" }, { &replockoutex_class, DB_PKG "ReplicationLockoutException" }, { &repunavailex_class, DB_PKG "ReplicationSiteUnavailableException" }, { &runrecex_class, DB_PKG "RunRecoveryException" }, @@ -604,6 +628,7 @@ const struct { { &bt_stat_bt_metaflags_fid, &bt_stat_class, "bt_metaflags", "I" }, { &bt_stat_bt_nkeys_fid, &bt_stat_class, "bt_nkeys", "I" }, { &bt_stat_bt_ndata_fid, &bt_stat_class, "bt_ndata", "I" }, + { &bt_stat_bt_pagecnt_fid, &bt_stat_class, "bt_pagecnt", "I" }, { &bt_stat_bt_pagesize_fid, &bt_stat_class, "bt_pagesize", "I" }, { &bt_stat_bt_minkey_fid, &bt_stat_class, "bt_minkey", "I" }, { &bt_stat_bt_re_len_fid, &bt_stat_class, "bt_re_len", "I" }, @@ -633,6 +658,7 @@ const struct { { &h_stat_hash_metaflags_fid, &h_stat_class, "hash_metaflags", "I" }, { &h_stat_hash_nkeys_fid, &h_stat_class, "hash_nkeys", "I" }, { &h_stat_hash_ndata_fid, &h_stat_class, "hash_ndata", "I" }, + { &h_stat_hash_pagecnt_fid, &h_stat_class, "hash_pagecnt", "I" }, { &h_stat_hash_pagesize_fid, &h_stat_class, "hash_pagesize", "I" }, { &h_stat_hash_ffactor_fid, &h_stat_class, "hash_ffactor", "I" }, { &h_stat_hash_buckets_fid, &h_stat_class, "hash_buckets", "I" }, @@ -650,9 +676,9 @@ const struct { { &lock_stat_st_maxlockers_fid, &lock_stat_class, "st_maxlockers", "I" }, { &lock_stat_st_maxobjects_fid, &lock_stat_class, "st_maxobjects", "I" }, { &lock_stat_st_nmodes_fid, &lock_stat_class, "st_nmodes", "I" }, + { &lock_stat_st_nlockers_fid, &lock_stat_class, "st_nlockers", "I" }, { &lock_stat_st_nlocks_fid, &lock_stat_class, "st_nlocks", "I" }, { &lock_stat_st_maxnlocks_fid, &lock_stat_class, "st_maxnlocks", "I" }, - { &lock_stat_st_nlockers_fid, &lock_stat_class, "st_nlockers", "I" }, { &lock_stat_st_maxnlockers_fid, &lock_stat_class, "st_maxnlockers", "I" }, { &lock_stat_st_nobjects_fid, &lock_stat_class, "st_nobjects", "I" }, { &lock_stat_st_maxnobjects_fid, &lock_stat_class, "st_maxnobjects", "I" }, @@ -667,19 +693,26 @@ const struct { { &lock_stat_st_nlocktimeouts_fid, &lock_stat_class, "st_nlocktimeouts", "I" }, { &lock_stat_st_txntimeout_fid, &lock_stat_class, "st_txntimeout", "I" }, { &lock_stat_st_ntxntimeouts_fid, &lock_stat_class, "st_ntxntimeouts", "I" }, + { &lock_stat_st_objs_wait_fid, &lock_stat_class, "st_objs_wait", "I" }, + { &lock_stat_st_objs_nowait_fid, &lock_stat_class, "st_objs_nowait", "I" }, + { &lock_stat_st_lockers_wait_fid, &lock_stat_class, "st_lockers_wait", "I" }, + { &lock_stat_st_lockers_nowait_fid, &lock_stat_class, "st_lockers_nowait", "I" }, + { &lock_stat_st_locks_wait_fid, &lock_stat_class, "st_locks_wait", "I" }, + { &lock_stat_st_locks_nowait_fid, &lock_stat_class, "st_locks_nowait", "I" }, { &lock_stat_st_region_wait_fid, &lock_stat_class, "st_region_wait", "I" }, { &lock_stat_st_region_nowait_fid, &lock_stat_class, "st_region_nowait", "I" }, + { &lock_stat_st_hash_len_fid, &lock_stat_class, "st_hash_len", "I" }, { &lock_stat_st_regsize_fid, &lock_stat_class, "st_regsize", "I" }, { &log_stat_st_magic_fid, &log_stat_class, "st_magic", "I" }, { &log_stat_st_version_fid, &log_stat_class, "st_version", "I" }, { &log_stat_st_mode_fid, &log_stat_class, "st_mode", "I" }, { &log_stat_st_lg_bsize_fid, &log_stat_class, "st_lg_bsize", "I" }, { &log_stat_st_lg_size_fid, &log_stat_class, "st_lg_size", "I" }, + { &log_stat_st_wc_bytes_fid, &log_stat_class, "st_wc_bytes", "I" }, + { &log_stat_st_wc_mbytes_fid, &log_stat_class, "st_wc_mbytes", "I" }, { &log_stat_st_record_fid, &log_stat_class, "st_record", "I" }, { &log_stat_st_w_bytes_fid, &log_stat_class, "st_w_bytes", "I" }, { &log_stat_st_w_mbytes_fid, &log_stat_class, "st_w_mbytes", "I" }, - { &log_stat_st_wc_bytes_fid, &log_stat_class, "st_wc_bytes", "I" }, - { &log_stat_st_wc_mbytes_fid, &log_stat_class, "st_wc_mbytes", "I" }, { &log_stat_st_wcount_fid, &log_stat_class, "st_wcount", "I" }, { &log_stat_st_wcount_fill_fid, &log_stat_class, "st_wcount_fill", "I" }, { &log_stat_st_rcount_fid, &log_stat_class, "st_rcount", "I" }, @@ -690,9 +723,9 @@ const struct { { &log_stat_st_cur_offset_fid, &log_stat_class, "st_cur_offset", "I" }, { &log_stat_st_disk_file_fid, &log_stat_class, "st_disk_file", "I" }, { &log_stat_st_disk_offset_fid, &log_stat_class, "st_disk_offset", "I" }, - { &log_stat_st_regsize_fid, &log_stat_class, "st_regsize", "I" }, { &log_stat_st_maxcommitperflush_fid, &log_stat_class, "st_maxcommitperflush", "I" }, { &log_stat_st_mincommitperflush_fid, &log_stat_class, "st_mincommitperflush", "I" }, + { &log_stat_st_regsize_fid, &log_stat_class, "st_regsize", "I" }, { &mpool_fstat_file_name_fid, &mpool_fstat_class, "file_name", "Ljava/lang/String;" }, { &mpool_fstat_st_pagesize_fid, &mpool_fstat_class, "st_pagesize", "I" }, { &mpool_fstat_st_map_fid, &mpool_fstat_class, "st_map", "I" }, @@ -704,11 +737,12 @@ const struct { { &mpool_stat_st_gbytes_fid, &mpool_stat_class, "st_gbytes", "I" }, { &mpool_stat_st_bytes_fid, &mpool_stat_class, "st_bytes", "I" }, { &mpool_stat_st_ncache_fid, &mpool_stat_class, "st_ncache", "I" }, - { &mpool_stat_st_regsize_fid, &mpool_stat_class, "st_regsize", "I" }, + { &mpool_stat_st_max_ncache_fid, &mpool_stat_class, "st_max_ncache", "I" }, { &mpool_stat_st_mmapsize_fid, &mpool_stat_class, "st_mmapsize", "I" }, { &mpool_stat_st_maxopenfd_fid, &mpool_stat_class, "st_maxopenfd", "I" }, { &mpool_stat_st_maxwrite_fid, &mpool_stat_class, "st_maxwrite", "I" }, { &mpool_stat_st_maxwrite_sleep_fid, &mpool_stat_class, "st_maxwrite_sleep", "I" }, + { &mpool_stat_st_pages_fid, &mpool_stat_class, "st_pages", "I" }, { &mpool_stat_st_map_fid, &mpool_stat_class, "st_map", "I" }, { &mpool_stat_st_cache_hit_fid, &mpool_stat_class, "st_cache_hit", "I" }, { &mpool_stat_st_cache_miss_fid, &mpool_stat_class, "st_cache_miss", "I" }, @@ -718,7 +752,6 @@ const struct { { &mpool_stat_st_ro_evict_fid, &mpool_stat_class, "st_ro_evict", "I" }, { &mpool_stat_st_rw_evict_fid, &mpool_stat_class, "st_rw_evict", "I" }, { &mpool_stat_st_page_trickle_fid, &mpool_stat_class, "st_page_trickle", "I" }, - { &mpool_stat_st_pages_fid, &mpool_stat_class, "st_pages", "I" }, { &mpool_stat_st_page_clean_fid, &mpool_stat_class, "st_page_clean", "I" }, { &mpool_stat_st_page_dirty_fid, &mpool_stat_class, "st_page_dirty", "I" }, { &mpool_stat_st_hash_buckets_fid, &mpool_stat_class, "st_hash_buckets", "I" }, @@ -740,6 +773,7 @@ const struct { { &mpool_stat_st_alloc_pages_fid, &mpool_stat_class, "st_alloc_pages", "I" }, { &mpool_stat_st_alloc_max_pages_fid, &mpool_stat_class, "st_alloc_max_pages", "I" }, { &mpool_stat_st_io_wait_fid, &mpool_stat_class, "st_io_wait", "I" }, + { &mpool_stat_st_regsize_fid, &mpool_stat_class, "st_regsize", "I" }, { &mutex_stat_st_mutex_align_fid, &mutex_stat_class, "st_mutex_align", "I" }, { &mutex_stat_st_mutex_tas_spins_fid, &mutex_stat_class, "st_mutex_tas_spins", "I" }, { &mutex_stat_st_mutex_cnt_fid, &mutex_stat_class, "st_mutex_cnt", "I" }, @@ -762,6 +796,8 @@ const struct { { &qam_stat_qs_pgfree_fid, &qam_stat_class, "qs_pgfree", "I" }, { &qam_stat_qs_first_recno_fid, &qam_stat_class, "qs_first_recno", "I" }, { &qam_stat_qs_cur_recno_fid, &qam_stat_class, "qs_cur_recno", "I" }, + { &rep_stat_st_log_queued_fid, &rep_stat_class, "st_log_queued", "I" }, + { &rep_stat_st_startup_complete_fid, &rep_stat_class, "st_startup_complete", "I" }, { &rep_stat_st_status_fid, &rep_stat_class, "st_status", "I" }, { &rep_stat_st_next_lsn_fid, &rep_stat_class, "st_next_lsn", "L" DB_PKG "LogSequenceNumber;" }, { &rep_stat_st_waiting_lsn_fid, &rep_stat_class, "st_waiting_lsn", "L" DB_PKG "LogSequenceNumber;" }, @@ -780,7 +816,6 @@ const struct { { &rep_stat_st_gen_fid, &rep_stat_class, "st_gen", "I" }, { &rep_stat_st_egen_fid, &rep_stat_class, "st_egen", "I" }, { &rep_stat_st_log_duplicated_fid, &rep_stat_class, "st_log_duplicated", "I" }, - { &rep_stat_st_log_queued_fid, &rep_stat_class, "st_log_queued", "I" }, { &rep_stat_st_log_queued_max_fid, &rep_stat_class, "st_log_queued_max", "I" }, { &rep_stat_st_log_queued_total_fid, &rep_stat_class, "st_log_queued_total", "I" }, { &rep_stat_st_log_records_fid, &rep_stat_class, "st_log_records", "I" }, @@ -799,8 +834,8 @@ const struct { { &rep_stat_st_pg_duplicated_fid, &rep_stat_class, "st_pg_duplicated", "I" }, { &rep_stat_st_pg_records_fid, &rep_stat_class, "st_pg_records", "I" }, { &rep_stat_st_pg_requested_fid, &rep_stat_class, "st_pg_requested", "I" }, - { &rep_stat_st_startup_complete_fid, &rep_stat_class, "st_startup_complete", "I" }, { &rep_stat_st_txns_applied_fid, &rep_stat_class, "st_txns_applied", "I" }, + { &rep_stat_st_startsync_delayed_fid, &rep_stat_class, "st_startsync_delayed", "I" }, { &rep_stat_st_elections_fid, &rep_stat_class, "st_elections", "I" }, { &rep_stat_st_elections_won_fid, &rep_stat_class, "st_elections_won", "I" }, { &rep_stat_st_election_cur_winner_fid, &rep_stat_class, "st_election_cur_winner", "I" }, @@ -814,6 +849,11 @@ const struct { { &rep_stat_st_election_votes_fid, &rep_stat_class, "st_election_votes", "I" }, { &rep_stat_st_election_sec_fid, &rep_stat_class, "st_election_sec", "I" }, { &rep_stat_st_election_usec_fid, &rep_stat_class, "st_election_usec", "I" }, + { &repmgr_stat_st_perm_failed_fid, &repmgr_stat_class, "st_perm_failed", "I" }, + { &repmgr_stat_st_msgs_queued_fid, &repmgr_stat_class, "st_msgs_queued", "I" }, + { &repmgr_stat_st_msgs_dropped_fid, &repmgr_stat_class, "st_msgs_dropped", "I" }, + { &repmgr_stat_st_connection_drop_fid, &repmgr_stat_class, "st_connection_drop", "I" }, + { &repmgr_stat_st_connect_fail_fid, &repmgr_stat_class, "st_connect_fail", "I" }, { &seq_stat_st_wait_fid, &seq_stat_class, "st_wait", "I" }, { &seq_stat_st_nowait_fid, &seq_stat_class, "st_nowait", "I" }, { &seq_stat_st_current_fid, &seq_stat_class, "st_current", "J" }, @@ -823,6 +863,7 @@ const struct { { &seq_stat_st_max_fid, &seq_stat_class, "st_max", "J" }, { &seq_stat_st_cache_size_fid, &seq_stat_class, "st_cache_size", "I" }, { &seq_stat_st_flags_fid, &seq_stat_class, "st_flags", "I" }, + { &txn_stat_st_nrestores_fid, &txn_stat_class, "st_nrestores", "I" }, { &txn_stat_st_last_ckp_fid, &txn_stat_class, "st_last_ckp", "L" DB_PKG "LogSequenceNumber;" }, { &txn_stat_st_time_ckp_fid, &txn_stat_class, "st_time_ckp", "J" }, { &txn_stat_st_last_txnid_fid, &txn_stat_class, "st_last_txnid", "I" }, @@ -832,7 +873,6 @@ const struct { { &txn_stat_st_ncommits_fid, &txn_stat_class, "st_ncommits", "I" }, { &txn_stat_st_nactive_fid, &txn_stat_class, "st_nactive", "I" }, { &txn_stat_st_nsnapshot_fid, &txn_stat_class, "st_nsnapshot", "I" }, - { &txn_stat_st_nrestores_fid, &txn_stat_class, "st_nrestores", "I" }, { &txn_stat_st_maxnactive_fid, &txn_stat_class, "st_maxnactive", "I" }, { &txn_stat_st_maxnsnapshot_fid, &txn_stat_class, "st_maxnsnapshot", "I" }, { &txn_stat_st_txnarray_fid, &txn_stat_class, "st_txnarray", "[L" DB_PKG "TransactionStats$Active;" }, @@ -854,8 +894,7 @@ const struct { { &rephost_port_fid, &rephost_class, "port", "I" }, { &rephost_host_fid, &rephost_class, "host", "Ljava/lang/String;" }, { &rephost_eid_fid, &rephost_class, "eid", "I" }, - { &rephost_status_fid, &rephost_class, "status", "I" }, - { &rep_processmsg_envid_fid, &rep_processmsg_class, "envid", "I" } + { &rephost_status_fid, &rephost_class, "status", "I" } }; const struct { @@ -872,6 +911,8 @@ const struct { { &dbtxn_construct, &dbtxn_class, "<init>", "(JZ)V" }, { &bt_stat_construct, &bt_stat_class, "<init>", "()V" }, + { &get_err_msg_method, &dbenv_class, "get_err_msg", + "(Ljava/lang/String;)Ljava/lang/String;" }, { &h_stat_construct, &h_stat_class, "<init>", "()V" }, { &lock_stat_construct, &lock_stat_class, "<init>", "()V" }, { &log_stat_construct, &log_stat_class, "<init>", "()V" }, @@ -880,6 +921,7 @@ const struct { { &mutex_stat_construct, &mutex_stat_class, "<init>", "()V" }, { &qam_stat_construct, &qam_stat_class, "<init>", "()V" }, { &rep_stat_construct, &rep_stat_class, "<init>", "()V" }, + { &repmgr_stat_construct, &repmgr_stat_class, "<init>", "()V" }, { &seq_stat_construct, &seq_stat_class, "<init>", "()V" }, { &txn_stat_construct, &txn_stat_class, "<init>", "()V" }, { &txn_active_construct, &txn_active_class, "<init>", "()V" }, @@ -905,6 +947,10 @@ const struct { "(Ljava/lang/String;IL" DB_PKG "internal/DbEnv;)V" }, { &repjoinfailex_construct, &repjoinfailex_class, "<init>", "(Ljava/lang/String;IL" DB_PKG "internal/DbEnv;)V" }, + { &repleaseexpiredex_construct, &repleaseexpiredex_class, "<init>", + "(Ljava/lang/String;IL" DB_PKG "internal/DbEnv;)V" }, + { &repleasetimeoutex_construct, &repleasetimeoutex_class, "<init>", + "(Ljava/lang/String;IL" DB_PKG "internal/DbEnv;)V" }, { &replockoutex_construct, &replockoutex_class, "<init>", "(Ljava/lang/String;IL" DB_PKG "internal/DbEnv;)V" }, { &repunavailex_construct, &repunavailex_class, "<init>", @@ -924,8 +970,22 @@ const struct { { &app_dispatch_method, &dbenv_class, "handle_app_dispatch", "(L" DB_PKG "DatabaseEntry;L" DB_PKG "LogSequenceNumber;I)I" }, - { &event_notify_method, &dbenv_class, "handle_event_notify", - "(I)I" }, + { &panic_event_notify_method, &dbenv_class, "handle_panic_event_notify", + "()V" }, + { &rep_client_event_notify_method, &dbenv_class, + "handle_rep_client_event_notify", "()V" }, + { &rep_elected_event_notify_method, &dbenv_class, + "handle_rep_elected_event_notify" ,"()V" }, + { &rep_master_event_notify_method, &dbenv_class, + "handle_rep_master_event_notify", "()V" }, + { &rep_new_master_event_notify_method, &dbenv_class, + "handle_rep_new_master_event_notify", "(I)V" }, + { &rep_perm_failed_event_notify_method, &dbenv_class, + "handle_rep_perm_failed_event_notify", "()V" }, + { &rep_startup_done_event_notify_method, &dbenv_class, + "handle_rep_startup_done_event_notify", "()V" }, + { &write_failed_event_notify_method, &dbenv_class, + "handle_write_failed_event_notify", "(I)V" }, { &env_feedback_method, &dbenv_class, "handle_env_feedback", "(II)V" }, { &errcall_method, &dbenv_class, "handle_error", "(Ljava/lang/String;)V" }, @@ -946,10 +1006,12 @@ const struct { { &db_feedback_method, &db_class, "handle_db_feedback", "(II)V" }, { &dup_compare_method, &db_class, "handle_dup_compare", "([B[B)I" }, + { &h_compare_method, &db_class, "handle_h_compare", + "([B[B)I" }, { &h_hash_method, &db_class, "handle_h_hash", "([BI)I" }, { &seckey_create_method, &db_class, "handle_seckey_create", - "(L" DB_PKG "DatabaseEntry;L" DB_PKG "DatabaseEntry;L" - DB_PKG "DatabaseEntry;)I" }, + "(L" DB_PKG "DatabaseEntry;L" DB_PKG "DatabaseEntry;)[L" + DB_PKG "DatabaseEntry;" }, { &outputstream_write_method, &outputstream_class, "write", "([BII)V" } }; @@ -1074,6 +1136,12 @@ static jthrowable __dbj_get_except(JNIEnv *jenv, jmsg = (*jenv)->NewStringUTF(jenv, msg); + /* Retrieve error message logged by DB */ + if (jdbenv != NULL) { + jmsg = (jstring) (*jenv)->CallNonvirtualObjectMethod(jenv, + jdbenv, dbenv_class, get_err_msg_method, jmsg); + } + switch (err) { case EINVAL: return (jthrowable)(*jenv)->NewObject(jenv, @@ -1111,6 +1179,16 @@ static jthrowable __dbj_get_except(JNIEnv *jenv, repjoinfailex_class, repjoinfailex_construct, jmsg, err, jdbenv); + case DB_REP_LEASE_EXPIRED: + return (jthrowable)(*jenv)->NewObject(jenv, + repleaseexpiredex_class, repleaseexpiredex_construct, + jmsg, err, jdbenv); + + case DB_REP_LEASE_TIMEOUT: + return (jthrowable)(*jenv)->NewObject(jenv, + repleasetimeoutex_class, repleasetimeoutex_construct, + jmsg, err, jdbenv); + case DB_REP_LOCKOUT: return (jthrowable)(*jenv)->NewObject(jenv, replockoutex_class, replockoutex_construct, @@ -1752,21 +1830,49 @@ static void __dbj_event_notify(DB_ENV *dbenv, u_int32_t event_id, void * info) { JNIEnv *jenv = __dbj_get_jnienv(); jobject jdbenv = (jobject)DB_ENV_INTERNAL(dbenv); - int ret; - COMPQUIET(info, NULL); - - if(jdbenv == NULL) + if (jdbenv == NULL) return ; - ret = (*jenv)->CallNonvirtualIntMethod(jenv, jdbenv, dbenv_class, - event_notify_method, event_id); - - if((*jenv)->ExceptionOccurred(jenv)) { - /* The exception will be thrown, so this could be any error. */ - ret = EINVAL; + switch (event_id) { + case DB_EVENT_PANIC: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, panic_event_notify_method); + break; + case DB_EVENT_REP_CLIENT: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, rep_client_event_notify_method); + break; + case DB_EVENT_REP_ELECTED: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, rep_elected_event_notify_method); + break; + case DB_EVENT_REP_MASTER: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, rep_master_event_notify_method); + break; + case DB_EVENT_REP_NEWMASTER: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, rep_new_master_event_notify_method, + *(int*)info); + break; + case DB_EVENT_REP_PERM_FAILED: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, rep_perm_failed_event_notify_method); + break; + case DB_EVENT_REP_STARTUPDONE: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, rep_startup_done_event_notify_method); + break; + case DB_EVENT_WRITE_FAILED: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, write_failed_event_notify_method, + *(int*)info); + break; + default: + dbenv->errx(dbenv, "Unhandled event callback in the Java API"); + DB_ASSERT(dbenv, 0); } - return ; } static int __dbj_rep_transport(DB_ENV *dbenv, @@ -1818,8 +1924,11 @@ static int __dbj_seckey_create(DB *db, JNIEnv *jenv = __dbj_get_jnienv(); jobject jdb = (jobject)DB_INTERNAL(db); jobject jkey, jdata, jresult; + jobjectArray jskeys; + jsize i, num_skeys; jbyteArray jkeyarr, jdataarr; DBT_LOCKED lresult; + DBT *tresult; int ret; if (jdb == NULL) @@ -1831,8 +1940,7 @@ static int __dbj_seckey_create(DB *db, jdata = (data->app_data != NULL) ? ((DBT_LOCKED *)data->app_data)->jdbt : (*jenv)->NewObject(jenv, dbt_class, dbt_construct); - jresult = (*jenv)->NewObject(jenv, dbt_class, dbt_construct); - if (jkey == NULL || jdata == NULL || jresult == NULL) + if (jkey == NULL || jdata == NULL) return (ENOMEM); /* An exception is pending */ if (key->app_data == NULL) { @@ -1846,11 +1954,25 @@ static int __dbj_seckey_create(DB *db, return (ENOMEM); /* An exception is pending */ } - ret = (int)(*jenv)->CallNonvirtualIntMethod(jenv, jdb, db_class, - seckey_create_method, jkey, jdata, jresult); + jskeys = (jobjectArray)(*jenv)->CallNonvirtualObjectMethod(jenv, + jdb, db_class, seckey_create_method, jkey, jdata); - if (ret != 0) + if (jskeys == NULL || + (num_skeys = (*jenv)->GetArrayLength(jenv, jskeys)) == 0) { + ret = DB_DONOTINDEX; goto err; + } else if (num_skeys == 1) { + memset(result, 0, sizeof (DBT)); + tresult = result; + } else { + if ((ret = __os_umalloc(db->dbenv, + num_skeys * sizeof (DBT), &result->data)) != 0) + goto err; + memset(result->data, 0, num_skeys * sizeof (DBT)); + result->size = num_skeys; + F_SET(result, DB_DBT_APPMALLOC | DB_DBT_MULTIPLE); + tresult = (DBT *)result->data; + } if ((*jenv)->ExceptionOccurred(jenv)) { /* The exception will be thrown, so this could be any error. */ @@ -1858,23 +1980,30 @@ static int __dbj_seckey_create(DB *db, goto err; } - if ((ret = __dbj_dbt_copyin(jenv, &lresult, NULL, jresult, 0)) != 0) - goto err; + for (i = 0; i < num_skeys; i++, tresult++) { + jresult = (*jenv)->GetObjectArrayElement(jenv, jskeys, i); - if (lresult.dbt.size != 0) { - /* If there's data, we need to take a copy of it. */ - memset(result, 0, sizeof (DBT)); - result->size = lresult.dbt.size; if ((ret = - __os_umalloc(NULL, result->size, &result->data)) != 0) + __dbj_dbt_copyin(jenv, &lresult, NULL, jresult, 0)) != 0) goto err; - if ((ret = __dbj_dbt_memcopy(&lresult.dbt, 0, - result->data, result->size, - DB_USERCOPY_GETDATA)) != 0) - goto err; - __dbj_dbt_release(jenv, jresult, &lresult.dbt, &lresult); - (*jenv)->DeleteLocalRef(jenv, lresult.jarr); - F_SET(result, DB_DBT_APPMALLOC); + + if (lresult.dbt.size != 0) { + /* If there's data, we need to take a copy of it. */ + tresult->size = lresult.dbt.size; + if ((ret = __os_umalloc(NULL, + tresult->size, &tresult->data)) != 0) + goto err; + if ((ret = __dbj_dbt_memcopy(&lresult.dbt, 0, + tresult->data, tresult->size, + DB_USERCOPY_GETDATA)) != 0) + goto err; + __dbj_dbt_release(jenv, + jresult, &lresult.dbt, &lresult); + (*jenv)->DeleteLocalRef(jenv, lresult.jarr); + F_SET(tresult, DB_DBT_APPMALLOC); + } + + (*jenv)->DeleteLocalRef(jenv, jresult); } err: if (key->app_data == NULL) { @@ -1885,7 +2014,6 @@ err: if (key->app_data == NULL) { (*jenv)->DeleteLocalRef(jenv, jdataarr); (*jenv)->DeleteLocalRef(jenv, jdata); } - (*jenv)->DeleteLocalRef(jenv, jresult); return (ret); } @@ -1948,7 +2076,11 @@ err: (*jenv)->DeleteLocalRef(jenv, jdbtarr); return (ret); } -static int __dbj_bt_compare(DB *db, const DBT *dbt1, const DBT *dbt2) +/* + * Shared by __dbj_bt_compare and __dbj_h_compare + */ +static int __dbj_am_compare(DB *db, const DBT *dbt1, const DBT *dbt2, + jmethodID compare_method) { JNIEnv *jenv = __dbj_get_jnienv(); jobject jdb = (jobject)DB_INTERNAL(db); @@ -1979,7 +2111,7 @@ static int __dbj_bt_compare(DB *db, const DBT *dbt1, const DBT *dbt2) } ret = (int)(*jenv)->CallNonvirtualIntMethod(jenv, jdb, db_class, - bt_compare_method, jdbtarr1, jdbtarr2); + compare_method, jdbtarr1, jdbtarr2); if ((*jenv)->ExceptionOccurred(jenv)) { /* The exception will be thrown, so this could be any error. */ @@ -1994,6 +2126,11 @@ static int __dbj_bt_compare(DB *db, const DBT *dbt1, const DBT *dbt2) return (ret); } +static int __dbj_bt_compare(DB *db, const DBT *dbt1, const DBT *dbt2) +{ + return __dbj_am_compare(db, dbt1, dbt2, bt_compare_method); +} + static size_t __dbj_bt_prefix(DB *db, const DBT *dbt1, const DBT *dbt2) { JNIEnv *jenv = __dbj_get_jnienv(); @@ -2008,7 +2145,8 @@ static size_t __dbj_bt_prefix(DB *db, const DBT *dbt1, const DBT *dbt2) if (dbt1->app_data != NULL) jdbt1 = ((DBT_LOCKED *)dbt1->app_data)->jdbt; else { - if ((jdbt1 = (*jenv)->NewObject(jenv, dbt_class, dbt_construct)) == NULL) + if ((jdbt1 = + (*jenv)->NewObject(jenv, dbt_class, dbt_construct)) == NULL) return (ENOMEM); /* An exception is pending */ __dbj_dbt_copyout(jenv, dbt1, &jdbtarr1, jdbt1); if (jdbtarr1 == NULL) @@ -2018,7 +2156,8 @@ static size_t __dbj_bt_prefix(DB *db, const DBT *dbt1, const DBT *dbt2) if (dbt2->app_data != NULL) jdbt2 = ((DBT_LOCKED *)dbt2->app_data)->jdbt; else { - if ((jdbt2 = (*jenv)->NewObject(jenv, dbt_class, dbt_construct)) == NULL) + if ((jdbt2 = + (*jenv)->NewObject(jenv, dbt_class, dbt_construct)) == NULL) return (ENOMEM); /* An exception is pending */ __dbj_dbt_copyout(jenv, dbt2, &jdbtarr2, jdbt2); if (jdbtarr2 == NULL) @@ -2086,6 +2225,11 @@ static void __dbj_db_feedback(DB *db, int opcode, int percent) db_feedback_method, opcode, percent); } +static int __dbj_h_compare(DB *db, const DBT *dbt1, const DBT *dbt2) +{ + return __dbj_am_compare(db, dbt1, dbt2, h_compare_method); +} + static u_int32_t __dbj_h_hash(DB *db, const void *data, u_int32_t len) { JNIEnv *jenv = __dbj_get_jnienv(); @@ -2232,8 +2376,8 @@ SWIGINTERN void Db_err(struct Db *self,int error,char const *message){ SWIGINTERN void Db_errx(struct Db *self,char const *message){ self->errx(self, message); } -SWIGINTERN int_bool Db_get_transactional(struct Db *self){ - return self->get_transactional(self); +SWIGINTERN int Db_exists(struct Db *self,DB_TXN *txnid,DBT *key,u_int32_t flags){ + return self->exists(self, txnid, key, flags); } SWIGINTERN int Db_get(struct Db *self,DB_TXN *txnid,DBT *key,DBT *data,u_int32_t flags){ return self->get(self, txnid, key, data, flags); @@ -2312,6 +2456,11 @@ SWIGINTERN int Db_get_re_delim(struct Db *self){ errno = self->get_re_delim(self, &ret); return ret; } +SWIGINTERN DB_CACHE_PRIORITY Db_get_priority(struct Db *self){ + DB_CACHE_PRIORITY ret; + errno = self->get_priority(self, &ret); + return ret; + } SWIGINTERN u_int32_t Db_get_re_len(struct Db *self){ u_int32_t ret = 0; errno = self->get_re_len(self, &ret); @@ -2332,6 +2481,12 @@ SWIGINTERN u_int32_t Db_get_q_extentsize(struct Db *self){ errno = self->get_q_extentsize(self, &ret); return ret; } +SWIGINTERN int_bool Db_get_multiple(struct Db *self){ + return self->get_multiple(self); + } +SWIGINTERN int_bool Db_get_transactional(struct Db *self){ + return self->get_transactional(self); + } SWIGINTERN DBTYPE Db_get_type(struct Db *self){ DBTYPE type = (DBTYPE)0; errno = self->get_type(self, &type); @@ -2390,6 +2545,9 @@ SWIGINTERN db_ret_t Db_set_feedback(struct Db *self,void (*db_feedback_fcn)(DB * SWIGINTERN db_ret_t Db_set_flags(struct Db *self,u_int32_t flags){ return self->set_flags(self, flags); } +SWIGINTERN db_ret_t Db_set_h_compare(struct Db *self,int (*h_compare_fcn)(DB *,DBT const *,DBT const *)){ + return self->set_h_compare(self, h_compare_fcn); + } SWIGINTERN db_ret_t Db_set_h_ffactor(struct Db *self,u_int32_t h_ffactor){ return self->set_h_ffactor(self, h_ffactor); } @@ -2405,6 +2563,9 @@ SWIGINTERN db_ret_t Db_set_lorder(struct Db *self,int lorder){ SWIGINTERN db_ret_t Db_set_pagesize(struct Db *self,u_int32_t pagesize){ return self->set_pagesize(self, pagesize); } +SWIGINTERN db_ret_t Db_set_priority(struct Db *self,DB_CACHE_PRIORITY priority){ + return self->set_priority(self, priority); + } SWIGINTERN db_ret_t Db_set_re_delim(struct Db *self,int re_delim){ return self->set_re_delim(self, re_delim); } @@ -2452,29 +2613,37 @@ SWIGINTERN int_bool Db_verify(struct Db *self,char const *file,char const *datab return 1; } SWIGINTERN db_ret_t Dbc_close(struct Dbc *self){ - return self->c_close(self); + return self->close(self); } SWIGINTERN db_recno_t Dbc_count(struct Dbc *self,u_int32_t flags){ db_recno_t count = 0; - errno = self->c_count(self, &count, flags); + errno = self->count(self, &count, flags); return count; } SWIGINTERN int Dbc_del(struct Dbc *self,u_int32_t flags){ - return self->c_del(self, flags); + return self->del(self, flags); } SWIGINTERN DBC *Dbc_dup(struct Dbc *self,u_int32_t flags){ DBC *newcurs = NULL; - errno = self->c_dup(self, &newcurs, flags); + errno = self->dup(self, &newcurs, flags); return newcurs; } SWIGINTERN int Dbc_get(struct Dbc *self,DBT *key,DBT *data,u_int32_t flags){ - return self->c_get(self, key, data, flags); + return self->get(self, key, data, flags); + } +SWIGINTERN DB_CACHE_PRIORITY Dbc_get_priority(struct Dbc *self){ + DB_CACHE_PRIORITY ret; + errno = self->get_priority(self, &ret); + return ret; } SWIGINTERN int Dbc_pget(struct Dbc *self,DBT *key,DBT *pkey,DBT *data,u_int32_t flags){ - return self->c_pget(self, key, pkey, data, flags); + return self->pget(self, key, pkey, data, flags); } SWIGINTERN int Dbc_put(struct Dbc *self,DBT *key,DBT *data,u_int32_t flags){ - return self->c_put(self, key, data, flags); + return self->put(self, key, data, flags); + } +SWIGINTERN db_ret_t Dbc_set_priority(struct Dbc *self,DB_CACHE_PRIORITY priority){ + return self->set_priority(self, priority); } SWIGINTERN struct DbEnv *new_DbEnv(u_int32_t flags){ DB_ENV *self = NULL; @@ -2564,6 +2733,11 @@ SWIGINTERN db_ret_t DbEnv_set_cachesize(struct DbEnv *self,jlong bytes,int ncach (u_int32_t)(bytes / GIGABYTE), (u_int32_t)(bytes % GIGABYTE), ncache); } +SWIGINTERN db_ret_t DbEnv_set_cache_max(struct DbEnv *self,jlong bytes){ + return self->set_cache_max(self, + (u_int32_t)(bytes / GIGABYTE), + (u_int32_t)(bytes % GIGABYTE)); + } SWIGINTERN db_ret_t DbEnv_set_data_dir(struct DbEnv *self,char const *dir){ return self->set_data_dir(self, dir); } @@ -2585,7 +2759,7 @@ SWIGINTERN db_ret_t DbEnv_set_feedback(struct DbEnv *self,void (*env_feedback_fc SWIGINTERN db_ret_t DbEnv_set_mp_max_openfd(struct DbEnv *self,int maxopenfd){ return self->set_mp_max_openfd(self, maxopenfd); } -SWIGINTERN db_ret_t DbEnv_set_mp_max_write(struct DbEnv *self,int maxwrite,int maxwrite_sleep){ +SWIGINTERN db_ret_t DbEnv_set_mp_max_write(struct DbEnv *self,int maxwrite,db_timeout_t maxwrite_sleep){ return self->set_mp_max_write(self, maxwrite, maxwrite_sleep); } SWIGINTERN db_ret_t DbEnv_set_mp_mmapsize(struct DbEnv *self,size_t mp_mmapsize){ @@ -2777,20 +2951,27 @@ SWIGINTERN int DbEnv_get_cachesize_ncache(struct DbEnv *self){ errno = self->get_cachesize(self, NULL, NULL, &ret); return ret; } +SWIGINTERN jlong DbEnv_get_cache_max(struct DbEnv *self){ + u_int32_t gbytes, bytes; + errno = self->get_cache_max(self, &gbytes, &bytes); + return (jlong)gbytes * GIGABYTE + bytes; + } SWIGINTERN int DbEnv_get_mp_max_openfd(struct DbEnv *self){ int ret; errno = self->get_mp_max_openfd(self, &ret); return ret; } SWIGINTERN int DbEnv_get_mp_max_write(struct DbEnv *self){ - int ret, junk; - errno = self->get_mp_max_write(self, &ret, &junk); - return ret; + int maxwrite; + db_timeout_t sleep; + errno = self->get_mp_max_write(self, &maxwrite, &sleep); + return maxwrite; } -SWIGINTERN int DbEnv_get_mp_max_write_sleep(struct DbEnv *self){ - int ret, junk; - errno = self->get_mp_max_write(self, &junk, &ret); - return ret; +SWIGINTERN db_timeout_t DbEnv_get_mp_max_write_sleep(struct DbEnv *self){ + int maxwrite; + db_timeout_t sleep; + errno = self->get_mp_max_write(self, &maxwrite, &sleep); + return sleep; } SWIGINTERN size_t DbEnv_get_mp_mmapsize(struct DbEnv *self){ size_t ret; @@ -2900,12 +3081,10 @@ SWIGINTERN jlong DbEnv_rep_get_limit(struct DbEnv *self){ errno = self->rep_get_limit(self, &gbytes, &bytes); return (jlong)gbytes * GIGABYTE + bytes; } -SWIGINTERN int DbEnv_rep_elect(struct DbEnv *self,int nsites,int nvotes,u_int32_t flags){ - int id; - errno = self->rep_elect(self, nsites, nvotes, &id, flags); - return id; +SWIGINTERN db_ret_t DbEnv_rep_elect(struct DbEnv *self,int nsites,int nvotes,u_int32_t flags){ + return self->rep_elect(self, nsites, nvotes, flags); } -SWIGINTERN int DbEnv_rep_process_message(struct DbEnv *self,DBT *control,DBT *rec,int *envid,DB_LSN *ret_lsn){ +SWIGINTERN int DbEnv_rep_process_message(struct DbEnv *self,DBT *control,DBT *rec,int envid,DB_LSN *ret_lsn){ return self->rep_process_message(self, control, rec, envid, ret_lsn); } @@ -2915,6 +3094,9 @@ SWIGINTERN db_ret_t DbEnv_rep_flush(struct DbEnv *self){ SWIGINTERN db_ret_t DbEnv_rep_set_config(struct DbEnv *self,u_int32_t which,int_bool onoff){ return self->rep_set_config(self, which, onoff); } +SWIGINTERN db_ret_t DbEnv_rep_set_lease(struct DbEnv *self,u_int32_t clock_scale_factor,u_int32_t flags){ + return self->rep_set_lease(self, clock_scale_factor, flags); + } SWIGINTERN db_ret_t DbEnv_rep_start(struct DbEnv *self,DBT *cdata,u_int32_t flags){ return self->rep_start(self, cdata, flags); } @@ -2991,6 +3173,11 @@ SWIGINTERN struct __db_repmgr_sites DbEnv_repmgr_site_list(struct DbEnv *self){ SWIGINTERN db_ret_t DbEnv_repmgr_start(struct DbEnv *self,int nthreads,u_int32_t flags){ return self->repmgr_start(self, nthreads, flags); } +SWIGINTERN DB_REPMGR_STAT *DbEnv_repmgr_stat(struct DbEnv *self,u_int32_t flags){ + DB_REPMGR_STAT *statp = NULL; + errno = self->repmgr_stat(self, &statp, flags); + return statp; + } SWIGINTERN char const *DbEnv_strerror(int error){ return db_strerror(error); } @@ -3015,6 +3202,11 @@ SWIGINTERN db_ret_t DbLogc_close(struct DbLogc *self,u_int32_t flags){ SWIGINTERN int DbLogc_get(struct DbLogc *self,DB_LSN *lsn,DBT *data,u_int32_t flags){ return self->get(self, lsn, data, flags); } +SWIGINTERN u_int32_t DbLogc_version(struct DbLogc *self,u_int32_t flags){ + u_int32_t result; + errno = self->version(self, &result, flags); + return result; + } SWIGINTERN DB_CACHE_PRIORITY DbMpoolFile_get_priority(struct DbMpoolFile *self){ DB_CACHE_PRIORITY ret; errno = self->get_priority(self, &ret); @@ -3158,7 +3350,7 @@ JNIEXPORT jlong JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_new_1Db(JNIEn } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1associate(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jobject jarg4, jint jarg5) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1associate(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jboolean jarg4, jint jarg5) { struct Db *arg1 = (struct Db *) 0 ; DB_TXN *arg2 = (DB_TXN *) 0 ; DB *arg3 = (DB *) 0 ; @@ -3172,7 +3364,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1associate( arg2 = *(DB_TXN **)&jarg2; arg3 = *(DB **)&jarg3; - arg4 = (jarg4 == NULL) ? NULL : __dbj_seckey_create; + arg4 = (jarg4 == JNI_TRUE) ? __dbj_seckey_create : NULL; arg5 = (u_int32_t)jarg5; @@ -3385,21 +3577,37 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1errx(JNIEn } -JNIEXPORT jboolean JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1get_1transactional(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jboolean jresult = 0 ; +JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1exists(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jobject jarg3, jint jarg4) { + jint jresult = 0 ; struct Db *arg1 = (struct Db *) 0 ; - int_bool result; + DB_TXN *arg2 = (DB_TXN *) 0 ; + DBT *arg3 = (DBT *) 0 ; + u_int32_t arg4 ; + int result; + DBT_LOCKED ldbt3 ; (void)jenv; (void)jcls; arg1 = *(struct Db **)&jarg1; + arg2 = *(DB_TXN **)&jarg2; + + if (__dbj_dbt_copyin(jenv, &ldbt3, &arg3, jarg3, 0) != 0) { + return 0; /* An exception will be pending. */ + } + arg4 = (u_int32_t)jarg4; if (jarg1 == 0) { __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); return 0; } - result = (int_bool)Db_get_transactional(arg1); - jresult = (result) ? JNI_TRUE : JNI_FALSE; + + result = (int)Db_exists(arg1,arg2,arg3,arg4); + if (!DB_RETOK_EXISTS(result)) { + __dbj_throw(jenv, result, NULL, NULL, DB2JDBENV); + } + + jresult = (jint)result; + __dbj_dbt_release(jenv, jarg3, arg3, &ldbt3); return jresult; } @@ -3821,6 +4029,31 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1get_1re_1d } +JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1get_1priority(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jint jresult = 0 ; + struct Db *arg1 = (struct Db *) 0 ; + DB_CACHE_PRIORITY result; + + (void)jenv; + (void)jcls; + arg1 = *(struct Db **)&jarg1; + + if (jarg1 == 0) { + __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); + return 0; + } + + errno = 0; + result = (DB_CACHE_PRIORITY)Db_get_priority(arg1); + if (!DB_RETOK_STD(errno)) { + __dbj_throw(jenv, errno, NULL, NULL, DB2JDBENV); + } + + jresult = (jint)result; + return jresult; +} + + JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1get_1re_1len(JNIEnv *jenv, jclass jcls, jlong jarg1) { jint jresult = 0 ; struct Db *arg1 = (struct Db *) 0 ; @@ -3921,6 +4154,44 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1get_1q_1ex } +JNIEXPORT jboolean JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1get_1multiple(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jboolean jresult = 0 ; + struct Db *arg1 = (struct Db *) 0 ; + int_bool result; + + (void)jenv; + (void)jcls; + arg1 = *(struct Db **)&jarg1; + + if (jarg1 == 0) { + __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); + return 0; + } + result = (int_bool)Db_get_multiple(arg1); + jresult = (result) ? JNI_TRUE : JNI_FALSE; + return jresult; +} + + +JNIEXPORT jboolean JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1get_1transactional(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jboolean jresult = 0 ; + struct Db *arg1 = (struct Db *) 0 ; + int_bool result; + + (void)jenv; + (void)jcls; + arg1 = *(struct Db **)&jarg1; + + if (jarg1 == 0) { + __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); + return 0; + } + result = (int_bool)Db_get_transactional(arg1); + jresult = (result) ? JNI_TRUE : JNI_FALSE; + return jresult; +} + + JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1get_1type(JNIEnv *jenv, jclass jcls, jlong jarg1) { jint jresult = 0 ; struct Db *arg1 = (struct Db *) 0 ; @@ -4258,7 +4529,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1rename0(JN } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1append_1recno(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1append_1recno(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { struct Db *arg1 = (struct Db *) 0 ; int (*arg2)(DB *,DBT *,db_recno_t) = (int (*)(DB *,DBT *,db_recno_t)) 0 ; db_ret_t result; @@ -4267,7 +4538,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1appen (void)jcls; arg1 = *(struct Db **)&jarg1; - arg2 = (jarg2 == NULL) ? NULL : __dbj_append_recno; + arg2 = (jarg2 == JNI_TRUE) ? __dbj_append_recno : NULL; if (jarg1 == 0) { @@ -4283,7 +4554,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1appen } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1bt_1compare(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1bt_1compare(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { struct Db *arg1 = (struct Db *) 0 ; int (*arg2)(DB *,DBT const *,DBT const *) = (int (*)(DB *,DBT const *,DBT const *)) 0 ; db_ret_t result; @@ -4292,7 +4563,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1bt_1c (void)jcls; arg1 = *(struct Db **)&jarg1; - arg2 = (jarg2 == NULL) ? NULL : __dbj_bt_compare; + arg2 = (jarg2 == JNI_TRUE) ? __dbj_bt_compare : NULL; if (jarg1 == 0) { @@ -4331,7 +4602,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1bt_1m } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1bt_1prefix(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1bt_1prefix(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { struct Db *arg1 = (struct Db *) 0 ; size_t (*arg2)(DB *,DBT const *,DBT const *) = (size_t (*)(DB *,DBT const *,DBT const *)) 0 ; db_ret_t result; @@ -4340,7 +4611,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1bt_1p (void)jcls; arg1 = *(struct Db **)&jarg1; - arg2 = (jarg2 == NULL) ? NULL : __dbj_bt_prefix; + arg2 = (jarg2 == JNI_TRUE) ? __dbj_bt_prefix : NULL; if (jarg1 == 0) { @@ -4381,7 +4652,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1cache } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1dup_1compare(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1dup_1compare(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { struct Db *arg1 = (struct Db *) 0 ; int (*arg2)(DB *,DBT const *,DBT const *) = (int (*)(DB *,DBT const *,DBT const *)) 0 ; db_ret_t result; @@ -4390,7 +4661,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1dup_1 (void)jcls; arg1 = *(struct Db **)&jarg1; - arg2 = (jarg2 == NULL) ? NULL : __dbj_dup_compare; + arg2 = (jarg2 == JNI_TRUE) ? __dbj_dup_compare : NULL; if (jarg1 == 0) { @@ -4436,7 +4707,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1encry } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1feedback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1feedback(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { struct Db *arg1 = (struct Db *) 0 ; void (*arg2)(DB *,int,int) = (void (*)(DB *,int,int)) 0 ; db_ret_t result; @@ -4445,7 +4716,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1feedb (void)jcls; arg1 = *(struct Db **)&jarg1; - arg2 = (jarg2 == NULL) ? NULL : __dbj_db_feedback; + arg2 = (jarg2 == JNI_TRUE) ? __dbj_db_feedback : NULL; if (jarg1 == 0) { @@ -4484,6 +4755,31 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1flags } +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1h_1compare(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { + struct Db *arg1 = (struct Db *) 0 ; + int (*arg2)(DB *,DBT const *,DBT const *) = (int (*)(DB *,DBT const *,DBT const *)) 0 ; + db_ret_t result; + + (void)jenv; + (void)jcls; + arg1 = *(struct Db **)&jarg1; + + arg2 = (jarg2 == JNI_TRUE) ? __dbj_h_compare : NULL; + + + if (jarg1 == 0) { + __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); + return ; + } + + result = (db_ret_t)Db_set_h_compare(arg1,arg2); + if (!DB_RETOK_STD(result)) { + __dbj_throw(jenv, result, NULL, NULL, DB2JDBENV); + } + +} + + JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1h_1ffactor(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) { struct Db *arg1 = (struct Db *) 0 ; u_int32_t arg2 ; @@ -4507,7 +4803,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1h_1ff } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1h_1hash(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1h_1hash(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { struct Db *arg1 = (struct Db *) 0 ; u_int32_t (*arg2)(DB *,void const *,u_int32_t) = (u_int32_t (*)(DB *,void const *,u_int32_t)) 0 ; db_ret_t result; @@ -4516,7 +4812,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1h_1ha (void)jcls; arg1 = *(struct Db **)&jarg1; - arg2 = (jarg2 == NULL) ? NULL : __dbj_h_hash; + arg2 = (jarg2 == JNI_TRUE) ? __dbj_h_hash : NULL; if (jarg1 == 0) { @@ -4601,6 +4897,29 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1pages } +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1priority(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) { + struct Db *arg1 = (struct Db *) 0 ; + DB_CACHE_PRIORITY arg2 ; + db_ret_t result; + + (void)jenv; + (void)jcls; + arg1 = *(struct Db **)&jarg1; + arg2 = (DB_CACHE_PRIORITY)jarg2; + + if (jarg1 == 0) { + __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); + return ; + } + + result = (db_ret_t)Db_set_priority(arg1,arg2); + if (!DB_RETOK_STD(result)) { + __dbj_throw(jenv, result, NULL, NULL, DB2JDBENV); + } + +} + + JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Db_1set_1re_1delim(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) { struct Db *arg1 = (struct Db *) 0 ; int arg2 ; @@ -5074,6 +5393,31 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Dbc_1get(JNIEn } +JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Dbc_1get_1priority(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jint jresult = 0 ; + struct Dbc *arg1 = (struct Dbc *) 0 ; + DB_CACHE_PRIORITY result; + + (void)jenv; + (void)jcls; + arg1 = *(struct Dbc **)&jarg1; + + if (jarg1 == 0) { + __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); + return 0; + } + + errno = 0; + result = (DB_CACHE_PRIORITY)Dbc_get_priority(arg1); + if (!DB_RETOK_STD(errno)) { + __dbj_throw(jenv, errno, NULL, NULL, DBC2JDBENV); + } + + jresult = (jint)result; + return jresult; +} + + JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Dbc_1pget(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2, jobject jarg3, jobject jarg4, jint jarg5) { jint jresult = 0 ; struct Dbc *arg1 = (struct Dbc *) 0 ; @@ -5161,6 +5505,30 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Dbc_1put(JNIEn } +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_Dbc_1set_1priority(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) { + struct Dbc *arg1 = (struct Dbc *) 0 ; + DB_CACHE_PRIORITY arg2 ; + db_ret_t result; + + (void)jenv; + (void)jcls; + arg1 = *(struct Dbc **)&jarg1; + arg2 = (DB_CACHE_PRIORITY)jarg2; + + if (jarg1 == 0) { + __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); + return ; + } + + errno = 0; + result = (db_ret_t)Dbc_set_priority(arg1,arg2); + if (!DB_RETOK_STD(errno)) { + __dbj_throw(jenv, errno, NULL, NULL, DBC2JDBENV); + } + +} + + JNIEXPORT jlong JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_new_1DbEnv(JNIEnv *jenv, jclass jcls, jint jarg1) { jlong jresult = 0 ; u_int32_t arg1 ; @@ -5733,6 +6101,29 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1ca } +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1cache_1max(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) { + struct DbEnv *arg1 = (struct DbEnv *) 0 ; + jlong arg2 ; + db_ret_t result; + + (void)jenv; + (void)jcls; + arg1 = *(struct DbEnv **)&jarg1; + arg2 = jarg2; + + if (jarg1 == 0) { + __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); + return ; + } + + result = (db_ret_t)DbEnv_set_cache_max(arg1,arg2); + if (!DB_RETOK_STD(result)) { + __dbj_throw(jenv, result, NULL, NULL, JDBENV); + } + +} + + JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1data_1dir(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2) { struct DbEnv *arg1 = (struct DbEnv *) 0 ; char *arg2 = (char *) 0 ; @@ -5816,7 +6207,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1en } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1errcall(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1errcall(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { struct DbEnv *arg1 = (struct DbEnv *) 0 ; void (*arg2)(DB_ENV const *,char const *,char const *) = (void (*)(DB_ENV const *,char const *,char const *)) 0 ; @@ -5824,7 +6215,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1er (void)jcls; arg1 = *(struct DbEnv **)&jarg1; - arg2 = (jarg2 == NULL) ? NULL : __dbj_error; + arg2 = (jarg2 == JNI_TRUE) ? __dbj_error : NULL; if (jarg1 == 0) { @@ -5860,7 +6251,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1fl } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1feedback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1feedback(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { struct DbEnv *arg1 = (struct DbEnv *) 0 ; void (*arg2)(DB_ENV *,int,int) = (void (*)(DB_ENV *,int,int)) 0 ; db_ret_t result; @@ -5869,7 +6260,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1fe (void)jcls; arg1 = *(struct DbEnv **)&jarg1; - arg2 = (jarg2 == NULL) ? NULL : __dbj_env_feedback; + arg2 = (jarg2 == JNI_TRUE) ? __dbj_env_feedback : NULL; if (jarg1 == 0) { @@ -5908,17 +6299,17 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1mp } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1mp_1max_1write(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1mp_1max_1write(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jlong jarg3) { struct DbEnv *arg1 = (struct DbEnv *) 0 ; int arg2 ; - int arg3 ; + db_timeout_t arg3 ; db_ret_t result; (void)jenv; (void)jcls; arg1 = *(struct DbEnv **)&jarg1; arg2 = (int)jarg2; - arg3 = (int)jarg3; + arg3 = (db_timeout_t)jarg3; if (jarg1 == 0) { __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); @@ -5956,7 +6347,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1mp } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1msgcall(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1msgcall(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { struct DbEnv *arg1 = (struct DbEnv *) 0 ; void (*arg2)(DB_ENV const *,char const *) = (void (*)(DB_ENV const *,char const *)) 0 ; @@ -5964,7 +6355,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1ms (void)jcls; arg1 = *(struct DbEnv **)&jarg1; - arg2 = (jarg2 == NULL) ? NULL : __dbj_message; + arg2 = (jarg2 == JNI_TRUE) ? __dbj_message : NULL; if (jarg1 == 0) { @@ -5975,7 +6366,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1ms } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1paniccall(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1paniccall(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { struct DbEnv *arg1 = (struct DbEnv *) 0 ; void (*arg2)(DB_ENV *,int) = (void (*)(DB_ENV *,int)) 0 ; db_ret_t result; @@ -5984,7 +6375,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1pa (void)jcls; arg1 = *(struct DbEnv **)&jarg1; - arg2 = (jarg2 == NULL) ? NULL : __dbj_panic; + arg2 = (jarg2 == JNI_TRUE) ? __dbj_panic : NULL; if (jarg1 == 0) { @@ -6133,7 +6524,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1tx } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1app_1dispatch(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1app_1dispatch(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { struct DbEnv *arg1 = (struct DbEnv *) 0 ; int (*arg2)(DB_ENV *,DBT *,DB_LSN *,db_recops) = (int (*)(DB_ENV *,DBT *,DB_LSN *,db_recops)) 0 ; db_ret_t result; @@ -6142,7 +6533,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1ap (void)jcls; arg1 = *(struct DbEnv **)&jarg1; - arg2 = (jarg2 == NULL) ? NULL : __dbj_app_dispatch; + arg2 = (jarg2 == JNI_TRUE) ? __dbj_app_dispatch : NULL; if (jarg1 == 0) { @@ -6158,7 +6549,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1ap } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1event_1notify(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1event_1notify(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) { struct DbEnv *arg1 = (struct DbEnv *) 0 ; void (*arg2)(DB_ENV *,u_int32_t,void *) = (void (*)(DB_ENV *,u_int32_t,void *)) 0 ; db_ret_t result; @@ -6167,7 +6558,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1ev (void)jcls; arg1 = *(struct DbEnv **)&jarg1; - arg2 = (jarg2 == NULL) ? NULL : __dbj_event_notify; + arg2 = (jarg2 == JNI_TRUE) ? __dbj_event_notify : NULL; if (jarg1 == 0) { @@ -7318,6 +7709,31 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1get_1ca } +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1get_1cache_1max(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong jresult = 0 ; + struct DbEnv *arg1 = (struct DbEnv *) 0 ; + jlong result; + + (void)jenv; + (void)jcls; + arg1 = *(struct DbEnv **)&jarg1; + + if (jarg1 == 0) { + __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); + return 0; + } + + errno = 0; + result = DbEnv_get_cache_max(arg1); + if (!DB_RETOK_STD(errno)) { + __dbj_throw(jenv, errno, NULL, NULL, JDBENV); + } + + jresult = result; + return jresult; +} + + JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1get_1mp_1max_1openfd(JNIEnv *jenv, jclass jcls, jlong jarg1) { jint jresult = 0 ; struct DbEnv *arg1 = (struct DbEnv *) 0 ; @@ -7368,10 +7784,10 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1get_1mp } -JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1get_1mp_1max_1write_1sleep(JNIEnv *jenv, jclass jcls, jlong jarg1) { - jint jresult = 0 ; +JNIEXPORT jlong JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1get_1mp_1max_1write_1sleep(JNIEnv *jenv, jclass jcls, jlong jarg1) { + jlong jresult = 0 ; struct DbEnv *arg1 = (struct DbEnv *) 0 ; - int result; + db_timeout_t result; (void)jenv; (void)jcls; @@ -7383,12 +7799,12 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1get_1mp } errno = 0; - result = (int)DbEnv_get_mp_max_write_sleep(arg1); + result = (db_timeout_t)DbEnv_get_mp_max_write_sleep(arg1); if (!DB_RETOK_STD(errno)) { __dbj_throw(jenv, errno, NULL, NULL, JDBENV); } - jresult = (jint)result; + jresult = (jlong)result; return jresult; } @@ -8017,13 +8433,12 @@ JNIEXPORT jlong JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1g } -JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1elect(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3, jint jarg4) { - jint jresult = 0 ; +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1elect(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3, jint jarg4) { struct DbEnv *arg1 = (struct DbEnv *) 0 ; int arg2 ; int arg3 ; u_int32_t arg4 ; - int result; + db_ret_t result; (void)jenv; (void)jcls; @@ -8034,31 +8449,27 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1el if (jarg1 == 0) { __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); - return 0; + return ; } - errno = 0; - result = (int)DbEnv_rep_elect(arg1,arg2,arg3,arg4); - if (!DB_RETOK_STD(errno)) { - __dbj_throw(jenv, errno, NULL, NULL, JDBENV); + result = (db_ret_t)DbEnv_rep_elect(arg1,arg2,arg3,arg4); + if (!DB_RETOK_STD(result)) { + __dbj_throw(jenv, result, NULL, NULL, JDBENV); } - jresult = (jint)result; - return jresult; } -JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1process_1message(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2, jobject jarg3, jobject jarg4, jobject jarg5) { +JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1process_1message(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2, jobject jarg3, jint jarg4, jobject jarg5) { jint jresult = 0 ; struct DbEnv *arg1 = (struct DbEnv *) 0 ; DBT *arg2 = (DBT *) 0 ; DBT *arg3 = (DBT *) 0 ; - int *arg4 = (int *) 0 ; + int arg4 ; DB_LSN *arg5 = (DB_LSN *) 0 ; int result; DBT_LOCKED ldbt2 ; DBT_LOCKED ldbt3 ; - int id4 ; DB_LSN lsn5 ; (void)jenv; @@ -8072,10 +8483,7 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1pr if (__dbj_dbt_copyin(jenv, &ldbt3, &arg3, jarg3, 0) != 0) { return 0; /* An exception will be pending. */ } - - id4 = (*jenv)->GetIntField(jenv, jarg4, rep_processmsg_envid_fid); - arg4 = &id4; - + arg4 = (int)jarg4; if (jarg5 == NULL) { arg5 = NULL; @@ -8104,9 +8512,6 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1pr } jresult = (jint)result; - - (*jenv)->SetIntField(jenv, jarg4, rep_processmsg_envid_fid, *arg4); - __dbj_dbt_release(jenv, jarg2, arg2, &ldbt2); __dbj_dbt_release(jenv, jarg3, arg3, &ldbt3); @@ -8166,6 +8571,31 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1se } +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1set_1lease(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3) { + struct DbEnv *arg1 = (struct DbEnv *) 0 ; + u_int32_t arg2 ; + u_int32_t arg3 ; + db_ret_t result; + + (void)jenv; + (void)jcls; + arg1 = *(struct DbEnv **)&jarg1; + arg2 = (u_int32_t)jarg2; + arg3 = (u_int32_t)jarg3; + + if (jarg1 == 0) { + __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); + return ; + } + + result = (db_ret_t)DbEnv_rep_set_lease(arg1,arg2,arg3); + if (!DB_RETOK_STD(result)) { + __dbj_throw(jenv, result, NULL, NULL, JDBENV); + } + +} + + JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1start(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg2, jint jarg3) { struct DbEnv *arg1 = (struct DbEnv *) 0 ; DBT *arg2 = (DBT *) 0 ; @@ -8326,7 +8756,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1set_1re } -JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1set_1transport(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jobject jarg3) { +JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1set_1transport(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jboolean jarg3) { struct DbEnv *arg1 = (struct DbEnv *) 0 ; int arg2 ; int (*arg3)(DB_ENV *,DBT const *,DBT const *,DB_LSN const *,int,u_int32_t) = (int (*)(DB_ENV *,DBT const *,DBT const *,DB_LSN const *,int,u_int32_t)) 0 ; @@ -8337,7 +8767,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1rep_1se arg1 = *(struct DbEnv **)&jarg1; arg2 = (int)jarg2; - arg3 = (jarg3 == NULL) ? NULL : __dbj_rep_transport; + arg3 = (jarg3 == JNI_TRUE) ? __dbj_rep_transport : NULL; if (jarg1 == 0) { @@ -8690,6 +9120,38 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1repmgr_ } +JNIEXPORT jobject JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1repmgr_1stat(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) { + jobject jresult = 0 ; + struct DbEnv *arg1 = (struct DbEnv *) 0 ; + u_int32_t arg2 ; + DB_REPMGR_STAT *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(struct DbEnv **)&jarg1; + arg2 = (u_int32_t)jarg2; + + if (jarg1 == 0) { + __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); + return 0; + } + + errno = 0; + result = (DB_REPMGR_STAT *)DbEnv_repmgr_stat(arg1,arg2); + if (!DB_RETOK_STD(errno)) { + __dbj_throw(jenv, errno, NULL, NULL, JDBENV); + } + + + jresult = (*jenv)->NewObject(jenv, repmgr_stat_class, repmgr_stat_construct); + if (jresult != NULL) + __dbj_fill_repmgr_stat(jenv, jresult, result); + __os_ufree(NULL, result); + + return jresult; +} + + JNIEXPORT jstring JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbEnv_1strerror(JNIEnv *jenv, jclass jcls, jint jarg1) { jstring jresult = 0 ; int arg1 ; @@ -8849,6 +9311,33 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbLogc_1get(JN } +JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbLogc_1version(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) { + jint jresult = 0 ; + struct DbLogc *arg1 = (struct DbLogc *) 0 ; + u_int32_t arg2 ; + u_int32_t result; + + (void)jenv; + (void)jcls; + arg1 = *(struct DbLogc **)&jarg1; + arg2 = (u_int32_t)jarg2; + + if (jarg1 == 0) { + __dbj_throw(jenv, EINVAL, "call on closed handle", NULL, NULL); + return 0; + } + + errno = 0; + result = (u_int32_t)DbLogc_version(arg1,arg2); + if (!DB_RETOK_STD(errno)) { + __dbj_throw(jenv, errno, NULL, NULL, NULL); + } + + jresult = (jint)result; + return jresult; +} + + JNIEXPORT jint JNICALL Java_com_sleepycat_db_internal_db_1javaJNI_DbMpoolFile_1get_1priority(JNIEnv *jenv, jclass jcls, jlong jarg1) { jint jresult = 0 ; struct DbMpoolFile *arg1 = (struct DbMpoolFile *) 0 ; diff --git a/db/libdb_java/java_callbacks.i b/db/libdb_java/java_callbacks.i index ae10f2062..c5dfcbbda 100644 --- a/db/libdb_java/java_callbacks.i +++ b/db/libdb_java/java_callbacks.i @@ -1,14 +1,15 @@ /* Callbacks */ %define JAVA_CALLBACK(_sig, _jclass, _name) -JAVA_TYPEMAP(_sig, _jclass, jobject) -%typemap(javain) _sig %{ (_name##_handler = $javainput) %} +JAVA_TYPEMAP(_sig, _jclass, jboolean) +%typemap(jtype) _sig "boolean" +%typemap(javain) _sig %{ (_name##_handler = $javainput) != null %} /* * The Java object is stored in the Db or DbEnv class. * Here we only care whether it is non-NULL. */ %typemap(in) _sig %{ - $1 = ($input == NULL) ? NULL : __dbj_##_name; + $1 = ($input == JNI_TRUE) ? __dbj_##_name : NULL; %} %enddef @@ -96,21 +97,49 @@ static void __dbj_event_notify(DB_ENV *dbenv, u_int32_t event_id, void * info) { JNIEnv *jenv = __dbj_get_jnienv(); jobject jdbenv = (jobject)DB_ENV_INTERNAL(dbenv); - int ret; - - COMPQUIET(info, NULL); - if(jdbenv == NULL) + if (jdbenv == NULL) return ; - ret = (*jenv)->CallNonvirtualIntMethod(jenv, jdbenv, dbenv_class, - event_notify_method, event_id); - - if((*jenv)->ExceptionOccurred(jenv)) { - /* The exception will be thrown, so this could be any error. */ - ret = EINVAL; + switch (event_id) { + case DB_EVENT_PANIC: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, panic_event_notify_method); + break; + case DB_EVENT_REP_CLIENT: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, rep_client_event_notify_method); + break; + case DB_EVENT_REP_ELECTED: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, rep_elected_event_notify_method); + break; + case DB_EVENT_REP_MASTER: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, rep_master_event_notify_method); + break; + case DB_EVENT_REP_NEWMASTER: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, rep_new_master_event_notify_method, + *(int*)info); + break; + case DB_EVENT_REP_PERM_FAILED: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, rep_perm_failed_event_notify_method); + break; + case DB_EVENT_REP_STARTUPDONE: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, rep_startup_done_event_notify_method); + break; + case DB_EVENT_WRITE_FAILED: + (*jenv)->CallNonvirtualVoidMethod(jenv, jdbenv, + dbenv_class, write_failed_event_notify_method, + *(int*)info); + break; + default: + dbenv->errx(dbenv, "Unhandled event callback in the Java API"); + DB_ASSERT(dbenv, 0); } - return ; } static int __dbj_rep_transport(DB_ENV *dbenv, @@ -162,8 +191,11 @@ static int __dbj_seckey_create(DB *db, JNIEnv *jenv = __dbj_get_jnienv(); jobject jdb = (jobject)DB_INTERNAL(db); jobject jkey, jdata, jresult; + jobjectArray jskeys; + jsize i, num_skeys; jbyteArray jkeyarr, jdataarr; DBT_LOCKED lresult; + DBT *tresult; int ret; if (jdb == NULL) @@ -175,8 +207,7 @@ static int __dbj_seckey_create(DB *db, jdata = (data->app_data != NULL) ? ((DBT_LOCKED *)data->app_data)->jdbt : (*jenv)->NewObject(jenv, dbt_class, dbt_construct); - jresult = (*jenv)->NewObject(jenv, dbt_class, dbt_construct); - if (jkey == NULL || jdata == NULL || jresult == NULL) + if (jkey == NULL || jdata == NULL) return (ENOMEM); /* An exception is pending */ if (key->app_data == NULL) { @@ -190,11 +221,25 @@ static int __dbj_seckey_create(DB *db, return (ENOMEM); /* An exception is pending */ } - ret = (int)(*jenv)->CallNonvirtualIntMethod(jenv, jdb, db_class, - seckey_create_method, jkey, jdata, jresult); + jskeys = (jobjectArray)(*jenv)->CallNonvirtualObjectMethod(jenv, + jdb, db_class, seckey_create_method, jkey, jdata); - if (ret != 0) + if (jskeys == NULL || + (num_skeys = (*jenv)->GetArrayLength(jenv, jskeys)) == 0) { + ret = DB_DONOTINDEX; goto err; + } else if (num_skeys == 1) { + memset(result, 0, sizeof (DBT)); + tresult = result; + } else { + if ((ret = __os_umalloc(db->dbenv, + num_skeys * sizeof (DBT), &result->data)) != 0) + goto err; + memset(result->data, 0, num_skeys * sizeof (DBT)); + result->size = num_skeys; + F_SET(result, DB_DBT_APPMALLOC | DB_DBT_MULTIPLE); + tresult = (DBT *)result->data; + } if ((*jenv)->ExceptionOccurred(jenv)) { /* The exception will be thrown, so this could be any error. */ @@ -202,23 +247,30 @@ static int __dbj_seckey_create(DB *db, goto err; } - if ((ret = __dbj_dbt_copyin(jenv, &lresult, NULL, jresult, 0)) != 0) - goto err; + for (i = 0; i < num_skeys; i++, tresult++) { + jresult = (*jenv)->GetObjectArrayElement(jenv, jskeys, i); - if (lresult.dbt.size != 0) { - /* If there's data, we need to take a copy of it. */ - memset(result, 0, sizeof (DBT)); - result->size = lresult.dbt.size; if ((ret = - __os_umalloc(NULL, result->size, &result->data)) != 0) + __dbj_dbt_copyin(jenv, &lresult, NULL, jresult, 0)) != 0) goto err; - if ((ret = __dbj_dbt_memcopy(&lresult.dbt, 0, - result->data, result->size, - DB_USERCOPY_GETDATA)) != 0) - goto err; - __dbj_dbt_release(jenv, jresult, &lresult.dbt, &lresult); - (*jenv)->DeleteLocalRef(jenv, lresult.jarr); - F_SET(result, DB_DBT_APPMALLOC); + + if (lresult.dbt.size != 0) { + /* If there's data, we need to take a copy of it. */ + tresult->size = lresult.dbt.size; + if ((ret = __os_umalloc(NULL, + tresult->size, &tresult->data)) != 0) + goto err; + if ((ret = __dbj_dbt_memcopy(&lresult.dbt, 0, + tresult->data, tresult->size, + DB_USERCOPY_GETDATA)) != 0) + goto err; + __dbj_dbt_release(jenv, + jresult, &lresult.dbt, &lresult); + (*jenv)->DeleteLocalRef(jenv, lresult.jarr); + F_SET(tresult, DB_DBT_APPMALLOC); + } + + (*jenv)->DeleteLocalRef(jenv, jresult); } err: if (key->app_data == NULL) { @@ -229,7 +281,6 @@ err: if (key->app_data == NULL) { (*jenv)->DeleteLocalRef(jenv, jdataarr); (*jenv)->DeleteLocalRef(jenv, jdata); } - (*jenv)->DeleteLocalRef(jenv, jresult); return (ret); } @@ -292,7 +343,11 @@ err: (*jenv)->DeleteLocalRef(jenv, jdbtarr); return (ret); } -static int __dbj_bt_compare(DB *db, const DBT *dbt1, const DBT *dbt2) +/* + * Shared by __dbj_bt_compare and __dbj_h_compare + */ +static int __dbj_am_compare(DB *db, const DBT *dbt1, const DBT *dbt2, + jmethodID compare_method) { JNIEnv *jenv = __dbj_get_jnienv(); jobject jdb = (jobject)DB_INTERNAL(db); @@ -323,7 +378,7 @@ static int __dbj_bt_compare(DB *db, const DBT *dbt1, const DBT *dbt2) } ret = (int)(*jenv)->CallNonvirtualIntMethod(jenv, jdb, db_class, - bt_compare_method, jdbtarr1, jdbtarr2); + compare_method, jdbtarr1, jdbtarr2); if ((*jenv)->ExceptionOccurred(jenv)) { /* The exception will be thrown, so this could be any error. */ @@ -338,6 +393,11 @@ static int __dbj_bt_compare(DB *db, const DBT *dbt1, const DBT *dbt2) return (ret); } +static int __dbj_bt_compare(DB *db, const DBT *dbt1, const DBT *dbt2) +{ + return __dbj_am_compare(db, dbt1, dbt2, bt_compare_method); +} + static size_t __dbj_bt_prefix(DB *db, const DBT *dbt1, const DBT *dbt2) { JNIEnv *jenv = __dbj_get_jnienv(); @@ -352,7 +412,8 @@ static size_t __dbj_bt_prefix(DB *db, const DBT *dbt1, const DBT *dbt2) if (dbt1->app_data != NULL) jdbt1 = ((DBT_LOCKED *)dbt1->app_data)->jdbt; else { - if ((jdbt1 = (*jenv)->NewObject(jenv, dbt_class, dbt_construct)) == NULL) + if ((jdbt1 = + (*jenv)->NewObject(jenv, dbt_class, dbt_construct)) == NULL) return (ENOMEM); /* An exception is pending */ __dbj_dbt_copyout(jenv, dbt1, &jdbtarr1, jdbt1); if (jdbtarr1 == NULL) @@ -362,7 +423,8 @@ static size_t __dbj_bt_prefix(DB *db, const DBT *dbt1, const DBT *dbt2) if (dbt2->app_data != NULL) jdbt2 = ((DBT_LOCKED *)dbt2->app_data)->jdbt; else { - if ((jdbt2 = (*jenv)->NewObject(jenv, dbt_class, dbt_construct)) == NULL) + if ((jdbt2 = + (*jenv)->NewObject(jenv, dbt_class, dbt_construct)) == NULL) return (ENOMEM); /* An exception is pending */ __dbj_dbt_copyout(jenv, dbt2, &jdbtarr2, jdbt2); if (jdbtarr2 == NULL) @@ -430,6 +492,11 @@ static void __dbj_db_feedback(DB *db, int opcode, int percent) db_feedback_method, opcode, percent); } +static int __dbj_h_compare(DB *db, const DBT *dbt1, const DBT *dbt2) +{ + return __dbj_am_compare(db, dbt1, dbt2, h_compare_method); +} + static u_int32_t __dbj_h_hash(DB *db, const void *data, u_int32_t len) { JNIEnv *jenv = __dbj_get_jnienv(); @@ -472,12 +539,17 @@ JAVA_CALLBACK(int (*send)(DB_ENV *, const DBT *, const DBT *, /* * Db.associate is a special case, because the handler must be set in the - * secondary DB - that's what we have in the callback. + * secondary DB - that's what we have in the callback. In addition, there + * are two flavors of callback (single key and multi-key), so we need to + * check for both types when working out whether the C callback should + * be NULL. Note that this implies that the multi-key callback will be set + * on the secondary database *before* associate is called. */ JAVA_CALLBACK(int (*callback)(DB *, const DBT *, const DBT *, DBT *), com.sleepycat.db.SecondaryKeyCreator, seckey_create) %typemap(javain) int (*callback)(DB *, const DBT *, const DBT *, DBT *) - %{ (secondary.seckey_create_handler = $javainput) %} + %{ (secondary.seckey_create_handler = $javainput) != null || + (secondary.secmultikey_create_handler != null) %} JAVA_CALLBACK(int (*db_append_recno_fcn)(DB *, DBT *, db_recno_t), com.sleepycat.db.RecordNumberAppender, append_recno) @@ -489,5 +561,7 @@ JAVA_CALLBACK(int (*dup_compare_fcn)(DB *, const DBT *, const DBT *), java.util.Comparator, dup_compare) JAVA_CALLBACK(void (*db_feedback_fcn)(DB *, int, int), com.sleepycat.db.FeedbackHandler, db_feedback) +JAVA_CALLBACK(int (*h_compare_fcn)(DB *, const DBT *, const DBT *), + java.util.Comparator, h_compare) JAVA_CALLBACK(u_int32_t (*h_hash_fcn)(DB *, const void *, u_int32_t), com.sleepycat.db.Hasher, h_hash) diff --git a/db/libdb_java/java_except.i b/db/libdb_java/java_except.i index c90e4cc1f..f15e5580f 100644 --- a/db/libdb_java/java_except.i +++ b/db/libdb_java/java_except.i @@ -65,6 +65,12 @@ static jthrowable __dbj_get_except(JNIEnv *jenv, jmsg = (*jenv)->NewStringUTF(jenv, msg); + /* Retrieve error message logged by DB */ + if (jdbenv != NULL) { + jmsg = (jstring) (*jenv)->CallNonvirtualObjectMethod(jenv, + jdbenv, dbenv_class, get_err_msg_method, jmsg); + } + switch (err) { case EINVAL: return (jthrowable)(*jenv)->NewObject(jenv, @@ -102,6 +108,16 @@ static jthrowable __dbj_get_except(JNIEnv *jenv, repjoinfailex_class, repjoinfailex_construct, jmsg, err, jdbenv); + case DB_REP_LEASE_EXPIRED: + return (jthrowable)(*jenv)->NewObject(jenv, + repleaseexpiredex_class, repleaseexpiredex_construct, + jmsg, err, jdbenv); + + case DB_REP_LEASE_TIMEOUT: + return (jthrowable)(*jenv)->NewObject(jenv, + repleasetimeoutex_class, repleasetimeoutex_construct, + jmsg, err, jdbenv); + case DB_REP_LOCKOUT: return (jthrowable)(*jenv)->NewObject(jenv, replockoutex_class, replockoutex_construct, diff --git a/db/libdb_java/java_stat.i b/db/libdb_java/java_stat.i index e932f5e23..409e2488e 100644 --- a/db/libdb_java/java_stat.i +++ b/db/libdb_java/java_stat.i @@ -90,6 +90,7 @@ JAVA_TYPEMAP(DB_MPOOL_FSTAT **, com.sleepycat.db.CacheFileStats[], jobjectArray) JAVA_STAT_CLASS(DB_MUTEX_STAT *, com.sleepycat.db.MutexStats, mutex_stat) JAVA_STAT_CLASS(DB_REP_STAT *, com.sleepycat.db.ReplicationStats, rep_stat) +JAVA_STAT_CLASS(DB_REPMGR_STAT *, com.sleepycat.db.ReplicationManagerStats, repmgr_stat) JAVA_STAT_CLASS(DB_SEQUENCE_STAT *, com.sleepycat.db.SequenceStats, seq_stat) JAVA_TYPEMAP(DB_TXN_STAT *, com.sleepycat.db.TransactionStats, jobject) %typemap(out) DB_TXN_STAT * { diff --git a/db/libdb_java/java_stat_auto.c b/db/libdb_java/java_stat_auto.c index b3de2a958..e7c7dfcb2 100644 --- a/db/libdb_java/java_stat_auto.c +++ b/db/libdb_java/java_stat_auto.c @@ -3,8 +3,7 @@ * * See the file LICENSE for redistribution information. * - * Copyright (c) 2002-2006 - * Oracle Corporation. All rights reserved. + * Copyright (c) 2002,2007 Oracle. All rights reserved. */ static int __dbj_fill_bt_stat(JNIEnv *jnienv, jobject jobj, struct __db_bt_stat *statp) { @@ -13,6 +12,7 @@ static int __dbj_fill_bt_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, bt_stat_bt_metaflags_fid, statp, bt_metaflags); JAVADB_STAT_INT(jnienv, jobj, bt_stat_bt_nkeys_fid, statp, bt_nkeys); JAVADB_STAT_INT(jnienv, jobj, bt_stat_bt_ndata_fid, statp, bt_ndata); + JAVADB_STAT_INT(jnienv, jobj, bt_stat_bt_pagecnt_fid, statp, bt_pagecnt); JAVADB_STAT_INT(jnienv, jobj, bt_stat_bt_pagesize_fid, statp, bt_pagesize); JAVADB_STAT_INT(jnienv, jobj, bt_stat_bt_minkey_fid, statp, bt_minkey); JAVADB_STAT_INT(jnienv, jobj, bt_stat_bt_re_len_fid, statp, bt_re_len); @@ -50,6 +50,7 @@ static int __dbj_fill_h_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, h_stat_hash_metaflags_fid, statp, hash_metaflags); JAVADB_STAT_INT(jnienv, jobj, h_stat_hash_nkeys_fid, statp, hash_nkeys); JAVADB_STAT_INT(jnienv, jobj, h_stat_hash_ndata_fid, statp, hash_ndata); + JAVADB_STAT_INT(jnienv, jobj, h_stat_hash_pagecnt_fid, statp, hash_pagecnt); JAVADB_STAT_INT(jnienv, jobj, h_stat_hash_pagesize_fid, statp, hash_pagesize); JAVADB_STAT_INT(jnienv, jobj, h_stat_hash_ffactor_fid, statp, hash_ffactor); JAVADB_STAT_INT(jnienv, jobj, h_stat_hash_buckets_fid, statp, hash_buckets); @@ -71,9 +72,9 @@ static int __dbj_fill_lock_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_maxlockers_fid, statp, st_maxlockers); JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_maxobjects_fid, statp, st_maxobjects); JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_nmodes_fid, statp, st_nmodes); + JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_nlockers_fid, statp, st_nlockers); JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_nlocks_fid, statp, st_nlocks); JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_maxnlocks_fid, statp, st_maxnlocks); - JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_nlockers_fid, statp, st_nlockers); JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_maxnlockers_fid, statp, st_maxnlockers); JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_nobjects_fid, statp, st_nobjects); JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_maxnobjects_fid, statp, st_maxnobjects); @@ -88,8 +89,15 @@ static int __dbj_fill_lock_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_nlocktimeouts_fid, statp, st_nlocktimeouts); JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_txntimeout_fid, statp, st_txntimeout); JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_ntxntimeouts_fid, statp, st_ntxntimeouts); + JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_objs_wait_fid, statp, st_objs_wait); + JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_objs_nowait_fid, statp, st_objs_nowait); + JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_lockers_wait_fid, statp, st_lockers_wait); + JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_lockers_nowait_fid, statp, st_lockers_nowait); + JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_locks_wait_fid, statp, st_locks_wait); + JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_locks_nowait_fid, statp, st_locks_nowait); JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_region_wait_fid, statp, st_region_wait); JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_region_nowait_fid, statp, st_region_nowait); + JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_hash_len_fid, statp, st_hash_len); JAVADB_STAT_INT(jnienv, jobj, lock_stat_st_regsize_fid, statp, st_regsize); return (0); } @@ -100,11 +108,11 @@ static int __dbj_fill_log_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, log_stat_st_mode_fid, statp, st_mode); JAVADB_STAT_INT(jnienv, jobj, log_stat_st_lg_bsize_fid, statp, st_lg_bsize); JAVADB_STAT_INT(jnienv, jobj, log_stat_st_lg_size_fid, statp, st_lg_size); + JAVADB_STAT_INT(jnienv, jobj, log_stat_st_wc_bytes_fid, statp, st_wc_bytes); + JAVADB_STAT_INT(jnienv, jobj, log_stat_st_wc_mbytes_fid, statp, st_wc_mbytes); JAVADB_STAT_INT(jnienv, jobj, log_stat_st_record_fid, statp, st_record); JAVADB_STAT_INT(jnienv, jobj, log_stat_st_w_bytes_fid, statp, st_w_bytes); JAVADB_STAT_INT(jnienv, jobj, log_stat_st_w_mbytes_fid, statp, st_w_mbytes); - JAVADB_STAT_INT(jnienv, jobj, log_stat_st_wc_bytes_fid, statp, st_wc_bytes); - JAVADB_STAT_INT(jnienv, jobj, log_stat_st_wc_mbytes_fid, statp, st_wc_mbytes); JAVADB_STAT_INT(jnienv, jobj, log_stat_st_wcount_fid, statp, st_wcount); JAVADB_STAT_INT(jnienv, jobj, log_stat_st_wcount_fill_fid, statp, st_wcount_fill); JAVADB_STAT_INT(jnienv, jobj, log_stat_st_rcount_fid, statp, st_rcount); @@ -115,9 +123,9 @@ static int __dbj_fill_log_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, log_stat_st_cur_offset_fid, statp, st_cur_offset); JAVADB_STAT_INT(jnienv, jobj, log_stat_st_disk_file_fid, statp, st_disk_file); JAVADB_STAT_INT(jnienv, jobj, log_stat_st_disk_offset_fid, statp, st_disk_offset); - JAVADB_STAT_INT(jnienv, jobj, log_stat_st_regsize_fid, statp, st_regsize); JAVADB_STAT_INT(jnienv, jobj, log_stat_st_maxcommitperflush_fid, statp, st_maxcommitperflush); JAVADB_STAT_INT(jnienv, jobj, log_stat_st_mincommitperflush_fid, statp, st_mincommitperflush); + JAVADB_STAT_INT(jnienv, jobj, log_stat_st_regsize_fid, statp, st_regsize); return (0); } static int __dbj_fill_mpool_fstat(JNIEnv *jnienv, @@ -137,11 +145,12 @@ static int __dbj_fill_mpool_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_gbytes_fid, statp, st_gbytes); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_bytes_fid, statp, st_bytes); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_ncache_fid, statp, st_ncache); - JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_regsize_fid, statp, st_regsize); + JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_max_ncache_fid, statp, st_max_ncache); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_mmapsize_fid, statp, st_mmapsize); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_maxopenfd_fid, statp, st_maxopenfd); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_maxwrite_fid, statp, st_maxwrite); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_maxwrite_sleep_fid, statp, st_maxwrite_sleep); + JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_pages_fid, statp, st_pages); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_map_fid, statp, st_map); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_cache_hit_fid, statp, st_cache_hit); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_cache_miss_fid, statp, st_cache_miss); @@ -151,7 +160,6 @@ static int __dbj_fill_mpool_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_ro_evict_fid, statp, st_ro_evict); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_rw_evict_fid, statp, st_rw_evict); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_page_trickle_fid, statp, st_page_trickle); - JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_pages_fid, statp, st_pages); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_page_clean_fid, statp, st_page_clean); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_page_dirty_fid, statp, st_page_dirty); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_hash_buckets_fid, statp, st_hash_buckets); @@ -173,6 +181,7 @@ static int __dbj_fill_mpool_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_alloc_pages_fid, statp, st_alloc_pages); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_alloc_max_pages_fid, statp, st_alloc_max_pages); JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_io_wait_fid, statp, st_io_wait); + JAVADB_STAT_INT(jnienv, jobj, mpool_stat_st_regsize_fid, statp, st_regsize); return (0); } static int __dbj_fill_mutex_stat(JNIEnv *jnienv, @@ -207,6 +216,8 @@ static int __dbj_fill_qam_stat(JNIEnv *jnienv, } static int __dbj_fill_rep_stat(JNIEnv *jnienv, jobject jobj, struct __db_rep_stat *statp) { + JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_log_queued_fid, statp, st_log_queued); + JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_startup_complete_fid, statp, st_startup_complete); JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_status_fid, statp, st_status); JAVADB_STAT_LSN(jnienv, jobj, rep_stat_st_next_lsn_fid, statp, st_next_lsn); JAVADB_STAT_LSN(jnienv, jobj, rep_stat_st_waiting_lsn_fid, statp, st_waiting_lsn); @@ -225,7 +236,6 @@ static int __dbj_fill_rep_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_gen_fid, statp, st_gen); JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_egen_fid, statp, st_egen); JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_log_duplicated_fid, statp, st_log_duplicated); - JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_log_queued_fid, statp, st_log_queued); JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_log_queued_max_fid, statp, st_log_queued_max); JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_log_queued_total_fid, statp, st_log_queued_total); JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_log_records_fid, statp, st_log_records); @@ -244,8 +254,8 @@ static int __dbj_fill_rep_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_pg_duplicated_fid, statp, st_pg_duplicated); JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_pg_records_fid, statp, st_pg_records); JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_pg_requested_fid, statp, st_pg_requested); - JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_startup_complete_fid, statp, st_startup_complete); JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_txns_applied_fid, statp, st_txns_applied); + JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_startsync_delayed_fid, statp, st_startsync_delayed); JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_elections_fid, statp, st_elections); JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_elections_won_fid, statp, st_elections_won); JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_election_cur_winner_fid, statp, st_election_cur_winner); @@ -261,6 +271,15 @@ static int __dbj_fill_rep_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, rep_stat_st_election_usec_fid, statp, st_election_usec); return (0); } +static int __dbj_fill_repmgr_stat(JNIEnv *jnienv, + jobject jobj, struct __db_repmgr_stat *statp) { + JAVADB_STAT_INT(jnienv, jobj, repmgr_stat_st_perm_failed_fid, statp, st_perm_failed); + JAVADB_STAT_INT(jnienv, jobj, repmgr_stat_st_msgs_queued_fid, statp, st_msgs_queued); + JAVADB_STAT_INT(jnienv, jobj, repmgr_stat_st_msgs_dropped_fid, statp, st_msgs_dropped); + JAVADB_STAT_INT(jnienv, jobj, repmgr_stat_st_connection_drop_fid, statp, st_connection_drop); + JAVADB_STAT_INT(jnienv, jobj, repmgr_stat_st_connect_fail_fid, statp, st_connect_fail); + return (0); +} static int __dbj_fill_seq_stat(JNIEnv *jnienv, jobject jobj, struct __db_seq_stat *statp) { JAVADB_STAT_INT(jnienv, jobj, seq_stat_st_wait_fid, statp, st_wait); @@ -276,6 +295,7 @@ static int __dbj_fill_seq_stat(JNIEnv *jnienv, } static int __dbj_fill_txn_stat(JNIEnv *jnienv, jobject jobj, struct __db_txn_stat *statp) { + JAVADB_STAT_INT(jnienv, jobj, txn_stat_st_nrestores_fid, statp, st_nrestores); JAVADB_STAT_LSN(jnienv, jobj, txn_stat_st_last_ckp_fid, statp, st_last_ckp); JAVADB_STAT_LONG(jnienv, jobj, txn_stat_st_time_ckp_fid, statp, st_time_ckp); JAVADB_STAT_INT(jnienv, jobj, txn_stat_st_last_txnid_fid, statp, st_last_txnid); @@ -285,7 +305,6 @@ static int __dbj_fill_txn_stat(JNIEnv *jnienv, JAVADB_STAT_INT(jnienv, jobj, txn_stat_st_ncommits_fid, statp, st_ncommits); JAVADB_STAT_INT(jnienv, jobj, txn_stat_st_nactive_fid, statp, st_nactive); JAVADB_STAT_INT(jnienv, jobj, txn_stat_st_nsnapshot_fid, statp, st_nsnapshot); - JAVADB_STAT_INT(jnienv, jobj, txn_stat_st_nrestores_fid, statp, st_nrestores); JAVADB_STAT_INT(jnienv, jobj, txn_stat_st_maxnactive_fid, statp, st_maxnactive); JAVADB_STAT_INT(jnienv, jobj, txn_stat_st_maxnsnapshot_fid, statp, st_maxnsnapshot); JAVADB_STAT_ACTIVE(jnienv, jobj, txn_stat_st_txnarray_fid, statp, st_txnarray); diff --git a/db/libdb_java/java_typemaps.i b/db/libdb_java/java_typemaps.i index 89a572886..2dd41f7c2 100644 --- a/db/libdb_java/java_typemaps.i +++ b/db/libdb_java/java_typemaps.i @@ -722,16 +722,6 @@ out0: return; } %} -JAVA_TYPEMAP(int *envid, DbEnv.RepProcessMessage, jobject) -%typemap(in) int *envid (int id) %{ - id = (*jenv)->GetIntField(jenv, $input, rep_processmsg_envid_fid); - $1 = &id; -%} - -%typemap(argout) int *envid %{ - (*jenv)->SetIntField(jenv, $input, rep_processmsg_envid_fid, *$1); -%} - JAVA_TYPEMAP(struct __db_repmgr_sites, com.sleepycat.db.ReplicationHostAddress[], jobjectArray) %typemap(out) struct __db_repmgr_sites diff --git a/db/libdb_java/java_util.i b/db/libdb_java/java_util.i index 2a9c27c45..0313b853a 100644 --- a/db/libdb_java/java_util.i +++ b/db/libdb_java/java_util.i @@ -2,6 +2,11 @@ static { /* An alternate library name can be specified via a property. */ String libname; + int v_major, v_minor, v_patch; + + v_major = DbConstants.DB_VERSION_MAJOR; + v_minor = DbConstants.DB_VERSION_MINOR; + v_patch = DbConstants.DB_VERSION_PATCH; if ((libname = System.getProperty("sleepycat.db.libfile")) != null) @@ -16,9 +21,7 @@ * On Windows, library name is something like * "libdb_java42.dll" or "libdb_java42d.dll". */ - libname = "libdb_java" + - DbConstants.DB_VERSION_MAJOR + - DbConstants.DB_VERSION_MINOR; + libname = "libdb_java" + v_major + v_minor; try { System.loadLibrary(libname); @@ -36,18 +39,22 @@ * "libdb_java-3.0.so". */ System.loadLibrary("db_java-" + - DbConstants.DB_VERSION_MAJOR + "." + - DbConstants.DB_VERSION_MINOR); + v_major + "." + v_minor); } } initialize(); - if (DbEnv_get_version_major() != DbConstants.DB_VERSION_MAJOR || - DbEnv_get_version_minor() != DbConstants.DB_VERSION_MINOR || - DbEnv_get_version_patch() != DbConstants.DB_VERSION_PATCH) + if (DbEnv_get_version_major() != v_major || + DbEnv_get_version_minor() != v_minor || + DbEnv_get_version_patch() != v_patch) throw new RuntimeException( - "Berkeley DB library version doesn't match Java classes"); + "Berkeley DB library version " + + DbEnv_get_version_major() + "." + + DbEnv_get_version_minor() + "." + + DbEnv_get_version_patch() + + " doesn't match Java class library version " + + v_major + "." + v_minor + "." + v_patch); } static native final void initialize(); @@ -75,13 +82,14 @@ static jclass keyrange_class; static jclass bt_stat_class, compact_class, h_stat_class, lock_stat_class; static jclass log_stat_class, mpool_stat_class, mpool_fstat_class; static jclass mutex_stat_class, qam_stat_class, rep_stat_class; -static jclass rephost_class, seq_stat_class, txn_stat_class; +static jclass repmgr_stat_class, rephost_class, seq_stat_class, txn_stat_class; static jclass txn_active_class; -static jclass lock_class, lockreq_class, rep_processmsg_class; +static jclass lock_class, lockreq_class; static jclass dbex_class, deadex_class, lockex_class, memex_class; static jclass repdupmasterex_class, rephandledeadex_class; -static jclass repholdelectionex_class, repjoinfailex_class, replockoutex_class; -static jclass repunavailex_class; +static jclass repholdelectionex_class, repjoinfailex_class; +static jclass repleaseexpiredex_class, repleasetimeoutex_class; +static jclass replockoutex_class, repunavailex_class; static jclass runrecex_class, versionex_class; static jclass filenotfoundex_class, illegalargex_class, outofmemerr_class; static jclass bytearray_class, string_class, outputstream_class; @@ -94,7 +102,6 @@ static jfieldID kr_less_fid, kr_equal_fid, kr_greater_fid; static jfieldID lock_cptr_fid; static jfieldID lockreq_op_fid, lockreq_modeflag_fid, lockreq_timeout_fid; static jfieldID lockreq_obj_fid, lockreq_lock_fid; -static jfieldID rep_processmsg_envid_fid; static jfieldID rephost_port_fid, rephost_host_fid, rephost_eid_fid; static jfieldID rephost_status_fid; @@ -104,6 +111,7 @@ static jfieldID bt_stat_bt_version_fid; static jfieldID bt_stat_bt_metaflags_fid; static jfieldID bt_stat_bt_nkeys_fid; static jfieldID bt_stat_bt_ndata_fid; +static jfieldID bt_stat_bt_pagecnt_fid; static jfieldID bt_stat_bt_pagesize_fid; static jfieldID bt_stat_bt_minkey_fid; static jfieldID bt_stat_bt_re_len_fid; @@ -133,6 +141,7 @@ static jfieldID h_stat_hash_version_fid; static jfieldID h_stat_hash_metaflags_fid; static jfieldID h_stat_hash_nkeys_fid; static jfieldID h_stat_hash_ndata_fid; +static jfieldID h_stat_hash_pagecnt_fid; static jfieldID h_stat_hash_pagesize_fid; static jfieldID h_stat_hash_ffactor_fid; static jfieldID h_stat_hash_buckets_fid; @@ -150,9 +159,9 @@ static jfieldID lock_stat_st_maxlocks_fid; static jfieldID lock_stat_st_maxlockers_fid; static jfieldID lock_stat_st_maxobjects_fid; static jfieldID lock_stat_st_nmodes_fid; +static jfieldID lock_stat_st_nlockers_fid; static jfieldID lock_stat_st_nlocks_fid; static jfieldID lock_stat_st_maxnlocks_fid; -static jfieldID lock_stat_st_nlockers_fid; static jfieldID lock_stat_st_maxnlockers_fid; static jfieldID lock_stat_st_nobjects_fid; static jfieldID lock_stat_st_maxnobjects_fid; @@ -167,19 +176,26 @@ static jfieldID lock_stat_st_locktimeout_fid; static jfieldID lock_stat_st_nlocktimeouts_fid; static jfieldID lock_stat_st_txntimeout_fid; static jfieldID lock_stat_st_ntxntimeouts_fid; +static jfieldID lock_stat_st_objs_wait_fid; +static jfieldID lock_stat_st_objs_nowait_fid; +static jfieldID lock_stat_st_lockers_wait_fid; +static jfieldID lock_stat_st_lockers_nowait_fid; +static jfieldID lock_stat_st_locks_wait_fid; +static jfieldID lock_stat_st_locks_nowait_fid; static jfieldID lock_stat_st_region_wait_fid; static jfieldID lock_stat_st_region_nowait_fid; +static jfieldID lock_stat_st_hash_len_fid; static jfieldID lock_stat_st_regsize_fid; static jfieldID log_stat_st_magic_fid; static jfieldID log_stat_st_version_fid; static jfieldID log_stat_st_mode_fid; static jfieldID log_stat_st_lg_bsize_fid; static jfieldID log_stat_st_lg_size_fid; +static jfieldID log_stat_st_wc_bytes_fid; +static jfieldID log_stat_st_wc_mbytes_fid; static jfieldID log_stat_st_record_fid; static jfieldID log_stat_st_w_bytes_fid; static jfieldID log_stat_st_w_mbytes_fid; -static jfieldID log_stat_st_wc_bytes_fid; -static jfieldID log_stat_st_wc_mbytes_fid; static jfieldID log_stat_st_wcount_fid; static jfieldID log_stat_st_wcount_fill_fid; static jfieldID log_stat_st_rcount_fid; @@ -190,9 +206,9 @@ static jfieldID log_stat_st_cur_file_fid; static jfieldID log_stat_st_cur_offset_fid; static jfieldID log_stat_st_disk_file_fid; static jfieldID log_stat_st_disk_offset_fid; -static jfieldID log_stat_st_regsize_fid; static jfieldID log_stat_st_maxcommitperflush_fid; static jfieldID log_stat_st_mincommitperflush_fid; +static jfieldID log_stat_st_regsize_fid; static jfieldID mpool_fstat_file_name_fid; static jfieldID mpool_fstat_st_pagesize_fid; static jfieldID mpool_fstat_st_map_fid; @@ -204,11 +220,12 @@ static jfieldID mpool_fstat_st_page_out_fid; static jfieldID mpool_stat_st_gbytes_fid; static jfieldID mpool_stat_st_bytes_fid; static jfieldID mpool_stat_st_ncache_fid; -static jfieldID mpool_stat_st_regsize_fid; +static jfieldID mpool_stat_st_max_ncache_fid; static jfieldID mpool_stat_st_mmapsize_fid; static jfieldID mpool_stat_st_maxopenfd_fid; static jfieldID mpool_stat_st_maxwrite_fid; static jfieldID mpool_stat_st_maxwrite_sleep_fid; +static jfieldID mpool_stat_st_pages_fid; static jfieldID mpool_stat_st_map_fid; static jfieldID mpool_stat_st_cache_hit_fid; static jfieldID mpool_stat_st_cache_miss_fid; @@ -218,7 +235,6 @@ static jfieldID mpool_stat_st_page_out_fid; static jfieldID mpool_stat_st_ro_evict_fid; static jfieldID mpool_stat_st_rw_evict_fid; static jfieldID mpool_stat_st_page_trickle_fid; -static jfieldID mpool_stat_st_pages_fid; static jfieldID mpool_stat_st_page_clean_fid; static jfieldID mpool_stat_st_page_dirty_fid; static jfieldID mpool_stat_st_hash_buckets_fid; @@ -240,6 +256,7 @@ static jfieldID mpool_stat_st_alloc_max_buckets_fid; static jfieldID mpool_stat_st_alloc_pages_fid; static jfieldID mpool_stat_st_alloc_max_pages_fid; static jfieldID mpool_stat_st_io_wait_fid; +static jfieldID mpool_stat_st_regsize_fid; static jfieldID mutex_stat_st_mutex_align_fid; static jfieldID mutex_stat_st_mutex_tas_spins_fid; static jfieldID mutex_stat_st_mutex_cnt_fid; @@ -262,6 +279,8 @@ static jfieldID qam_stat_qs_re_pad_fid; static jfieldID qam_stat_qs_pgfree_fid; static jfieldID qam_stat_qs_first_recno_fid; static jfieldID qam_stat_qs_cur_recno_fid; +static jfieldID rep_stat_st_log_queued_fid; +static jfieldID rep_stat_st_startup_complete_fid; static jfieldID rep_stat_st_status_fid; static jfieldID rep_stat_st_next_lsn_fid; static jfieldID rep_stat_st_waiting_lsn_fid; @@ -280,7 +299,6 @@ static jfieldID rep_stat_st_client_svc_miss_fid; static jfieldID rep_stat_st_gen_fid; static jfieldID rep_stat_st_egen_fid; static jfieldID rep_stat_st_log_duplicated_fid; -static jfieldID rep_stat_st_log_queued_fid; static jfieldID rep_stat_st_log_queued_max_fid; static jfieldID rep_stat_st_log_queued_total_fid; static jfieldID rep_stat_st_log_records_fid; @@ -299,8 +317,8 @@ static jfieldID rep_stat_st_outdated_fid; static jfieldID rep_stat_st_pg_duplicated_fid; static jfieldID rep_stat_st_pg_records_fid; static jfieldID rep_stat_st_pg_requested_fid; -static jfieldID rep_stat_st_startup_complete_fid; static jfieldID rep_stat_st_txns_applied_fid; +static jfieldID rep_stat_st_startsync_delayed_fid; static jfieldID rep_stat_st_elections_fid; static jfieldID rep_stat_st_elections_won_fid; static jfieldID rep_stat_st_election_cur_winner_fid; @@ -314,6 +332,11 @@ static jfieldID rep_stat_st_election_tiebreaker_fid; static jfieldID rep_stat_st_election_votes_fid; static jfieldID rep_stat_st_election_sec_fid; static jfieldID rep_stat_st_election_usec_fid; +static jfieldID repmgr_stat_st_perm_failed_fid; +static jfieldID repmgr_stat_st_msgs_queued_fid; +static jfieldID repmgr_stat_st_msgs_dropped_fid; +static jfieldID repmgr_stat_st_connection_drop_fid; +static jfieldID repmgr_stat_st_connect_fail_fid; static jfieldID seq_stat_st_wait_fid; static jfieldID seq_stat_st_nowait_fid; static jfieldID seq_stat_st_current_fid; @@ -323,6 +346,7 @@ static jfieldID seq_stat_st_min_fid; static jfieldID seq_stat_st_max_fid; static jfieldID seq_stat_st_cache_size_fid; static jfieldID seq_stat_st_flags_fid; +static jfieldID txn_stat_st_nrestores_fid; static jfieldID txn_stat_st_last_ckp_fid; static jfieldID txn_stat_st_time_ckp_fid; static jfieldID txn_stat_st_last_txnid_fid; @@ -332,7 +356,6 @@ static jfieldID txn_stat_st_nbegins_fid; static jfieldID txn_stat_st_ncommits_fid; static jfieldID txn_stat_st_nactive_fid; static jfieldID txn_stat_st_nsnapshot_fid; -static jfieldID txn_stat_st_nrestores_fid; static jfieldID txn_stat_st_maxnactive_fid; static jfieldID txn_stat_st_maxnsnapshot_fid; static jfieldID txn_stat_st_txnarray_fid; @@ -353,18 +376,19 @@ static jfieldID txn_active_name_fid; static jmethodID dbenv_construct, dbt_construct, dblsn_construct; static jmethodID dbpreplist_construct, dbtxn_construct; -static jmethodID bt_stat_construct, h_stat_construct; +static jmethodID bt_stat_construct, get_err_msg_method, h_stat_construct; static jmethodID lock_stat_construct, log_stat_construct; static jmethodID mpool_stat_construct, mpool_fstat_construct; static jmethodID mutex_stat_construct, qam_stat_construct; -static jmethodID rep_stat_construct, seq_stat_construct; +static jmethodID rep_stat_construct, repmgr_stat_construct, seq_stat_construct; static jmethodID txn_stat_construct, txn_active_construct; static jmethodID dbex_construct, deadex_construct, lockex_construct; static jmethodID memex_construct, memex_update_method; static jmethodID repdupmasterex_construct, rephandledeadex_construct; static jmethodID repholdelectionex_construct, repjoinfailex_construct; -static jmethodID rephost_construct; -static jmethodID replockoutex_construct, repunavailex_construct; +static jmethodID rephost_construct, repleaseexpiredex_construct; +static jmethodID repleasetimeoutex_construct, replockoutex_construct; +static jmethodID repunavailex_construct; static jmethodID runrecex_construct, versionex_construct; static jmethodID filenotfoundex_construct, illegalargex_construct; static jmethodID outofmemerr_construct; @@ -372,11 +396,17 @@ static jmethodID lock_construct; static jmethodID app_dispatch_method, errcall_method, env_feedback_method; static jmethodID msgcall_method, paniccall_method, rep_transport_method; -static jmethodID event_notify_method; +static jmethodID panic_event_notify_method, rep_client_event_notify_method; +static jmethodID rep_elected_event_notify_method; +static jmethodID rep_master_event_notify_method; +static jmethodID rep_new_master_event_notify_method; +static jmethodID rep_perm_failed_event_notify_method; +static jmethodID rep_startup_done_event_notify_method; +static jmethodID write_failed_event_notify_method; static jmethodID append_recno_method, bt_compare_method, bt_prefix_method; -static jmethodID db_feedback_method, dup_compare_method, h_hash_method; -static jmethodID seckey_create_method; +static jmethodID db_feedback_method, dup_compare_method, h_compare_method; +static jmethodID h_hash_method, seckey_create_method; static jmethodID outputstream_write_method; @@ -402,6 +432,7 @@ const struct { { &mutex_stat_class, DB_PKG "MutexStats" }, { &qam_stat_class, DB_PKG "QueueStats" }, { &rep_stat_class, DB_PKG "ReplicationStats" }, + { &repmgr_stat_class, DB_PKG "ReplicationManagerStats" }, { &seq_stat_class, DB_PKG "SequenceStats" }, { &txn_stat_class, DB_PKG "TransactionStats" }, { &txn_active_class, DB_PKG "TransactionStats$Active" }, @@ -409,8 +440,6 @@ const struct { { &keyrange_class, DB_PKG "KeyRange" }, { &lock_class, DB_PKG "internal/DbLock" }, { &lockreq_class, DB_PKG "LockRequest" }, - { &rep_processmsg_class, DB_PKG "internal/DbEnv$RepProcessMessage" }, - { &rep_processmsg_class, DB_PKG "internal/DbEnv$RepProcessMessage" }, { &dbex_class, DB_PKG "DatabaseException" }, { &deadex_class, DB_PKG "DeadlockException" }, @@ -421,6 +450,8 @@ const struct { { &repholdelectionex_class, DB_PKG "ReplicationHoldElectionException" }, { &rephost_class, DB_PKG "ReplicationHostAddress" }, { &repjoinfailex_class, DB_PKG "ReplicationJoinFailureException" }, + { &repleaseexpiredex_class, DB_PKG "ReplicationLeaseExpiredException" }, + { &repleasetimeoutex_class, DB_PKG "ReplicationLeaseTimeoutException" }, { &replockoutex_class, DB_PKG "ReplicationLockoutException" }, { &repunavailex_class, DB_PKG "ReplicationSiteUnavailableException" }, { &runrecex_class, DB_PKG "RunRecoveryException" }, @@ -474,6 +505,7 @@ const struct { { &bt_stat_bt_metaflags_fid, &bt_stat_class, "bt_metaflags", "I" }, { &bt_stat_bt_nkeys_fid, &bt_stat_class, "bt_nkeys", "I" }, { &bt_stat_bt_ndata_fid, &bt_stat_class, "bt_ndata", "I" }, + { &bt_stat_bt_pagecnt_fid, &bt_stat_class, "bt_pagecnt", "I" }, { &bt_stat_bt_pagesize_fid, &bt_stat_class, "bt_pagesize", "I" }, { &bt_stat_bt_minkey_fid, &bt_stat_class, "bt_minkey", "I" }, { &bt_stat_bt_re_len_fid, &bt_stat_class, "bt_re_len", "I" }, @@ -503,6 +535,7 @@ const struct { { &h_stat_hash_metaflags_fid, &h_stat_class, "hash_metaflags", "I" }, { &h_stat_hash_nkeys_fid, &h_stat_class, "hash_nkeys", "I" }, { &h_stat_hash_ndata_fid, &h_stat_class, "hash_ndata", "I" }, + { &h_stat_hash_pagecnt_fid, &h_stat_class, "hash_pagecnt", "I" }, { &h_stat_hash_pagesize_fid, &h_stat_class, "hash_pagesize", "I" }, { &h_stat_hash_ffactor_fid, &h_stat_class, "hash_ffactor", "I" }, { &h_stat_hash_buckets_fid, &h_stat_class, "hash_buckets", "I" }, @@ -520,9 +553,9 @@ const struct { { &lock_stat_st_maxlockers_fid, &lock_stat_class, "st_maxlockers", "I" }, { &lock_stat_st_maxobjects_fid, &lock_stat_class, "st_maxobjects", "I" }, { &lock_stat_st_nmodes_fid, &lock_stat_class, "st_nmodes", "I" }, + { &lock_stat_st_nlockers_fid, &lock_stat_class, "st_nlockers", "I" }, { &lock_stat_st_nlocks_fid, &lock_stat_class, "st_nlocks", "I" }, { &lock_stat_st_maxnlocks_fid, &lock_stat_class, "st_maxnlocks", "I" }, - { &lock_stat_st_nlockers_fid, &lock_stat_class, "st_nlockers", "I" }, { &lock_stat_st_maxnlockers_fid, &lock_stat_class, "st_maxnlockers", "I" }, { &lock_stat_st_nobjects_fid, &lock_stat_class, "st_nobjects", "I" }, { &lock_stat_st_maxnobjects_fid, &lock_stat_class, "st_maxnobjects", "I" }, @@ -537,19 +570,26 @@ const struct { { &lock_stat_st_nlocktimeouts_fid, &lock_stat_class, "st_nlocktimeouts", "I" }, { &lock_stat_st_txntimeout_fid, &lock_stat_class, "st_txntimeout", "I" }, { &lock_stat_st_ntxntimeouts_fid, &lock_stat_class, "st_ntxntimeouts", "I" }, + { &lock_stat_st_objs_wait_fid, &lock_stat_class, "st_objs_wait", "I" }, + { &lock_stat_st_objs_nowait_fid, &lock_stat_class, "st_objs_nowait", "I" }, + { &lock_stat_st_lockers_wait_fid, &lock_stat_class, "st_lockers_wait", "I" }, + { &lock_stat_st_lockers_nowait_fid, &lock_stat_class, "st_lockers_nowait", "I" }, + { &lock_stat_st_locks_wait_fid, &lock_stat_class, "st_locks_wait", "I" }, + { &lock_stat_st_locks_nowait_fid, &lock_stat_class, "st_locks_nowait", "I" }, { &lock_stat_st_region_wait_fid, &lock_stat_class, "st_region_wait", "I" }, { &lock_stat_st_region_nowait_fid, &lock_stat_class, "st_region_nowait", "I" }, + { &lock_stat_st_hash_len_fid, &lock_stat_class, "st_hash_len", "I" }, { &lock_stat_st_regsize_fid, &lock_stat_class, "st_regsize", "I" }, { &log_stat_st_magic_fid, &log_stat_class, "st_magic", "I" }, { &log_stat_st_version_fid, &log_stat_class, "st_version", "I" }, { &log_stat_st_mode_fid, &log_stat_class, "st_mode", "I" }, { &log_stat_st_lg_bsize_fid, &log_stat_class, "st_lg_bsize", "I" }, { &log_stat_st_lg_size_fid, &log_stat_class, "st_lg_size", "I" }, + { &log_stat_st_wc_bytes_fid, &log_stat_class, "st_wc_bytes", "I" }, + { &log_stat_st_wc_mbytes_fid, &log_stat_class, "st_wc_mbytes", "I" }, { &log_stat_st_record_fid, &log_stat_class, "st_record", "I" }, { &log_stat_st_w_bytes_fid, &log_stat_class, "st_w_bytes", "I" }, { &log_stat_st_w_mbytes_fid, &log_stat_class, "st_w_mbytes", "I" }, - { &log_stat_st_wc_bytes_fid, &log_stat_class, "st_wc_bytes", "I" }, - { &log_stat_st_wc_mbytes_fid, &log_stat_class, "st_wc_mbytes", "I" }, { &log_stat_st_wcount_fid, &log_stat_class, "st_wcount", "I" }, { &log_stat_st_wcount_fill_fid, &log_stat_class, "st_wcount_fill", "I" }, { &log_stat_st_rcount_fid, &log_stat_class, "st_rcount", "I" }, @@ -560,9 +600,9 @@ const struct { { &log_stat_st_cur_offset_fid, &log_stat_class, "st_cur_offset", "I" }, { &log_stat_st_disk_file_fid, &log_stat_class, "st_disk_file", "I" }, { &log_stat_st_disk_offset_fid, &log_stat_class, "st_disk_offset", "I" }, - { &log_stat_st_regsize_fid, &log_stat_class, "st_regsize", "I" }, { &log_stat_st_maxcommitperflush_fid, &log_stat_class, "st_maxcommitperflush", "I" }, { &log_stat_st_mincommitperflush_fid, &log_stat_class, "st_mincommitperflush", "I" }, + { &log_stat_st_regsize_fid, &log_stat_class, "st_regsize", "I" }, { &mpool_fstat_file_name_fid, &mpool_fstat_class, "file_name", "Ljava/lang/String;" }, { &mpool_fstat_st_pagesize_fid, &mpool_fstat_class, "st_pagesize", "I" }, { &mpool_fstat_st_map_fid, &mpool_fstat_class, "st_map", "I" }, @@ -574,11 +614,12 @@ const struct { { &mpool_stat_st_gbytes_fid, &mpool_stat_class, "st_gbytes", "I" }, { &mpool_stat_st_bytes_fid, &mpool_stat_class, "st_bytes", "I" }, { &mpool_stat_st_ncache_fid, &mpool_stat_class, "st_ncache", "I" }, - { &mpool_stat_st_regsize_fid, &mpool_stat_class, "st_regsize", "I" }, + { &mpool_stat_st_max_ncache_fid, &mpool_stat_class, "st_max_ncache", "I" }, { &mpool_stat_st_mmapsize_fid, &mpool_stat_class, "st_mmapsize", "I" }, { &mpool_stat_st_maxopenfd_fid, &mpool_stat_class, "st_maxopenfd", "I" }, { &mpool_stat_st_maxwrite_fid, &mpool_stat_class, "st_maxwrite", "I" }, { &mpool_stat_st_maxwrite_sleep_fid, &mpool_stat_class, "st_maxwrite_sleep", "I" }, + { &mpool_stat_st_pages_fid, &mpool_stat_class, "st_pages", "I" }, { &mpool_stat_st_map_fid, &mpool_stat_class, "st_map", "I" }, { &mpool_stat_st_cache_hit_fid, &mpool_stat_class, "st_cache_hit", "I" }, { &mpool_stat_st_cache_miss_fid, &mpool_stat_class, "st_cache_miss", "I" }, @@ -588,7 +629,6 @@ const struct { { &mpool_stat_st_ro_evict_fid, &mpool_stat_class, "st_ro_evict", "I" }, { &mpool_stat_st_rw_evict_fid, &mpool_stat_class, "st_rw_evict", "I" }, { &mpool_stat_st_page_trickle_fid, &mpool_stat_class, "st_page_trickle", "I" }, - { &mpool_stat_st_pages_fid, &mpool_stat_class, "st_pages", "I" }, { &mpool_stat_st_page_clean_fid, &mpool_stat_class, "st_page_clean", "I" }, { &mpool_stat_st_page_dirty_fid, &mpool_stat_class, "st_page_dirty", "I" }, { &mpool_stat_st_hash_buckets_fid, &mpool_stat_class, "st_hash_buckets", "I" }, @@ -610,6 +650,7 @@ const struct { { &mpool_stat_st_alloc_pages_fid, &mpool_stat_class, "st_alloc_pages", "I" }, { &mpool_stat_st_alloc_max_pages_fid, &mpool_stat_class, "st_alloc_max_pages", "I" }, { &mpool_stat_st_io_wait_fid, &mpool_stat_class, "st_io_wait", "I" }, + { &mpool_stat_st_regsize_fid, &mpool_stat_class, "st_regsize", "I" }, { &mutex_stat_st_mutex_align_fid, &mutex_stat_class, "st_mutex_align", "I" }, { &mutex_stat_st_mutex_tas_spins_fid, &mutex_stat_class, "st_mutex_tas_spins", "I" }, { &mutex_stat_st_mutex_cnt_fid, &mutex_stat_class, "st_mutex_cnt", "I" }, @@ -632,6 +673,8 @@ const struct { { &qam_stat_qs_pgfree_fid, &qam_stat_class, "qs_pgfree", "I" }, { &qam_stat_qs_first_recno_fid, &qam_stat_class, "qs_first_recno", "I" }, { &qam_stat_qs_cur_recno_fid, &qam_stat_class, "qs_cur_recno", "I" }, + { &rep_stat_st_log_queued_fid, &rep_stat_class, "st_log_queued", "I" }, + { &rep_stat_st_startup_complete_fid, &rep_stat_class, "st_startup_complete", "I" }, { &rep_stat_st_status_fid, &rep_stat_class, "st_status", "I" }, { &rep_stat_st_next_lsn_fid, &rep_stat_class, "st_next_lsn", "L" DB_PKG "LogSequenceNumber;" }, { &rep_stat_st_waiting_lsn_fid, &rep_stat_class, "st_waiting_lsn", "L" DB_PKG "LogSequenceNumber;" }, @@ -650,7 +693,6 @@ const struct { { &rep_stat_st_gen_fid, &rep_stat_class, "st_gen", "I" }, { &rep_stat_st_egen_fid, &rep_stat_class, "st_egen", "I" }, { &rep_stat_st_log_duplicated_fid, &rep_stat_class, "st_log_duplicated", "I" }, - { &rep_stat_st_log_queued_fid, &rep_stat_class, "st_log_queued", "I" }, { &rep_stat_st_log_queued_max_fid, &rep_stat_class, "st_log_queued_max", "I" }, { &rep_stat_st_log_queued_total_fid, &rep_stat_class, "st_log_queued_total", "I" }, { &rep_stat_st_log_records_fid, &rep_stat_class, "st_log_records", "I" }, @@ -669,8 +711,8 @@ const struct { { &rep_stat_st_pg_duplicated_fid, &rep_stat_class, "st_pg_duplicated", "I" }, { &rep_stat_st_pg_records_fid, &rep_stat_class, "st_pg_records", "I" }, { &rep_stat_st_pg_requested_fid, &rep_stat_class, "st_pg_requested", "I" }, - { &rep_stat_st_startup_complete_fid, &rep_stat_class, "st_startup_complete", "I" }, { &rep_stat_st_txns_applied_fid, &rep_stat_class, "st_txns_applied", "I" }, + { &rep_stat_st_startsync_delayed_fid, &rep_stat_class, "st_startsync_delayed", "I" }, { &rep_stat_st_elections_fid, &rep_stat_class, "st_elections", "I" }, { &rep_stat_st_elections_won_fid, &rep_stat_class, "st_elections_won", "I" }, { &rep_stat_st_election_cur_winner_fid, &rep_stat_class, "st_election_cur_winner", "I" }, @@ -684,6 +726,11 @@ const struct { { &rep_stat_st_election_votes_fid, &rep_stat_class, "st_election_votes", "I" }, { &rep_stat_st_election_sec_fid, &rep_stat_class, "st_election_sec", "I" }, { &rep_stat_st_election_usec_fid, &rep_stat_class, "st_election_usec", "I" }, + { &repmgr_stat_st_perm_failed_fid, &repmgr_stat_class, "st_perm_failed", "I" }, + { &repmgr_stat_st_msgs_queued_fid, &repmgr_stat_class, "st_msgs_queued", "I" }, + { &repmgr_stat_st_msgs_dropped_fid, &repmgr_stat_class, "st_msgs_dropped", "I" }, + { &repmgr_stat_st_connection_drop_fid, &repmgr_stat_class, "st_connection_drop", "I" }, + { &repmgr_stat_st_connect_fail_fid, &repmgr_stat_class, "st_connect_fail", "I" }, { &seq_stat_st_wait_fid, &seq_stat_class, "st_wait", "I" }, { &seq_stat_st_nowait_fid, &seq_stat_class, "st_nowait", "I" }, { &seq_stat_st_current_fid, &seq_stat_class, "st_current", "J" }, @@ -693,6 +740,7 @@ const struct { { &seq_stat_st_max_fid, &seq_stat_class, "st_max", "J" }, { &seq_stat_st_cache_size_fid, &seq_stat_class, "st_cache_size", "I" }, { &seq_stat_st_flags_fid, &seq_stat_class, "st_flags", "I" }, + { &txn_stat_st_nrestores_fid, &txn_stat_class, "st_nrestores", "I" }, { &txn_stat_st_last_ckp_fid, &txn_stat_class, "st_last_ckp", "L" DB_PKG "LogSequenceNumber;" }, { &txn_stat_st_time_ckp_fid, &txn_stat_class, "st_time_ckp", "J" }, { &txn_stat_st_last_txnid_fid, &txn_stat_class, "st_last_txnid", "I" }, @@ -702,7 +750,6 @@ const struct { { &txn_stat_st_ncommits_fid, &txn_stat_class, "st_ncommits", "I" }, { &txn_stat_st_nactive_fid, &txn_stat_class, "st_nactive", "I" }, { &txn_stat_st_nsnapshot_fid, &txn_stat_class, "st_nsnapshot", "I" }, - { &txn_stat_st_nrestores_fid, &txn_stat_class, "st_nrestores", "I" }, { &txn_stat_st_maxnactive_fid, &txn_stat_class, "st_maxnactive", "I" }, { &txn_stat_st_maxnsnapshot_fid, &txn_stat_class, "st_maxnsnapshot", "I" }, { &txn_stat_st_txnarray_fid, &txn_stat_class, "st_txnarray", "[L" DB_PKG "TransactionStats$Active;" }, @@ -724,8 +771,7 @@ const struct { { &rephost_port_fid, &rephost_class, "port", "I" }, { &rephost_host_fid, &rephost_class, "host", "Ljava/lang/String;" }, { &rephost_eid_fid, &rephost_class, "eid", "I" }, - { &rephost_status_fid, &rephost_class, "status", "I" }, - { &rep_processmsg_envid_fid, &rep_processmsg_class, "envid", "I" } + { &rephost_status_fid, &rephost_class, "status", "I" } }; const struct { @@ -742,6 +788,8 @@ const struct { { &dbtxn_construct, &dbtxn_class, "<init>", "(JZ)V" }, { &bt_stat_construct, &bt_stat_class, "<init>", "()V" }, + { &get_err_msg_method, &dbenv_class, "get_err_msg", + "(Ljava/lang/String;)Ljava/lang/String;" }, { &h_stat_construct, &h_stat_class, "<init>", "()V" }, { &lock_stat_construct, &lock_stat_class, "<init>", "()V" }, { &log_stat_construct, &log_stat_class, "<init>", "()V" }, @@ -750,6 +798,7 @@ const struct { { &mutex_stat_construct, &mutex_stat_class, "<init>", "()V" }, { &qam_stat_construct, &qam_stat_class, "<init>", "()V" }, { &rep_stat_construct, &rep_stat_class, "<init>", "()V" }, + { &repmgr_stat_construct, &repmgr_stat_class, "<init>", "()V" }, { &seq_stat_construct, &seq_stat_class, "<init>", "()V" }, { &txn_stat_construct, &txn_stat_class, "<init>", "()V" }, { &txn_active_construct, &txn_active_class, "<init>", "()V" }, @@ -775,6 +824,10 @@ const struct { "(Ljava/lang/String;IL" DB_PKG "internal/DbEnv;)V" }, { &repjoinfailex_construct, &repjoinfailex_class, "<init>", "(Ljava/lang/String;IL" DB_PKG "internal/DbEnv;)V" }, + { &repleaseexpiredex_construct, &repleaseexpiredex_class, "<init>", + "(Ljava/lang/String;IL" DB_PKG "internal/DbEnv;)V" }, + { &repleasetimeoutex_construct, &repleasetimeoutex_class, "<init>", + "(Ljava/lang/String;IL" DB_PKG "internal/DbEnv;)V" }, { &replockoutex_construct, &replockoutex_class, "<init>", "(Ljava/lang/String;IL" DB_PKG "internal/DbEnv;)V" }, { &repunavailex_construct, &repunavailex_class, "<init>", @@ -794,8 +847,22 @@ const struct { { &app_dispatch_method, &dbenv_class, "handle_app_dispatch", "(L" DB_PKG "DatabaseEntry;L" DB_PKG "LogSequenceNumber;I)I" }, - { &event_notify_method, &dbenv_class, "handle_event_notify", - "(I)I" }, + { &panic_event_notify_method, &dbenv_class, "handle_panic_event_notify", + "()V" }, + { &rep_client_event_notify_method, &dbenv_class, + "handle_rep_client_event_notify", "()V" }, + { &rep_elected_event_notify_method, &dbenv_class, + "handle_rep_elected_event_notify" ,"()V" }, + { &rep_master_event_notify_method, &dbenv_class, + "handle_rep_master_event_notify", "()V" }, + { &rep_new_master_event_notify_method, &dbenv_class, + "handle_rep_new_master_event_notify", "(I)V" }, + { &rep_perm_failed_event_notify_method, &dbenv_class, + "handle_rep_perm_failed_event_notify", "()V" }, + { &rep_startup_done_event_notify_method, &dbenv_class, + "handle_rep_startup_done_event_notify", "()V" }, + { &write_failed_event_notify_method, &dbenv_class, + "handle_write_failed_event_notify", "(I)V" }, { &env_feedback_method, &dbenv_class, "handle_env_feedback", "(II)V" }, { &errcall_method, &dbenv_class, "handle_error", "(Ljava/lang/String;)V" }, @@ -816,10 +883,12 @@ const struct { { &db_feedback_method, &db_class, "handle_db_feedback", "(II)V" }, { &dup_compare_method, &db_class, "handle_dup_compare", "([B[B)I" }, + { &h_compare_method, &db_class, "handle_h_compare", + "([B[B)I" }, { &h_hash_method, &db_class, "handle_h_hash", "([BI)I" }, { &seckey_create_method, &db_class, "handle_seckey_create", - "(L" DB_PKG "DatabaseEntry;L" DB_PKG "DatabaseEntry;L" - DB_PKG "DatabaseEntry;)I" }, + "(L" DB_PKG "DatabaseEntry;L" DB_PKG "DatabaseEntry;)[L" + DB_PKG "DatabaseEntry;" }, { &outputstream_write_method, &outputstream_class, "write", "([BII)V" } }; |