mirror of https://gitee.com/bigwinds/arangodb
parent
e823f86601
commit
5c25b6934e
|
@ -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)
|
||||
|
|
|
@ -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<TRI_voc_size_t>();
|
||||
if (toUpdate < TRI_JOURNAL_MINIMAL_SIZE) {
|
||||
return {TRI_ERROR_BAD_PARAMETER, "<properties>.journalSize too small"};
|
||||
|
|
Loading…
Reference in New Issue