File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed
main/java/com/arangodb/model Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 11v4.3.3 (2018-xx-xx)
22---------------------------
3+ * added CollectionCreateOptions.distributeShardsLike(String) (Issue #170)
34* fixed inconsistency of getDocument() variants (Issue #168)
45* added AqlQueryOptions.memoryLimit(Long)
56* added AqlQueryOptions.failOnWarning(Boolean)
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ public class CollectionCreateOptions {
4444 private Boolean isSystem ;
4545 private CollectionType type ;
4646 private Integer indexBuckets ;
47+ private String distributeShardsLike ;
4748
4849 public CollectionCreateOptions () {
4950 super ();
@@ -257,4 +258,22 @@ public CollectionCreateOptions indexBuckets(final Integer indexBuckets) {
257258 return this ;
258259 }
259260
261+ public String getDistributeShardsLike () {
262+ return distributeShardsLike ;
263+ }
264+
265+ /**
266+ * @param distributeShardsLike
267+ * (The default is ""): in an enterprise cluster, this attribute binds the specifics of sharding for the
268+ * newly created collection to follow that of a specified existing collection. Note: Using this parameter
269+ * has consequences for the prototype collection. It can no longer be dropped, before sharding imitating
270+ * collections are dropped. Equally, backups and restores of imitating collections alone will generate
271+ * warnings, which can be overridden, about missing sharding prototype.
272+ * @return options
273+ */
274+ public CollectionCreateOptions distributeShardsLike (final String distributeShardsLike ) {
275+ this .distributeShardsLike = distributeShardsLike ;
276+ return this ;
277+ }
278+
260279}
Original file line number Diff line number Diff line change 5252import com .arangodb .entity .AqlParseEntity ;
5353import com .arangodb .entity .AqlParseEntity .AstNode ;
5454import com .arangodb .entity .ArangoDBVersion ;
55+ import com .arangodb .entity .ArangoDBVersion .License ;
5556import com .arangodb .entity .BaseDocument ;
5657import com .arangodb .entity .BaseEdgeDocument ;
5758import com .arangodb .entity .CollectionEntity ;
@@ -197,6 +198,18 @@ public void createCollectionWithNumberOfShardsAndShardKeys() {
197198 }
198199 }
199200
201+ @ Test
202+ public void createCollectionWithDistributeShardsLike () {
203+ if (arangoDB .getVersion ().getLicense () == License .ENTERPRISE && arangoDB .getRole () != ServerRole .SINGLE ) {
204+ final Integer numberOfShards = 3 ;
205+ db .createCollection (COLLECTION_NAME , new CollectionCreateOptions ().numberOfShards (numberOfShards ));
206+ db .createCollection (COLLECTION_NAME + "2" ,
207+ new CollectionCreateOptions ().distributeShardsLike (COLLECTION_NAME ));
208+ assertThat (db .collection (COLLECTION_NAME ).getProperties ().getNumberOfShards (), is (numberOfShards ));
209+ assertThat (db .collection (COLLECTION_NAME + "2" ).getProperties ().getNumberOfShards (), is (numberOfShards ));
210+ }
211+ }
212+
200213 @ Test
201214 public void deleteCollection () {
202215 db .createCollection (COLLECTION_NAME , null );
You can’t perform that action at this time.
0 commit comments