1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
11 #include "db/column_family.h"
12 #include "db/version_edit.h"
13 #include "logging/event_logger.h"
14 #include "rocksdb/listener.h"
15 #include "rocksdb/table_properties.h"
17 namespace ROCKSDB_NAMESPACE
{
21 static void AppendCurrentTime(JSONWriter
* json_writer
);
23 static void NotifyTableFileCreationStarted(
24 const std::vector
<std::shared_ptr
<EventListener
>>& listeners
,
25 const std::string
& db_name
, const std::string
& cf_name
,
26 const std::string
& file_path
, int job_id
, TableFileCreationReason reason
);
27 #endif // !ROCKSDB_LITE
28 static void NotifyOnBackgroundError(
29 const std::vector
<std::shared_ptr
<EventListener
>>& listeners
,
30 BackgroundErrorReason reason
, Status
* bg_error
,
31 InstrumentedMutex
* db_mutex
, bool* auto_recovery
);
32 static void LogAndNotifyTableFileCreationFinished(
33 EventLogger
* event_logger
,
34 const std::vector
<std::shared_ptr
<EventListener
>>& listeners
,
35 const std::string
& db_name
, const std::string
& cf_name
,
36 const std::string
& file_path
, int job_id
, const FileDescriptor
& fd
,
37 uint64_t oldest_blob_file_number
, const TableProperties
& table_properties
,
38 TableFileCreationReason reason
, const Status
& s
,
39 const std::string
& file_checksum
,
40 const std::string
& file_checksum_func_name
);
41 static void LogAndNotifyTableFileDeletion(
42 EventLogger
* event_logger
, int job_id
, uint64_t file_number
,
43 const std::string
& file_path
, const Status
& status
,
44 const std::string
& db_name
,
45 const std::vector
<std::shared_ptr
<EventListener
>>& listeners
);
46 static void NotifyOnErrorRecoveryEnd(
47 const std::vector
<std::shared_ptr
<EventListener
>>& listeners
,
48 const Status
& old_bg_error
, const Status
& new_bg_error
,
49 InstrumentedMutex
* db_mutex
);
52 static void NotifyBlobFileCreationStarted(
53 const std::vector
<std::shared_ptr
<EventListener
>>& listeners
,
54 const std::string
& db_name
, const std::string
& cf_name
,
55 const std::string
& file_path
, int job_id
,
56 BlobFileCreationReason creation_reason
);
57 #endif // !ROCKSDB_LITE
59 static void LogAndNotifyBlobFileCreationFinished(
60 EventLogger
* event_logger
,
61 const std::vector
<std::shared_ptr
<EventListener
>>& listeners
,
62 const std::string
& db_name
, const std::string
& cf_name
,
63 const std::string
& file_path
, int job_id
, uint64_t file_number
,
64 BlobFileCreationReason creation_reason
, const Status
& s
,
65 const std::string
& file_checksum
,
66 const std::string
& file_checksum_func_name
, uint64_t total_blob_count
,
67 uint64_t total_blob_bytes
);
69 static void LogAndNotifyBlobFileDeletion(
70 EventLogger
* event_logger
,
71 const std::vector
<std::shared_ptr
<EventListener
>>& listeners
, int job_id
,
72 uint64_t file_number
, const std::string
& file_path
, const Status
& status
,
73 const std::string
& db_name
);
76 static void LogAndNotifyTableFileCreation(
77 EventLogger
* event_logger
,
78 const std::vector
<std::shared_ptr
<EventListener
>>& listeners
,
79 const FileDescriptor
& fd
, const TableFileCreationInfo
& info
);
82 } // namespace ROCKSDB_NAMESPACE