question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Snapshot representation does not include data even if "snapshot data" is enabled

See original GitHub issue

Liquibase Version: 4.6.1 Liquibase Integration & Version:Maven Database Vendor & Version: POSTGRESQL Operating System Type & Version: Windows

Description: we are planning to use Liquibase for test data snapshot and after updating the test data using microservice then roll back with snapshot version. This was whole idea behind doing the POC. I have configured a POSTGRESQL db and using pgadmin as a front end.

Steps To Reproduce

Using the command prompt i have entered “liquibase --snapshotFormat=json --outputFile=test_snapshot.json --url=jdbc:postgresql://localhost:5432/postgres --username=postgres --password=test --should-snapshot-data=true snapshot --logLevel=INFO”

C:\Automation Assessmen- CF\liquibase\dbcon\dbcon>liquibase --snapshotFormat=json --outputFile=test_snapshot.json --url=jdbc:postgresql://localhost:5432/postgres --username=postgres --password=**** --should-snapshot-data=true snapshot --logLevel=debug

Actual Behavior test_snapshot json file is generated with the following data:

{
  "snapshot": {
    "created": "2021-12-02T16:18:01.394",
    "database": {
      "productVersion": "13.3",
      "shortName": "postgresql",
      "majorVersion": "13",
      "minorVersion": "3",
      "user": "postgres",
      "productName": "PostgreSQL",
      "url": "jdbc:postgresql://localhost:5432/postgres"
    },
    "objects": {
      "liquibase.structure.core.Catalog": [
        {
          "catalog": {
            "default": true,
            "name": "postgres",
            "snapshotId": "908d100"
          }
        }]
      ,
      "liquibase.structure.core.Column": [
        {
          "column": {
            "defaultValue": true,
            "name": "active",
            "nullable": true,
            "order": "3!{java.lang.Integer}",
            "relation": "liquibase.structure.core.Table#908d102",
            "snapshotId": "908d106",
            "type": {
              "characterOctetLength": "1!{java.lang.Integer}",
              "columnSizeUnit": "BYTE!{liquibase.structure.core.DataType$ColumnSizeUnit}",
              "dataTypeId": "-7!{java.lang.Integer}",
              "radix": "10!{java.lang.Integer}",
              "typeName": "bool"
            }
          }
        },
        {
          "column": {
            "name": "age",
            "nullable": true,
            "order": "4!{java.lang.Integer}",
            "relation": "liquibase.structure.core.Table#908d102",
            "snapshotId": "908d107",
            "type": {
              "characterOctetLength": "19!{java.lang.Integer}",
              "columnSizeUnit": "BYTE!{liquibase.structure.core.DataType$ColumnSizeUnit}",
              "dataTypeId": "-5!{java.lang.Integer}",
              "radix": "10!{java.lang.Integer}",
              "typeName": "int8"
            }
          }
        },
        {
          "column": {
            "name": "id",
            "nullable": false,
            "order": "1!{java.lang.Integer}",
            "relation": "liquibase.structure.core.Table#908d102",
            "snapshotId": "908d104",
            "type": {
              "characterOctetLength": "10!{java.lang.Integer}",
              "columnSizeUnit": "BYTE!{liquibase.structure.core.DataType$ColumnSizeUnit}",
              "dataTypeId": "4!{java.lang.Integer}",
              "radix": "10!{java.lang.Integer}",
              "typeName": "int4"
            }
          }
        },
        {
          "column": {
            "name": "name",
            "nullable": false,
            "order": "2!{java.lang.Integer}",
            "relation": "liquibase.structure.core.Table#908d102",
            "snapshotId": "908d105",
            "type": {
              "characterOctetLength": "50!{java.lang.Integer}",
              "columnSize": "50!{java.lang.Integer}",
              "columnSizeUnit": "BYTE!{liquibase.structure.core.DataType$ColumnSizeUnit}",
              "dataTypeId": "12!{java.lang.Integer}",
              "radix": "10!{java.lang.Integer}",
              "typeName": "varchar"
            }
          }
        }]
      ,
      "liquibase.structure.core.Index": [
        {
          "index": {
            "columns": [
              "liquibase.structure.core.Column#908d104"]
            ,
            "name": "sampletable_pkey",
            "snapshotId": "908d103",
            "table": "liquibase.structure.core.Table#908d102",
            "unique": true
          }
        }]
      ,
      "liquibase.structure.core.PrimaryKey": [
        {
          "primaryKey": {
            "backingIndex": "liquibase.structure.core.Index#908d103",
            "columns": [
              "liquibase.structure.core.Column#908d104"]
            ,
            "name": "sampletable_pkey",
            "snapshotId": "908d108",
            "table": "liquibase.structure.core.Table#908d102"
          }
        }]
      ,
      "liquibase.structure.core.Schema": [
        {
          "schema": {
            "catalog": "liquibase.structure.core.Catalog#908d100",
            "default": true,
            "name": "public",
            "snapshotId": "908d101"
          }
        }]
      ,
      "liquibase.structure.core.Table": [
        {
          "table": {
            "columns": [
              "liquibase.structure.core.Column#908d104",
              "liquibase.structure.core.Column#908d105",
              "liquibase.structure.core.Column#908d106",
              "liquibase.structure.core.Column#908d107"]
            ,
            "default_tablespace": false,
            "indexes": [
              "liquibase.structure.core.Index#908d103"]
            ,
            "name": "sampletable",
            "primaryKey": "liquibase.structure.core.PrimaryKey#908d108",
            "schema": "liquibase.structure.core.Schema#908d101",
            "snapshotId": "908d102"
          }
        }]
      
    },
    "snapshotControl": {
      "snapshotControl": {
        "includedType": [
          "liquibase.structure.core.Catalog",
          "liquibase.structure.core.Column",
          "liquibase.structure.core.ForeignKey",
          "liquibase.structure.core.Index",
          "liquibase.structure.core.PrimaryKey",
          "liquibase.structure.core.Schema",
          "liquibase.structure.core.Sequence",
          "liquibase.structure.core.Table",
          "liquibase.structure.core.UniqueConstraint",
          "liquibase.structure.core.View"]
        
      }
    }
  }
}

