Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/user/upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ Removed Classes
* ``org.locationtech.geomesa.filter.index.BucketIndexSupport``
* ``org.locationtech.geomesa.filter.index.SizeSeparatedBucketIndexSupport``
* ``org.locationtech.geomesa.fs.storage.common.AbstractFileSystemStorage.FileSystemPathReader``
* ``org.locationtech.geomesa.gt.partition.postgis.dialect.tables.PartitionTablespacesTable``
* ``org.locationtech.geomesa.index.planning.LocalQueryRunner.LocalTransformReducer``
* ``org.locationtech.geomesa.metrics.micrometer.MicrometerSetup``
* ``org.locationtech.geomesa.security.VisibilityEvaluator``
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ import org.locationtech.geomesa.gt.partition.postgis.dialect.tables._
import org.locationtech.geomesa.gt.partition.postgis.dialect.triggers.{DeleteTrigger, InsertTrigger, UpdateTrigger, WriteAheadTrigger}
import org.locationtech.geomesa.index.planning.QueryInterceptor.QueryInterceptorFactory
import org.locationtech.geomesa.utils.geotools.PrimitiveConversions.{Conversion, ConvertToInt}
import org.locationtech.geomesa.utils.geotools.SimpleFeatureTypes.AttributeOptions
import org.locationtech.geomesa.utils.geotools.SimpleFeatureTypes
import org.locationtech.geomesa.utils.geotools.SimpleFeatureTypes.AttributeOptions
import org.locationtech.geomesa.utils.io.{CloseWithLogging, WithClose}
import org.locationtech.jts.geom._

import java.sql.{Connection, DatabaseMetaData, ResultSet, Types}
import scala.util.Try
import scala.util.control.NonFatal
import scala.util.{Failure, Success, Try}

/**
* Dialect
Expand Down Expand Up @@ -217,19 +216,22 @@ class PartitionedPostgisDialect(store: JDBCDataStore, grants: Seq[RoleName] = Se
UserDataTable.read(cx, schemaName, sft.getTypeName).foreach { case (k, v) => sft.getUserData.put(k, v) }

// populate flags on indexed attributes
getIndexedColumns(cx, sft.getTypeName)
.recover {
case NonFatal(throwable) =>
logger.warn(s"SimpleFeatureType: ${sft.getTypeName} could not load attributes with indices", throwable)
List.empty
}
.get
.foreach { attribute =>
Try(sft.getDescriptor(attribute)).fold(
throwable => logger.warn(s"SimpleFeatureType: ${sft.getTypeName} could not load attribute descriptor by name: $attribute", throwable),
_.getUserData.put(AttributeOptions.OptIndex, "true")
)
}
getIndexedColumns(cx, sft.getTypeName) match {
case Success(cols) =>
cols.foreach { col =>
if (col != "fid") {
val i = sft.indexOf(col)
if (i == -1) {
logger.debug(
s"Found unexpected indexed column not in feature type: $col for ${sft.getTypeName}=${SimpleFeatureTypes.encodeType(sft)}")
} else {
sft.getDescriptor(i).getUserData.put(AttributeOptions.OptIndex, "true")
}
}
}

case Failure(e) => logger.warn(s"Error loading indexed columns for feature type ${sft.getTypeName}:", e)
}
}

override def preDropTable(schemaName: String, sft: SimpleFeatureType, cx: Connection): Unit = {
Expand All @@ -241,6 +243,7 @@ class PartitionedPostgisDialect(store: JDBCDataStore, grants: Seq[RoleName] = Se
implicit val ex: ExecutionContext = new ExecutionContext(cx)
try {
PartitionedPostgisDialect.Commands.reverse.filter(_ != WriteAheadTable).foreach(_.drop(info))
PartitionTablespacesTable.drop(info)
} finally {
ex.close()
}
Expand Down Expand Up @@ -397,7 +400,6 @@ object PartitionedPostgisDialect extends StrictLogging {
UpdateTrigger,
DeleteTrigger,
PrimaryKeyTable,
PartitionTablespacesTable,
AnalyzeQueueTable,
SortQueueTable,
UserDataTable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ import org.locationtech.geomesa.utils.io.WithClose
import java.sql.{Connection, DatabaseMetaData}

/**
* Stores tablespaces used by each feature type
* Stores tablespaces used by each feature type - deprecated but kept around for back-compatibility
*/
@deprecated("Tablespaces are stored in user data table")
object PartitionTablespacesTable extends PartitionTablespacesTable with AdvisoryLock {
private[postgis] object PartitionTablespacesTable extends PartitionTablespacesTable with AdvisoryLock {
override protected val lockId: Long = 2005234735580322669L
}

@deprecated("Tablespaces are stored in user data table")
class PartitionTablespacesTable extends Sql with LazyLogging {
private[dialect] class PartitionTablespacesTable extends Sql with LazyLogging {

val Name: TableName = TableName("partition_tablespaces")

Expand Down
Loading