1
0
Fork 0

Don't wait eternaly; don't unload collections with rocksdb (#9415)

This commit is contained in:
Wilfried Goesgens 2019-07-05 17:13:25 +02:00 committed by Jan
parent e605c9cd2e
commit 3599aedda1
6 changed files with 548 additions and 432 deletions

View File

@ -863,6 +863,8 @@ function runInRSpec (options, instanceInfo, file, addArgs) {
' c.ARANGO_PASSWORD = "' + options.password + '"\n' + ' c.ARANGO_PASSWORD = "' + options.password + '"\n' +
' c.add_setting :SKIP_TIMECRITICAL\n' + ' c.add_setting :SKIP_TIMECRITICAL\n' +
' c.SKIP_TIMECRITICAL = ' + JSON.stringify(options.skipTimeCritical) + '\n' + ' c.SKIP_TIMECRITICAL = ' + JSON.stringify(options.skipTimeCritical) + '\n' +
' c.add_setting :STORAGE_ENGINE\n' +
' c.STORAGE_ENGINE = ' + JSON.stringify(options.storageEngine) + '\n' +
'end\n'; 'end\n';
fs.write(tmpname, rspecConfig); fs.write(tmpname, rspecConfig);

View File

@ -194,20 +194,25 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
end
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)

View File

@ -6,9 +6,9 @@ require 'arangodb.rb'
describe ArangoDB do describe ArangoDB do
prefix = "api-index-hash" prefix = "api-index-hash"
################################################################################ ################################################################################
## unique constraints during create ## unique constraints during create
################################################################################ ################################################################################
context "creating hash index:" do context "creating hash index:" do
context "dealing with unique constraints violation:" do context "dealing with unique constraints violation:" do
@ -126,9 +126,9 @@ describe ArangoDB do
end end
end end
################################################################################ ################################################################################
## unique constraints during create ## unique constraints during create
################################################################################ ################################################################################
context "creating documents:" do context "creating documents:" do
context "dealing with unique constraints:" do context "dealing with unique constraints:" do
@ -279,34 +279,39 @@ describe ArangoDB do
doc.parsed_response['_id'].should eq(id1) doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd3 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd3) cmd3 = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.log_put("#{prefix}", cmd3)
doc.code.should eq(200)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd3)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd3)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
it "rolls back in case of violation, sparse index" do it "rolls back in case of violation, sparse index" do
@ -371,42 +376,47 @@ describe ArangoDB do
doc.parsed_response['_id'].should eq(id1) doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd3 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd3) cmd3 = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.log_put("#{prefix}", cmd3)
doc.code.should eq(200)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd3)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd3)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
end end
end end
################################################################################ ################################################################################
## unique constraints during update ## unique constraints during update
################################################################################ ################################################################################
context "updating documents:" do context "updating documents:" do
context "dealing with unique constraints:" do context "dealing with unique constraints:" do
@ -508,35 +518,40 @@ describe ArangoDB do
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2) doc.parsed_response['_rev'].should_not eq(rev2)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd4 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd4) cmd4 = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.log_put("#{prefix}", cmd4)
doc.code.should eq(200)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd4)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd4)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
it "rolls back in case of violation, sparse index" do it "rolls back in case of violation, sparse index" do
@ -627,35 +642,40 @@ describe ArangoDB do
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2) doc.parsed_response['_rev'].should_not eq(rev2)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd4 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd4) cmd4 = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.log_put("#{prefix}", cmd4)
doc.code.should eq(200)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd4)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd4)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
end end

View File

@ -200,33 +200,38 @@ describe ArangoDB do
doc.parsed_response['_id'].should eq(id1) doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd3 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd3) cmd3 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd3)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd3)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd3)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
it "rolls back in case of violation, sparse index" do it "rolls back in case of violation, sparse index" do
@ -291,33 +296,38 @@ describe ArangoDB do
doc.parsed_response['_id'].should eq(id1) doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd3 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd3) cmd3 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd3)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd3)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd3)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
end end
end end
@ -426,34 +436,39 @@ describe ArangoDB do
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2) doc.parsed_response['_rev'].should_not eq(rev2)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd4 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd4) cmd4 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd4)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd4)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd4)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
it "rolls back in case of violation, sparse index" do it "rolls back in case of violation, sparse index" do
@ -544,34 +559,39 @@ describe ArangoDB do
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2) doc.parsed_response['_rev'].should_not eq(rev2)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd4 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd4) cmd4 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd4)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd4)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd4)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
end end