Expected/Desired Behavior

There are no reference to the test data that were present in the DB

Is it something expected? Back to my original requriement is it something possible using liquibase( data snapshot & then rolling back to previous state)??

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
r2liquibasecommented, Feb 14, 2022

Hi, @kathir43 ! We have a project at Liquibase that handles version of test data. You can get access to it here: https://github.com/liquibase/liquibase-data. This might be helpful. Please join me on our Discord to chat about it. I’m r2liquibase over there.

0reactions
nvoxlandcommented, Feb 15, 2022

As far as whether this is something we can fix or not, the problem is going to be that the snapshot object structure is designed to be in-memory, but the data dump can easily be too large to fit in memory. That is part of why the queries for data is in the changeSet generation when we can stream to files vs. being part of the snapshot process.

Because of that, fixing this will be relatively complex.

(I updated the title and description a bit)

Read more comments on GitHub >

github_iconTop Results From Across the Web

snapshot.data is null in flutter firebase - Stack Overflow
my widget tree is stuck on stream builder condition i.e !snapshot.hasdata so data of snapshot has null . I ...
Read more >
Snapshot Preparation Guidance - WISEdata
What is a SNapshot? LEAs collect and share data with DPI every day. The data is live, and ever-changing as corrections are made,...
Read more >
ESXi Snapshot Errors and Solutions. - 33HOPS
Most common errors that you may face in an ESXi host, how to fix them or work the problem around.
Read more >
Snapshot and restore | Elasticsearch Guide [8.5] | Elastic
A snapshot doesn't represent a cluster at a precise point in time. Instead, each snapshot includes a start and end time. The snapshot...
Read more >
Commits are snapshots, not diffs - The GitHub Blog
I believe that Git becomes understandable if we peel back the curtain and look at how Git stores your repository data. After we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found