Commit Graph

435 Commits

Author SHA1 Message Date
Andres Noetzli
6a82fba75f Add missing hashCode() implementation
Summary:
Whenever a Java class implements equals(), it has to implement hashCode(), otherwise
there might be weird behavior when inserting instances of the class in a hash map for
example. This adds two missing hashCode() implementations and extends tests to test
the hashCode() implementations.

Test Plan: make jtest

Reviewers: rven, igor, sdong, yhchiang

Reviewed By: yhchiang

Subscribers: anthony, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D43017
2015-07-24 17:07:19 -07:00
Andres Noetzli
f73c801432 Fixing Java tests.
Summary:
While working on https://reviews.facebook.net/D43017 , I realized
that some Java tests are failing due to a deprecated option.
This patch removes the offending tests, adds @Deprecated annotations
to the Java interface and removes the corresponding functions in
rocksjni

Test Plan: make jtest (all tests are passing now)

Reviewers: rven, igor, sdong, anthony, yhchiang

Reviewed By: yhchiang

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D43035
2015-07-24 16:56:26 -07:00
Igor Canadi
35ca59364c Don't let flushes preempt compactions
Summary:
When we first started, max_background_flushes was 0 by default and compaction thread was executing flushes (since there was no flush thread). Then, we switched the default max_background_flushes to 1. However, we still support the case where there is no flush thread and flushes are done in compaction. This is making our code a bit more complicated. By not supporting this use-case we can make our code simpler.

We have a special case that when you set max_background_flushes to 0, we
schedule the flush to execute on the compaction thread.

Test Plan: make check (there might be some unit tests that depend on this behavior)

Reviewers: IslamAbdelRahman, yhchiang, sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D41931
2015-07-17 12:02:52 -07:00
agiardullo
79373c372d Fix ROCKSDB_WARNING
Summary:
ROCKSDB_WARNING is only defined if either ROCKSDB_PLATFORM_POSIX or OS_WIN is defined.  This works well for building rocksdb with its own build scripts.  But this won't work when an outside project(like mongodb) doesn't define ROCKSDB_PLATFORM_POSIX.

This fix defines ROCKSDB_WARNING for all platforms.  No idea if its defined correctly on non-posix,non-windows platforms but this is no worse that the current situation where this macro is missing on unexpected platforms.

This fix should hopefully fix anyone whose build broke now that we've switched from using #warning to Pragma (to support windows).  Unfortunately, while mongo-rocks compiles, it ignores the Pragma and doesn't print a warning.  I have not been able to figure out a way to implement this portably on all platforms.

Of course, an alternate solution would be to just get rid of ROCKSDB_WARNING and live with include file redirects indefinitely.  Thoughts?

Test Plan: build rocks, build mongorocks

Reviewers: igor, kradhakrishnan, IslamAbdelRahman, sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D42477
2015-07-17 11:04:55 -07:00
Jörg Maier
05e194158c Merge pull request #639 from cleaton/setMaxTableFileSize
Add JNI interface to set max_table_files_size for FIFO compaction
2015-07-14 23:23:06 +02:00
Adam Retter
9d22a97379 Resolve Java test dependencies from local maven repo if present 2015-07-14 18:42:33 +01:00
Yueh-Hsuan Chiang
03d433ee65 [RocksJava] Fixed test failures
Summary:
The option bottommost_level_compaction was introduced lately.
This option breaks the Java API behavior. To prevent the library
from doing so we set that option to a fixed value in Java.

In future we are going to remove that portion and replace the
hardcoded options using a more flexible way.

Fixed bug introduced by WriteBatchWithIndex Patch

Lately icanadi changed the behavior of WriteBatchWithIndex.
See commit: 821cff114e

This commit solves problems introduced by above mentioned commit.

Test Plan:
make rocksdbjava
make jtest

Reviewers: adamretter, ankgup87, yhchiang

Reviewed By: yhchiang

Subscribers: igor, dhruba

Differential Revision: https://reviews.facebook.net/D40647
2015-07-01 23:22:03 -07:00
Yueh-Hsuan Chiang
c00948d5e1 [RocksJava] Fix test failure of compactRangeToLevel
Summary:
Rewrite Java tests compactRangeToLevel and compactRangeToLevelColumnFamily
to make them more deterministic and robust.

Test Plan:
make rocksdbjava
make jtest

Reviewers: anthony, fyrz, adamretter, igor

