mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-04-11 22:33:40 +00:00
Tweaks
This commit is contained in:
parent
f975caa1b6
commit
c3fb1c1ba5
1 changed files with 2 additions and 4 deletions
|
@ -76,16 +76,14 @@ func UpStateBlocksRefactor(tx *sql.Tx) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("tx.QueryRow.Scan (count snapshots): %w", err)
|
return fmt.Errorf("tx.QueryRow.Scan (count snapshots): %w", err)
|
||||||
}
|
}
|
||||||
logrus.Warnf("Will convert %d snapshots...", snapshotcount)
|
|
||||||
|
|
||||||
batchsize := 100
|
batchsize := 100
|
||||||
batchoffset := 0
|
|
||||||
|
|
||||||
var lastsnapshot types.StateSnapshotNID
|
var lastsnapshot types.StateSnapshotNID
|
||||||
var newblocks types.StateBlockNIDs
|
var newblocks types.StateBlockNIDs
|
||||||
var snapshotrows *sql.Rows
|
var snapshotrows *sql.Rows
|
||||||
|
|
||||||
for ; batchoffset < snapshotcount; batchoffset += batchsize {
|
for batchoffset := 0; batchoffset < snapshotcount; batchoffset += batchsize {
|
||||||
snapshotrows, err = tx.Query(`
|
snapshotrows, err = tx.Query(`
|
||||||
SELECT
|
SELECT
|
||||||
state_snapshot_nid,
|
state_snapshot_nid,
|
||||||
|
@ -119,7 +117,7 @@ func UpStateBlocksRefactor(tx *sql.Tx) error {
|
||||||
var snapshots []stateBlockData
|
var snapshots []stateBlockData
|
||||||
|
|
||||||
for snapshotrows.Next() {
|
for snapshotrows.Next() {
|
||||||
logrus.Warnf("Performing %d to %d...", batchoffset, batchoffset+batchsize)
|
logrus.Warnf("Rewriting snapshots %d-%d of %d...", batchoffset, batchoffset+batchsize, snapshotcount)
|
||||||
var snapshot stateBlockData
|
var snapshot stateBlockData
|
||||||
var eventsarray pq.Int64Array
|
var eventsarray pq.Int64Array
|
||||||
if err = snapshotrows.Scan(&snapshot.StateSnapshotNID, &snapshot.RoomNID, &snapshot.StateBlockNID, &eventsarray); err != nil {
|
if err = snapshotrows.Scan(&snapshot.StateSnapshotNID, &snapshot.RoomNID, &snapshot.StateBlockNID, &eventsarray); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue