libfoedus-core
FOEDUS Core Library
log_gleaner_impl.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details. You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * HP designates this particular file as subject to the "Classpath" exception
16  * as provided by HP in the LICENSE.txt file that accompanied this code.
17  */
18 #ifndef FOEDUS_SNAPSHOT_LOG_GLEANER_IMPL_HPP_
19 #define FOEDUS_SNAPSHOT_LOG_GLEANER_IMPL_HPP_
20 #include <stdint.h>
21 
22 #include <atomic>
23 #include <iosfwd>
24 #include <map>
25 #include <string>
26 #include <vector>
27 
28 #include "foedus/assert_nd.hpp"
29 #include "foedus/attachable.hpp"
30 #include "foedus/epoch.hpp"
31 #include "foedus/fwd.hpp"
32 #include "foedus/initializable.hpp"
33 #include "foedus/log/fwd.hpp"
34 #include "foedus/log/log_id.hpp"
36 #include "foedus/snapshot/fwd.hpp"
39 #include "foedus/storage/fwd.hpp"
41 #include "foedus/thread/fwd.hpp"
43 
44 namespace foedus {
45 namespace snapshot {
104 class LogGleaner final : public LogGleanerRef {
105  public:
106  LogGleaner(Engine* engine, LogGleanerResource* gleaner_resource, const Snapshot& new_snapshot);
107 
108  LogGleaner() = delete;
109  LogGleaner(const LogGleaner &other) = delete;
110  LogGleaner& operator=(const LogGleaner &other) = delete;
111 
114 
115  std::string to_string() const;
116  friend std::ostream& operator<<(std::ostream& o, const LogGleaner& v);
117 
119  const std::map<storage::StorageId, storage::SnapshotPagePointer>& get_new_root_page_pointers()
120  const {
121  return new_root_page_pointers_;
122  }
123 
124  private:
126  LogGleanerResource* const gleaner_resource_;
128  const Snapshot new_snapshot_;
129 
134  std::map<storage::StorageId, storage::SnapshotPagePointer> new_root_page_pointers_;
135 
137  void clear_all();
138 
143  ErrorStack design_partitions();
147  void design_partitions_run(storage::StorageId from, storage::StorageId count, ErrorStack* result);
148 
153  ErrorStack cancel_reducers_mappers();
154 
161  ErrorStack construct_root_pages();
162 };
163 
164 } // namespace snapshot
165 } // namespace foedus
166 #endif // FOEDUS_SNAPSHOT_LOG_GLEANER_IMPL_HPP_
Definitions of IDs in this package and a few related constant values.
Forward declarations of classes in log manager package.
uint32_t StorageId
Unique ID for storage.
Definition: storage_id.hpp:55
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
A log-gleaner, which constructs a new set of snapshot files during snapshotting.
Forward declarations of classes in root package.
Local resource for the log gleaner, which runs only in the master node.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
Forward declarations of classes in snapshot manager package.
Typedefs of ID types used in log package.
Forward declarations of classes in storage package.
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
std::string to_string() const
Represents one snapshot that converts all logs from base epoch to valid_until epoch into snapshot fil...
Definition: snapshot.hpp:37
LogGleaner & operator=(const LogGleaner &other)=delete
ErrorStack execute()
Main routine of log gleaner.
A remote view of LogGleaner from all engines.
Forward declarations of classes in thread package.
const std::map< storage::StorageId, storage::SnapshotPagePointer > & get_new_root_page_pointers() const
Returns pointers to new root pages constructed at the end of gleaning.
friend std::ostream & operator<<(std::ostream &o, const LogGleaner &v)