Skip to content

Commit

Permalink
0005094: Log miner for Postgres database
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Oct 4, 2021
1 parent df08661 commit f81452f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
11 changes: 11 additions & 0 deletions symmetric-assemble/src/asciidoc/appendix/postgresql.ad
Expand Up @@ -54,6 +54,17 @@ GRANT ALL ON ALL FUNCTIONS IN SCHEMA {SYMMETRIC_SCHEMA} TO {APPLICATION USER}

----

ifdef::pro[]
==== Log Miner
When using Log Miner instead of triggers, it will use the logical decoding feature introduced in PostgreSQL version 9.4.
The WAL level should be set to "logical" on the Postgres server.
Edit postgresql.conf and restart Postgres after changing:

wal_level = logical
max_replication_slots = 3

endif::pro[]

.supported data types
|===
|Data Type|Supported?
Expand Down
Expand Up @@ -1152,7 +1152,7 @@ protected PermissionResult getCreateSymFunctionPermission() {
}

protected PermissionResult getLogMinePermission() {
PermissionResult result = new PermissionResult(PermissionType.CREATE_TRIGGER, "UNIMPLEMENTED");
PermissionResult result = new PermissionResult(PermissionType.LOG_MINE, "UNIMPLEMENTED");
result.setStatus(Status.UNIMPLEMENTED);
return result;
}
Expand Down
Expand Up @@ -250,6 +250,20 @@ public PermissionResult getDropSymTriggerPermission() {
return result;
}

@Override
protected PermissionResult getLogMinePermission() {
PermissionResult result = new PermissionResult(PermissionType.LOG_MINE, "UNIMPLEMENTED");
String walLevel = getSqlTemplate().queryForString("select current_setting('wal_level')");
if ("logical".equals(walLevel)) {
result.setStatus(Status.PASS);
} else {
result.setStatus(Status.FAIL);
result.setTestDetails(walLevel);
result.setSolution("Set wal_level to logical");
}
return result;
}

@Override
public long getEstimatedRowCount(Table table) {
return getSqlTemplateDirty().queryForLong("select coalesce(c.reltuples, -1) from pg_catalog.pg_class c inner join pg_catalog.pg_namespace n " +
Expand Down

0 comments on commit f81452f

Please sign in to comment.