← Back to team overview

maria-developers team mailing list archive

Re: d1ec0231553: MDEV-26732 Assertion `0' failed in Item::val_native

 

Hi Sergei,


On 10/26/21 11:54 AM, Sergei Golubchik wrote:
Hi, Alexander!

On Oct 26, Alexander Barkov wrote:

Fix:

- Adding a new class Item_copy_inet6, which implements val_native().
- Fixing Type_handler::create_item_copy() to make Item_copy_inet6
instead of Item_copy_string.

Could there be a universal solution that uses memcpy and doesn't need
Item_copy variant for every new type?

I'm not sure it's easy to simplify the code at this point quickly.

val_str() needs the underlying storage class to call to_string().
The currently proposed patch implements it in 10.5 as:


+  String *val_str(String *to) override
+  {
+    if (null_value)
+      return NULL;
+    Inet6_null tmp(m_value.ptr(), m_value.length());
+    return tmp.is_null() || tmp.to_string(to) ? NULL : to;
+  }


and I already have a working 10.7 version,
where the new class goes inside FixedBinTypeBundle:

+  class Item_copy_fbt: public Item_copy
+  {
+    NativeBuffer<Fbt::binary_length()+1> m_value;
+ ...
+    String *val_str(String *to) override
+    {
+      if (null_value)
+        return NULL;
+      Fbt_null tmp(m_value.ptr(), m_value.length());
+      return tmp.is_null() || tmp.to_string(to) ? NULL : to;
+    }
+ ..

so there won't be a separate *source* variant for every new type.


I propose to go with this solution for now and at some point
revise how to share more code.


Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx



References