|
@@ 582-611 (lines=30) @@
|
| 579 |
|
size_after_twice = info["partitions"][0]["segments"][0]["data_size"] |
| 580 |
|
assert(size_after == size_after_twice) |
| 581 |
|
|
| 582 |
|
@pytest.mark.timeout(COMPACT_TIMEOUT) |
| 583 |
|
@pytest.mark.skip(reason="delete not support yet") |
| 584 |
|
def test_insert_delete_part_and_compact_twice(self, connect, binary_collection): |
| 585 |
|
''' |
| 586 |
|
target: test add entities, delete part of them and compact twice |
| 587 |
|
method: add entities, delete part and compact collection twice |
| 588 |
|
expected: status ok, data size smaller after first compact, no change after second |
| 589 |
|
''' |
| 590 |
|
ids = connect.insert(binary_collection, binary_entities) |
| 591 |
|
assert len(ids) == nb |
| 592 |
|
connect.flush([binary_collection]) |
| 593 |
|
delete_ids = [ids[0], ids[-1]] |
| 594 |
|
status = connect.delete_entity_by_id(binary_collection, delete_ids) |
| 595 |
|
assert status.OK() |
| 596 |
|
connect.flush([binary_collection]) |
| 597 |
|
# get collection info before compact |
| 598 |
|
info = connect.get_collection_stats(binary_collection) |
| 599 |
|
size_before = info["partitions"][0]["segments"][0]["data_size"] |
| 600 |
|
status = connect.compact(binary_collection) |
| 601 |
|
assert status.OK() |
| 602 |
|
# get collection info after compact |
| 603 |
|
info = connect.get_collection_stats(binary_collection) |
| 604 |
|
size_after = info["partitions"][0]["segments"][0]["data_size"] |
| 605 |
|
assert(size_before >= size_after) |
| 606 |
|
status = connect.compact(binary_collection) |
| 607 |
|
assert status.OK() |
| 608 |
|
# get collection info after compact twice |
| 609 |
|
info = connect.get_collection_stats(binary_collection) |
| 610 |
|
size_after_twice = info["partitions"][0]["segments"][0]["data_size"] |
| 611 |
|
assert(size_after == size_after_twice) |
| 612 |
|
|
| 613 |
|
@pytest.mark.timeout(COMPACT_TIMEOUT) |
| 614 |
|
@pytest.mark.skip(reason="delete not support yet") |
|
@@ 283-311 (lines=29) @@
|
| 280 |
|
size_after_twice = info["partitions"][0]["segments"][0]["data_size"] |
| 281 |
|
assert(size_after == size_after_twice) |
| 282 |
|
|
| 283 |
|
@pytest.mark.timeout(COMPACT_TIMEOUT) |
| 284 |
|
@pytest.mark.skip(reason="delete not support yet") |
| 285 |
|
def test_insert_delete_part_and_compact_twice(self, connect, collection): |
| 286 |
|
''' |
| 287 |
|
target: test add entities, delete part of them and compact twice |
| 288 |
|
method: add entities, delete part and compact collection twice |
| 289 |
|
expected: status ok, data size smaller after first compact, no change after second |
| 290 |
|
''' |
| 291 |
|
ids = connect.insert(collection, entities) |
| 292 |
|
connect.flush([collection]) |
| 293 |
|
delete_ids = [ids[0], ids[-1]] |
| 294 |
|
status = connect.delete_entity_by_id(collection, delete_ids) |
| 295 |
|
assert status.OK() |
| 296 |
|
connect.flush([collection]) |
| 297 |
|
# get collection info before compact |
| 298 |
|
info = connect.get_collection_stats(collection) |
| 299 |
|
size_before = info["partitions"][0]["segments"][0]["data_size"] |
| 300 |
|
status = connect.compact(collection) |
| 301 |
|
assert status.OK() |
| 302 |
|
# get collection info after compact |
| 303 |
|
info = connect.get_collection_stats(collection) |
| 304 |
|
size_after = info["partitions"][0]["segments"][0]["data_size"] |
| 305 |
|
assert(size_before >= size_after) |
| 306 |
|
status = connect.compact(collection) |
| 307 |
|
assert status.OK() |
| 308 |
|
# get collection info after compact twice |
| 309 |
|
info = connect.get_collection_stats(collection) |
| 310 |
|
size_after_twice = info["partitions"][0]["segments"][0]["data_size"] |
| 311 |
|
assert(size_after == size_after_twice) |
| 312 |
|
|
| 313 |
|
# TODO |
| 314 |
|
@pytest.mark.level(2) |