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

Certain schemas(?) don't work with events. #79

Open
Scusemua opened this issue Nov 16, 2021 · 0 comments
Open

Certain schemas(?) don't work with events. #79

Scusemua opened this issue Nov 16, 2021 · 0 comments

Comments

@Scusemua
Copy link

Scusemua commented Nov 16, 2021

It seems that certain table schemas do not work well with NDB events. That is, if you create a table with a particular schema and then create an event on that table, some of the column values will always be undefined when you receive that event.

After looking through the code a little, I think it might have to do with buffer alignment issues and type sizes? Something about when the NdbRecAttr objects are created. But I don't really know.

Reproducability:

Using the following schema, create a table:

CREATE TABLE `example` (
    `column1` BIGINT NOT NULL,
    `column2` INT NOT NULL,
    `column3` TINYINT  NOT NULL,
    `column4` BIGINT NOT NULL,
    `column5` BIGINT NOT NULL,
    `column6` BIGINT NOT NULL,
    PRIMARY KEY (`column1`, `column4`, `column6`)
) ENGINE=NDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs;

You can use this modified version of ndb_apievent.cpp to test: https://pastebin.com/jsLcffnQ

Or you can use your own program/modify the example yourself. Just specify the name of the table created above and use the same event columns. I created an event and specified "column1", "column2", "column3", "column4". For every received event (INSERT, UPDATE, DELETE), the pre- and post-values for "column2" and "column3" will be undefined.

Observations:

  • If I specify all of the columns, then they all receive values correctly.
  • If the primary key is set to just column1, then the event described above works.
  • Likewise, the event works if the primary key is set to (column1, column4).

If this is intended behavior, then maybe it could be documented a little more clearly?

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

1 participant