Skip to content
Open
Show file tree
Hide file tree
Changes from 11 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 .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
cd ~/oak-subql && \
echo ${{ secrets.SECRET_FILE }} | base64 --decode > secret.${{ inputs.target_env }} && \
source secret.${{ inputs.target_env }} && \
cp project-${{ inputs.target_env }}.yaml project.yaml && \
make build'

- name: Bring up the new container
Expand Down
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,25 @@ query {
}
```

# Local development
# Local development

# Re-indexing

When changing code we would need to re-index follow this process.

1. Stop the existing index process

2. Reset the state

```
subql-node reindex -f ./ --db-schema=turing --targetHeight=the-block-to-start-the-reindex --log-level=trace
```

After running this, the metadata and pointer will be reset to the `targetHeight`
all data higher than or equal to that block height is delete and we are ready to
resume the index process

3. Resume the index process

We write code in an idempotent way so we will be able to restart from that
height
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.9"

services:
subquery-node:
image: onfinality/subql-node:v2.5.1
image: onfinality/subql-node:v3.5.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisli30 have to upgrade to get the re-indexing work

depends_on:
- postgres
restart: always
Expand All @@ -14,6 +14,8 @@ services:
DB_PORT: 5432
volumes:
- ./:/app
# entrypoint: [ "sleep" ]
# command: ["infinity" ]
command:
- -f=/app
- --db-schema=turing
Expand Down
7 changes: 5 additions & 2 deletions mixer/src/etl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,11 @@ export const populateTask = async() => {
inner join events on extrinsics.id = events.extrinsic_id
where events.data->>'taskId' is not null
and events.method = 'TaskScheduled'
and extrinsics.module = 'automationTime'
and extrinsics.method like 'schedule%'
and (
(extrinsics.module = 'automationTime' and extrinsics.method like 'schedule%')
-- this is XCM task
or (extrinsics.module = 'parachainSystem' and extrinsics.method = 'setValidationData')
)
order by events.block_height asc, idx asc
)

Expand Down
1 change: 1 addition & 0 deletions mixer/src/migrate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const migrate = async () => {
client.query('alter table turing.tasks add column if not exists scheduled_start_at timestamp'),
client.query('alter table turing.tasks add column if not exists scheduled_end_at timestamp'),
client.query('alter table turing.tasks add column if not exists executed_count integer default(0)'),
client.query('alter table turing.tasks alter column executed_count set default(0)'),
])

// column need to be create before commit
Expand Down
Loading