Opened 6 years ago

Closed 6 years ago

#4079 closed defect (fixed)

OCI: layer extents not updated in metadata when SyncToDisk() called.

Reported by: warmerdam Owned by: warmerdam
Priority: high Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords: oci
Cc: andersmoe, msmitherdc

Description

When saving a new layer it seems as if it is not comitted as expected. To reproduce :

OGRLayer* layer = datasource->ExecuteSQL("SELECT * FROM mylayer");

datasource->CopyLayer (layer, "newlayer", ....)

datasource->SyncToDisc();

If I now list SDO_GEOM_METADATA I dont see the laye listed until I close the DataSource?. Is there any way to have this comitted ?

Attachments (2)

sdo_metadata.patch (1.4 KB) - added by msmitherdc 6 years ago.
Patch to use sdo_metadata for extents
sdo_metadata_2.patch (1.8 KB) - added by msmitherdc 6 years ago.
Updated patch with correct closing parens

Download all attachments as: .zip

Change History (10)

comment:1 Changed 6 years ago by warmerdam

Resolution: fixed
Status: newclosed

I have made significant modifications so that layer extents are now written or updated in the metadata each time SyncToDisk?() is called on the layer. Note that previously, there was no attempt to update the layer extents of existing layers when new features were written so this aspect is new too (r22346).

comment:2 Changed 6 years ago by msmitherdc

Priority: normalhigh
Resolution: fixed
Status: closedreopened

Frank,

On existing datasets, where the amount of data is large, this is causing a big problem, as its have to re-read all the geometries to set the new extents. We might have to make this an option of in some way disable this for some datasets. Or just read the existing metadata and expand it by the new extents only if the new data is not within the current extents.

comment:3 Changed 6 years ago by msmitherdc

Looking through the changes, looks like the logic makes sense, you are only updating the metadata where the new data is not in the extent of the existing metadata. But I set a data layer to have -180, -90, +180, +90 extents in the metadata and then ran an update. The result was that after the data was loaded, it did run a select against the data and the metadata. And that is where the problem is. I think you just want to run the check against the existing metadata rather than against both. So change lines 1333- 1347 of /gdal/ogr/ogrsf_frmts/oci/ogrocitablelayer.cpp

to

osCommand.Printf(

"select min(case when r=1 then sdo_lb else null end) minx, min(case when r=2 then sdo_lb else null end) miny, "

"min(case when r=1 then sdo_ub else null end) maxx, min(case when r=2 then sdo_ub else null end) maxy"

"from( select sdo_dimname, sdo_lb, sdo_ub, sdo_tolerance, rownum r from table" "(SELECT m.sdo_diminfo FROM MDSYS.SDO_GEOM_METADATA_TABLE m" "where m.sdo_table_name = UPPER('%s') and m.SDO_COLUMN_NAME = UPPER('%s')"

osTableName.c_str(), pszGeomName );

if( osOwner != "" )

{

osMoreCmd.Printf( "AND SDO_OWNER = UPPER('%s')", osOwner.c_str() );

}

osMoreCmd.Printf("))");

Mike

comment:4 Changed 6 years ago by msmitherdc

Cc: msmitherdc added

Changed 6 years ago by msmitherdc

Attachment: sdo_metadata.patch added

Patch to use sdo_metadata for extents

comment:5 Changed 6 years ago by msmitherdc

Code improved, patch attached

comment:6 Changed 6 years ago by warmerdam

Resolution: fixed
Status: reopenedclosed

Mike,

Thanks! I have applied this in trunk (r22544).

Changed 6 years ago by msmitherdc

Attachment: sdo_metadata_2.patch added

Updated patch with correct closing parens

comment:7 Changed 6 years ago by msmitherdc

Resolution: fixed
Status: closedreopened

comment:8 Changed 6 years ago by warmerdam

Resolution: fixed
Status: reopenedclosed

updated patch (approximately) applied in trunk (r22563) but not yet tested.

Note: See TracTickets for help on using tickets.