diff --git a/CMakeLists.txt b/CMakeLists.txt index e07a9c9ac3e..57917e26f9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,7 +180,7 @@ endif() add_subdirectory(fdbbackup) add_subdirectory(contrib) add_subdirectory(tests) -add_subdirectory(flowbench EXCLUDE_FROM_ALL) +#add_subdirectory(flowbench EXCLUDE_FROM_ALL) if(WITH_PYTHON AND WITH_C_BINDING) add_subdirectory(bindings) endif() diff --git a/bindings/java/CMakeLists.txt b/bindings/java/CMakeLists.txt index 40727063f6f..37b3aea89da 100644 --- a/bindings/java/CMakeLists.txt +++ b/bindings/java/CMakeLists.txt @@ -41,6 +41,7 @@ set(JAVA_BINDING_SRCS src/main/com/apple/foundationdb/JNIUtil.java src/main/com/apple/foundationdb/KeySelector.java src/main/com/apple/foundationdb/KeyValue.java + src/main/com/apple/foundationdb/KeyValueAndMappedReqAndResult.java src/main/com/apple/foundationdb/LocalityUtil.java src/main/com/apple/foundationdb/NativeFuture.java src/main/com/apple/foundationdb/NativeObjectWrapper.java diff --git a/bindings/java/src/integration/com/apple/foundationdb/RangeAndFlatMapQueryIntegrationTest.java b/bindings/java/src/integration/com/apple/foundationdb/RangeAndFlatMapQueryIntegrationTest.java index c97ce1f7508..1e490b85118 100644 --- a/bindings/java/src/integration/com/apple/foundationdb/RangeAndFlatMapQueryIntegrationTest.java +++ b/bindings/java/src/integration/com/apple/foundationdb/RangeAndFlatMapQueryIntegrationTest.java @@ -179,7 +179,7 @@ public interface RangeQueryWithIndex { RangeQueryWithIndex rangeQueryAndFlatMap = (int begin, int end, Database db) -> db.run(tr -> { try { tr.options().setReadYourWritesDisable(); - List kvs = + List kvs = tr.snapshot() .getRangeAndFlatMap(KeySelector.firstGreaterOrEqual(indexEntryKey(begin)), KeySelector.firstGreaterOrEqual(indexEntryKey(end)), MAPPER, @@ -221,7 +221,7 @@ void rangeAndFlatMapQueryOverMultipleRows() throws Exception { tr.options().setReadYourWritesDisable(); // getRangeAndFlatMap is only supported with snapshot. - Iterator kvs = + Iterator kvs = tr.snapshot() .getRangeAndFlatMap(KeySelector.firstGreaterOrEqual(indexEntryKey(0)), KeySelector.firstGreaterThan(indexEntryKey(1)), MAPPER, diff --git a/bindings/java/src/main/com/apple/foundationdb/FDBTransaction.java b/bindings/java/src/main/com/apple/foundationdb/FDBTransaction.java index 8a30280a4d7..226c62076e3 100644 --- a/bindings/java/src/main/com/apple/foundationdb/FDBTransaction.java +++ b/bindings/java/src/main/com/apple/foundationdb/FDBTransaction.java @@ -92,8 +92,9 @@ public CompletableFuture getRangeSplitPoints(Range range, long c } @Override - public AsyncIterable getRangeAndFlatMap(KeySelector begin, KeySelector end, byte[] mapper, int limit, - boolean reverse, StreamingMode mode) { + public AsyncIterable getRangeAndFlatMap(KeySelector begin, KeySelector end, + byte[] mapper, int limit, + boolean reverse, StreamingMode mode) { if (mapper == null) { throw new IllegalArgumentException("Mapper must be non-null"); } @@ -348,8 +349,9 @@ public CompletableFuture getRangeSplitPoints(Range range, long c } @Override - public AsyncIterable getRangeAndFlatMap(KeySelector begin, KeySelector end, byte[] mapper, int limit, - boolean reverse, StreamingMode mode) { + public AsyncIterable getRangeAndFlatMap(KeySelector begin, KeySelector end, + byte[] mapper, int limit, boolean reverse, + StreamingMode mode) { throw new UnsupportedOperationException("getRangeAndFlatMap is only supported in snapshot"); } diff --git a/bindings/java/src/main/com/apple/foundationdb/KeyValueAndMappedReqAndResult.java b/bindings/java/src/main/com/apple/foundationdb/KeyValueAndMappedReqAndResult.java new file mode 100644 index 00000000000..78c3f1d1112 --- /dev/null +++ b/bindings/java/src/main/com/apple/foundationdb/KeyValueAndMappedReqAndResult.java @@ -0,0 +1,96 @@ +/* + * KeyValue.java + * + * This source file is part of the FoundationDB open source project + * + * Copyright 2013-2018 Apple Inc. and the FoundationDB project authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.apple.foundationdb; + +import java.util.Objects; + +public class KeyValueAndMappedReqAndResult extends KeyValue { + interface MappedReqAndResult {} + + static class GetValueReqAndResult implements MappedReqAndResult { + // Value is nullable, which meaning the key does not exist. + private KeyValue keyValue; // Nonnull + + public GetValueReqAndResult(KeyValue keyValue) { this.keyValue = keyValue; } + + public KeyValue getKeyValue() { return keyValue; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + GetValueReqAndResult that = (GetValueReqAndResult)o; + return keyValue.equals(that.keyValue); + } + + @Override + public int hashCode() { + return Objects.hash(keyValue); + } + } + + static class GetRangeReqAndResult implements MappedReqAndResult { + private RangeResult result; // Nonnull + + public GetRangeReqAndResult(RangeResult result) { this.result = result; } + + public RangeResult getResult() { return result; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + GetRangeReqAndResult that = (GetRangeReqAndResult)o; + return result.equals(that.result); + } + + @Override + public int hashCode() { + return Objects.hash(result); + } + } + + MappedReqAndResult mappedReqAndResult; // Nonnull + + public KeyValueAndMappedReqAndResult(byte[] key, // Nonnull + byte[] value, // Nullable + MappedReqAndResult mappedReqAndResult // Nonnull + ) { + super(key, value); + this.mappedReqAndResult = mappedReqAndResult; + } + + public MappedReqAndResult getMappedReqAndResult() { return mappedReqAndResult; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + KeyValueAndMappedReqAndResult that = (KeyValueAndMappedReqAndResult)o; + return mappedReqAndResult.equals(that.mappedReqAndResult); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), mappedReqAndResult); + } +} \ No newline at end of file diff --git a/bindings/java/src/main/com/apple/foundationdb/ReadTransaction.java b/bindings/java/src/main/com/apple/foundationdb/ReadTransaction.java index b2b81553ef5..545cda4f0b8 100644 --- a/bindings/java/src/main/com/apple/foundationdb/ReadTransaction.java +++ b/bindings/java/src/main/com/apple/foundationdb/ReadTransaction.java @@ -457,8 +457,8 @@ AsyncIterable getRange(Range range, *

* @return a handle to access the results of the asynchronous call */ - AsyncIterable getRangeAndFlatMap(KeySelector begin, KeySelector end, byte[] mapper, int limit, - boolean reverse, StreamingMode mode); + AsyncIterable getRangeAndFlatMap(KeySelector begin, KeySelector end, byte[] mapper, + int limit, boolean reverse, StreamingMode mode); /** * Gets an estimate for the number of bytes stored in the given range. diff --git a/cmake/CompileBoost.cmake b/cmake/CompileBoost.cmake index 52788e68ce5..2712228d817 100644 --- a/cmake/CompileBoost.cmake +++ b/cmake/CompileBoost.cmake @@ -113,7 +113,7 @@ if(WIN32) return() endif() -find_package(Boost 1.78.0 EXACT QUIET COMPONENTS context CONFIG PATHS ${BOOST_HINT_PATHS}) +find_package(Boost 1.76.0 EXACT QUIET COMPONENTS context CONFIG PATHS ${BOOST_HINT_PATHS}) set(FORCE_BOOST_BUILD OFF CACHE BOOL "Forces cmake to build boost and ignores any installed boost") if(Boost_FOUND AND NOT FORCE_BOOST_BUILD) diff --git a/cmake/FDBComponents.cmake b/cmake/FDBComponents.cmake index a31d3866886..4b7dd71805f 100644 --- a/cmake/FDBComponents.cmake +++ b/cmake/FDBComponents.cmake @@ -94,7 +94,7 @@ else() find_package(Java 1.8 COMPONENTS Development) # leave FreeBSD JVM compat for later if(JNI_FOUND AND Java_FOUND AND Java_Development_FOUND AND NOT (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") AND WITH_C_BINDING) - set(WITH_JAVA_BINDING ON) +# set(WITH_JAVA_BINDING ON) include(UseJava) enable_language(Java) else()