Revision fa9e5d94

View differences:

include/FedReplicaManager.h
196 196
    void finalize_action(const ActionRequest& ar);
197 197

  
198 198
    /**
199
     *  Get the nest record to replicate in a zone
199
     *  Get the nerxt record to replicate in a zone
200 200
     *    @param zone_id of the zone
201
     *    @param index of the next record to send
202
     *    @param sql command to replicate
201
     *    @param zedp zone endpoint
202
     *    @param lr log record
203
     *    @param error description if any
204
     *
203 205
     *    @return 0 on success, -1 otherwise
204 206
     */
205
    int get_next_record(int zone_id, std::string& zedp, LogDBRecord& lr);
207
    int get_next_record(int zone_id, std::string& zedp, LogDBRecord& lr,
208
            std::string& error);
206 209

  
207 210
};
208 211

  
src/raft/FedReplicaManager.cc
274 274
/* -------------------------------------------------------------------------- */
275 275

  
276 276
int FedReplicaManager::get_next_record(int zone_id, std::string& zedp, 
277
        LogDBRecord& lr)
277
        LogDBRecord& lr, std::string& error)
278 278
{
279 279
    pthread_mutex_lock(&mutex);
280 280

  
......
303 303

  
304 304
    int rc = logdb->get_log_record(zs->next, lr);
305 305

  
306
    if ( rc == -1 )
307
    {
308
        std::ostringstream oss;
309

  
310
        oss << "Failed to load federation log record " << zs->next
311
            << " for zone " << zs->zone_id;
312

  
313
        error = oss.str();
314
    }
315

  
306 316
    pthread_mutex_unlock(&mutex);
307 317

  
308 318
    return rc;
......
380 390

  
381 391
    LogDBRecord lr;
382 392

  
383
    if ( get_next_record(zone_id, zedp, lr) != 0 )
393
    if ( get_next_record(zone_id, zedp, lr, error) != 0 )
384 394
    {
385
        error = "Failed to load federation log record";
386 395
        return -1;
387 396
    }
388 397

  
src/sql/LogDB.cc
61 61

  
62 62
    if ( _sql == 0 )
63 63
    {
64

  
65
        std::ostringstream oss;
66

  
67
        oss << "Error zlib inflate for " << index << ", " << fed_index
68
            << ", " << zsql;
69

  
70
        NebulaLog::log("DBM", Log::ERROR, oss);
71

  
64 72
        return -1;
65 73
    }
66 74

  
......
191 199

  
192 200
    if ( lr.index != index )
193 201
    {
202
        std::ostringstream oss;
203

  
204
        oss << "Log record " << index << " loaded incorrectly. Record index: "
205
            << lr.index << " fed. index: " << lr.fed_index << " sql command: " 
206
            << lr.sql << ". Operation return code: " << rc;
207

  
208
        NebulaLog::log("DBM", Log::ERROR, oss);
209

  
194 210
        rc = -1;
195 211
    }
196 212

  

Also available in: Unified diff