hey @Dylan_W, thanks for helping me out!
I am using python 3.8
simply wrapping the bytes with bytearray
works for me here, but it looks like a different issue is preventing the appends to run in queries, which is what I actually want; here’s a repro
namespace config:
namespace dram_general {
storage-engine memory
memory-size 2G
replication-factor 2
nsup-period 60
}
code:
import time
import aerospike
from aerospike import exception, predicates
from aerospike_helpers.operations import operations
ac = aerospike.client({'hosts': [('localhost', 3000)]})
ac.connect()
key = ('dram_general', None, 0)
try:
ac.index_string_create('dram_general', None, 'c', 'c_index')
except exception.IndexFoundError:
pass
ac.put(key, bins={'bytes': b'', 'c': 'c0'})
b = bytearray(b'\n\x04\x12\x02\x10\x01')
ac.append(key, bin='bytes', val=b)
print(ac.get(key))
ac.append(key, bin='bytes', val=b)
print(ac.get(key)) # works fine
def append_query():
query = ac.query('dram_general', None)
query.where(predicates.equals('c', 'c0'))
query.add_ops([operations.append('bytes', b)])
job_id = query.execute_background()
# print(ac.job_info(job_id, aerospike.JOB_QUERY))
time.sleep(1)
print(ac.job_info(job_id, aerospike.JOB_QUERY))
print(ac.get(key))
for _ in range(4):
append_query()
output:
(('dram_general', None, None, bytearray(b'\xb3F\x13{\xa9\x18\x95y\xdaR\x01b\xdf\xdc\xd6\x1a\x10\xfe7\xd6')), {'ttl': 4294967295, 'gen': 2}, {'bytes': bytearray(b'\n\x04\x12\x02\x10\x01'), 'c': 'c0'})
(('dram_general', None, None, bytearray(b'\xb3F\x13{\xa9\x18\x95y\xdaR\x01b\xdf\xdc\xd6\x1a\x10\xfe7\xd6')), {'ttl': 4294967295, 'gen': 3}, {'bytes': bytearray(b'\n\x04\x12\x02\x10\x01\n\x04\x12\x02\x10\x01'), 'c': 'c0'})
{'progress_pct': 0, 'records_read': 0, 'status': 2}
(('dram_general', None, None, bytearray(b'\xb3F\x13{\xa9\x18\x95y\xdaR\x01b\xdf\xdc\xd6\x1a\x10\xfe7\xd6')), {'ttl': 4294967295, 'gen': 4}, {'bytes': bytearray(b'\n\x04\x12\x02\x10\x01\n\x04\x12\x02\x10\x01\xff\xd8\xccO\t\xd9'), 'c': 'c0'})
{'progress_pct': 0, 'records_read': 0, 'status': 2}
(('dram_general', None, None, bytearray(b'\xb3F\x13{\xa9\x18\x95y\xdaR\x01b\xdf\xdc\xd6\x1a\x10\xfe7\xd6')), {'ttl': 4294967295, 'gen': 4}, {'bytes': bytearray(b'\n\x04\x12\x02\x10\x01\n\x04\x12\x02\x10\x01\xff\xd8\xccO\t\xd9'), 'c': 'c0'})
free(): double free detected in tcache 2
Aborted (core dumped)
it looks like despite the second query job status return 2 (success), the generation of the record is unchanged and the bytes were not appended, and then the client crashes out of python; is this a related issue? Thanks again!
edit: also just noticed that the bytes appended by the first query have been transformed somehow?