Reviewed By: igor

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D40941
2015-07-01 16:03:56 -07:00
Jesper Lundgren
dda74111ae add setMaxTableFilesSize Options unit test 2015-06-20 16:24:09 +08:00
Jesper Lundgren
d62b6ed838 add setMaxTableFilesSize to JNI interface 2015-06-20 16:23:22 +08:00
Islam AbdelRahman
12e030a992 Use CompactRangeOptions for CompactRange
Summary:
This diff update DB::CompactRange to use RangeCompactionOptions instead of using multiple parameters
Old CompactRange is still available but deprecated

Test Plan:
make all check
make rocksdbjava
USE_CLANG=1 make all
OPT=-DROCKSDB_LITE make release

Reviewers: sdong, yhchiang, igor

Reviewed By: igor

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D40209
2015-06-17 14:36:14 -07:00
agiardullo
dc9d70de65 Optimistic Transactions
Summary: Optimistic transactions supporting begin/commit/rollback semantics.  Currently relies on checking the memtable to determine if there are any collisions at commit time.  Not yet implemented would be a way of enuring the memtable has some minimum amount of history so that we won't fail to commit when the memtable is empty.  You should probably start with transaction.h to get an overview of what is currently supported.

Test Plan: Added a new test, but still need to look into stress testing.

Reviewers: yhchiang, igor, rven, sdong

Reviewed By: sdong

Subscribers: adamretter, MarkCallaghan, leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D33435
2015-05-29 14:36:35 -07:00
agiardullo
c815351038 Support saving history in memtable_list
Summary:
For transactions, we are using the memtables to validate that there are no write conflicts.  But after flushing, we don't have any memtables, and transactions could fail to commit.  So we want to someone keep around some extra history to use for conflict checking.  In addition, we want to provide a way to increase the size of this history if too many transactions fail to commit.

After chatting with people, it seems like everyone prefers just using Memtables to store this history (instead of a separate history structure).  It seems like the best place for this is abstracted inside the memtable_list.  I decide to create a separate list in MemtableListVersion as using the same list complicated the flush/installalflushresults logic too much.

