On Tue, Jul 25, 2017 at 3:27 PM, Octave J. Orgeron <octave.orge...@oracle.com> wrote: > 5. Evaluated against the other columns in the table, which one makes the > most sense to adjust?
well, the above point is one I've been trying to get a straight answer on for a long time. "evaluated against other columns" suggests we cannot change the size of a datatype in isolation, instead we are trying to create a total length of the row. Otherwise, the size of the "other" columns should not matter. Then, in fact yes I do see you aren't changing every size, in 216_havana I see: Column('display_name', String(length=255)) -> no change Column('display_description', String(length=255)), -> becomes TINYTEXT Column('os_type', String(length=255)) -> becomes VARCHAR(64) The "display_name" column will render VARCHAR(255). Which means, ndb can have a VARCHAR(255). But in the case of os_type, you shrink it to be VARCHAR(64) for ndb. Why? What happens if it stays VARCHAR(255) ? There is a bigger problem with this entire series of changes, whether or not the "ndb" keyword is present. Which is that projects need to add new columns, tables, and make datatype changes all the time, and they will not have any idea about the requirements for ndb or even that it exists, nor will anyone have access to this platform for development nor should they be expected to worry about it. If they not only have to fill in dozens of special "ndb" or generic-but-needed by ndb flags, and then if they even have to worry about the sum of all the sizes in a row, that means the ndb implementation will be continuously broken across many projects in every release unless ndb developers are checking every database change in every project at all times. Is that level of effort part of the plan? > > I don't see a way of automating that and making it maintainable without a > lot more overhead in code and people. If we really want to remove the > complexity here, why don't we just change the sizes and types on these > handful of table columns so that they fit within both InnoDB and NDB? That > way we don't need these functions and the tables are exactly the same? That > would only leave us with the createtable, savepoint/rollback, etc. stuff to > address which is already taken care of in the ndb module in oslo.db? Then we > just fix the foreign key stuff as I've been doing, since it has zero impact > on InnoDB deployments and if anything ensures things are consistent. That > would then leave us to really focus on fixing migrations to use oslo.db and > pass the correct flags, which is a more lengthy process than the rest of > this. > > I don't see the point in trying to make this stuff anymore complicated. > > Octave > > > On 7/25/2017 12:20 PM, Michael Bayer wrote: >> >> On Mon, Jul 24, 2017 at 5:41 PM, Michael Bayer <mba...@redhat.com> wrote: >>>> >>>> oslo_db.sqlalchemy.String(255, ndb_type=TINYTEXT) -> VARCHAR(255) for >>>> most >>>> dbs, TINYTEXT for ndb >>>> oslo_db.sqlalchemy.String(4096, ndb_type=TEXT) -> VARCHAR(4096) for most >>>> dbs, TEXT for ndb >>>> oslo_db.sqlalchemy.String(255, ndb_size=64) -> VARCHAR(255) on most dbs, >>>> VARCHAR(64) on ndb >>>> >>>> This way, we can override the String with TINYTEXT or TEXT or change the >>>> size for ndb. >>>>> >>>>> oslo_db.sqlalchemy.String(255) -> VARCHAR(255) on most dbs, >>>>> TINYTEXT() on ndb >>>>> oslo_db.sqlalchemy.String(255, ndb_size=64) -> VARCHAR(255) on >>>>> most dbs, VARCHAR(64) on ndb >>>>> oslo_db.sqlalchemy.String(50) -> VARCHAR(50) on all dbs >>>>> oslo_db.sqlalchemy.String(64) -> VARCHAR(64) on all dbs >>>>> oslo_db.sqlalchemy.String(80) -> VARCHAR(64) on most dbs, >>>>> TINYTEXT() >>>>> on ndb >>>>> oslo_db.sqlalchemy.String(80, ndb_size=55) -> VARCHAR(64) on most >>>>> dbs, VARCHAR(55) on ndb >>>>> >>>>> don't worry about implementation, can the above declaration -> >>>>> datatype mapping work ? >>>>> >>>>> >>>> In my patch for Neutron, you'll see a lot of the AutoStringText() calls >>>> to >>>> replace exceptionally long String columns (4096, 8192, and larger). >>> >>> MySQL supports large VARCHAR now, OK. yeah this could be >>> String(8192, ndb_type=TEXT) as well. >> >> OK, no, sorry each time I think of this I keep seeing the verbosity of >> imports etc. in the code, because if we had: >> >> String(80, ndb_type=TEXT) >> >> then we have to import both String and TEXT, and then what if there's >> ndb.TEXT, the code is still making an ndb-specific decision, etc. >> >> I still see that this can be mostly automated from a simple ruleset >> based on the size: >> >> length <= 64 : VARCHAR(length) on all backends >> length > 64, length <= 255: VARCHAR(length) for most backends, >> TINYTEXT for ndb >> length > 4096: VARCHAR(length) for most backends, TEXT for ndb >> >> the one case that seems outside of this is: >> >> String(255) where they have an index or key on the VARCHAR, and in >> fact they only need < 64 characters to be indexed. In that case you >> don't want to use TINYTEXT, right? So one exception: >> >> oslo_db.sqlalchemy.types.String(255, indexable=True) >> >> e.g. a declarative hint to the oslo_db backend to not use a LOB type. >> >> then we just need oslo_db.sqlalchemy.types.String, and virtually >> nothing except the import has to change, and a few keywords. >> >> What we're trying to do in oslo_db is as much as possible state the >> intent of a structure or datatype declaratively, and leave as much of >> the implementation up to oslo_db itself. >> >> __________________________________________________________________________ >> OpenStack Development Mailing List (not for usage questions) >> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe >> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > > > > > __________________________________________________________________________ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev __________________________________________________________________________ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev