hazelcast / hazelcast/hazelcast-python-client

Map with Near Cache causes get_all operations to fail with exception.

Open
#701 0 comments 0 reactions 0 assignees View on GitHub
Source: Community
Dominant language
Python
Stars
116
Forks
78
Avg merge
10d 22h
Merged PRs (30d)
1

Description

This code will replicate the issue.
Running the Hazelcast Python Client 5.5.0 driver, with a 3 node cluster running community 5.5.
Downgrading did not fix the issue.
Exception was `cannot convert dictionary update sequence element #0 to a sequence`
```python
import time
import uuid

import hazelcast
from hazelcast.config import NearCacheConfig, InMemoryFormat

test_size = 10000

test_target_near_cache_config = NearCacheConfig()
test_target_near_cache_config.in_memory_format = InMemoryFormat.BINARY
test_target_near_cache_config.time_to_live = 30
test_target_near_cache_config.max_idle = 15
test_target_near_cache_config.eviction_max_size = test_size * 2

client = hazelcast.HazelcastClient(
cluster_name="hazelcast",
cluster_members=[...
],
near_caches={
"test-target-nc": test_target_near_cache_config
}
)

nc_map = client.get_map('test-target-nc')
uc_map = client.get_map('test-target-uc')

def readSingle(map, keys):
try:
startms = round(time.time() * 1000)
futures = []
for key in keys:
futures.append(map.get(key))
for future in futures:
future.result()
endms = round(time.time()* 1000)
print(f"total time: {endms - startms:0.2f}ms")
print(f"op time: {(endms - startms)/(len(keys)):0.2f}ms")
except Exception as e:
print("operation failed", e)

def readMulti(map, keys):
try:
startms = round(time.time() * 1000)
map.get_all(keys).result()
endms = round(time.time()* 1000)
print(f"total time: {endms - startms:0.2f}ms")
print(f"op time: {(endms - startms)/(len(keys)):0.2f}ms")
except Exception as e:
print("operation failed", e)

content = {}
for index in range(0, test_size):
id = uuid.uuid4()
value = uuid.uuid4()
content[id] = value

keys = list(content.keys())

nc_map.put_all(content)
uc_map.put_all(content)

print("Warm Near Cache")
futures = []
for key in keys:
futures.append(nc_map.get(key))
for future in futures:
future.result()

print('Read Single, No Cache')
readSingle(uc_map, keys)
print('Read Single, With Cache')
readSingle(nc_map, keys)
print('Read Multi, No Cache')
readMulti(uc_map, keys)
print('Read Multi, With Cache')
readMulti(nc_map, keys)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.