View File

@ -200,33 +200,38 @@ describe ArangoDB do
doc.parsed_response['_id'].should eq(id1) doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd3 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd3) cmd3 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd3)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd3)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd3)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
it "rolls back in case of violation, sparse index" do it "rolls back in case of violation, sparse index" do
@ -291,33 +296,38 @@ describe ArangoDB do
doc.parsed_response['_id'].should eq(id1) doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd3 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd3) cmd3 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd3)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd3)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd3 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd3)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd3)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
# check it again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
end end
end end
end end
@ -426,34 +436,39 @@ describe ArangoDB do
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2) doc.parsed_response['_rev'].should_not eq(rev2)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd4 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd4) cmd4 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd4)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd4)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd4)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
it "rolls back in case of violation, sparse index" do it "rolls back in case of violation, sparse index" do
@ -544,34 +559,39 @@ describe ArangoDB do
doc.parsed_response['_rev'].should eq(rev1) doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2) doc.parsed_response['_rev'].should_not eq(rev2)
# unload collection if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
cmd4 = "/_api/collection/#{@cn}/unload" # unload collection
doc = ArangoDB.log_put("#{prefix}", cmd4) cmd4 = "/_api/collection/#{@cn}/unload"
doc.code.should eq(200) doc = ArangoDB.log_put("#{prefix}", cmd4)
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd4)
doc.code.should eq(200) doc.code.should eq(200)
sleep 1
# flush wal
doc = ArangoDB.put("/_admin/wal/flush");
doc.code.should eq(200)
cmd4 = "/_api/collection/#{@cn}"
doc = ArangoDB.log_get("#{prefix}", cmd4)
doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd4)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
# check the first document again
doc = ArangoDB.log_get("#{prefix}", cmd2)
doc.code.should eq(200)
doc.parsed_response['a'].should eq(1)
doc.parsed_response['b'].should eq(1)
doc.parsed_response['_id'].should eq(id1)
doc.parsed_response['_rev'].should eq(rev1)
doc.parsed_response['_rev'].should_not eq(rev2)
end end
end end

View File

@ -160,33 +160,39 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
cmd = api + "/#{iid}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
doc.headers['content-type'].should eq("application/json; charset=utf-8")
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['id'].should match(@reFull)
doc.parsed_response['id'].should eq(iid)
doc.parsed_response['type'].should eq("hash")
doc.parsed_response['unique'].should eq(true)
doc.parsed_response['sparse'].should eq(false)
doc.parsed_response['fields'].should eq([ "a", "b" ])
end end
cmd = api + "/#{iid}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
doc.headers['content-type'].should eq("application/json; charset=utf-8")
doc.parsed_response['error'].should eq(false)
doc.parsed_response['code'].should eq(200)
doc.parsed_response['id'].should match(@reFull)
doc.parsed_response['id'].should eq(iid)
doc.parsed_response['type'].should eq("hash")
doc.parsed_response['unique'].should eq(true)
doc.parsed_response['sparse'].should eq(false)
doc.parsed_response['fields'].should eq([ "a", "b" ])
end end
it "survives unload, sparse index" do it "survives unload, sparse index" do
@ -202,18 +208,25 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
@ -376,18 +389,24 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
@ -418,18 +437,24 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
@ -592,18 +617,24 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
@ -634,18 +665,24 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
@ -774,18 +811,24 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"
@ -816,18 +859,24 @@ describe ArangoDB do
iid = doc.parsed_response['id'] iid = doc.parsed_response['id']
cmd = "/_api/collection/#{@cn}/unload" if RSpec.configuration.STORAGE_ENGINE == "mmfiles"
doc = ArangoDB.put(cmd) cmd = "/_api/collection/#{@cn}/unload"
doc = ArangoDB.put(cmd)
doc.code.should eq(200) doc.code.should eq(200)
cmd = "/_api/collection/#{@cn}" cmd = "/_api/collection/#{@cn}"
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
while doc.parsed_response['status'] != 2
doc = ArangoDB.get(cmd) doc = ArangoDB.get(cmd)
doc.code.should eq(200) doc.code.should eq(200)
i = 0
while (doc.parsed_response['status'] != 2) && (i < 100)
doc = ArangoDB.get(cmd)
doc.code.should eq(200)
i += 1
sleep 1
end
expect(i).to be < 100 # Timeout...
end end
cmd = api + "/#{iid}" cmd = api + "/#{iid}"