[openstack-dev] [oslo.db] [ndb] ndb namespace throughout openstack projects

Graham Hayes ghayes at suse.de
Tue Jul 25 11:04:43 UTC 2017


On 24/07/17 20:37, Octave J. Orgeron wrote:

<snip>

>>
>> Rather than having all the projects make use of
>> oslo_db.sqlalchemy.ndb.AutoStringTinyText / AutoStringSize, we add new
>> generic types to oslo.db :
>>
>> oslo_db.sqlalchemy.types.SmallString
>> oslo_db.sqlalchemy.types.String
>>
>> (or similar )
>>
>> Internally, the ndb module would be mapping its implementation for
>> AutoStringTinyText and AutoStringSize to these types.   Functionality
>> would be identical, just the naming convention exported to downstream
>> consuming projects would no longer refer to "ndb.<name>" for
>> datatypes.
> 
> I think this would make sense.
> 
>>
> 
<snip>
> 
> AutoStringSize, you pass two parameters, one being the non-NDB size and
> the second being the NDB size. The point here is where you need to
> reduce the size of the column to fit within the NDB limits, but you want
> to preserve the String varchar type because it might be used in a key,
> index, etc. I only use these in cases where the impacts are very low..
> for example where a column is used for keeping track of status (up,
> down, active, inactive, etc.) that don't require 255 varchars.
> 
> In many cases, the use of these could be removed by simply changing the
> columns to more appropriate types and sizes. There is a tremendous
> amount of wasted space in many of the databases. I'm more than willing
> to help out with this if teams decide they would rather do that instead
> as the long-term solution. Until then, these functions enable the use of
> both with minimal impact.
> 
> Another thing to keep in mind is that the only services that I've had to
> adjust column sizes for are:
> 
> Cinder
> Neutron
> Nova
> Magnum
> 
> The other services that I'm working on like Keystone, Barbican, Murano,
> Glance, etc. only need changes to:
> 
> 1. Ensure that foreign keys are dropped and created in the correct order
> when changing things like indexes, constraints, etc. Many services do
> these proper steps already, there are just cases where this has been
> missed because InnoDB is very forgiving on this. But other databases are
> not.
> 2. Fixing the database migration and sync operations to use oslo.db,
> pass the right parameters, etc. Something that should have been done in
> the first place, but hasn't. So this more of a house cleaning step to
> insure that services are using oslo.db correctly.
> 
> The only other oddball use case is deal with disabling nested
> transactions, where Neutron is the only one that does this.
> 
> On the flip side, here is a short list of services that I haven't had to
> make ANY changes for other than having oslo.db 4.24 or above:
> 
> aodh
> gnocchi
> heat
> ironic
> manila

Which projects are you looking at?

>>
>> 3. it's not clear (I don't even know right now by looking at these
>> reviews) when one would use "AutoStringTinyText" or "AutoStringSize".
>> For example in
>> https://review.openstack.org/#/c/446643/10/nova/db/sqlalchemy/migrate_repo/versions/216_havana.py
>>
>> I see a list of String(255)'s changed to one type or the other without
>> any clear notion why one would use one or the other.  Having names
>> that define simply the declared nature of the type would be most
>> appropriate.
> 
> One has to look at what the column is being used for and decide what
> appropriate remediation steps are. This takes time and one must research
> what kind of data goes in the column, what puts it there, what consumes
> it, and what remediation would have the least amount of impact.
> 

I have been out of the loop for a while - but I thought we were
settling on one database, (MySQL over pgSQL) to ensure that we
no longer had to have weird conditionals in our database layers and
migrations?

Is this something that someone is willing to commit to maintaining for
all projects?

I am just concerned we are adding in more custom code just as we are
trying to indicate that we moving to MySQL (which I understand as MySQL
like DB using an InnoDB based engine e.g. Maria, MySQL, Percona)[1]

- Graham

1 - Thinking about it - should https://review.openstack.org/#/c/427880
refer to InnoDB vs just MySQL ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x23BA8E2E.asc
Type: application/pgp-keys
Size: 28103 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170725/bf28f288/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170725/bf28f288/attachment.sig>


More information about the OpenStack-dev mailing list