|
@@ 501-528 (lines=28) @@
|
| 498 |
|
size_after = info["partitions"][0]["segments"][0]["data_size"] |
| 499 |
|
assert(size_before == size_after) |
| 500 |
|
|
| 501 |
|
@pytest.mark.timeout(COMPACT_TIMEOUT) |
| 502 |
|
@pytest.mark.skip(reason="delete not support yet") |
| 503 |
|
def test_insert_delete_part_and_compact(self, connect, binary_collection): |
| 504 |
|
''' |
| 505 |
|
target: test add entities, delete part of them and compact |
| 506 |
|
method: add entities, delete a few and compact collection |
| 507 |
|
expected: status ok, data size is smaller after compact |
| 508 |
|
''' |
| 509 |
|
ids = connect.insert(binary_collection, binary_entities) |
| 510 |
|
assert len(ids) == nb |
| 511 |
|
connect.flush([binary_collection]) |
| 512 |
|
delete_ids = [ids[0], ids[-1]] |
| 513 |
|
status = connect.delete_entity_by_id(binary_collection, delete_ids) |
| 514 |
|
assert status.OK() |
| 515 |
|
connect.flush([binary_collection]) |
| 516 |
|
# get collection info before compact |
| 517 |
|
info = connect.get_collection_stats(binary_collection) |
| 518 |
|
logging.getLogger().info(info["partitions"]) |
| 519 |
|
size_before = info["partitions"][0]["segments"][0]["data_size"] |
| 520 |
|
logging.getLogger().info(size_before) |
| 521 |
|
status = connect.compact(binary_collection) |
| 522 |
|
assert status.OK() |
| 523 |
|
# get collection info after compact |
| 524 |
|
info = connect.get_collection_stats(binary_collection) |
| 525 |
|
logging.getLogger().info(info["partitions"]) |
| 526 |
|
size_after = info["partitions"][0]["segments"][0]["data_size"] |
| 527 |
|
logging.getLogger().info(size_after) |
| 528 |
|
assert(size_before >= size_after) |
| 529 |
|
|
| 530 |
|
@pytest.mark.timeout(COMPACT_TIMEOUT) |
| 531 |
|
@pytest.mark.skip(reason="delete not support yet") |
|
@@ 133-160 (lines=28) @@
|
| 130 |
|
size_after = info["partitions"][0]["segments"][0]["data_size"] |
| 131 |
|
assert(size_before == size_after) |
| 132 |
|
|
| 133 |
|
@pytest.mark.timeout(COMPACT_TIMEOUT) |
| 134 |
|
@pytest.mark.skip(reason="delete not support yet") |
| 135 |
|
def test_insert_delete_part_and_compact(self, connect, collection): |
| 136 |
|
''' |
| 137 |
|
target: test add entities, delete part of them and compact |
| 138 |
|
method: add entities, delete a few and compact collection |
| 139 |
|
expected: status ok, data size maybe is smaller after compact |
| 140 |
|
''' |
| 141 |
|
ids = connect.insert(collection, entities) |
| 142 |
|
assert len(ids) == nb |
| 143 |
|
connect.flush([collection]) |
| 144 |
|
delete_ids = [ids[0], ids[-1]] |
| 145 |
|
status = connect.delete_entity_by_id(collection, delete_ids) |
| 146 |
|
assert status.OK() |
| 147 |
|
connect.flush([collection]) |
| 148 |
|
# get collection info before compact |
| 149 |
|
info = connect.get_collection_stats(collection) |
| 150 |
|
logging.getLogger().info(info["partitions"]) |
| 151 |
|
size_before = info["partitions"][0]["segments"][0]["data_size"] |
| 152 |
|
logging.getLogger().info(size_before) |
| 153 |
|
status = connect.compact(collection) |
| 154 |
|
assert status.OK() |
| 155 |
|
# get collection info after compact |
| 156 |
|
info = connect.get_collection_stats(collection) |
| 157 |
|
logging.getLogger().info(info["partitions"]) |
| 158 |
|
size_after = info["partitions"][0]["segments"][0]["data_size"] |
| 159 |
|
logging.getLogger().info(size_after) |
| 160 |
|
assert(size_before >= size_after) |
| 161 |
|
|
| 162 |
|
@pytest.mark.timeout(COMPACT_TIMEOUT) |
| 163 |
|
@pytest.mark.skip(reason="delete not support yet") |