This diff adds a new parameter to control how much memtable history to keep around after flushing.  However, it sounds like people aren't too fond of adding new parameters.  So I am making the default size of flushed+not-flushed memtables be set to max_write_buffers.  This should not change the maximum amount of memory used, but make it more likely we're using closer the the limit.  (We are now postponing deleting flushed memtables until the max_write_buffer limit is reached).  So while we might use more memory on average, we are still obeying the limit set (and you could argue it's better to go ahead and use up memory now instead of waiting for a write stall to happen to test this limit).

However, if people are opposed to this default behavior, we can easily set it to 0 and require this parameter be set in order to use transactions.

Test Plan: Added a xfunc test to play around with setting different values of this parameter in all tests.  Added testing in memtablelist_test and planning on adding more testing here.

Reviewers: sdong, rven, igor

Reviewed By: igor

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D37443
2015-05-28 16:34:24 -07:00
Adam Retter
197f01b7b8 Bugfix remove deprecated option use which was removed in previous commit 019ecd1932 2015-04-30 23:16:04 +01:00
Adam Retter
aa094e8ea3 Fix conversion from nano-seconds to milli-seconds and seconds 2015-04-30 23:15:33 +01:00
fyrz
019ecd1932 [RocksJava] Remove deprecated methods
Summary:
- Removed deprecated ColumnFamilyDescript constructor methods
- Removed deprecated skipLogErrorOnRecovery methods
- Removed deprecated tableCacheRemoveScanCountLimit methods

Test Plan:
make rocksdbjava
make jtest

Reviewers: yhchiang, adamretter, ankgup87

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D37191
2015-04-16 00:31:43 +02:00
fyrz
5b7131c751 [RocksJava] Removed deprecated skipLogErrorOnRecovery methods.
As annonunced these options are not used anymore so these are
removed from code.
2015-04-15 23:37:24 +02:00
fyrz
566f652716 [RocksJava] Removed deprecated ColumnFamilyDescriptor methods
As announced previously removed methods are obsolete and will
be replaced by its byte array pendants.
2015-04-15 23:31:59 +02:00
fyrz
582c4b0f74 [RocksJava] Fix RateLimiter Tests in 3.10 2015-04-15 23:19:41 +02:00
Yueh-Hsuan Chiang
727684bf97 Fixed a typo in RocksDBSample.java
Summary:
Fixed a typo in RocksDBSample.java

Test Plan:
make clean
make rocksdbjava -j32
make jtest
2015-03-25 11:09:30 -07:00
Yueh-Hsuan Chiang
2d417e52df Update HISTORY.md for 3.10.0
Summary: Update HISTORY.md for 3.10.0

Test Plan: no code chagne.

Reviewers: sdong, rven, igor

Reviewed By: igor

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D35871
2015-03-24 16:39:39 -07:00
fyrz
8f104ae5e0 [RocksJava] Maven build fix 2015-03-24 22:52:30 +01:00
Yueh-Hsuan Chiang
afc51649e2 Merge pull request #546 from fyrz/RocksJava-MemEnv
[RocksJava] Expose MemEnv in RocksJava
2015-03-24 14:01:12 -07:00
Yueh-Hsuan Chiang
6284eef4c0 Merge pull request #545 from fyrz/RocksJava-Level-Compression
[RocksJava] Add compression per level to API
2015-03-24 12:14:09 -07:00
Yueh-Hsuan Chiang
8d8656243e Merge pull request #551 from fyrz/RocksJava-JavaDoc-Fix
[RocksJava] Add missing JavaDoc annotations
2015-03-23 13:25:37 -07:00
fyrz
46443bfa94 [RocksJava] Add missing JavaDoc annotations 2015-03-23 21:17:20 +01:00
fyrz
864b7e88f4 [RocksJava] Java sample bugfix
One of the latest commits broke the sample code. This
resolves the introduced bug.
2015-03-23 21:03:28 +01:00
fyrz
2b2394cbbb [RocksJava] DBBenchmark option for RocksMemEnv
Extended DBBenchmark with option to enable RocksMemEnv.
2015-03-23 18:59:32 +01:00
fyrz
fd8804f979 [RocksJava] Expose MemEnv in RocksJava
Summary:
In 3.10 the C++ code was extended with a MemEnv implementation. This
is now also available in RocksJava.

Changes:
- Extraced abstract super class Env
- Introduced RocksMemEnv
- Remove unnecessary disposeInternal method. The disposal of the default environment is managed by C++ so there needs to be no disposeInternal method in Java.
- Introduced a RocksMemEnvTest, which is aligned with the C++ equivalent.

Test Plan:
make rocksdbjava
make jtest

Reviewers: adamretter, yhchiang, ankgup87

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D35619
2015-03-23 18:59:31 +01:00
fyrz
004b89fba4 [RocksJava] Add compression per level to API
Summary:
RocksDB offers the possibility to set different compression types
on a per level basis. This shall be also available using RocksJava.

Test Plan:
make rocksdbjava
make jtest

Reviewers: adamretter, yhchiang, ankgup87

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D35577
2015-03-23 18:58:56 +01:00
Adam Retter
51da3aab4a Merge pull request #536 from fyrz/RocksJava-32-Bit-adjustment
[RocksJava] 32-Bit adjustments
2015-03-22 23:33:35 +00:00
fyrz
39f4271be0 [RocksJava] Enhanced Logger comment
Added information about performance penalties using a custom
logger implementation.
2015-03-19 22:01:00 +01:00
fyrz
5615e23d8c [RocksJava] 32-Bit adjustments
Summary:
Before this change overflowing size_t values led to a checked Exception.

After that change:

size_t overflows on 32-Bit architecture throw now an IllegalArgumentException,
which removes the necessity for a developer to catch these Exceptions explicitly.

This is especially an advantage for developers targeting 64-Bit systems because
it is not necessary anymore to catch exceptions which are never thrown on a 64-Bit
system.

Test Plan:
make clean jclean rocksdbjava jtest
mvn -f rocksjni.pom package

Reviewers: adamretter, yhchiang, ankgup87

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D34923
2015-03-19 20:45:55 +01:00
Adam Retter
836bcc2f00 Merge pull request #532 from fyrz/RocksJava-LevelCompactionDynamicLevelBytes
[RocksJava] Added LevelCompactionDynamicLevelBytes to Options
2015-03-19 12:51:40 +00:00
Yueh-Hsuan Chiang
f7ed654641 Fix RocksJava test failure due to deprecation of table_cache_remove_scan_count_limit
Summary:
table_cache_remove_scan_count_limit is marked as deprecated in RocksDB C++.
(see rocksdb/options.h).  This patch made necessary changes on RocksJava
side.

Test Plan:
make rocksdbjava -j32
make jtest

Reviewers: rven, igor, fyrz, adamretter, ankgup87, sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D35355
2015-03-18 15:40:27 -07:00
Yueh-Hsuan Chiang
652db51a31 Fix compilation error in rocksjni/write_batch_test.cc
Summary: Fix compilation error in rocksjni/write_batch_test.cc

Test Plan: make rocksdbjava -j32

Reviewers: sdong, igor, rven

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D35343
2015-03-18 15:10:57 -07:00
fyrz
c345d1ee88 [RocksJava] Integrated changes for D34857 2015-03-18 21:38:17 +01:00
fyrz
12350115da [RocksJava] Added LevelCompactionDynamicLevelBytes to Options
Summary: Added LevelCompactionDynamicLevelBytes to Options.

Test Plan:
make clean jclean rocksdbjava jtest
mvn -f rocksjni.pom package

Reviewers: adamretter, ankgup87, yhchiang

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D34857
2015-03-18 21:38:17 +01:00
Igor Canadi
c88ff4ca76 Deprecate removeScanCountLimit in NewLRUCache
Summary: It is no longer used by the implementation, so we should also remove it from the public API.

Test Plan: make check

Reviewers: sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D34971
2015-03-17 15:04:37 -07:00
Adam Retter
eafa1bfc3c Merge pull request #529 from fyrz/RocksJava-Logger
[RockJava] Custom logger addition
2015-03-16 10:38:15 +00:00
fyrz
04778a94c5 [RocksJava] OptimizeFiltersForHits
Summary: Added optimize_filters_for_hits option.

Test Plan:
make clean jclean rocksdbjava jtest
mvn -f rocksjni.pom package

Reviewers: adamretter, yhchiang, ankgup87

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D35013
2015-03-14 21:00:15 +01:00
fyrz
57f2a00c6f RocksJava - JNI Logger callback
Summary:
Within this commit a new AbstractLogger was introduced
which allows to handle log messages at an application level.

Log messages are passed up to Java using a JNI callback.

This allows a Java-Developer to use common Java APIs for log
messages e.g. SLF4J, LOG4J, etc. Within this commit no new
dependencies were introduced, which keeps the RocksDB API clean
and doesn`t force a developer to use a predefined high-level Java API.

Another feature is to dynamically set a custom loggers verbosity at
runtime using its public method `setInfoLogLevel` and to retrieve
the currently active level using the `infoLogLevel` method.

Test Plan:
make clean jclean rocksdbjava jtest
mvn -f rocksjni.pom package

Reviewers: adamretter, ankgup87, yhchiang

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D34755
2015-03-14 20:57:18 +01:00
fyrz
814627af3d [RocksJava] Change log level at runtime in custom logger
This commit introduces the possibility to change the log level
of a used custom logger at runtime.
2015-03-14 20:57:18 +01:00
fyrz
a3bd4142f2 [RocksJava] Logging JNI callback
Within this commit a new AbstractLogger was introduced
which pushes info log messages all the way up to Java.
2015-03-14 20:57:18 +01:00
Adam Retter
756532daf5 Merge pull request #524 from fyrz/RocksJava-Test-Fix
[RocksJava] Fix JTest issues with enabled assertions.

Closes https://github.com/facebook/rocksdb/issues/523
2015-03-13 12:45:04 +00:00
Adam Retter
47a2b3a406 Merge pull request #534 from fyrz/RocksJava-Fix-BrokenJacocoReport
[RocksJava] Fix broken jacoco report
2015-03-13 12:39:36 +00:00
fyrz
2dc636f62b [RocksJava] Fix broken jacoco report
With the last folder layout change a bug was introduced which
prevents Jacoco from working correctly.
2015-03-12 21:28:58 +01:00
fyrz
f210b0f6c5 [RocksJava] Fix NativeLibraryLoader
- Resolve problem while using a temporary data folder
- Fix test
2015-03-12 20:13:09 +01:00
fyrz
0d13bbe272 RocksJava] Fix ColumnFamily tests
Summary:
Cleaned up some tests regarding disposal order and tests
which were failing when C++ assertions were enabled.

Test Plan:
- Enable C++ Assertions (remove e.g. -DNDebug in rocksdbjava target)
- make rocksdbjava jtest

Reviewers: adamretter, ankgup87, yhchiang

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D34569
2015-03-05 21:13:46 +01:00
fyrz
67533809fd [RocksJava] Fixed CompactionTest 2015-03-04 22:45:18 +01:00