@@ -49,11 +49,16 @@ class ObMember
49
49
void set_migrating ();
50
50
void reset_migrating ();
51
51
52
+ bool is_columnstore () const ;
53
+ void set_columnstore ();
54
+ void reset_columnstore ();
55
+
52
56
TO_STRING_KV (K_(server), K_(timestamp), K_(flag));
53
57
TO_YSON_KV (OB_Y_(server), OB_ID(t), timestamp_, OB_Y_(flag));
54
58
OB_UNIS_VERSION (1 );
55
59
protected:
56
60
static const int64_t MIGRATING_FLAG_BIT = 1 ;
61
+ static const int64_t COLUMNSTORE_FLAG_BIT = 0 ;
57
62
common::ObAddr server_;
58
63
int64_t timestamp_;
59
64
int64_t flag_;
@@ -90,61 +95,46 @@ inline int member_to_string(const common::ObMember &member, ObSqlString &member_
90
95
class ObReplicaMember : public ObMember
91
96
{
92
97
public:
98
+ // default constructor
93
99
ObReplicaMember ()
94
100
: ObMember(),
95
101
replica_type_ (REPLICA_TYPE_FULL),
96
- region_(DEFAULT_REGION_NAME),
97
102
memstore_percent_(100 )
98
103
{}
104
+ // construct with only server and timestamp, when we don't know or care about replica_type
105
+ // TODO(cangming.zl): remove this constructor when DRTask do not use it.
99
106
ObReplicaMember (const common::ObAddr &server,
100
107
const int64_t timestamp)
101
- : ObMember(server, timestamp),
108
+ : ObMember(ObMember( server, timestamp) ),
102
109
replica_type_(REPLICA_TYPE_FULL),
103
- region_(DEFAULT_REGION_NAME),
104
- memstore_percent_(100 )
105
- {}
106
- ObReplicaMember (const ObMember &member)
107
- : ObMember(member),
108
- replica_type_(REPLICA_TYPE_FULL),
109
- region_(DEFAULT_REGION_NAME),
110
- memstore_percent_(100 )
111
- {}
112
- /* After the subsequent type conversion code is completed, remove the constructor */
113
- ObReplicaMember (const common::ObAddr &server,
114
- const int64_t timestamp,
115
- const common::ObReplicaType replica_type)
116
- : ObMember(server, timestamp),
117
- replica_type_(replica_type),
118
- region_(DEFAULT_REGION_NAME),
119
110
memstore_percent_(100 )
120
111
{}
112
+ // construct with server, timestamp and replica_type,
113
+ // this func will set columnstore flag if replica_type is C.
121
114
ObReplicaMember (const common::ObAddr &server,
122
115
const int64_t timestamp,
123
116
const common::ObReplicaType replica_type,
124
- const int64_t memstore_percent)
125
- : ObMember(server, timestamp),
117
+ const int64_t memstore_percent = 100 )
118
+ : ObMember(ObMember( server, timestamp) ),
126
119
replica_type_(replica_type),
127
- region_(DEFAULT_REGION_NAME),
128
120
memstore_percent_(memstore_percent)
129
- {}
130
- ObReplicaMember (const common::ObAddr &server,
131
- const int64_t timestamp,
132
- const common::ObReplicaType replica_type,
133
- const common::ObRegion ®ion,
134
- const int64_t memstore_percent)
135
- : ObMember(server, timestamp),
136
- replica_type_(replica_type),
137
- region_(region),
138
- memstore_percent_(memstore_percent)
139
- {}
121
+ {
122
+ if (REPLICA_TYPE_COLUMNSTORE == replica_type) {
123
+ ObMember::set_columnstore ();
124
+ }
125
+ }
140
126
public:
127
+ // init with server, timestamp, replica_type.
128
+ // this func will set columnstore flag if replica_type is C.
129
+ int init (const common::ObAddr &server,
130
+ const int64_t timestamp,
131
+ const common::ObReplicaType replica_type);
132
+ // init with existing member whose flag_ may have been set.
133
+ // this function will check whether flag_ is consistent with replica_type.
134
+ int init (const ObMember &member,
135
+ const common::ObReplicaType replica_type);
141
136
common::ObReplicaType get_replica_type () const ;
142
- int set_replica_type (const common::ObReplicaType replica_type);
143
- const common::ObRegion &get_region () const ;
144
- int set_region (const common::ObRegion ®ion);
145
- int set_member (const ObMember &member);
146
137
int64_t get_memstore_percent () const { return memstore_percent_; }
147
- void set_memstore_percent (const int64_t memstore_percent) { memstore_percent_ = memstore_percent; }
148
138
virtual void reset ();
149
139
virtual bool is_valid () const ;
150
140
virtual bool is_readonly_replica () const ;
@@ -154,8 +144,8 @@ class ObReplicaMember : public ObMember
154
144
OB_UNIS_VERSION (1 );
155
145
private:
156
146
common::ObReplicaType replica_type_;
157
- common::ObRegion region_;
158
- int64_t memstore_percent_;
147
+ int64_t memstore_percent_; // obsolate, only as placeholder
148
+ common::ObRegion region_ = DEFAULT_REGION_NAME; // obsolate, only as placeholder
159
149
};
160
150
} // namespace common
161
151
} // namespace oceanbase
0 commit comments