Skip to content

Commit b41feb9

Browse files
author
Krzysztof Leśniak
committed
Flush the state before switching to live
Safety net for HAF, which is about to start long running CREATE INDEX. In case of interruption that would break state, so flush it just in case.
1 parent fd1d093 commit b41feb9

File tree

8 files changed

+21
-0
lines changed

8 files changed

+21
-0
lines changed

libraries/chain/database.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,8 @@ void database::notify_comment_reward(const comment_reward_notification& note)
976976

977977
void database::notify_end_of_syncing()
978978
{
979+
chainbase::database::flush();
980+
get_comments_handler().flush();
979981
HIVE_TRY_NOTIFY(_end_of_syncing_signal)
980982
}
981983

libraries/chain/external_storage/memory_comment_archive.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,10 @@ void memory_comment_archive::wipe()
110110
// since storage is part of SHM, database::wipe clears it, nothing extra to do here
111111
}
112112

113+
void memory_comment_archive::flush()
114+
{
115+
// nothing extra to do here
116+
}
117+
113118
} } // hive::chain
114119

libraries/chain/external_storage/placeholder_comment_archive.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,10 @@ void placeholder_comment_archive::wipe()
6363
// do nothing - there is no extra data
6464
}
6565

66+
void placeholder_comment_archive::flush()
67+
{
68+
// do nothing - there is no extra data
69+
}
70+
6671
} } // hive::chain
6772

libraries/chain/external_storage/rocksdb_comment_archive.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ void rocksdb_comment_archive::wipe()
203203
provider->wipeDb();
204204
}
205205

206+
void rocksdb_comment_archive::flush()
207+
{
208+
provider->flush();
209+
}
210+
206211
} }
207212

208213
HIVE_DEFINE_TYPE_REGISTRAR_REGISTER_TYPE( hive::chain::volatile_comment_index )

libraries/chain/include/hive/chain/external_storage/comments_handler.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class comments_handler : public external_storage_snapshot
2424

2525
virtual void open() = 0;
2626
virtual void close() = 0;
27+
virtual void flush() = 0;
2728
virtual void wipe() = 0;
2829

2930
static hive::utilities::benchmark_dumper::comment_archive_details_t stats; // note: times should be measured in nanoseconds

libraries/chain/include/hive/chain/external_storage/memory_comment_archive.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class memory_comment_archive final : public comments_handler
9090

9191
virtual void open() override;
9292
virtual void close() override;
93+
virtual void flush() override;
9394
virtual void wipe() override;
9495
};
9596

libraries/chain/include/hive/chain/external_storage/placeholder_comment_archive.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class placeholder_comment_archive final : public comments_handler
2525

2626
virtual void open() override;
2727
virtual void close() override;
28+
virtual void flush() override;
2829
virtual void wipe() override;
2930
};
3031

libraries/chain/include/hive/chain/external_storage/rocksdb_comment_archive.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class rocksdb_comment_archive : public comments_handler
4242

4343
void open() override;
4444
void close() override;
45+
void flush() override;
4546
void wipe() override;
4647
};
4748

0 commit comments

Comments
 (0)