Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue to get data using php8 client which stored from php7 client #48

Open
piyush-bansal1989 opened this issue Dec 20, 2024 · 13 comments
Open

Comments

@piyush-bansal1989
Copy link

piyush-bansal1989 commented Dec 20, 2024

@vmsachin / @khaf : I'm encountering an issue when retrieving data stored by a PHP 7 client using a PHP 8 client. The vice versa operation (retrieving data stored by PHP 8 using PHP 7) works correctly. The data format for storage is consistent.

Could you please assist me in resolving this issue? Please find the sample data attached.

PHP7 client store data which not able retrieving from php8 client

aql> select * from ns_amcat_datastore.amcat_auth_tokens where PK='1d6eed27fdc8b35d46ed7d48'; +----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+-------+ | PK | content | {ttl} | {gen} | +----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+-------+ | "1d6eed27fdc8b35d46ed7d48" | MAP('{"authDetails":{"apiSecret":"**********", "apiToken":"1d6eed27fdc8b35d46ed7d48", "createdOn":"2024-12-20 10:34:38", "expiresOn":"2024-12-21 10:34:38", "isActive":1, "userName":"******", "userType":"******"}, "configEntities":{"A | 85586 | 5 | +----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+-------+ 1 row in set (0.000 secs)

Below data stored using php8 client which able to retrieving in php7 client

aql> select * from ns_amcat_datastore.amcat_auth_tokens where PK='f8aa10dac9111e70b4b09de2'; +----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+-------+ | PK | content | {ttl} | {gen} | +----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+-------+ | "f8aa10dac9111e70b4b09de2" | MAP('{"authDetails":{"apiSecret":"*********", "apiToken":"f8aa10dac9111e70b4b09de2", "createdOn":"2024-12-19 18:24:32", "expiresOn":"2024-12-20 18:24:32", "isActive":1, "userName":"********", "userType":"********"}, "configEntities":{"A | 27454 | 4 | +----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------+-------+

We require fix for this issue as we move traffic from old to new one distributed way.

Waiting for your revert thanks

@khaf
Copy link
Contributor

khaf commented Dec 20, 2024

Can you provide a PHP 7 snippet that reproduces the issue? The information you have provided is not enough for me to reproduce the issue unfortunately.

What is the error you get from the PHP8 client?

@piyush-bansal1989
Copy link
Author

piyush-bansal1989 commented Dec 21, 2024

@khaf / @vmsachin: PFA the sample data, code snippet for both php7 and php8 clients.
code-snippet-files.zip

First run the old-aerospike -client which put and get data from aerospike.
Run new-aerospike-client which only get data from aerospike from same namspace, set and key

I didn't get any error from php8 client recieved the following kind of response.
Please also see the ttl always recieved 1 in response but the actual the ttl is showing in the aerospike server.

Aerospike Response

Aerospike\Record Object
(
[bins] => Array
(
[content] => Array
(
)

      )

[ttl] => 1
[key] => Aerospike\Key Object
    (
        [digest] => f86b5c15e94856ec5a7144ec2800cf976c85a992
        [setname] => test
        [value] => testing
        [namespace] => ns_amcat_datastore
        [partition_id] => 3064
    )

[expiration] => Aerospike\Expiration Object
    (
    )

[generation] => 28

)

@piyush-bansal1989
Copy link
Author

piyush-bansal1989 commented Jan 1, 2025

@khaf / @vmsachin : I've found the issue, The PHP 8 Aerospike client cannot reliably retrieve data written by the PHP 7 Aerospike client when that data is stored in array/list format and contains true/false/null values.

  • The PHP 7 aerospike client handles true, false, and null values differently, converting them to hexadecimal representations (e.g., true: 62 3A 31 3B, false: 62 3A 30 3B, null: 4E 3B) when storing data in array/list format.
  • Conversely, when the PHP 7 aerospike client retrieves data stored by the PHP 8 aerospike client, it incorrectly modifies the values: true becomes 1, false becomes 0, and null value keys are removed.

Could you please fix this issue? or suggest some other solution.

@piyush-bansal1989
Copy link
Author

Happy New Year, @khaf and @vmsachin!
I hope you have had a restful holiday season. Could you please review this issue at your earliest convenience?

@khaf
Copy link
Contributor

khaf commented Jan 8, 2025

Hi @piyush-bansal1989 , happy new year! Sorry I have been looking into this issue for the last few days but I have not updated this ticket. I need until early next week to give a proper update.

ps. @vmsachin is not working on this project anymore, you can ping me instead.

@piyush-bansal1989
Copy link
Author

@khaf: Do you have any update on this issue.

@piyush-bansal1989
Copy link
Author

@khaf : I would request you to share some update on this issue.

@piyush-bansal1989
Copy link
Author

@khaf : I hope you doing well! , will you please share the update on this issue?

@khaf
Copy link
Contributor

khaf commented Jan 29, 2025

@piyush-bansal1989 Hi Piyush, sorry for my late reply. I am working on this issue still, it seems like a serialization compatibility issue between our old C client and the newer clients. I'll keep you updated on what exactly is the issue and how we will deal with it in a couple of days.

@piyush-bansal1989
Copy link
Author

Hi @khaf Is there any update on it, our product upgrade peding on it.

@paul-brackin
Copy link

Hey @piyush-bansal1989 - I am a new engineer here at Aerospike & I will be helping @khaf on this one.

Just to update you, I have been able to reproduce your problem. You were correct in your assessment that there is an incompatibility between the boolean encoding of these 2 clients. Essentially, the old client is doing it wrong. I am looking to see if we can get a possible workaround into the new PHP client. RN it doesn't look like repairing the old client is in the cards. So, say we got a patch into the new client - you would just have to start using the new client for everything & get rid of the old client.

@khaf
Copy link
Contributor

khaf commented Feb 24, 2025

@piyush-bansal1989 We have addressed the issue and will release the fix before the end of this week. It took much longer than anticipated due to the changes required in the Go client, in which we had to come to an agreement regarding the introduction of the support for the old PHP client.

@piyush-bansal1989
Copy link
Author

@khaf : Thank you for addressing the issue. I understand that the resolution required more time due to necessary changes in the Go client to support the legacy PHP client. I appreciate your efforts and look forward to the fix being released by the end of this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants