diff --git a/UnitTests/HttpInterface/api-collection-mmfiles-spec.rb b/UnitTests/HttpInterface/api-collection-mmfiles-spec.rb index 98616b533f..2adb3368ee 100644 --- a/UnitTests/HttpInterface/api-collection-mmfiles-spec.rb +++ b/UnitTests/HttpInterface/api-collection-mmfiles-spec.rb @@ -786,6 +786,51 @@ describe ArangoDB do ################################################################################ context "properties:" do + it "changing the journalSize to null" do + cn = "UnitTestsCollectionBasics" + ArangoDB.drop_collection(cn) + cid = ArangoDB.create_collection(cn) + + cmd = api + "/" + cn + "/properties" + body = "{ \"journalSize\" : 1048576 }" + doc = ArangoDB.log_put("#{prefix}-properties-journalSize", cmd, :body => body) + doc.code.should eq(200) + + doc = ArangoDB.log_get("#{prefix}-properties-journalSize", cmd) + doc.code.should eq(200) + doc.parsed_response['error'].should eq(false) + doc.parsed_response['journalSize'].should eq(1048576) + + body = "{ \"journalSize\" : 8388608 }" + doc = ArangoDB.log_put("#{prefix}-properties-journalSize", cmd, :body => body) + doc.code.should eq(200) + + doc = ArangoDB.log_get("#{prefix}-properties-journalSize", cmd) + doc.code.should eq(200) + doc.parsed_response['error'].should eq(false) + doc.parsed_response['journalSize'].should eq(8388608) + + body = "{ \"journalSize\" : null }" + doc = ArangoDB.log_put("#{prefix}-properties-journalSize", cmd, :body => body) + doc.code.should eq(200) + + doc = ArangoDB.log_get("#{prefix}-properties-journalSize", cmd) + doc.code.should eq(200) + doc.parsed_response['error'].should eq(false) + doc.parsed_response['journalSize'].should eq(8388608) + + body = "{ }" + doc = ArangoDB.log_put("#{prefix}-properties-journalSize", cmd, :body => body) + doc.code.should eq(200) + + doc = ArangoDB.log_get("#{prefix}-properties-journalSize", cmd) + doc.code.should eq(200) + doc.parsed_response['error'].should eq(false) + doc.parsed_response['journalSize'].should eq(8388608) + + ArangoDB.drop_collection(cn) + end + it "changing the properties of a collection by identifier" do cn = "UnitTestsCollectionBasics" ArangoDB.drop_collection(cn) diff --git a/arangod/MMFiles/MMFilesCollection.cpp b/arangod/MMFiles/MMFilesCollection.cpp index 8ed084e37a..3767f9b4de 100644 --- a/arangod/MMFiles/MMFilesCollection.cpp +++ b/arangod/MMFiles/MMFilesCollection.cpp @@ -144,11 +144,11 @@ arangodb::Result MMFilesCollection::updateProperties(VPackSlice const& slice, auto journalSlice = slice.get("journalSize"); if (journalSlice.isNone()) { - // In some apis maximalSize is allowed instead + // In some APIs maximalSize is allowed instead journalSlice = slice.get("maximalSize"); } - if (!journalSlice.isNone()) { + if (!journalSlice.isNone() && journalSlice.isNumber()) { TRI_voc_size_t toUpdate = journalSlice.getNumericValue(); if (toUpdate < TRI_JOURNAL_MINIMAL_SIZE) { return {TRI_ERROR_BAD_PARAMETER, ".journalSize too small"};