Skip to content

Commit

Permalink
Fix & enable new grpc status endpoint (#105)
Browse files Browse the repository at this point in the history
* Add generated types

* Use generated types instead of protoset

* Change cpu vcores to integer

* Fix grpc resource parsing

* Add upgrade script

* .

* Change version to 1.7.1

* Enable grpc

* Fix version comparison

* Fix rounding issue with CPU
  • Loading branch information
Redm4x authored Feb 20, 2024
1 parent 9838962 commit 037f753
Show file tree
Hide file tree
Showing 24 changed files with 2,994 additions and 458 deletions.
15 changes: 12 additions & 3 deletions indexer/UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# Upgrade instructions

Some indexer updates changes the database schemas and an upgrade script must be run on the database to migrate the data before or after updating the indexer. Here is a list of those migrations. If a version is not listed here it means the indexer can be updated without any manual migration.
Some indexer updates changes the database schemas and an upgrade script must be run on the database to migrate the data before or after updating the indexer. Here is a list of those migrations. If a version is not listed here it means the indexer can be updated without any manual migration.

**It is recommended to stop the indexer before running any migration script.**

## v1.7.1

Storing cpu vcores as numbers instead of strings

```
ALTER TABLE IF EXISTS public."providerSnapshotNodeCPU"
ALTER COLUMN vcores smallint;
```

## v1.7.0

Version 1.7.0 adds some tables and fields to improve provider queries as well as keep track of node/cpu/gpu data provided by the new status endpoint (grpc).
Expand All @@ -23,13 +32,13 @@ ALTER TABLE IF EXISTS public."providerSnapshot"
ADD COLUMN "isLastOfDay" boolean NOT NULL DEFAULT false,
ALTER COLUMN "isOnline" SET NOT NULL,
ALTER COLUMN "checkDate" SET NOT NULL;
-- Set isLastOfDay to true for snapshots that are the last of each day for every providers
WITH last_snapshots AS (
SELECT DISTINCT ON(ps."owner",DATE("checkDate")) DATE("checkDate") AS date, ps."id" AS "psId"
FROM "providerSnapshot" ps
ORDER BY ps."owner",DATE("checkDate"),"checkDate" DESC
)
)
UPDATE "providerSnapshot" AS ps
SET "isLastOfDay" = TRUE
FROM last_snapshots AS ls
Expand Down
Loading

0 comments on commit 037f753

Please sign in to comment.