Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: If edition is changed from Community Edition to Apache Edition only two rows of data are returned from compressed chunks instead of reporting error compression is not supported in Apache Edition #7787

Open
igor2x opened this issue Mar 4, 2025 · 1 comment
Labels
bug low-hanging-fruit Label for issues that are easy to implement

Comments

@igor2x
Copy link

igor2x commented Mar 4, 2025

What type of bug is this?

Incorrect result

What subsystems and features are affected?

Compression

What happened?

  • On Red Hat 9.5 TimescaleDB v2.18.0 Community Edition is installed.
  • I have found out that in this particular version "pg_stat_statement" extension does not work because of regression bug reported in issue 7648
  • I tried to upgrade to v2.18.2 where this bug is fixed, but by mistake, I have installed Linux package for TimescaleDB Apache Edition instead of TimescaleDB Community Edition.
  • It looks like the only distinct feature we use from Community Edition that is not available in Apache Edition is "compression". We use compression for older data that are rarely accessed to spare few TB of disk space. We use compression only for old archive like data. We don't use compression for "live" data, because of our requirement during the day we need to execute heavy updates on hyper-table and compressed chunks are too slow for bulk update. Only having old data compressed was the cause we did not spot this issue on our test environment first, because old data are rarely accessed.
  • But now the weird part (THE ISSUE) when I executed select count(*) from myhypertable where mytime = '2023-12-08 00:45:00.000 +0100 I have got only 2-rows displayed instead of 850-thousand. What ever SELECT I write on compressed chunks with what ever specific timestamp for archived compressed chunks for 2022 and 2023 year I always get 2-rows only. Very weird. Because returning only 2 rows, it looked like someone has massively deleted old data and only retained 2-rows per timestamp. This was super misleading and we spent few hours to figure it out this is actually license issue.
  • From our nightly "reorder_chunk" bash scripts I have recognized issue is "reorg_chunk" is not supported in Apache Edition.
  • Now super struggle to switch from Apache Edition to Community Edition - I don't know if this is really so complicated (steps bellow), so I was required to downgrade first to be able to upgrade again. I haven't found instructions on documentation or widely on web how to switch editions, just try and error until solution is found.

RECAP:

  • ISSUE: select returns 2-rows only selecting on compressed chunk with Apache Edition.
  • EXPECTED: Do not return any row, just display the error that "compression" is not supported on Apache Edition.

TimescaleDB version affected

2.18.2

PostgreSQL version used

15.10

What operating system did you use?

Red Hat v9.5

What installation method did you use?

RPM

What platform did you run on?

On prem/Self-hosted

Relevant log output and stack trace

How can we reproduce the bug?

I. HOW TO REPRODUCE THE ISSUE
On Red Hat 9.5 TimescaleDb v2.18.0 Community Edition is installed on premis.

\dx for timescaledb outputs

        Name        | Version |   Schema   |                                      Description
--------------------+---------+------------+---------------------------------------------------------------------------------------
 timescaledb        | 2.18.0  | public     | Enables scalable inserts and complex queries for time-series data (Community Edition)

# I installed Apache Edition by mistake and upgraded the package
sudo dnf install timescaledb_15
psql -d mydb -X -c "ALTER EXTENSION timescaledb UPDATE".

\dx for timescaledb now outputs:

        Name        | Version |   Schema   |                                     Description
--------------------+---------+------------+--------------------------------------------------------------------------------------
 timescaledb        | 2.18.2  | public     | Enables scalable inserts and complex queries for time-series data (Apache 2 Edition)


psql -d mydb -c "select count(*) from myhypertable where mytime = '2023-12-08 00:45:00.000 +0100';"

WHAT HAPPENS: SQL returns 2 rows
EXPECTED: Return error that compression is not supported in Apache Edition.

-----------

II. HOW I FIXED THE ISSUE

# 1. Stop Postgres
sudo systemctl stop postgresql-15.service

# 2. Remove Apache Edition package
sudo dnf -y remove timescaledb_15

# 3. Install Community Edition package
sudo dnf -y install timescaledb-2-postgresql-15.x86_64

# 4. Start Postgres
sudo systemctl start postgresql-15.service

# 5. Try to alter extension, but I get error:
#NOTICE:  version "2.18.2" of extension "timescaledb" is already installed
#ALTER EXTENSION
psql -d mydb -X -c "ALTER EXTENSION timescaledb UPDATE"

# 6. I tried to downgrade from v2.18.2 to v2.18.1.
sudo systemctl stop postgresql-15.service
sudo dnf -y remove timescaledb-2-postgresql-15.x86_64
sudo dnf -y install timescaledb-2-postgresql-15-2.18.1-0.el9.x86_64
sudo systemctl start postgresql-15.service
psql -d mydb -X -c "ALTER EXTENSION timescaledb UPDATE TO '2.18.1'"

# Extension is successfully dowgraded to 2.18.1

# 7. Now upgrade it back to v2.18.2 but for Community Edition

sudo systemctl stop postgresql-15.service
sudo dnf -y install timescaledb-2-postgresql-15-2.18.2-0.el9.x86_64
sudo systemctl start postgresql-15.service
psql -d mydb -X -c "ALTER EXTENSION timescaledb UPDATE"
psql -d mydbp -c "\dx"

# Extension successfully upgraded to v2.18.2 Community Edition.

# 8. Select on compressed chunk
psql -d mydb -c "select count(*) from myhypertable where mytime = '2023-12-08 00:45:00.000 +0100';"

# Now returns 850-thousand rows, previously when was the issue only two rows were returned.
@igor2x igor2x added the bug label Mar 4, 2025
@igor2x igor2x changed the title [Bug]: If edition is changed from Community Edition to Apache Edition only two rows of data are returned instead of reporting error compression is not supported in Apache Edition [Bug]: If edition is changed from Community Edition to Apache Edition only two rows of data are returned from compressed chunks instead of reporting error compression is not supported in Apache Edition Mar 4, 2025
@akuzm
Copy link
Member

akuzm commented Mar 10, 2025

Thanks for reporting, this definitely needs a proper error message.

@akuzm akuzm added the low-hanging-fruit Label for issues that are easy to implement label Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug low-hanging-fruit Label for issues that are easy to implement
Projects
None yet
Development

No branches or pull requests

2 participants