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

Abierto
#701 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Comienza ejecutando la reproducción de Python proporcionada contra Hazelcast Python Client con y sin Near Cache, centrándote en get_all(keys) y en la excepción de conversión de diccionario indicada. Traza la ruta de Near Cache utilizada por get_all y compárala con la operación de mapa sin caché. Se considera terminado cuando get_all se completa correctamente para el mapa con Near Cache sin la excepción.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Source: Community

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

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)
Lenguaje dominante
Python
Estrellas
115
Forks
78
Merge medio
2 d 23 h
PR fusionados (30 d)
2

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de hazelcast/hazelcast-python-client

Todos los issues de hazelcast/hazelcast-python-client

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.